DescribeSystemEventCountResult.cc 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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/DescribeSystemEventCountResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Cms;
  19. using namespace AlibabaCloud::Cms::Model;
  20. DescribeSystemEventCountResult::DescribeSystemEventCountResult() :
  21. ServiceResult()
  22. {}
  23. DescribeSystemEventCountResult::DescribeSystemEventCountResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeSystemEventCountResult::~DescribeSystemEventCountResult()
  29. {}
  30. void DescribeSystemEventCountResult::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 allSystemEventCountsNode = value["SystemEventCounts"]["SystemEventCount"];
  37. for (auto valueSystemEventCountsSystemEventCount : allSystemEventCountsNode)
  38. {
  39. SystemEventCount systemEventCountsObject;
  40. if(!valueSystemEventCountsSystemEventCount["Content"].isNull())
  41. systemEventCountsObject.content = valueSystemEventCountsSystemEventCount["Content"].asString();
  42. if(!valueSystemEventCountsSystemEventCount["Product"].isNull())
  43. systemEventCountsObject.product = valueSystemEventCountsSystemEventCount["Product"].asString();
  44. if(!valueSystemEventCountsSystemEventCount["Name"].isNull())
  45. systemEventCountsObject.name = valueSystemEventCountsSystemEventCount["Name"].asString();
  46. if(!valueSystemEventCountsSystemEventCount["GroupId"].isNull())
  47. systemEventCountsObject.groupId = valueSystemEventCountsSystemEventCount["GroupId"].asString();
  48. if(!valueSystemEventCountsSystemEventCount["Num"].isNull())
  49. systemEventCountsObject.num = std::stol(valueSystemEventCountsSystemEventCount["Num"].asString());
  50. if(!valueSystemEventCountsSystemEventCount["Level"].isNull())
  51. systemEventCountsObject.level = valueSystemEventCountsSystemEventCount["Level"].asString();
  52. if(!valueSystemEventCountsSystemEventCount["Status"].isNull())
  53. systemEventCountsObject.status = valueSystemEventCountsSystemEventCount["Status"].asString();
  54. if(!valueSystemEventCountsSystemEventCount["ResourceId"].isNull())
  55. systemEventCountsObject.resourceId = valueSystemEventCountsSystemEventCount["ResourceId"].asString();
  56. if(!valueSystemEventCountsSystemEventCount["RegionId"].isNull())
  57. systemEventCountsObject.regionId = valueSystemEventCountsSystemEventCount["RegionId"].asString();
  58. if(!valueSystemEventCountsSystemEventCount["InstanceName"].isNull())
  59. systemEventCountsObject.instanceName = valueSystemEventCountsSystemEventCount["InstanceName"].asString();
  60. if(!valueSystemEventCountsSystemEventCount["Time"].isNull())
  61. systemEventCountsObject.time = std::stol(valueSystemEventCountsSystemEventCount["Time"].asString());
  62. systemEventCounts_.push_back(systemEventCountsObject);
  63. }
  64. if(!value["Code"].isNull())
  65. code_ = value["Code"].asString();
  66. if(!value["Message"].isNull())
  67. message_ = value["Message"].asString();
  68. if(!value["Success"].isNull())
  69. success_ = value["Success"].asString();
  70. }
  71. std::string DescribeSystemEventCountResult::getMessage()const
  72. {
  73. return message_;
  74. }
  75. std::vector<DescribeSystemEventCountResult::SystemEventCount> DescribeSystemEventCountResult::getSystemEventCounts()const
  76. {
  77. return systemEventCounts_;
  78. }
  79. std::string DescribeSystemEventCountResult::getCode()const
  80. {
  81. return code_;
  82. }
  83. std::string DescribeSystemEventCountResult::getSuccess()const
  84. {
  85. return success_;
  86. }