ListCpfsFileSystemsResult.cc 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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/ehpc/model/ListCpfsFileSystemsResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::EHPC;
  19. using namespace AlibabaCloud::EHPC::Model;
  20. ListCpfsFileSystemsResult::ListCpfsFileSystemsResult() :
  21. ServiceResult()
  22. {}
  23. ListCpfsFileSystemsResult::ListCpfsFileSystemsResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. ListCpfsFileSystemsResult::~ListCpfsFileSystemsResult()
  29. {}
  30. void ListCpfsFileSystemsResult::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 allFileSystemList = value["FileSystemList"]["FileSystems"];
  37. for (auto value : allFileSystemList)
  38. {
  39. FileSystems fileSystemListObject;
  40. if(!value["RegionId"].isNull())
  41. fileSystemListObject.regionId = value["RegionId"].asString();
  42. if(!value["ZoneId"].isNull())
  43. fileSystemListObject.zoneId = value["ZoneId"].asString();
  44. if(!value["FileSystemId"].isNull())
  45. fileSystemListObject.fileSystemId = value["FileSystemId"].asString();
  46. if(!value["CreateTime"].isNull())
  47. fileSystemListObject.createTime = value["CreateTime"].asString();
  48. if(!value["Destription"].isNull())
  49. fileSystemListObject.destription = value["Destription"].asString();
  50. if(!value["ProtocolType"].isNull())
  51. fileSystemListObject.protocolType = value["ProtocolType"].asString();
  52. if(!value["Capacity"].isNull())
  53. fileSystemListObject.capacity = value["Capacity"].asString();
  54. auto allMountTargetList = value["MountTargetList"]["MountTargets"];
  55. for (auto value : allMountTargetList)
  56. {
  57. FileSystems::MountTargets mountTargetListObject;
  58. if(!value["MountTargetDomain"].isNull())
  59. mountTargetListObject.mountTargetDomain = value["MountTargetDomain"].asString();
  60. if(!value["Status"].isNull())
  61. mountTargetListObject.status = value["Status"].asString();
  62. if(!value["NetworkType"].isNull())
  63. mountTargetListObject.networkType = value["NetworkType"].asString();
  64. if(!value["VswId"].isNull())
  65. mountTargetListObject.vswId = value["VswId"].asString();
  66. if(!value["VpcId"].isNull())
  67. mountTargetListObject.vpcId = value["VpcId"].asString();
  68. fileSystemListObject.mountTargetList.push_back(mountTargetListObject);
  69. }
  70. fileSystemList_.push_back(fileSystemListObject);
  71. }
  72. if(!value["TotalCount"].isNull())
  73. totalCount_ = std::stoi(value["TotalCount"].asString());
  74. if(!value["PageNumber"].isNull())
  75. pageNumber_ = std::stoi(value["PageNumber"].asString());
  76. if(!value["PageSize"].isNull())
  77. pageSize_ = std::stoi(value["PageSize"].asString());
  78. }
  79. int ListCpfsFileSystemsResult::getTotalCount()const
  80. {
  81. return totalCount_;
  82. }
  83. int ListCpfsFileSystemsResult::getPageSize()const
  84. {
  85. return pageSize_;
  86. }
  87. int ListCpfsFileSystemsResult::getPageNumber()const
  88. {
  89. return pageNumber_;
  90. }
  91. std::vector<ListCpfsFileSystemsResult::FileSystems> ListCpfsFileSystemsResult::getFileSystemList()const
  92. {
  93. return fileSystemList_;
  94. }