DescribeWhitelistSettingResult.cc 3.0 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/cloudauth/model/DescribeWhitelistSettingResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Cloudauth;
  19. using namespace AlibabaCloud::Cloudauth::Model;
  20. DescribeWhitelistSettingResult::DescribeWhitelistSettingResult() :
  21. ServiceResult()
  22. {}
  23. DescribeWhitelistSettingResult::DescribeWhitelistSettingResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeWhitelistSettingResult::~DescribeWhitelistSettingResult()
  29. {}
  30. void DescribeWhitelistSettingResult::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 allItemsNode = value["Items"]["Item"];
  37. for (auto valueItemsItem : allItemsNode)
  38. {
  39. Item itemsObject;
  40. if(!valueItemsItem["Id"].isNull())
  41. itemsObject.id = std::stol(valueItemsItem["Id"].asString());
  42. if(!valueItemsItem["SceneId"].isNull())
  43. itemsObject.sceneId = std::stol(valueItemsItem["SceneId"].asString());
  44. if(!valueItemsItem["ValidStartDate"].isNull())
  45. itemsObject.validStartDate = valueItemsItem["ValidStartDate"].asString();
  46. if(!valueItemsItem["ValidEndDate"].isNull())
  47. itemsObject.validEndDate = valueItemsItem["ValidEndDate"].asString();
  48. if(!valueItemsItem["CertNo"].isNull())
  49. itemsObject.certNo = valueItemsItem["CertNo"].asString();
  50. if(!valueItemsItem["CertifyId"].isNull())
  51. itemsObject.certifyId = valueItemsItem["CertifyId"].asString();
  52. if(!valueItemsItem["Status"].isNull())
  53. itemsObject.status = valueItemsItem["Status"].asString();
  54. if(!valueItemsItem["GmtCreate"].isNull())
  55. itemsObject.gmtCreate = valueItemsItem["GmtCreate"].asString();
  56. if(!valueItemsItem["GmtModified"].isNull())
  57. itemsObject.gmtModified = valueItemsItem["GmtModified"].asString();
  58. items_.push_back(itemsObject);
  59. }
  60. if(!value["TotalCount"].isNull())
  61. totalCount_ = std::stoi(value["TotalCount"].asString());
  62. if(!value["CurrentPage"].isNull())
  63. currentPage_ = std::stoi(value["CurrentPage"].asString());
  64. if(!value["PageSize"].isNull())
  65. pageSize_ = std::stoi(value["PageSize"].asString());
  66. }
  67. int DescribeWhitelistSettingResult::getTotalCount()const
  68. {
  69. return totalCount_;
  70. }
  71. int DescribeWhitelistSettingResult::getPageSize()const
  72. {
  73. return pageSize_;
  74. }
  75. int DescribeWhitelistSettingResult::getCurrentPage()const
  76. {
  77. return currentPage_;
  78. }
  79. std::vector<DescribeWhitelistSettingResult::Item> DescribeWhitelistSettingResult::getItems()const
  80. {
  81. return items_;
  82. }