GetLoadBalancerAttributeResult.cc 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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/alb/model/GetLoadBalancerAttributeResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Alb;
  19. using namespace AlibabaCloud::Alb::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 allLoadBalancerOperationLocksNode = value["LoadBalancerOperationLocks"]["LoadBalancerOperationLock"];
  37. for (auto valueLoadBalancerOperationLocksLoadBalancerOperationLock : allLoadBalancerOperationLocksNode)
  38. {
  39. LoadBalancerOperationLock loadBalancerOperationLocksObject;
  40. if(!valueLoadBalancerOperationLocksLoadBalancerOperationLock["LockReason"].isNull())
  41. loadBalancerOperationLocksObject.lockReason = valueLoadBalancerOperationLocksLoadBalancerOperationLock["LockReason"].asString();
  42. if(!valueLoadBalancerOperationLocksLoadBalancerOperationLock["LockType"].isNull())
  43. loadBalancerOperationLocksObject.lockType = valueLoadBalancerOperationLocksLoadBalancerOperationLock["LockType"].asString();
  44. loadBalancerOperationLocks_.push_back(loadBalancerOperationLocksObject);
  45. }
  46. auto allTagsNode = value["Tags"]["Tag"];
  47. for (auto valueTagsTag : allTagsNode)
  48. {
  49. Tag tagsObject;
  50. if(!valueTagsTag["Key"].isNull())
  51. tagsObject.key = valueTagsTag["Key"].asString();
  52. if(!valueTagsTag["Value"].isNull())
  53. tagsObject.value = valueTagsTag["Value"].asString();
  54. tags_.push_back(tagsObject);
  55. }
  56. auto allZoneMappingsNode = value["ZoneMappings"]["ZoneMapping"];
  57. for (auto valueZoneMappingsZoneMapping : allZoneMappingsNode)
  58. {
  59. ZoneMapping zoneMappingsObject;
  60. if(!valueZoneMappingsZoneMapping["VSwitchId"].isNull())
  61. zoneMappingsObject.vSwitchId = valueZoneMappingsZoneMapping["VSwitchId"].asString();
  62. if(!valueZoneMappingsZoneMapping["ZoneId"].isNull())
  63. zoneMappingsObject.zoneId = valueZoneMappingsZoneMapping["ZoneId"].asString();
  64. auto allLoadBalancerAddressesNode = valueZoneMappingsZoneMapping["LoadBalancerAddresses"]["LoadBalancerAddress"];
  65. for (auto valueZoneMappingsZoneMappingLoadBalancerAddressesLoadBalancerAddress : allLoadBalancerAddressesNode)
  66. {
  67. ZoneMapping::LoadBalancerAddress loadBalancerAddressesObject;
  68. if(!valueZoneMappingsZoneMappingLoadBalancerAddressesLoadBalancerAddress["Address"].isNull())
  69. loadBalancerAddressesObject.address = valueZoneMappingsZoneMappingLoadBalancerAddressesLoadBalancerAddress["Address"].asString();
  70. if(!valueZoneMappingsZoneMappingLoadBalancerAddressesLoadBalancerAddress["Ipv6Address"].isNull())
  71. loadBalancerAddressesObject.ipv6Address = valueZoneMappingsZoneMappingLoadBalancerAddressesLoadBalancerAddress["Ipv6Address"].asString();
  72. if(!valueZoneMappingsZoneMappingLoadBalancerAddressesLoadBalancerAddress["IntranetAddress"].isNull())
  73. loadBalancerAddressesObject.intranetAddress = valueZoneMappingsZoneMappingLoadBalancerAddressesLoadBalancerAddress["IntranetAddress"].asString();
  74. zoneMappingsObject.loadBalancerAddresses.push_back(loadBalancerAddressesObject);
  75. }
  76. zoneMappings_.push_back(zoneMappingsObject);
  77. }
  78. auto accessLogConfigNode = value["AccessLogConfig"];
  79. if(!accessLogConfigNode["LogProject"].isNull())
  80. accessLogConfig_.logProject = accessLogConfigNode["LogProject"].asString();
  81. if(!accessLogConfigNode["LogStore"].isNull())
  82. accessLogConfig_.logStore = accessLogConfigNode["LogStore"].asString();
  83. auto deletionProtectionConfigNode = value["DeletionProtectionConfig"];
  84. if(!deletionProtectionConfigNode["Enabled"].isNull())
  85. deletionProtectionConfig_.enabled = deletionProtectionConfigNode["Enabled"].asString() == "true";
  86. if(!deletionProtectionConfigNode["EnabledTime"].isNull())
  87. deletionProtectionConfig_.enabledTime = deletionProtectionConfigNode["EnabledTime"].asString();
  88. auto loadBalancerBillingConfigNode = value["LoadBalancerBillingConfig"];
  89. if(!loadBalancerBillingConfigNode["InternetBandwidth"].isNull())
  90. loadBalancerBillingConfig_.internetBandwidth = std::stoi(loadBalancerBillingConfigNode["InternetBandwidth"].asString());
  91. if(!loadBalancerBillingConfigNode["InternetChargeType"].isNull())
  92. loadBalancerBillingConfig_.internetChargeType = loadBalancerBillingConfigNode["InternetChargeType"].asString();
  93. if(!loadBalancerBillingConfigNode["PayType"].isNull())
  94. loadBalancerBillingConfig_.payType = loadBalancerBillingConfigNode["PayType"].asString();
  95. auto modificationProtectionConfigNode = value["ModificationProtectionConfig"];
  96. if(!modificationProtectionConfigNode["Reason"].isNull())
  97. modificationProtectionConfig_.reason = modificationProtectionConfigNode["Reason"].asString();
  98. if(!modificationProtectionConfigNode["Status"].isNull())
  99. modificationProtectionConfig_.status = modificationProtectionConfigNode["Status"].asString();
  100. auto allFeatureLabels = value["FeatureLabels"]["FeatureLabel"];
  101. for (const auto &item : allFeatureLabels)
  102. featureLabels_.push_back(item.asString());
  103. if(!value["AddressAllocatedMode"].isNull())
  104. addressAllocatedMode_ = value["AddressAllocatedMode"].asString();
  105. if(!value["AddressType"].isNull())
  106. addressType_ = value["AddressType"].asString();
  107. if(!value["BandwidthCapacity"].isNull())
  108. bandwidthCapacity_ = std::stoi(value["BandwidthCapacity"].asString());
  109. if(!value["BandwidthPackageId"].isNull())
  110. bandwidthPackageId_ = value["BandwidthPackageId"].asString();
  111. if(!value["CreateTime"].isNull())
  112. createTime_ = value["CreateTime"].asString();
  113. if(!value["DNSName"].isNull())
  114. dNSName_ = value["DNSName"].asString();
  115. if(!value["LoadBalancerBussinessStatus"].isNull())
  116. loadBalancerBussinessStatus_ = value["LoadBalancerBussinessStatus"].asString();
  117. if(!value["LoadBalancerEdition"].isNull())
  118. loadBalancerEdition_ = value["LoadBalancerEdition"].asString();
  119. if(!value["LoadBalancerId"].isNull())
  120. loadBalancerId_ = value["LoadBalancerId"].asString();
  121. if(!value["LoadBalancerName"].isNull())
  122. loadBalancerName_ = value["LoadBalancerName"].asString();
  123. if(!value["ServiceManagedEnabled"].isNull())
  124. serviceManagedEnabled_ = value["ServiceManagedEnabled"].asString() == "true";
  125. if(!value["ServiceManagedMode"].isNull())
  126. serviceManagedMode_ = value["ServiceManagedMode"].asString();
  127. if(!value["LoadBalancerStatus"].isNull())
  128. loadBalancerStatus_ = value["LoadBalancerStatus"].asString();
  129. if(!value["RegionId"].isNull())
  130. regionId_ = value["RegionId"].asString();
  131. if(!value["ResourceGroupId"].isNull())
  132. resourceGroupId_ = value["ResourceGroupId"].asString();
  133. if(!value["VpcId"].isNull())
  134. vpcId_ = value["VpcId"].asString();
  135. if(!value["ConfigManagedEnabled"].isNull())
  136. configManagedEnabled_ = value["ConfigManagedEnabled"].asString() == "true";
  137. if(!value["AddressIpVersion"].isNull())
  138. addressIpVersion_ = value["AddressIpVersion"].asString();
  139. if(!value["Ipv6AddressType"].isNull())
  140. ipv6AddressType_ = value["Ipv6AddressType"].asString();
  141. }
  142. bool GetLoadBalancerAttributeResult::getServiceManagedEnabled()const
  143. {
  144. return serviceManagedEnabled_;
  145. }
  146. std::string GetLoadBalancerAttributeResult::getAddressIpVersion()const
  147. {
  148. return addressIpVersion_;
  149. }
  150. std::string GetLoadBalancerAttributeResult::getResourceGroupId()const
  151. {
  152. return resourceGroupId_;
  153. }
  154. std::vector<std::string> GetLoadBalancerAttributeResult::getFeatureLabels()const
  155. {
  156. return featureLabels_;
  157. }
  158. std::string GetLoadBalancerAttributeResult::getLoadBalancerId()const
  159. {
  160. return loadBalancerId_;
  161. }
  162. std::vector<GetLoadBalancerAttributeResult::ZoneMapping> GetLoadBalancerAttributeResult::getZoneMappings()const
  163. {
  164. return zoneMappings_;
  165. }
  166. std::string GetLoadBalancerAttributeResult::getDNSName()const
  167. {
  168. return dNSName_;
  169. }
  170. std::string GetLoadBalancerAttributeResult::getIpv6AddressType()const
  171. {
  172. return ipv6AddressType_;
  173. }
  174. int GetLoadBalancerAttributeResult::getBandwidthCapacity()const
  175. {
  176. return bandwidthCapacity_;
  177. }
  178. GetLoadBalancerAttributeResult::DeletionProtectionConfig GetLoadBalancerAttributeResult::getDeletionProtectionConfig()const
  179. {
  180. return deletionProtectionConfig_;
  181. }
  182. std::string GetLoadBalancerAttributeResult::getServiceManagedMode()const
  183. {
  184. return serviceManagedMode_;
  185. }
  186. std::string GetLoadBalancerAttributeResult::getBandwidthPackageId()const
  187. {
  188. return bandwidthPackageId_;
  189. }
  190. std::vector<GetLoadBalancerAttributeResult::Tag> GetLoadBalancerAttributeResult::getTags()const
  191. {
  192. return tags_;
  193. }
  194. std::string GetLoadBalancerAttributeResult::getLoadBalancerEdition()const
  195. {
  196. return loadBalancerEdition_;
  197. }
  198. GetLoadBalancerAttributeResult::LoadBalancerBillingConfig GetLoadBalancerAttributeResult::getLoadBalancerBillingConfig()const
  199. {
  200. return loadBalancerBillingConfig_;
  201. }
  202. std::string GetLoadBalancerAttributeResult::getCreateTime()const
  203. {
  204. return createTime_;
  205. }
  206. GetLoadBalancerAttributeResult::ModificationProtectionConfig GetLoadBalancerAttributeResult::getModificationProtectionConfig()const
  207. {
  208. return modificationProtectionConfig_;
  209. }
  210. std::string GetLoadBalancerAttributeResult::getLoadBalancerName()const
  211. {
  212. return loadBalancerName_;
  213. }
  214. GetLoadBalancerAttributeResult::AccessLogConfig GetLoadBalancerAttributeResult::getAccessLogConfig()const
  215. {
  216. return accessLogConfig_;
  217. }
  218. bool GetLoadBalancerAttributeResult::getConfigManagedEnabled()const
  219. {
  220. return configManagedEnabled_;
  221. }
  222. std::string GetLoadBalancerAttributeResult::getLoadBalancerBussinessStatus()const
  223. {
  224. return loadBalancerBussinessStatus_;
  225. }
  226. std::string GetLoadBalancerAttributeResult::getVpcId()const
  227. {
  228. return vpcId_;
  229. }
  230. std::string GetLoadBalancerAttributeResult::getRegionId()const
  231. {
  232. return regionId_;
  233. }
  234. std::string GetLoadBalancerAttributeResult::getAddressAllocatedMode()const
  235. {
  236. return addressAllocatedMode_;
  237. }
  238. std::string GetLoadBalancerAttributeResult::getAddressType()const
  239. {
  240. return addressType_;
  241. }
  242. std::string GetLoadBalancerAttributeResult::getLoadBalancerStatus()const
  243. {
  244. return loadBalancerStatus_;
  245. }
  246. std::vector<GetLoadBalancerAttributeResult::LoadBalancerOperationLock> GetLoadBalancerAttributeResult::getLoadBalancerOperationLocks()const
  247. {
  248. return loadBalancerOperationLocks_;
  249. }