QueryEndPointListResult.cc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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/openanalytics/model/QueryEndPointListResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Openanalytics;
  19. using namespace AlibabaCloud::Openanalytics::Model;
  20. QueryEndPointListResult::QueryEndPointListResult() :
  21. ServiceResult()
  22. {}
  23. QueryEndPointListResult::QueryEndPointListResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. QueryEndPointListResult::~QueryEndPointListResult()
  29. {}
  30. void QueryEndPointListResult::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 allEndPointListNode = value["EndPointList"]["EndPointListItem"];
  37. for (auto valueEndPointListEndPointListItem : allEndPointListNode)
  38. {
  39. EndPointListItem endPointListObject;
  40. if(!valueEndPointListEndPointListItem["endPointID"].isNull())
  41. endPointListObject.endPointID = valueEndPointListEndPointListItem["endPointID"].asString();
  42. if(!valueEndPointListEndPointListItem["zone"].isNull())
  43. endPointListObject.zone = valueEndPointListEndPointListItem["zone"].asString();
  44. if(!valueEndPointListEndPointListItem["vSwitch"].isNull())
  45. endPointListObject.vSwitch = valueEndPointListEndPointListItem["vSwitch"].asString();
  46. if(!valueEndPointListEndPointListItem["status"].isNull())
  47. endPointListObject.status = valueEndPointListEndPointListItem["status"].asString();
  48. if(!valueEndPointListEndPointListItem["vpcID"].isNull())
  49. endPointListObject.vpcID = valueEndPointListEndPointListItem["vpcID"].asString();
  50. if(!valueEndPointListEndPointListItem["host"].isNull())
  51. endPointListObject.host = valueEndPointListEndPointListItem["host"].asString();
  52. if(!valueEndPointListEndPointListItem["domainURL"].isNull())
  53. endPointListObject.domainURL = valueEndPointListEndPointListItem["domainURL"].asString();
  54. if(!valueEndPointListEndPointListItem["networkType"].isNull())
  55. endPointListObject.networkType = valueEndPointListEndPointListItem["networkType"].asString();
  56. if(!valueEndPointListEndPointListItem["allowIP"].isNull())
  57. endPointListObject.allowIP = valueEndPointListEndPointListItem["allowIP"].asString();
  58. if(!valueEndPointListEndPointListItem["port"].isNull())
  59. endPointListObject.port = valueEndPointListEndPointListItem["port"].asString();
  60. if(!valueEndPointListEndPointListItem["cloudInstanceID"].isNull())
  61. endPointListObject.cloudInstanceID = valueEndPointListEndPointListItem["cloudInstanceID"].asString();
  62. endPointList_.push_back(endPointListObject);
  63. }
  64. if(!value["RegionId"].isNull())
  65. regionId_ = value["RegionId"].asString();
  66. }
  67. std::vector<QueryEndPointListResult::EndPointListItem> QueryEndPointListResult::getEndPointList()const
  68. {
  69. return endPointList_;
  70. }
  71. std::string QueryEndPointListResult::getRegionId()const
  72. {
  73. return regionId_;
  74. }