DescribeGatewayResult.cc 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  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/sgw/model/DescribeGatewayResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Sgw;
  19. using namespace AlibabaCloud::Sgw::Model;
  20. DescribeGatewayResult::DescribeGatewayResult() :
  21. ServiceResult()
  22. {}
  23. DescribeGatewayResult::DescribeGatewayResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeGatewayResult::~DescribeGatewayResult()
  29. {}
  30. void DescribeGatewayResult::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 allElasticNodes = value["ElasticNodes"]["ElasticNode"];
  37. for (const auto &item : allElasticNodes)
  38. elasticNodes_.push_back(item.asString());
  39. if(!value["Success"].isNull())
  40. success_ = value["Success"].asString() == "true";
  41. if(!value["Code"].isNull())
  42. code_ = value["Code"].asString();
  43. if(!value["Message"].isNull())
  44. message_ = value["Message"].asString();
  45. if(!value["GatewayId"].isNull())
  46. gatewayId_ = value["GatewayId"].asString();
  47. if(!value["StorageBundleId"].isNull())
  48. storageBundleId_ = value["StorageBundleId"].asString();
  49. if(!value["Name"].isNull())
  50. name_ = value["Name"].asString();
  51. if(!value["Description"].isNull())
  52. description_ = value["Description"].asString();
  53. if(!value["Location"].isNull())
  54. location_ = value["Location"].asString();
  55. if(!value["Category"].isNull())
  56. category_ = value["Category"].asString();
  57. if(!value["Type"].isNull())
  58. type_ = value["Type"].asString();
  59. if(!value["GatewayClass"].isNull())
  60. gatewayClass_ = value["GatewayClass"].asString();
  61. if(!value["Model"].isNull())
  62. model_ = value["Model"].asString();
  63. if(!value["SerialNumber"].isNull())
  64. serialNumber_ = value["SerialNumber"].asString();
  65. if(!value["Status"].isNull())
  66. status_ = value["Status"].asString();
  67. if(!value["EcsInstanceId"].isNull())
  68. ecsInstanceId_ = value["EcsInstanceId"].asString();
  69. if(!value["VpcId"].isNull())
  70. vpcId_ = value["VpcId"].asString();
  71. if(!value["VSwitchId"].isNull())
  72. vSwitchId_ = value["VSwitchId"].asString();
  73. if(!value["Ip"].isNull())
  74. ip_ = value["Ip"].asString();
  75. if(!value["InnerIp"].isNull())
  76. innerIp_ = value["InnerIp"].asString();
  77. if(!value["CreatedTime"].isNull())
  78. createdTime_ = std::stol(value["CreatedTime"].asString());
  79. if(!value["ActivatedTime"].isNull())
  80. activatedTime_ = std::stol(value["ActivatedTime"].asString());
  81. if(!value["TaskId"].isNull())
  82. taskId_ = value["TaskId"].asString();
  83. if(!value["GatewayVersion"].isNull())
  84. gatewayVersion_ = value["GatewayVersion"].asString();
  85. if(!value["BuyURL"].isNull())
  86. buyURL_ = value["BuyURL"].asString();
  87. if(!value["RenewURL"].isNull())
  88. renewURL_ = value["RenewURL"].asString();
  89. if(!value["IsPostPaid"].isNull())
  90. isPostPaid_ = value["IsPostPaid"].asString() == "true";
  91. if(!value["IsReleaseAfterExpiration"].isNull())
  92. isReleaseAfterExpiration_ = value["IsReleaseAfterExpiration"].asString() == "true";
  93. if(!value["ExpiredTime"].isNull())
  94. expiredTime_ = std::stol(value["ExpiredTime"].asString());
  95. if(!value["ExpireStatus"].isNull())
  96. expireStatus_ = std::stoi(value["ExpireStatus"].asString());
  97. if(!value["CommonBuyInstanceId"].isNull())
  98. commonBuyInstanceId_ = value["CommonBuyInstanceId"].asString();
  99. if(!value["PublicNetworkBandwidth"].isNull())
  100. publicNetworkBandwidth_ = std::stoi(value["PublicNetworkBandwidth"].asString());
  101. if(!value["GatewayType"].isNull())
  102. gatewayType_ = value["GatewayType"].asString();
  103. if(!value["ElasticGateway"].isNull())
  104. elasticGateway_ = value["ElasticGateway"].asString() == "true";
  105. if(!value["MaxThroughput"].isNull())
  106. maxThroughput_ = std::stoi(value["MaxThroughput"].asString());
  107. if(!value["Capacity"].isNull())
  108. capacity_ = std::stoi(value["Capacity"].asString());
  109. if(!value["DataLoadType"].isNull())
  110. dataLoadType_ = value["DataLoadType"].asString();
  111. if(!value["DataLoadInterval"].isNull())
  112. dataLoadInterval_ = std::stoi(value["DataLoadInterval"].asString());
  113. if(!value["LastErrorKey"].isNull())
  114. lastErrorKey_ = value["LastErrorKey"].asString();
  115. }
  116. std::string DescribeGatewayResult::getDescription()const
  117. {
  118. return description_;
  119. }
  120. std::string DescribeGatewayResult::getCategory()const
  121. {
  122. return category_;
  123. }
  124. long DescribeGatewayResult::getCreatedTime()const
  125. {
  126. return createdTime_;
  127. }
  128. std::string DescribeGatewayResult::getTaskId()const
  129. {
  130. return taskId_;
  131. }
  132. int DescribeGatewayResult::getPublicNetworkBandwidth()const
  133. {
  134. return publicNetworkBandwidth_;
  135. }
  136. std::string DescribeGatewayResult::getDataLoadType()const
  137. {
  138. return dataLoadType_;
  139. }
  140. std::string DescribeGatewayResult::getMessage()const
  141. {
  142. return message_;
  143. }
  144. std::string DescribeGatewayResult::getIp()const
  145. {
  146. return ip_;
  147. }
  148. int DescribeGatewayResult::getExpireStatus()const
  149. {
  150. return expireStatus_;
  151. }
  152. std::string DescribeGatewayResult::getStorageBundleId()const
  153. {
  154. return storageBundleId_;
  155. }
  156. std::string DescribeGatewayResult::getGatewayType()const
  157. {
  158. return gatewayType_;
  159. }
  160. std::string DescribeGatewayResult::getGatewayClass()const
  161. {
  162. return gatewayClass_;
  163. }
  164. bool DescribeGatewayResult::getSuccess()const
  165. {
  166. return success_;
  167. }
  168. std::string DescribeGatewayResult::getName()const
  169. {
  170. return name_;
  171. }
  172. bool DescribeGatewayResult::getIsPostPaid()const
  173. {
  174. return isPostPaid_;
  175. }
  176. int DescribeGatewayResult::getCapacity()const
  177. {
  178. return capacity_;
  179. }
  180. long DescribeGatewayResult::getExpiredTime()const
  181. {
  182. return expiredTime_;
  183. }
  184. std::string DescribeGatewayResult::getGatewayVersion()const
  185. {
  186. return gatewayVersion_;
  187. }
  188. bool DescribeGatewayResult::getIsReleaseAfterExpiration()const
  189. {
  190. return isReleaseAfterExpiration_;
  191. }
  192. std::string DescribeGatewayResult::getStatus()const
  193. {
  194. return status_;
  195. }
  196. std::string DescribeGatewayResult::getBuyURL()const
  197. {
  198. return buyURL_;
  199. }
  200. int DescribeGatewayResult::getMaxThroughput()const
  201. {
  202. return maxThroughput_;
  203. }
  204. int DescribeGatewayResult::getDataLoadInterval()const
  205. {
  206. return dataLoadInterval_;
  207. }
  208. std::string DescribeGatewayResult::getInnerIp()const
  209. {
  210. return innerIp_;
  211. }
  212. std::string DescribeGatewayResult::getVSwitchId()const
  213. {
  214. return vSwitchId_;
  215. }
  216. std::vector<std::string> DescribeGatewayResult::getElasticNodes()const
  217. {
  218. return elasticNodes_;
  219. }
  220. std::string DescribeGatewayResult::getGatewayId()const
  221. {
  222. return gatewayId_;
  223. }
  224. std::string DescribeGatewayResult::getCode()const
  225. {
  226. return code_;
  227. }
  228. std::string DescribeGatewayResult::getEcsInstanceId()const
  229. {
  230. return ecsInstanceId_;
  231. }
  232. std::string DescribeGatewayResult::getType()const
  233. {
  234. return type_;
  235. }
  236. std::string DescribeGatewayResult::getRenewURL()const
  237. {
  238. return renewURL_;
  239. }
  240. std::string DescribeGatewayResult::getSerialNumber()const
  241. {
  242. return serialNumber_;
  243. }
  244. std::string DescribeGatewayResult::getVpcId()const
  245. {
  246. return vpcId_;
  247. }
  248. long DescribeGatewayResult::getActivatedTime()const
  249. {
  250. return activatedTime_;
  251. }
  252. bool DescribeGatewayResult::getElasticGateway()const
  253. {
  254. return elasticGateway_;
  255. }
  256. std::string DescribeGatewayResult::getCommonBuyInstanceId()const
  257. {
  258. return commonBuyInstanceId_;
  259. }
  260. std::string DescribeGatewayResult::getModel()const
  261. {
  262. return model_;
  263. }
  264. std::string DescribeGatewayResult::getLastErrorKey()const
  265. {
  266. return lastErrorKey_;
  267. }
  268. std::string DescribeGatewayResult::getLocation()const
  269. {
  270. return location_;
  271. }