DescribeIPv6TranslatorEntriesResult.cc 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * Copyright 2009-2017 Alibaba Cloud All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #include <alibabacloud/vpc/model/DescribeIPv6TranslatorEntriesResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Vpc;
  19. using namespace AlibabaCloud::Vpc::Model;
  20. DescribeIPv6TranslatorEntriesResult::DescribeIPv6TranslatorEntriesResult() :
  21. ServiceResult()
  22. {}
  23. DescribeIPv6TranslatorEntriesResult::DescribeIPv6TranslatorEntriesResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeIPv6TranslatorEntriesResult::~DescribeIPv6TranslatorEntriesResult()
  29. {}
  30. void DescribeIPv6TranslatorEntriesResult::parse(const std::string &payload)
  31. {
  32. Json::Reader reader;
  33. Json::Value value;
  34. reader.parse(payload, value);
  35. setRequestId(value["RequestId"].asString());
  36. auto allIpv6TranslatorEntriesNode = value["Ipv6TranslatorEntries"]["Ipv6TranslatorEntry"];
  37. for (auto valueIpv6TranslatorEntriesIpv6TranslatorEntry : allIpv6TranslatorEntriesNode)
  38. {
  39. Ipv6TranslatorEntry ipv6TranslatorEntriesObject;
  40. if(!valueIpv6TranslatorEntriesIpv6TranslatorEntry["Ipv6TranslatorId"].isNull())
  41. ipv6TranslatorEntriesObject.ipv6TranslatorId = valueIpv6TranslatorEntriesIpv6TranslatorEntry["Ipv6TranslatorId"].asString();
  42. if(!valueIpv6TranslatorEntriesIpv6TranslatorEntry["Ipv6TranslatorEntryId"].isNull())
  43. ipv6TranslatorEntriesObject.ipv6TranslatorEntryId = valueIpv6TranslatorEntriesIpv6TranslatorEntry["Ipv6TranslatorEntryId"].asString();
  44. if(!valueIpv6TranslatorEntriesIpv6TranslatorEntry["AllocateIpv6Addr"].isNull())
  45. ipv6TranslatorEntriesObject.allocateIpv6Addr = valueIpv6TranslatorEntriesIpv6TranslatorEntry["AllocateIpv6Addr"].asString();
  46. if(!valueIpv6TranslatorEntriesIpv6TranslatorEntry["AllocateIpv6Port"].isNull())
  47. ipv6TranslatorEntriesObject.allocateIpv6Port = std::stoi(valueIpv6TranslatorEntriesIpv6TranslatorEntry["AllocateIpv6Port"].asString());
  48. if(!valueIpv6TranslatorEntriesIpv6TranslatorEntry["BackendIpv4Addr"].isNull())
  49. ipv6TranslatorEntriesObject.backendIpv4Addr = valueIpv6TranslatorEntriesIpv6TranslatorEntry["BackendIpv4Addr"].asString();
  50. if(!valueIpv6TranslatorEntriesIpv6TranslatorEntry["BackendIpv4Port"].isNull())
  51. ipv6TranslatorEntriesObject.backendIpv4Port = valueIpv6TranslatorEntriesIpv6TranslatorEntry["BackendIpv4Port"].asString();
  52. if(!valueIpv6TranslatorEntriesIpv6TranslatorEntry["TransProtocol"].isNull())
  53. ipv6TranslatorEntriesObject.transProtocol = valueIpv6TranslatorEntriesIpv6TranslatorEntry["TransProtocol"].asString();
  54. if(!valueIpv6TranslatorEntriesIpv6TranslatorEntry["EntryBandwidth"].isNull())
  55. ipv6TranslatorEntriesObject.entryBandwidth = valueIpv6TranslatorEntriesIpv6TranslatorEntry["EntryBandwidth"].asString();
  56. if(!valueIpv6TranslatorEntriesIpv6TranslatorEntry["EntryDescription"].isNull())
  57. ipv6TranslatorEntriesObject.entryDescription = valueIpv6TranslatorEntriesIpv6TranslatorEntry["EntryDescription"].asString();
  58. if(!valueIpv6TranslatorEntriesIpv6TranslatorEntry["EntryName"].isNull())
  59. ipv6TranslatorEntriesObject.entryName = valueIpv6TranslatorEntriesIpv6TranslatorEntry["EntryName"].asString();
  60. if(!valueIpv6TranslatorEntriesIpv6TranslatorEntry["EntryStatus"].isNull())
  61. ipv6TranslatorEntriesObject.entryStatus = valueIpv6TranslatorEntriesIpv6TranslatorEntry["EntryStatus"].asString();
  62. if(!valueIpv6TranslatorEntriesIpv6TranslatorEntry["AclStatus"].isNull())
  63. ipv6TranslatorEntriesObject.aclStatus = valueIpv6TranslatorEntriesIpv6TranslatorEntry["AclStatus"].asString();
  64. if(!valueIpv6TranslatorEntriesIpv6TranslatorEntry["AclType"].isNull())
  65. ipv6TranslatorEntriesObject.aclType = valueIpv6TranslatorEntriesIpv6TranslatorEntry["AclType"].asString();
  66. if(!valueIpv6TranslatorEntriesIpv6TranslatorEntry["AclId"].isNull())
  67. ipv6TranslatorEntriesObject.aclId = valueIpv6TranslatorEntriesIpv6TranslatorEntry["AclId"].asString();
  68. if(!valueIpv6TranslatorEntriesIpv6TranslatorEntry["RegionId"].isNull())
  69. ipv6TranslatorEntriesObject.regionId = valueIpv6TranslatorEntriesIpv6TranslatorEntry["RegionId"].asString();
  70. ipv6TranslatorEntries_.push_back(ipv6TranslatorEntriesObject);
  71. }
  72. if(!value["TotalCount"].isNull())
  73. totalCount_ = std::stoi(value["TotalCount"].asString());
  74. if(!value["PageNumber"].isNull())
  75. pageNumber_ = std::stoi(value["PageNumber"].asString());
  76. if(!value["PageSize"].isNull())
  77. pageSize_ = std::stoi(value["PageSize"].asString());
  78. }
  79. int DescribeIPv6TranslatorEntriesResult::getTotalCount()const
  80. {
  81. return totalCount_;
  82. }
  83. int DescribeIPv6TranslatorEntriesResult::getPageSize()const
  84. {
  85. return pageSize_;
  86. }
  87. int DescribeIPv6TranslatorEntriesResult::getPageNumber()const
  88. {
  89. return pageNumber_;
  90. }
  91. std::vector<DescribeIPv6TranslatorEntriesResult::Ipv6TranslatorEntry> DescribeIPv6TranslatorEntriesResult::getIpv6TranslatorEntries()const
  92. {
  93. return ipv6TranslatorEntries_;
  94. }