DescribeApiGroupsResult.cc 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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/cloudapi/model/DescribeApiGroupsResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::CloudAPI;
  19. using namespace AlibabaCloud::CloudAPI::Model;
  20. DescribeApiGroupsResult::DescribeApiGroupsResult() :
  21. ServiceResult()
  22. {}
  23. DescribeApiGroupsResult::DescribeApiGroupsResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeApiGroupsResult::~DescribeApiGroupsResult()
  29. {}
  30. void DescribeApiGroupsResult::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 allApiGroupAttributesNode = value["ApiGroupAttributes"]["ApiGroupAttribute"];
  37. for (auto valueApiGroupAttributesApiGroupAttribute : allApiGroupAttributesNode)
  38. {
  39. ApiGroupAttribute apiGroupAttributesObject;
  40. if(!valueApiGroupAttributesApiGroupAttribute["GroupId"].isNull())
  41. apiGroupAttributesObject.groupId = valueApiGroupAttributesApiGroupAttribute["GroupId"].asString();
  42. if(!valueApiGroupAttributesApiGroupAttribute["GroupName"].isNull())
  43. apiGroupAttributesObject.groupName = valueApiGroupAttributesApiGroupAttribute["GroupName"].asString();
  44. if(!valueApiGroupAttributesApiGroupAttribute["SubDomain"].isNull())
  45. apiGroupAttributesObject.subDomain = valueApiGroupAttributesApiGroupAttribute["SubDomain"].asString();
  46. if(!valueApiGroupAttributesApiGroupAttribute["Description"].isNull())
  47. apiGroupAttributesObject.description = valueApiGroupAttributesApiGroupAttribute["Description"].asString();
  48. if(!valueApiGroupAttributesApiGroupAttribute["CreatedTime"].isNull())
  49. apiGroupAttributesObject.createdTime = valueApiGroupAttributesApiGroupAttribute["CreatedTime"].asString();
  50. if(!valueApiGroupAttributesApiGroupAttribute["ModifiedTime"].isNull())
  51. apiGroupAttributesObject.modifiedTime = valueApiGroupAttributesApiGroupAttribute["ModifiedTime"].asString();
  52. if(!valueApiGroupAttributesApiGroupAttribute["RegionId"].isNull())
  53. apiGroupAttributesObject.regionId = valueApiGroupAttributesApiGroupAttribute["RegionId"].asString();
  54. if(!valueApiGroupAttributesApiGroupAttribute["TrafficLimit"].isNull())
  55. apiGroupAttributesObject.trafficLimit = std::stoi(valueApiGroupAttributesApiGroupAttribute["TrafficLimit"].asString());
  56. if(!valueApiGroupAttributesApiGroupAttribute["BillingStatus"].isNull())
  57. apiGroupAttributesObject.billingStatus = valueApiGroupAttributesApiGroupAttribute["BillingStatus"].asString();
  58. if(!valueApiGroupAttributesApiGroupAttribute["IllegalStatus"].isNull())
  59. apiGroupAttributesObject.illegalStatus = valueApiGroupAttributesApiGroupAttribute["IllegalStatus"].asString();
  60. if(!valueApiGroupAttributesApiGroupAttribute["InstanceId"].isNull())
  61. apiGroupAttributesObject.instanceId = valueApiGroupAttributesApiGroupAttribute["InstanceId"].asString();
  62. if(!valueApiGroupAttributesApiGroupAttribute["InstanceType"].isNull())
  63. apiGroupAttributesObject.instanceType = valueApiGroupAttributesApiGroupAttribute["InstanceType"].asString();
  64. if(!valueApiGroupAttributesApiGroupAttribute["HttpsPolicy"].isNull())
  65. apiGroupAttributesObject.httpsPolicy = valueApiGroupAttributesApiGroupAttribute["HttpsPolicy"].asString();
  66. apiGroupAttributes_.push_back(apiGroupAttributesObject);
  67. }
  68. if(!value["TotalCount"].isNull())
  69. totalCount_ = std::stoi(value["TotalCount"].asString());
  70. if(!value["PageSize"].isNull())
  71. pageSize_ = std::stoi(value["PageSize"].asString());
  72. if(!value["PageNumber"].isNull())
  73. pageNumber_ = std::stoi(value["PageNumber"].asString());
  74. }
  75. int DescribeApiGroupsResult::getTotalCount()const
  76. {
  77. return totalCount_;
  78. }
  79. int DescribeApiGroupsResult::getPageSize()const
  80. {
  81. return pageSize_;
  82. }
  83. int DescribeApiGroupsResult::getPageNumber()const
  84. {
  85. return pageNumber_;
  86. }
  87. std::vector<DescribeApiGroupsResult::ApiGroupAttribute> DescribeApiGroupsResult::getApiGroupAttributes()const
  88. {
  89. return apiGroupAttributes_;
  90. }