DescribeExporterRuleListResult.cc 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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/cms/model/DescribeExporterRuleListResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Cms;
  19. using namespace AlibabaCloud::Cms::Model;
  20. DescribeExporterRuleListResult::DescribeExporterRuleListResult() :
  21. ServiceResult()
  22. {}
  23. DescribeExporterRuleListResult::DescribeExporterRuleListResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeExporterRuleListResult::~DescribeExporterRuleListResult()
  29. {}
  30. void DescribeExporterRuleListResult::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 allDatapointsNode = value["Datapoints"]["Datapoint"];
  37. for (auto valueDatapointsDatapoint : allDatapointsNode)
  38. {
  39. Datapoint datapointsObject;
  40. if(!valueDatapointsDatapoint["RuleName"].isNull())
  41. datapointsObject.ruleName = valueDatapointsDatapoint["RuleName"].asString();
  42. if(!valueDatapointsDatapoint["Namespace"].isNull())
  43. datapointsObject._namespace = valueDatapointsDatapoint["Namespace"].asString();
  44. if(!valueDatapointsDatapoint["MetricName"].isNull())
  45. datapointsObject.metricName = valueDatapointsDatapoint["MetricName"].asString();
  46. if(!valueDatapointsDatapoint["Enabled"].isNull())
  47. datapointsObject.enabled = valueDatapointsDatapoint["Enabled"].asString() == "true";
  48. if(!valueDatapointsDatapoint["TargetWindows"].isNull())
  49. datapointsObject.targetWindows = valueDatapointsDatapoint["TargetWindows"].asString();
  50. if(!valueDatapointsDatapoint["Describe"].isNull())
  51. datapointsObject.describe = valueDatapointsDatapoint["Describe"].asString();
  52. if(!valueDatapointsDatapoint["Dimension"].isNull())
  53. datapointsObject.dimension = valueDatapointsDatapoint["Dimension"].asString();
  54. if(!valueDatapointsDatapoint["CreateTime"].isNull())
  55. datapointsObject.createTime = std::stol(valueDatapointsDatapoint["CreateTime"].asString());
  56. auto allDstName = value["DstName"]["DstName"];
  57. for (auto value : allDstName)
  58. datapointsObject.dstName.push_back(value.asString());
  59. datapoints_.push_back(datapointsObject);
  60. }
  61. if(!value["Code"].isNull())
  62. code_ = value["Code"].asString();
  63. if(!value["Message"].isNull())
  64. message_ = value["Message"].asString();
  65. if(!value["Total"].isNull())
  66. total_ = std::stoi(value["Total"].asString());
  67. if(!value["PageNumber"].isNull())
  68. pageNumber_ = std::stoi(value["PageNumber"].asString());
  69. if(!value["Success"].isNull())
  70. success_ = value["Success"].asString() == "true";
  71. }
  72. std::string DescribeExporterRuleListResult::getMessage()const
  73. {
  74. return message_;
  75. }
  76. int DescribeExporterRuleListResult::getPageNumber()const
  77. {
  78. return pageNumber_;
  79. }
  80. int DescribeExporterRuleListResult::getTotal()const
  81. {
  82. return total_;
  83. }
  84. std::vector<DescribeExporterRuleListResult::Datapoint> DescribeExporterRuleListResult::getDatapoints()const
  85. {
  86. return datapoints_;
  87. }
  88. std::string DescribeExporterRuleListResult::getCode()const
  89. {
  90. return code_;
  91. }
  92. bool DescribeExporterRuleListResult::getSuccess()const
  93. {
  94. return success_;
  95. }