DescribeIpv6GatewaysResult.cc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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/DescribeIpv6GatewaysResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Vpc;
  19. using namespace AlibabaCloud::Vpc::Model;
  20. DescribeIpv6GatewaysResult::DescribeIpv6GatewaysResult() :
  21. ServiceResult()
  22. {}
  23. DescribeIpv6GatewaysResult::DescribeIpv6GatewaysResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeIpv6GatewaysResult::~DescribeIpv6GatewaysResult()
  29. {}
  30. void DescribeIpv6GatewaysResult::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 allIpv6Gateways = value["Ipv6Gateways"]["Ipv6Gateway"];
  37. for (auto value : allIpv6Gateways)
  38. {
  39. Ipv6Gateway ipv6GatewaysObject;
  40. if(!value["RegionId"].isNull())
  41. ipv6GatewaysObject.regionId = value["RegionId"].asString();
  42. if(!value["Ipv6GatewayId"].isNull())
  43. ipv6GatewaysObject.ipv6GatewayId = value["Ipv6GatewayId"].asString();
  44. if(!value["VpcId"].isNull())
  45. ipv6GatewaysObject.vpcId = value["VpcId"].asString();
  46. if(!value["Status"].isNull())
  47. ipv6GatewaysObject.status = value["Status"].asString();
  48. if(!value["Name"].isNull())
  49. ipv6GatewaysObject.name = value["Name"].asString();
  50. if(!value["Description"].isNull())
  51. ipv6GatewaysObject.description = value["Description"].asString();
  52. if(!value["Spec"].isNull())
  53. ipv6GatewaysObject.spec = value["Spec"].asString();
  54. if(!value["InstanceChargeType"].isNull())
  55. ipv6GatewaysObject.instanceChargeType = value["InstanceChargeType"].asString();
  56. if(!value["BusinessStatus"].isNull())
  57. ipv6GatewaysObject.businessStatus = value["BusinessStatus"].asString();
  58. if(!value["ExpiredTime"].isNull())
  59. ipv6GatewaysObject.expiredTime = value["ExpiredTime"].asString();
  60. if(!value["CreationTime"].isNull())
  61. ipv6GatewaysObject.creationTime = value["CreationTime"].asString();
  62. ipv6Gateways_.push_back(ipv6GatewaysObject);
  63. }
  64. if(!value["TotalCount"].isNull())
  65. totalCount_ = std::stoi(value["TotalCount"].asString());
  66. if(!value["PageNumber"].isNull())
  67. pageNumber_ = std::stoi(value["PageNumber"].asString());
  68. if(!value["PageSize"].isNull())
  69. pageSize_ = std::stoi(value["PageSize"].asString());
  70. }
  71. int DescribeIpv6GatewaysResult::getTotalCount()const
  72. {
  73. return totalCount_;
  74. }
  75. int DescribeIpv6GatewaysResult::getPageSize()const
  76. {
  77. return pageSize_;
  78. }
  79. int DescribeIpv6GatewaysResult::getPageNumber()const
  80. {
  81. return pageNumber_;
  82. }
  83. std::vector<DescribeIpv6GatewaysResult::Ipv6Gateway> DescribeIpv6GatewaysResult::getIpv6Gateways()const
  84. {
  85. return ipv6Gateways_;
  86. }