GetLoadBalancerAttributeResult.cc 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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/gwlb/model/GetLoadBalancerAttributeResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Gwlb;
  19. using namespace AlibabaCloud::Gwlb::Model;
  20. GetLoadBalancerAttributeResult::GetLoadBalancerAttributeResult() :
  21. ServiceResult()
  22. {}
  23. GetLoadBalancerAttributeResult::GetLoadBalancerAttributeResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. GetLoadBalancerAttributeResult::~GetLoadBalancerAttributeResult()
  29. {}
  30. void GetLoadBalancerAttributeResult::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 allTagsNode = value["Tags"]["TagModel"];
  37. for (auto valueTagsTagModel : allTagsNode)
  38. {
  39. TagModel tagsObject;
  40. if(!valueTagsTagModel["Key"].isNull())
  41. tagsObject.key = valueTagsTagModel["Key"].asString();
  42. if(!valueTagsTagModel["Value"].isNull())
  43. tagsObject.value = valueTagsTagModel["Value"].asString();
  44. tags_.push_back(tagsObject);
  45. }
  46. auto allZoneMappingsNode = value["ZoneMappings"]["ZoneEniModel"];
  47. for (auto valueZoneMappingsZoneEniModel : allZoneMappingsNode)
  48. {
  49. ZoneEniModel zoneMappingsObject;
  50. if(!valueZoneMappingsZoneEniModel["VSwitchId"].isNull())
  51. zoneMappingsObject.vSwitchId = valueZoneMappingsZoneEniModel["VSwitchId"].asString();
  52. if(!valueZoneMappingsZoneEniModel["ZoneId"].isNull())
  53. zoneMappingsObject.zoneId = valueZoneMappingsZoneEniModel["ZoneId"].asString();
  54. auto allLoadBalancerAddressesNode = valueZoneMappingsZoneEniModel["LoadBalancerAddresses"]["EniModels"];
  55. for (auto valueZoneMappingsZoneEniModelLoadBalancerAddressesEniModels : allLoadBalancerAddressesNode)
  56. {
  57. ZoneEniModel::EniModels loadBalancerAddressesObject;
  58. if(!valueZoneMappingsZoneEniModelLoadBalancerAddressesEniModels["EniId"].isNull())
  59. loadBalancerAddressesObject.eniId = valueZoneMappingsZoneEniModelLoadBalancerAddressesEniModels["EniId"].asString();
  60. if(!valueZoneMappingsZoneEniModelLoadBalancerAddressesEniModels["PrivateIpv4Address"].isNull())
  61. loadBalancerAddressesObject.privateIpv4Address = valueZoneMappingsZoneEniModelLoadBalancerAddressesEniModels["PrivateIpv4Address"].asString();
  62. zoneMappingsObject.loadBalancerAddresses.push_back(loadBalancerAddressesObject);
  63. }
  64. zoneMappings_.push_back(zoneMappingsObject);
  65. }
  66. if(!value["AddressIpVersion"].isNull())
  67. addressIpVersion_ = value["AddressIpVersion"].asString();
  68. if(!value["CreateTime"].isNull())
  69. createTime_ = value["CreateTime"].asString();
  70. if(!value["CrossZoneEnabled"].isNull())
  71. crossZoneEnabled_ = value["CrossZoneEnabled"].asString() == "true";
  72. if(!value["LoadBalancerBusinessStatus"].isNull())
  73. loadBalancerBusinessStatus_ = value["LoadBalancerBusinessStatus"].asString();
  74. if(!value["LoadBalancerId"].isNull())
  75. loadBalancerId_ = value["LoadBalancerId"].asString();
  76. if(!value["LoadBalancerName"].isNull())
  77. loadBalancerName_ = value["LoadBalancerName"].asString();
  78. if(!value["LoadBalancerStatus"].isNull())
  79. loadBalancerStatus_ = value["LoadBalancerStatus"].asString();
  80. if(!value["ResourceGroupId"].isNull())
  81. resourceGroupId_ = value["ResourceGroupId"].asString();
  82. if(!value["VpcId"].isNull())
  83. vpcId_ = value["VpcId"].asString();
  84. }
  85. std::string GetLoadBalancerAttributeResult::getLoadBalancerName()const
  86. {
  87. return loadBalancerName_;
  88. }
  89. std::string GetLoadBalancerAttributeResult::getAddressIpVersion()const
  90. {
  91. return addressIpVersion_;
  92. }
  93. std::string GetLoadBalancerAttributeResult::getResourceGroupId()const
  94. {
  95. return resourceGroupId_;
  96. }
  97. std::string GetLoadBalancerAttributeResult::getVpcId()const
  98. {
  99. return vpcId_;
  100. }
  101. std::string GetLoadBalancerAttributeResult::getCreateTime()const
  102. {
  103. return createTime_;
  104. }
  105. std::string GetLoadBalancerAttributeResult::getLoadBalancerId()const
  106. {
  107. return loadBalancerId_;
  108. }
  109. std::vector<GetLoadBalancerAttributeResult::ZoneEniModel> GetLoadBalancerAttributeResult::getZoneMappings()const
  110. {
  111. return zoneMappings_;
  112. }
  113. std::string GetLoadBalancerAttributeResult::getLoadBalancerBusinessStatus()const
  114. {
  115. return loadBalancerBusinessStatus_;
  116. }
  117. std::string GetLoadBalancerAttributeResult::getLoadBalancerStatus()const
  118. {
  119. return loadBalancerStatus_;
  120. }
  121. std::vector<GetLoadBalancerAttributeResult::TagModel> GetLoadBalancerAttributeResult::getTags()const
  122. {
  123. return tags_;
  124. }
  125. bool GetLoadBalancerAttributeResult::getCrossZoneEnabled()const
  126. {
  127. return crossZoneEnabled_;
  128. }