DescribeVpnRouteEntriesResult.cc 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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/DescribeVpnRouteEntriesResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Vpc;
  19. using namespace AlibabaCloud::Vpc::Model;
  20. DescribeVpnRouteEntriesResult::DescribeVpnRouteEntriesResult() :
  21. ServiceResult()
  22. {}
  23. DescribeVpnRouteEntriesResult::DescribeVpnRouteEntriesResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeVpnRouteEntriesResult::~DescribeVpnRouteEntriesResult()
  29. {}
  30. void DescribeVpnRouteEntriesResult::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 allVpnRouteEntriesNode = value["VpnRouteEntries"]["VpnRouteEntry"];
  37. for (auto valueVpnRouteEntriesVpnRouteEntry : allVpnRouteEntriesNode)
  38. {
  39. VpnRouteEntry vpnRouteEntriesObject;
  40. if(!valueVpnRouteEntriesVpnRouteEntry["VpnInstanceId"].isNull())
  41. vpnRouteEntriesObject.vpnInstanceId = valueVpnRouteEntriesVpnRouteEntry["VpnInstanceId"].asString();
  42. if(!valueVpnRouteEntriesVpnRouteEntry["RouteDest"].isNull())
  43. vpnRouteEntriesObject.routeDest = valueVpnRouteEntriesVpnRouteEntry["RouteDest"].asString();
  44. if(!valueVpnRouteEntriesVpnRouteEntry["NextHop"].isNull())
  45. vpnRouteEntriesObject.nextHop = valueVpnRouteEntriesVpnRouteEntry["NextHop"].asString();
  46. if(!valueVpnRouteEntriesVpnRouteEntry["Weight"].isNull())
  47. vpnRouteEntriesObject.weight = std::stoi(valueVpnRouteEntriesVpnRouteEntry["Weight"].asString());
  48. if(!valueVpnRouteEntriesVpnRouteEntry["CreateTime"].isNull())
  49. vpnRouteEntriesObject.createTime = std::stol(valueVpnRouteEntriesVpnRouteEntry["CreateTime"].asString());
  50. if(!valueVpnRouteEntriesVpnRouteEntry["State"].isNull())
  51. vpnRouteEntriesObject.state = valueVpnRouteEntriesVpnRouteEntry["State"].asString();
  52. vpnRouteEntries_.push_back(vpnRouteEntriesObject);
  53. }
  54. if(!value["TotalCount"].isNull())
  55. totalCount_ = std::stoi(value["TotalCount"].asString());
  56. if(!value["PageNumber"].isNull())
  57. pageNumber_ = std::stoi(value["PageNumber"].asString());
  58. if(!value["PageSize"].isNull())
  59. pageSize_ = std::stoi(value["PageSize"].asString());
  60. }
  61. int DescribeVpnRouteEntriesResult::getTotalCount()const
  62. {
  63. return totalCount_;
  64. }
  65. std::vector<DescribeVpnRouteEntriesResult::VpnRouteEntry> DescribeVpnRouteEntriesResult::getVpnRouteEntries()const
  66. {
  67. return vpnRouteEntries_;
  68. }
  69. int DescribeVpnRouteEntriesResult::getPageSize()const
  70. {
  71. return pageSize_;
  72. }
  73. int DescribeVpnRouteEntriesResult::getPageNumber()const
  74. {
  75. return pageNumber_;
  76. }