GetPtsSceneRunningDataResult.cc 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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/pts/model/GetPtsSceneRunningDataResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::PTS;
  19. using namespace AlibabaCloud::PTS::Model;
  20. GetPtsSceneRunningDataResult::GetPtsSceneRunningDataResult() :
  21. ServiceResult()
  22. {}
  23. GetPtsSceneRunningDataResult::GetPtsSceneRunningDataResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. GetPtsSceneRunningDataResult::~GetPtsSceneRunningDataResult()
  29. {}
  30. void GetPtsSceneRunningDataResult::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 allAgentLocationNode = value["AgentLocation"]["Location"];
  37. for (auto valueAgentLocationLocation : allAgentLocationNode)
  38. {
  39. Location agentLocationObject;
  40. if(!valueAgentLocationLocation["Region"].isNull())
  41. agentLocationObject.region = valueAgentLocationLocation["Region"].asString();
  42. if(!valueAgentLocationLocation["Isp"].isNull())
  43. agentLocationObject.isp = valueAgentLocationLocation["Isp"].asString();
  44. if(!valueAgentLocationLocation["Count"].isNull())
  45. agentLocationObject.count = std::stoi(valueAgentLocationLocation["Count"].asString());
  46. if(!valueAgentLocationLocation["Province"].isNull())
  47. agentLocationObject.province = valueAgentLocationLocation["Province"].asString();
  48. agentLocation_.push_back(agentLocationObject);
  49. }
  50. auto allChainMonitorDataListNode = value["ChainMonitorDataList"]["ChainMonitorData"];
  51. for (auto valueChainMonitorDataListChainMonitorData : allChainMonitorDataListNode)
  52. {
  53. ChainMonitorData chainMonitorDataListObject;
  54. if(!valueChainMonitorDataListChainMonitorData["TimePoint"].isNull())
  55. chainMonitorDataListObject.timePoint = std::stol(valueChainMonitorDataListChainMonitorData["TimePoint"].asString());
  56. if(!valueChainMonitorDataListChainMonitorData["ApiId"].isNull())
  57. chainMonitorDataListObject.apiId = valueChainMonitorDataListChainMonitorData["ApiId"].asString();
  58. if(!valueChainMonitorDataListChainMonitorData["MinRt"].isNull())
  59. chainMonitorDataListObject.minRt = std::stoi(valueChainMonitorDataListChainMonitorData["MinRt"].asString());
  60. if(!valueChainMonitorDataListChainMonitorData["Qps2XX"].isNull())
  61. chainMonitorDataListObject.qps2XX = std::stof(valueChainMonitorDataListChainMonitorData["Qps2XX"].asString());
  62. if(!valueChainMonitorDataListChainMonitorData["MaxRt"].isNull())
  63. chainMonitorDataListObject.maxRt = std::stoi(valueChainMonitorDataListChainMonitorData["MaxRt"].asString());
  64. if(!valueChainMonitorDataListChainMonitorData["ConfigQps"].isNull())
  65. chainMonitorDataListObject.configQps = std::stoi(valueChainMonitorDataListChainMonitorData["ConfigQps"].asString());
  66. if(!valueChainMonitorDataListChainMonitorData["FailedCount"].isNull())
  67. chainMonitorDataListObject.failedCount = std::stol(valueChainMonitorDataListChainMonitorData["FailedCount"].asString());
  68. if(!valueChainMonitorDataListChainMonitorData["FailedQps"].isNull())
  69. chainMonitorDataListObject.failedQps = std::stof(valueChainMonitorDataListChainMonitorData["FailedQps"].asString());
  70. if(!valueChainMonitorDataListChainMonitorData["AverageRt"].isNull())
  71. chainMonitorDataListObject.averageRt = std::stoi(valueChainMonitorDataListChainMonitorData["AverageRt"].asString());
  72. if(!valueChainMonitorDataListChainMonitorData["Count2XX"].isNull())
  73. chainMonitorDataListObject.count2XX = std::stol(valueChainMonitorDataListChainMonitorData["Count2XX"].asString());
  74. if(!valueChainMonitorDataListChainMonitorData["RealQps"].isNull())
  75. chainMonitorDataListObject.realQps = std::stof(valueChainMonitorDataListChainMonitorData["RealQps"].asString());
  76. if(!valueChainMonitorDataListChainMonitorData["ApiName"].isNull())
  77. chainMonitorDataListObject.apiName = valueChainMonitorDataListChainMonitorData["ApiName"].asString();
  78. if(!valueChainMonitorDataListChainMonitorData["NodeId"].isNull())
  79. chainMonitorDataListObject.nodeId = std::stol(valueChainMonitorDataListChainMonitorData["NodeId"].asString());
  80. if(!valueChainMonitorDataListChainMonitorData["Concurrency"].isNull())
  81. chainMonitorDataListObject.concurrency = std::stof(valueChainMonitorDataListChainMonitorData["Concurrency"].asString());
  82. auto checkPointResultNode = value["CheckPointResult"];
  83. if(!checkPointResultNode["SucceedBusinessCount"].isNull())
  84. chainMonitorDataListObject.checkPointResult.succeedBusinessCount = std::stol(checkPointResultNode["SucceedBusinessCount"].asString());
  85. if(!checkPointResultNode["SucceedBusinessQps"].isNull())
  86. chainMonitorDataListObject.checkPointResult.succeedBusinessQps = std::stof(checkPointResultNode["SucceedBusinessQps"].asString());
  87. if(!checkPointResultNode["FailedBusinessCount"].isNull())
  88. chainMonitorDataListObject.checkPointResult.failedBusinessCount = std::stol(checkPointResultNode["FailedBusinessCount"].asString());
  89. if(!checkPointResultNode["FailedBusinessQps"].isNull())
  90. chainMonitorDataListObject.checkPointResult.failedBusinessQps = std::stof(checkPointResultNode["FailedBusinessQps"].asString());
  91. chainMonitorDataList_.push_back(chainMonitorDataListObject);
  92. }
  93. if(!value["Status"].isNull())
  94. status_ = std::stoi(value["Status"].asString());
  95. if(!value["TotalRequestCount"].isNull())
  96. totalRequestCount_ = std::stol(value["TotalRequestCount"].asString());
  97. if(!value["HasReport"].isNull())
  98. hasReport_ = value["HasReport"].asString() == "true";
  99. if(!value["ConcurrencyLimit"].isNull())
  100. concurrencyLimit_ = std::stoi(value["ConcurrencyLimit"].asString());
  101. if(!value["Message"].isNull())
  102. message_ = value["Message"].asString();
  103. if(!value["BeginTime"].isNull())
  104. beginTime_ = std::stol(value["BeginTime"].asString());
  105. if(!value["Seg90Rt"].isNull())
  106. seg90Rt_ = std::stol(value["Seg90Rt"].asString());
  107. if(!value["ResponseBps"].isNull())
  108. responseBps_ = value["ResponseBps"].asString();
  109. if(!value["TotalAgents"].isNull())
  110. totalAgents_ = std::stoi(value["TotalAgents"].asString());
  111. if(!value["Code"].isNull())
  112. code_ = value["Code"].asString();
  113. if(!value["Success"].isNull())
  114. success_ = value["Success"].asString() == "true";
  115. if(!value["Vum"].isNull())
  116. vum_ = std::stol(value["Vum"].asString());
  117. if(!value["AverageRt"].isNull())
  118. averageRt_ = std::stol(value["AverageRt"].asString());
  119. if(!value["RequestBps"].isNull())
  120. requestBps_ = value["RequestBps"].asString();
  121. if(!value["FailedBusinessCount"].isNull())
  122. failedBusinessCount_ = std::stol(value["FailedBusinessCount"].asString());
  123. if(!value["Concurrency"].isNull())
  124. concurrency_ = std::stoi(value["Concurrency"].asString());
  125. if(!value["HttpStatusCode"].isNull())
  126. httpStatusCode_ = std::stoi(value["HttpStatusCode"].asString());
  127. if(!value["FailedRequestCount"].isNull())
  128. failedRequestCount_ = std::stol(value["FailedRequestCount"].asString());
  129. if(!value["TpsLimit"].isNull())
  130. tpsLimit_ = std::stoi(value["TpsLimit"].asString());
  131. if(!value["AliveAgents"].isNull())
  132. aliveAgents_ = std::stoi(value["AliveAgents"].asString());
  133. if(!value["TotalRealQps"].isNull())
  134. totalRealQps_ = std::stoi(value["TotalRealQps"].asString());
  135. }
  136. int GetPtsSceneRunningDataResult::getStatus()const
  137. {
  138. return status_;
  139. }
  140. long GetPtsSceneRunningDataResult::getTotalRequestCount()const
  141. {
  142. return totalRequestCount_;
  143. }
  144. bool GetPtsSceneRunningDataResult::getHasReport()const
  145. {
  146. return hasReport_;
  147. }
  148. int GetPtsSceneRunningDataResult::getConcurrencyLimit()const
  149. {
  150. return concurrencyLimit_;
  151. }
  152. std::string GetPtsSceneRunningDataResult::getMessage()const
  153. {
  154. return message_;
  155. }
  156. std::vector<GetPtsSceneRunningDataResult::Location> GetPtsSceneRunningDataResult::getAgentLocation()const
  157. {
  158. return agentLocation_;
  159. }
  160. long GetPtsSceneRunningDataResult::getBeginTime()const
  161. {
  162. return beginTime_;
  163. }
  164. long GetPtsSceneRunningDataResult::getSeg90Rt()const
  165. {
  166. return seg90Rt_;
  167. }
  168. std::string GetPtsSceneRunningDataResult::getResponseBps()const
  169. {
  170. return responseBps_;
  171. }
  172. int GetPtsSceneRunningDataResult::getTotalAgents()const
  173. {
  174. return totalAgents_;
  175. }
  176. std::string GetPtsSceneRunningDataResult::getCode()const
  177. {
  178. return code_;
  179. }
  180. bool GetPtsSceneRunningDataResult::getSuccess()const
  181. {
  182. return success_;
  183. }
  184. long GetPtsSceneRunningDataResult::getVum()const
  185. {
  186. return vum_;
  187. }
  188. std::vector<GetPtsSceneRunningDataResult::ChainMonitorData> GetPtsSceneRunningDataResult::getChainMonitorDataList()const
  189. {
  190. return chainMonitorDataList_;
  191. }
  192. long GetPtsSceneRunningDataResult::getAverageRt()const
  193. {
  194. return averageRt_;
  195. }
  196. std::string GetPtsSceneRunningDataResult::getRequestBps()const
  197. {
  198. return requestBps_;
  199. }
  200. long GetPtsSceneRunningDataResult::getFailedBusinessCount()const
  201. {
  202. return failedBusinessCount_;
  203. }
  204. int GetPtsSceneRunningDataResult::getConcurrency()const
  205. {
  206. return concurrency_;
  207. }
  208. int GetPtsSceneRunningDataResult::getHttpStatusCode()const
  209. {
  210. return httpStatusCode_;
  211. }
  212. int GetPtsSceneRunningDataResult::getTotalRealQps()const
  213. {
  214. return totalRealQps_;
  215. }
  216. long GetPtsSceneRunningDataResult::getFailedRequestCount()const
  217. {
  218. return failedRequestCount_;
  219. }
  220. int GetPtsSceneRunningDataResult::getTpsLimit()const
  221. {
  222. return tpsLimit_;
  223. }
  224. int GetPtsSceneRunningDataResult::getAliveAgents()const
  225. {
  226. return aliveAgents_;
  227. }