DescribeApplicationConfigResult.cc 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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/sae/model/DescribeApplicationConfigResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Sae;
  19. using namespace AlibabaCloud::Sae::Model;
  20. DescribeApplicationConfigResult::DescribeApplicationConfigResult() :
  21. ServiceResult()
  22. {}
  23. DescribeApplicationConfigResult::DescribeApplicationConfigResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeApplicationConfigResult::~DescribeApplicationConfigResult()
  29. {}
  30. void DescribeApplicationConfigResult::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 dataNode = value["Data"];
  37. if(!dataNode["AppId"].isNull())
  38. data_.appId = dataNode["AppId"].asString();
  39. if(!dataNode["AppName"].isNull())
  40. data_.appName = dataNode["AppName"].asString();
  41. if(!dataNode["NamespaceId"].isNull())
  42. data_.namespaceId = dataNode["NamespaceId"].asString();
  43. if(!dataNode["AppDescription"].isNull())
  44. data_.appDescription = dataNode["AppDescription"].asString();
  45. if(!dataNode["VpcId"].isNull())
  46. data_.vpcId = dataNode["VpcId"].asString();
  47. if(!dataNode["VSwitchId"].isNull())
  48. data_.vSwitchId = dataNode["VSwitchId"].asString();
  49. if(!dataNode["PackageType"].isNull())
  50. data_.packageType = dataNode["PackageType"].asString();
  51. if(!dataNode["PackageVersion"].isNull())
  52. data_.packageVersion = dataNode["PackageVersion"].asString();
  53. if(!dataNode["PackageUrl"].isNull())
  54. data_.packageUrl = dataNode["PackageUrl"].asString();
  55. if(!dataNode["ImageUrl"].isNull())
  56. data_.imageUrl = dataNode["ImageUrl"].asString();
  57. if(!dataNode["Jdk"].isNull())
  58. data_.jdk = dataNode["Jdk"].asString();
  59. if(!dataNode["WebContainer"].isNull())
  60. data_.webContainer = dataNode["WebContainer"].asString();
  61. if(!dataNode["Cpu"].isNull())
  62. data_.cpu = std::stoi(dataNode["Cpu"].asString());
  63. if(!dataNode["Memory"].isNull())
  64. data_.memory = std::stoi(dataNode["Memory"].asString());
  65. if(!dataNode["Replicas"].isNull())
  66. data_.replicas = std::stoi(dataNode["Replicas"].asString());
  67. if(!dataNode["Command"].isNull())
  68. data_.command = dataNode["Command"].asString();
  69. if(!dataNode["CommandArgs"].isNull())
  70. data_.commandArgs = dataNode["CommandArgs"].asString();
  71. if(!dataNode["Envs"].isNull())
  72. data_.envs = dataNode["Envs"].asString();
  73. if(!dataNode["CustomHostAlias"].isNull())
  74. data_.customHostAlias = dataNode["CustomHostAlias"].asString();
  75. if(!dataNode["JarStartOptions"].isNull())
  76. data_.jarStartOptions = dataNode["JarStartOptions"].asString();
  77. if(!dataNode["JarStartArgs"].isNull())
  78. data_.jarStartArgs = dataNode["JarStartArgs"].asString();
  79. if(!dataNode["Liveness"].isNull())
  80. data_.liveness = dataNode["Liveness"].asString();
  81. if(!dataNode["Readiness"].isNull())
  82. data_.readiness = dataNode["Readiness"].asString();
  83. if(!dataNode["MinReadyInstances"].isNull())
  84. data_.minReadyInstances = std::stoi(dataNode["MinReadyInstances"].asString());
  85. if(!dataNode["BatchWaitTime"].isNull())
  86. data_.batchWaitTime = std::stoi(dataNode["BatchWaitTime"].asString());
  87. if(!dataNode["EdasContainerVersion"].isNull())
  88. data_.edasContainerVersion = dataNode["EdasContainerVersion"].asString();
  89. if(!dataNode["RegionId"].isNull())
  90. data_.regionId = dataNode["RegionId"].asString();
  91. if(!dataNode["SlsConfigs"].isNull())
  92. data_.slsConfigs = dataNode["SlsConfigs"].asString();
  93. if(!dataNode["Timezone"].isNull())
  94. data_.timezone = dataNode["Timezone"].asString();
  95. if(!dataNode["NasId"].isNull())
  96. data_.nasId = dataNode["NasId"].asString();
  97. if(!dataNode["MountHost"].isNull())
  98. data_.mountHost = dataNode["MountHost"].asString();
  99. if(!dataNode["PreStop"].isNull())
  100. data_.preStop = dataNode["PreStop"].asString();
  101. if(!dataNode["PostStart"].isNull())
  102. data_.postStart = dataNode["PostStart"].asString();
  103. if(!dataNode["WarStartOptions"].isNull())
  104. data_.warStartOptions = dataNode["WarStartOptions"].asString();
  105. if(!dataNode["SecurityGroupId"].isNull())
  106. data_.securityGroupId = dataNode["SecurityGroupId"].asString();
  107. if(!dataNode["TerminationGracePeriodSeconds"].isNull())
  108. data_.terminationGracePeriodSeconds = std::stoi(dataNode["TerminationGracePeriodSeconds"].asString());
  109. if(!dataNode["EnableAhas"].isNull())
  110. data_.enableAhas = dataNode["EnableAhas"].asString();
  111. if(!dataNode["PhpArmsConfigLocation"].isNull())
  112. data_.phpArmsConfigLocation = dataNode["PhpArmsConfigLocation"].asString();
  113. if(!dataNode["PhpConfigLocation"].isNull())
  114. data_.phpConfigLocation = dataNode["PhpConfigLocation"].asString();
  115. if(!dataNode["PhpConfig"].isNull())
  116. data_.phpConfig = dataNode["PhpConfig"].asString();
  117. if(!dataNode["TomcatConfig"].isNull())
  118. data_.tomcatConfig = dataNode["TomcatConfig"].asString();
  119. auto allMountDescNode = dataNode["MountDesc"]["MountDescItem"];
  120. for (auto dataNodeMountDescMountDescItem : allMountDescNode)
  121. {
  122. Data::MountDescItem mountDescItemObject;
  123. if(!dataNodeMountDescMountDescItem["NasPath"].isNull())
  124. mountDescItemObject.nasPath = dataNodeMountDescMountDescItem["NasPath"].asString();
  125. if(!dataNodeMountDescMountDescItem["MountPath"].isNull())
  126. mountDescItemObject.mountPath = dataNodeMountDescMountDescItem["MountPath"].asString();
  127. data_.mountDesc.push_back(mountDescItemObject);
  128. }
  129. auto allTagsNode = dataNode["Tags"]["Tag"];
  130. for (auto dataNodeTagsTag : allTagsNode)
  131. {
  132. Data::Tag tagObject;
  133. if(!dataNodeTagsTag["Key"].isNull())
  134. tagObject.key = dataNodeTagsTag["Key"].asString();
  135. if(!dataNodeTagsTag["Value"].isNull())
  136. tagObject.value = dataNodeTagsTag["Value"].asString();
  137. data_.tags.push_back(tagObject);
  138. }
  139. auto allConfigMapMountDescNode = dataNode["ConfigMapMountDesc"]["ConfigMapMountDescItem"];
  140. for (auto dataNodeConfigMapMountDescConfigMapMountDescItem : allConfigMapMountDescNode)
  141. {
  142. Data::ConfigMapMountDescItem configMapMountDescItemObject;
  143. if(!dataNodeConfigMapMountDescConfigMapMountDescItem["ConfigMapId"].isNull())
  144. configMapMountDescItemObject.configMapId = std::stol(dataNodeConfigMapMountDescConfigMapMountDescItem["ConfigMapId"].asString());
  145. if(!dataNodeConfigMapMountDescConfigMapMountDescItem["ConfigMapName"].isNull())
  146. configMapMountDescItemObject.configMapName = dataNodeConfigMapMountDescConfigMapMountDescItem["ConfigMapName"].asString();
  147. if(!dataNodeConfigMapMountDescConfigMapMountDescItem["Key"].isNull())
  148. configMapMountDescItemObject.key = dataNodeConfigMapMountDescConfigMapMountDescItem["Key"].asString();
  149. if(!dataNodeConfigMapMountDescConfigMapMountDescItem["MountPath"].isNull())
  150. configMapMountDescItemObject.mountPath = dataNodeConfigMapMountDescConfigMapMountDescItem["MountPath"].asString();
  151. data_.configMapMountDesc.push_back(configMapMountDescItemObject);
  152. }
  153. if(!value["Code"].isNull())
  154. code_ = value["Code"].asString();
  155. if(!value["Message"].isNull())
  156. message_ = value["Message"].asString();
  157. if(!value["TraceId"].isNull())
  158. traceId_ = value["TraceId"].asString();
  159. if(!value["Success"].isNull())
  160. success_ = value["Success"].asString() == "true";
  161. if(!value["ErrorCode"].isNull())
  162. errorCode_ = value["ErrorCode"].asString();
  163. }
  164. std::string DescribeApplicationConfigResult::getMessage()const
  165. {
  166. return message_;
  167. }
  168. std::string DescribeApplicationConfigResult::getTraceId()const
  169. {
  170. return traceId_;
  171. }
  172. DescribeApplicationConfigResult::Data DescribeApplicationConfigResult::getData()const
  173. {
  174. return data_;
  175. }
  176. std::string DescribeApplicationConfigResult::getErrorCode()const
  177. {
  178. return errorCode_;
  179. }
  180. std::string DescribeApplicationConfigResult::getCode()const
  181. {
  182. return code_;
  183. }
  184. bool DescribeApplicationConfigResult::getSuccess()const
  185. {
  186. return success_;
  187. }