DescribeVSwitchAttributesResult.cc 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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/DescribeVSwitchAttributesResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Vpc;
  19. using namespace AlibabaCloud::Vpc::Model;
  20. DescribeVSwitchAttributesResult::DescribeVSwitchAttributesResult() :
  21. ServiceResult()
  22. {}
  23. DescribeVSwitchAttributesResult::DescribeVSwitchAttributesResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeVSwitchAttributesResult::~DescribeVSwitchAttributesResult()
  29. {}
  30. void DescribeVSwitchAttributesResult::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 allCloudResources = value["CloudResources"]["CloudResourceSetType"];
  37. for (auto value : allCloudResources)
  38. {
  39. CloudResourceSetType cloudResourcesObject;
  40. if(!value["ResourceType"].isNull())
  41. cloudResourcesObject.resourceType = value["ResourceType"].asString();
  42. if(!value["ResourceCount"].isNull())
  43. cloudResourcesObject.resourceCount = std::stoi(value["ResourceCount"].asString());
  44. cloudResources_.push_back(cloudResourcesObject);
  45. }
  46. auto routeTableNode = value["RouteTable"];
  47. if(!routeTableNode["RouteTableId"].isNull())
  48. routeTable_.routeTableId = routeTableNode["RouteTableId"].asString();
  49. if(!routeTableNode["RouteTableType"].isNull())
  50. routeTable_.routeTableType = routeTableNode["RouteTableType"].asString();
  51. if(!value["VSwitchId"].isNull())
  52. vSwitchId_ = value["VSwitchId"].asString();
  53. if(!value["VpcId"].isNull())
  54. vpcId_ = value["VpcId"].asString();
  55. if(!value["Status"].isNull())
  56. status_ = value["Status"].asString();
  57. if(!value["CidrBlock"].isNull())
  58. cidrBlock_ = value["CidrBlock"].asString();
  59. if(!value["Ipv6CidrBlock"].isNull())
  60. ipv6CidrBlock_ = value["Ipv6CidrBlock"].asString();
  61. if(!value["ZoneId"].isNull())
  62. zoneId_ = value["ZoneId"].asString();
  63. if(!value["AvailableIpAddressCount"].isNull())
  64. availableIpAddressCount_ = std::stol(value["AvailableIpAddressCount"].asString());
  65. if(!value["Description"].isNull())
  66. description_ = value["Description"].asString();
  67. if(!value["VSwitchName"].isNull())
  68. vSwitchName_ = value["VSwitchName"].asString();
  69. if(!value["CreationTime"].isNull())
  70. creationTime_ = value["CreationTime"].asString();
  71. if(!value["IsDefault"].isNull())
  72. isDefault_ = value["IsDefault"].asString() == "true";
  73. if(!value["ResourceGroupId"].isNull())
  74. resourceGroupId_ = value["ResourceGroupId"].asString();
  75. }
  76. std::string DescribeVSwitchAttributesResult::getStatus()const
  77. {
  78. return status_;
  79. }
  80. bool DescribeVSwitchAttributesResult::getIsDefault()const
  81. {
  82. return isDefault_;
  83. }
  84. std::string DescribeVSwitchAttributesResult::getDescription()const
  85. {
  86. return description_;
  87. }
  88. std::string DescribeVSwitchAttributesResult::getZoneId()const
  89. {
  90. return zoneId_;
  91. }
  92. std::string DescribeVSwitchAttributesResult::getResourceGroupId()const
  93. {
  94. return resourceGroupId_;
  95. }
  96. std::string DescribeVSwitchAttributesResult::getVSwitchId()const
  97. {
  98. return vSwitchId_;
  99. }
  100. long DescribeVSwitchAttributesResult::getAvailableIpAddressCount()const
  101. {
  102. return availableIpAddressCount_;
  103. }
  104. std::string DescribeVSwitchAttributesResult::getCidrBlock()const
  105. {
  106. return cidrBlock_;
  107. }
  108. DescribeVSwitchAttributesResult::RouteTable DescribeVSwitchAttributesResult::getRouteTable()const
  109. {
  110. return routeTable_;
  111. }
  112. std::string DescribeVSwitchAttributesResult::getVpcId()const
  113. {
  114. return vpcId_;
  115. }
  116. std::string DescribeVSwitchAttributesResult::getCreationTime()const
  117. {
  118. return creationTime_;
  119. }
  120. std::string DescribeVSwitchAttributesResult::getVSwitchName()const
  121. {
  122. return vSwitchName_;
  123. }
  124. std::string DescribeVSwitchAttributesResult::getIpv6CidrBlock()const
  125. {
  126. return ipv6CidrBlock_;
  127. }
  128. std::vector<DescribeVSwitchAttributesResult::CloudResourceSetType> DescribeVSwitchAttributesResult::getCloudResources()const
  129. {
  130. return cloudResources_;
  131. }