DescribeStorageSetsResult.cc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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/ecs/model/DescribeStorageSetsResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Ecs;
  19. using namespace AlibabaCloud::Ecs::Model;
  20. DescribeStorageSetsResult::DescribeStorageSetsResult() :
  21. ServiceResult()
  22. {}
  23. DescribeStorageSetsResult::DescribeStorageSetsResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeStorageSetsResult::~DescribeStorageSetsResult()
  29. {}
  30. void DescribeStorageSetsResult::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 allStorageSetsNode = value["StorageSets"]["StorageSet"];
  37. for (auto valueStorageSetsStorageSet : allStorageSetsNode)
  38. {
  39. StorageSet storageSetsObject;
  40. if(!valueStorageSetsStorageSet["StorageSetId"].isNull())
  41. storageSetsObject.storageSetId = valueStorageSetsStorageSet["StorageSetId"].asString();
  42. if(!valueStorageSetsStorageSet["CreationTime"].isNull())
  43. storageSetsObject.creationTime = valueStorageSetsStorageSet["CreationTime"].asString();
  44. if(!valueStorageSetsStorageSet["StorageSetName"].isNull())
  45. storageSetsObject.storageSetName = valueStorageSetsStorageSet["StorageSetName"].asString();
  46. if(!valueStorageSetsStorageSet["Description"].isNull())
  47. storageSetsObject.description = valueStorageSetsStorageSet["Description"].asString();
  48. if(!valueStorageSetsStorageSet["StorageSetPartitionNumber"].isNull())
  49. storageSetsObject.storageSetPartitionNumber = std::stoi(valueStorageSetsStorageSet["StorageSetPartitionNumber"].asString());
  50. if(!valueStorageSetsStorageSet["RegionId"].isNull())
  51. storageSetsObject.regionId = valueStorageSetsStorageSet["RegionId"].asString();
  52. if(!valueStorageSetsStorageSet["ZoneId"].isNull())
  53. storageSetsObject.zoneId = valueStorageSetsStorageSet["ZoneId"].asString();
  54. storageSets_.push_back(storageSetsObject);
  55. }
  56. if(!value["TotalCount"].isNull())
  57. totalCount_ = std::stoi(value["TotalCount"].asString());
  58. if(!value["PageNumber"].isNull())
  59. pageNumber_ = std::stoi(value["PageNumber"].asString());
  60. if(!value["PageSize"].isNull())
  61. pageSize_ = std::stoi(value["PageSize"].asString());
  62. }
  63. int DescribeStorageSetsResult::getTotalCount()const
  64. {
  65. return totalCount_;
  66. }
  67. int DescribeStorageSetsResult::getPageSize()const
  68. {
  69. return pageSize_;
  70. }
  71. int DescribeStorageSetsResult::getPageNumber()const
  72. {
  73. return pageNumber_;
  74. }
  75. std::vector<DescribeStorageSetsResult::StorageSet> DescribeStorageSetsResult::getStorageSets()const
  76. {
  77. return storageSets_;
  78. }