DescribeDomainSlowRatioResult.cc 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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/cdn/model/DescribeDomainSlowRatioResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Cdn;
  19. using namespace AlibabaCloud::Cdn::Model;
  20. DescribeDomainSlowRatioResult::DescribeDomainSlowRatioResult() :
  21. ServiceResult()
  22. {}
  23. DescribeDomainSlowRatioResult::DescribeDomainSlowRatioResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeDomainSlowRatioResult::~DescribeDomainSlowRatioResult()
  29. {}
  30. void DescribeDomainSlowRatioResult::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 allSlowRatioDataPerInterval = value["SlowRatioDataPerInterval"]["SlowRatioData"];
  37. for (auto value : allSlowRatioDataPerInterval)
  38. {
  39. SlowRatioData slowRatioDataPerIntervalObject;
  40. if(!value["TotalUsers"].isNull())
  41. slowRatioDataPerIntervalObject.totalUsers = std::stoi(value["TotalUsers"].asString());
  42. if(!value["SlowUsers"].isNull())
  43. slowRatioDataPerIntervalObject.slowUsers = std::stoi(value["SlowUsers"].asString());
  44. if(!value["SlowRatio"].isNull())
  45. slowRatioDataPerIntervalObject.slowRatio = std::stof(value["SlowRatio"].asString());
  46. if(!value["RegionNameZh"].isNull())
  47. slowRatioDataPerIntervalObject.regionNameZh = value["RegionNameZh"].asString();
  48. if(!value["RegionNameEn"].isNull())
  49. slowRatioDataPerIntervalObject.regionNameEn = value["RegionNameEn"].asString();
  50. if(!value["IspNameZh"].isNull())
  51. slowRatioDataPerIntervalObject.ispNameZh = value["IspNameZh"].asString();
  52. if(!value["IspNameEn"].isNull())
  53. slowRatioDataPerIntervalObject.ispNameEn = value["IspNameEn"].asString();
  54. if(!value["Time"].isNull())
  55. slowRatioDataPerIntervalObject.time = value["Time"].asString();
  56. slowRatioDataPerInterval_.push_back(slowRatioDataPerIntervalObject);
  57. }
  58. if(!value["EndTime"].isNull())
  59. endTime_ = value["EndTime"].asString();
  60. if(!value["DataInterval"].isNull())
  61. dataInterval_ = std::stoi(value["DataInterval"].asString());
  62. if(!value["PageNumber"].isNull())
  63. pageNumber_ = std::stoi(value["PageNumber"].asString());
  64. if(!value["PageSize"].isNull())
  65. pageSize_ = std::stoi(value["PageSize"].asString());
  66. if(!value["TotalCount"].isNull())
  67. totalCount_ = std::stoi(value["TotalCount"].asString());
  68. if(!value["StartTime"].isNull())
  69. startTime_ = value["StartTime"].asString();
  70. }
  71. int DescribeDomainSlowRatioResult::getTotalCount()const
  72. {
  73. return totalCount_;
  74. }
  75. std::string DescribeDomainSlowRatioResult::getEndTime()const
  76. {
  77. return endTime_;
  78. }
  79. int DescribeDomainSlowRatioResult::getPageSize()const
  80. {
  81. return pageSize_;
  82. }
  83. int DescribeDomainSlowRatioResult::getPageNumber()const
  84. {
  85. return pageNumber_;
  86. }
  87. int DescribeDomainSlowRatioResult::getDataInterval()const
  88. {
  89. return dataInterval_;
  90. }
  91. std::string DescribeDomainSlowRatioResult::getStartTime()const
  92. {
  93. return startTime_;
  94. }
  95. std::vector<DescribeDomainSlowRatioResult::SlowRatioData> DescribeDomainSlowRatioResult::getSlowRatioDataPerInterval()const
  96. {
  97. return slowRatioDataPerInterval_;
  98. }