DescribeScreenAlarmEventListResult.cc 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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/aegis/model/DescribeScreenAlarmEventListResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Aegis;
  19. using namespace AlibabaCloud::Aegis::Model;
  20. DescribeScreenAlarmEventListResult::DescribeScreenAlarmEventListResult() :
  21. ServiceResult()
  22. {}
  23. DescribeScreenAlarmEventListResult::DescribeScreenAlarmEventListResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeScreenAlarmEventListResult::~DescribeScreenAlarmEventListResult()
  29. {}
  30. void DescribeScreenAlarmEventListResult::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 allSuspEventsNode = value["SuspEvents"]["SuspEventsItem"];
  37. for (auto valueSuspEventsSuspEventsItem : allSuspEventsNode)
  38. {
  39. SuspEventsItem suspEventsObject;
  40. if(!valueSuspEventsSuspEventsItem["AlarmUniqueInfo"].isNull())
  41. suspEventsObject.alarmUniqueInfo = valueSuspEventsSuspEventsItem["AlarmUniqueInfo"].asString();
  42. if(!valueSuspEventsSuspEventsItem["Solution"].isNull())
  43. suspEventsObject.solution = valueSuspEventsSuspEventsItem["Solution"].asString();
  44. if(!valueSuspEventsSuspEventsItem["Level"].isNull())
  45. suspEventsObject.level = valueSuspEventsSuspEventsItem["Level"].asString();
  46. if(!valueSuspEventsSuspEventsItem["CanBeDealOnLine"].isNull())
  47. suspEventsObject.canBeDealOnLine = valueSuspEventsSuspEventsItem["CanBeDealOnLine"].asString() == "true";
  48. if(!valueSuspEventsSuspEventsItem["Description"].isNull())
  49. suspEventsObject.description = valueSuspEventsSuspEventsItem["Description"].asString();
  50. if(!valueSuspEventsSuspEventsItem["StartTime"].isNull())
  51. suspEventsObject.startTime = std::stol(valueSuspEventsSuspEventsItem["StartTime"].asString());
  52. if(!valueSuspEventsSuspEventsItem["EndTime"].isNull())
  53. suspEventsObject.endTime = std::stol(valueSuspEventsSuspEventsItem["EndTime"].asString());
  54. if(!valueSuspEventsSuspEventsItem["AlarmEventType"].isNull())
  55. suspEventsObject.alarmEventType = valueSuspEventsSuspEventsItem["AlarmEventType"].asString();
  56. if(!valueSuspEventsSuspEventsItem["SuspiciousEventCount"].isNull())
  57. suspEventsObject.suspiciousEventCount = std::stoi(valueSuspEventsSuspEventsItem["SuspiciousEventCount"].asString());
  58. if(!valueSuspEventsSuspEventsItem["Uuid"].isNull())
  59. suspEventsObject.uuid = valueSuspEventsSuspEventsItem["Uuid"].asString();
  60. if(!valueSuspEventsSuspEventsItem["InstanceName"].isNull())
  61. suspEventsObject.instanceName = valueSuspEventsSuspEventsItem["InstanceName"].asString();
  62. if(!valueSuspEventsSuspEventsItem["InternetIp"].isNull())
  63. suspEventsObject.internetIp = valueSuspEventsSuspEventsItem["InternetIp"].asString();
  64. if(!valueSuspEventsSuspEventsItem["IntranetIp"].isNull())
  65. suspEventsObject.intranetIp = valueSuspEventsSuspEventsItem["IntranetIp"].asString();
  66. if(!valueSuspEventsSuspEventsItem["AlarmEventName"].isNull())
  67. suspEventsObject.alarmEventName = valueSuspEventsSuspEventsItem["AlarmEventName"].asString();
  68. if(!valueSuspEventsSuspEventsItem["SaleVersion"].isNull())
  69. suspEventsObject.saleVersion = valueSuspEventsSuspEventsItem["SaleVersion"].asString();
  70. if(!valueSuspEventsSuspEventsItem["DataSource"].isNull())
  71. suspEventsObject.dataSource = valueSuspEventsSuspEventsItem["DataSource"].asString();
  72. if(!valueSuspEventsSuspEventsItem["CanCancelFault"].isNull())
  73. suspEventsObject.canCancelFault = valueSuspEventsSuspEventsItem["CanCancelFault"].asString() == "true";
  74. if(!valueSuspEventsSuspEventsItem["Dealed"].isNull())
  75. suspEventsObject.dealed = valueSuspEventsSuspEventsItem["Dealed"].asString() == "true";
  76. suspEvents_.push_back(suspEventsObject);
  77. }
  78. auto pageInfoNode = value["PageInfo"];
  79. if(!pageInfoNode["Count"].isNull())
  80. pageInfo_.count = std::stoi(pageInfoNode["Count"].asString());
  81. if(!pageInfoNode["PageSize"].isNull())
  82. pageInfo_.pageSize = std::stoi(pageInfoNode["PageSize"].asString());
  83. if(!pageInfoNode["TotalCount"].isNull())
  84. pageInfo_.totalCount = std::stoi(pageInfoNode["TotalCount"].asString());
  85. if(!pageInfoNode["CurrentPage"].isNull())
  86. pageInfo_.currentPage = std::stoi(pageInfoNode["CurrentPage"].asString());
  87. }
  88. DescribeScreenAlarmEventListResult::PageInfo DescribeScreenAlarmEventListResult::getPageInfo()const
  89. {
  90. return pageInfo_;
  91. }
  92. std::vector<DescribeScreenAlarmEventListResult::SuspEventsItem> DescribeScreenAlarmEventListResult::getSuspEvents()const
  93. {
  94. return suspEvents_;
  95. }