DescribeAuthorizedApisResult.cc 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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/DescribeAuthorizedApisResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::CloudAPI;
  19. using namespace AlibabaCloud::CloudAPI::Model;
  20. DescribeAuthorizedApisResult::DescribeAuthorizedApisResult() :
  21. ServiceResult()
  22. {}
  23. DescribeAuthorizedApisResult::DescribeAuthorizedApisResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeAuthorizedApisResult::~DescribeAuthorizedApisResult()
  29. {}
  30. void DescribeAuthorizedApisResult::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 allAuthorizedApisNode = value["AuthorizedApis"]["AuthorizedApi"];
  37. for (auto valueAuthorizedApisAuthorizedApi : allAuthorizedApisNode)
  38. {
  39. AuthorizedApi authorizedApisObject;
  40. if(!valueAuthorizedApisAuthorizedApi["RegionId"].isNull())
  41. authorizedApisObject.regionId = valueAuthorizedApisAuthorizedApi["RegionId"].asString();
  42. if(!valueAuthorizedApisAuthorizedApi["GroupId"].isNull())
  43. authorizedApisObject.groupId = valueAuthorizedApisAuthorizedApi["GroupId"].asString();
  44. if(!valueAuthorizedApisAuthorizedApi["GroupName"].isNull())
  45. authorizedApisObject.groupName = valueAuthorizedApisAuthorizedApi["GroupName"].asString();
  46. if(!valueAuthorizedApisAuthorizedApi["StageName"].isNull())
  47. authorizedApisObject.stageName = valueAuthorizedApisAuthorizedApi["StageName"].asString();
  48. if(!valueAuthorizedApisAuthorizedApi["Operator"].isNull())
  49. authorizedApisObject._operator = valueAuthorizedApisAuthorizedApi["Operator"].asString();
  50. if(!valueAuthorizedApisAuthorizedApi["ApiId"].isNull())
  51. authorizedApisObject.apiId = valueAuthorizedApisAuthorizedApi["ApiId"].asString();
  52. if(!valueAuthorizedApisAuthorizedApi["ApiName"].isNull())
  53. authorizedApisObject.apiName = valueAuthorizedApisAuthorizedApi["ApiName"].asString();
  54. if(!valueAuthorizedApisAuthorizedApi["AuthorizationSource"].isNull())
  55. authorizedApisObject.authorizationSource = valueAuthorizedApisAuthorizedApi["AuthorizationSource"].asString();
  56. if(!valueAuthorizedApisAuthorizedApi["Description"].isNull())
  57. authorizedApisObject.description = valueAuthorizedApisAuthorizedApi["Description"].asString();
  58. if(!valueAuthorizedApisAuthorizedApi["AuthorizedTime"].isNull())
  59. authorizedApisObject.authorizedTime = valueAuthorizedApisAuthorizedApi["AuthorizedTime"].asString();
  60. if(!valueAuthorizedApisAuthorizedApi["AuthVaildTime"].isNull())
  61. authorizedApisObject.authVaildTime = valueAuthorizedApisAuthorizedApi["AuthVaildTime"].asString();
  62. authorizedApis_.push_back(authorizedApisObject);
  63. }
  64. if(!value["TotalCount"].isNull())
  65. totalCount_ = std::stoi(value["TotalCount"].asString());
  66. if(!value["PageSize"].isNull())
  67. pageSize_ = std::stoi(value["PageSize"].asString());
  68. if(!value["PageNumber"].isNull())
  69. pageNumber_ = std::stoi(value["PageNumber"].asString());
  70. }
  71. int DescribeAuthorizedApisResult::getTotalCount()const
  72. {
  73. return totalCount_;
  74. }
  75. int DescribeAuthorizedApisResult::getPageSize()const
  76. {
  77. return pageSize_;
  78. }
  79. int DescribeAuthorizedApisResult::getPageNumber()const
  80. {
  81. return pageNumber_;
  82. }
  83. std::vector<DescribeAuthorizedApisResult::AuthorizedApi> DescribeAuthorizedApisResult::getAuthorizedApis()const
  84. {
  85. return authorizedApis_;
  86. }