DescribeRouteTableListResult.cc 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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/DescribeRouteTableListResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Vpc;
  19. using namespace AlibabaCloud::Vpc::Model;
  20. DescribeRouteTableListResult::DescribeRouteTableListResult() :
  21. ServiceResult()
  22. {}
  23. DescribeRouteTableListResult::DescribeRouteTableListResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeRouteTableListResult::~DescribeRouteTableListResult()
  29. {}
  30. void DescribeRouteTableListResult::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 allRouterTableListNode = value["RouterTableList"]["RouterTableListType"];
  37. for (auto valueRouterTableListRouterTableListType : allRouterTableListNode)
  38. {
  39. RouterTableListType routerTableListObject;
  40. if(!valueRouterTableListRouterTableListType["VpcId"].isNull())
  41. routerTableListObject.vpcId = valueRouterTableListRouterTableListType["VpcId"].asString();
  42. if(!valueRouterTableListRouterTableListType["RouterType"].isNull())
  43. routerTableListObject.routerType = valueRouterTableListRouterTableListType["RouterType"].asString();
  44. if(!valueRouterTableListRouterTableListType["RouterId"].isNull())
  45. routerTableListObject.routerId = valueRouterTableListRouterTableListType["RouterId"].asString();
  46. if(!valueRouterTableListRouterTableListType["RouteTableId"].isNull())
  47. routerTableListObject.routeTableId = valueRouterTableListRouterTableListType["RouteTableId"].asString();
  48. if(!valueRouterTableListRouterTableListType["RouteTableName"].isNull())
  49. routerTableListObject.routeTableName = valueRouterTableListRouterTableListType["RouteTableName"].asString();
  50. if(!valueRouterTableListRouterTableListType["RouteTableType"].isNull())
  51. routerTableListObject.routeTableType = valueRouterTableListRouterTableListType["RouteTableType"].asString();
  52. if(!valueRouterTableListRouterTableListType["Description"].isNull())
  53. routerTableListObject.description = valueRouterTableListRouterTableListType["Description"].asString();
  54. if(!valueRouterTableListRouterTableListType["ResourceGroupId"].isNull())
  55. routerTableListObject.resourceGroupId = valueRouterTableListRouterTableListType["ResourceGroupId"].asString();
  56. if(!valueRouterTableListRouterTableListType["CreationTime"].isNull())
  57. routerTableListObject.creationTime = valueRouterTableListRouterTableListType["CreationTime"].asString();
  58. if(!valueRouterTableListRouterTableListType["Status"].isNull())
  59. routerTableListObject.status = valueRouterTableListRouterTableListType["Status"].asString();
  60. auto allTagsNode = allRouterTableListNode["Tags"]["Tag"];
  61. for (auto allRouterTableListNodeTagsTag : allTagsNode)
  62. {
  63. RouterTableListType::Tag tagsObject;
  64. if(!allRouterTableListNodeTagsTag["Key"].isNull())
  65. tagsObject.key = allRouterTableListNodeTagsTag["Key"].asString();
  66. if(!allRouterTableListNodeTagsTag["Value"].isNull())
  67. tagsObject.value = allRouterTableListNodeTagsTag["Value"].asString();
  68. routerTableListObject.tags.push_back(tagsObject);
  69. }
  70. auto allVSwitchIds = value["VSwitchIds"]["VSwitchId"];
  71. for (auto value : allVSwitchIds)
  72. routerTableListObject.vSwitchIds.push_back(value.asString());
  73. routerTableList_.push_back(routerTableListObject);
  74. }
  75. if(!value["Code"].isNull())
  76. code_ = value["Code"].asString();
  77. if(!value["Message"].isNull())
  78. message_ = value["Message"].asString();
  79. if(!value["Success"].isNull())
  80. success_ = value["Success"].asString() == "true";
  81. if(!value["PageSize"].isNull())
  82. pageSize_ = std::stoi(value["PageSize"].asString());
  83. if(!value["PageNumber"].isNull())
  84. pageNumber_ = std::stoi(value["PageNumber"].asString());
  85. if(!value["TotalCount"].isNull())
  86. totalCount_ = std::stoi(value["TotalCount"].asString());
  87. }
  88. int DescribeRouteTableListResult::getTotalCount()const
  89. {
  90. return totalCount_;
  91. }
  92. std::string DescribeRouteTableListResult::getMessage()const
  93. {
  94. return message_;
  95. }
  96. int DescribeRouteTableListResult::getPageSize()const
  97. {
  98. return pageSize_;
  99. }
  100. int DescribeRouteTableListResult::getPageNumber()const
  101. {
  102. return pageNumber_;
  103. }
  104. std::vector<DescribeRouteTableListResult::RouterTableListType> DescribeRouteTableListResult::getRouterTableList()const
  105. {
  106. return routerTableList_;
  107. }
  108. std::string DescribeRouteTableListResult::getCode()const
  109. {
  110. return code_;
  111. }
  112. bool DescribeRouteTableListResult::getSuccess()const
  113. {
  114. return success_;
  115. }