ListVpcInfoByVpcResult.cc 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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/ots/model/ListVpcInfoByVpcResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Ots;
  19. using namespace AlibabaCloud::Ots::Model;
  20. ListVpcInfoByVpcResult::ListVpcInfoByVpcResult() :
  21. ServiceResult()
  22. {}
  23. ListVpcInfoByVpcResult::ListVpcInfoByVpcResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. ListVpcInfoByVpcResult::~ListVpcInfoByVpcResult()
  29. {}
  30. void ListVpcInfoByVpcResult::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 allVpcInfos = value["VpcInfos"]["VpcInfo"];
  37. for (auto value : allVpcInfos)
  38. {
  39. VpcInfo vpcInfosObject;
  40. if(!value["InstanceName"].isNull())
  41. vpcInfosObject.instanceName = value["InstanceName"].asString();
  42. if(!value["InstanceVpcName"].isNull())
  43. vpcInfosObject.instanceVpcName = value["InstanceVpcName"].asString();
  44. if(!value["Endpoint"].isNull())
  45. vpcInfosObject.endpoint = value["Endpoint"].asString();
  46. if(!value["Domain"].isNull())
  47. vpcInfosObject.domain = value["Domain"].asString();
  48. if(!value["RegionNo"].isNull())
  49. vpcInfosObject.regionNo = value["RegionNo"].asString();
  50. vpcInfos_.push_back(vpcInfosObject);
  51. }
  52. if(!value["TotalCount"].isNull())
  53. totalCount_ = std::stol(value["TotalCount"].asString());
  54. if(!value["PageNum"].isNull())
  55. pageNum_ = std::stol(value["PageNum"].asString());
  56. if(!value["PageSize"].isNull())
  57. pageSize_ = std::stol(value["PageSize"].asString());
  58. if(!value["VpcId"].isNull())
  59. vpcId_ = value["VpcId"].asString();
  60. }
  61. long ListVpcInfoByVpcResult::getTotalCount()const
  62. {
  63. return totalCount_;
  64. }
  65. long ListVpcInfoByVpcResult::getPageNum()const
  66. {
  67. return pageNum_;
  68. }
  69. long ListVpcInfoByVpcResult::getPageSize()const
  70. {
  71. return pageSize_;
  72. }
  73. std::string ListVpcInfoByVpcResult::getVpcId()const
  74. {
  75. return vpcId_;
  76. }
  77. std::vector<ListVpcInfoByVpcResult::VpcInfo> ListVpcInfoByVpcResult::getVpcInfos()const
  78. {
  79. return vpcInfos_;
  80. }