GetJMeterSamplingLogsResult.cc 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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/GetJMeterSamplingLogsResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::PTS;
  19. using namespace AlibabaCloud::PTS::Model;
  20. GetJMeterSamplingLogsResult::GetJMeterSamplingLogsResult() :
  21. ServiceResult()
  22. {}
  23. GetJMeterSamplingLogsResult::GetJMeterSamplingLogsResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. GetJMeterSamplingLogsResult::~GetJMeterSamplingLogsResult()
  29. {}
  30. void GetJMeterSamplingLogsResult::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 allSampleResults = value["SampleResults"]["JMeterSampleResult"];
  37. for (const auto &item : allSampleResults)
  38. sampleResults_.push_back(item.asString());
  39. if(!value["TotalCount"].isNull())
  40. totalCount_ = std::stol(value["TotalCount"].asString());
  41. if(!value["Message"].isNull())
  42. message_ = value["Message"].asString();
  43. if(!value["PageSize"].isNull())
  44. pageSize_ = std::stoi(value["PageSize"].asString());
  45. if(!value["PageNumber"].isNull())
  46. pageNumber_ = std::stoi(value["PageNumber"].asString());
  47. if(!value["HttpStatusCode"].isNull())
  48. httpStatusCode_ = std::stoi(value["HttpStatusCode"].asString());
  49. if(!value["Code"].isNull())
  50. code_ = value["Code"].asString();
  51. if(!value["Success"].isNull())
  52. success_ = value["Success"].asString() == "true";
  53. }
  54. long GetJMeterSamplingLogsResult::getTotalCount()const
  55. {
  56. return totalCount_;
  57. }
  58. std::string GetJMeterSamplingLogsResult::getMessage()const
  59. {
  60. return message_;
  61. }
  62. int GetJMeterSamplingLogsResult::getPageSize()const
  63. {
  64. return pageSize_;
  65. }
  66. int GetJMeterSamplingLogsResult::getPageNumber()const
  67. {
  68. return pageNumber_;
  69. }
  70. int GetJMeterSamplingLogsResult::getHttpStatusCode()const
  71. {
  72. return httpStatusCode_;
  73. }
  74. std::vector<std::string> GetJMeterSamplingLogsResult::getSampleResults()const
  75. {
  76. return sampleResults_;
  77. }
  78. std::string GetJMeterSamplingLogsResult::getCode()const
  79. {
  80. return code_;
  81. }
  82. bool GetJMeterSamplingLogsResult::getSuccess()const
  83. {
  84. return success_;
  85. }