GetMonitorListResult.cc 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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/vcs/model/GetMonitorListResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Vcs;
  19. using namespace AlibabaCloud::Vcs::Model;
  20. GetMonitorListResult::GetMonitorListResult() :
  21. ServiceResult()
  22. {}
  23. GetMonitorListResult::GetMonitorListResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. GetMonitorListResult::~GetMonitorListResult()
  29. {}
  30. void GetMonitorListResult::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 dataNode = value["Data"];
  37. if(!dataNode["PageNo"].isNull())
  38. data_.pageNo = std::stoi(dataNode["PageNo"].asString());
  39. if(!dataNode["PageSize"].isNull())
  40. data_.pageSize = std::stoi(dataNode["PageSize"].asString());
  41. if(!dataNode["TotalCount"].isNull())
  42. data_.totalCount = std::stoi(dataNode["TotalCount"].asString());
  43. if(!dataNode["TotalPage"].isNull())
  44. data_.totalPage = std::stoi(dataNode["TotalPage"].asString());
  45. auto allRecordsNode = dataNode["Records"]["Record"];
  46. for (auto dataNodeRecordsRecord : allRecordsNode)
  47. {
  48. Data::Record recordObject;
  49. if(!dataNodeRecordsRecord["TaskId"].isNull())
  50. recordObject.taskId = dataNodeRecordsRecord["TaskId"].asString();
  51. if(!dataNodeRecordsRecord["Status"].isNull())
  52. recordObject.status = dataNodeRecordsRecord["Status"].asString();
  53. if(!dataNodeRecordsRecord["MonitorType"].isNull())
  54. recordObject.monitorType = dataNodeRecordsRecord["MonitorType"].asString();
  55. if(!dataNodeRecordsRecord["RuleName"].isNull())
  56. recordObject.ruleName = dataNodeRecordsRecord["RuleName"].asString();
  57. if(!dataNodeRecordsRecord["AlgorithmVendor"].isNull())
  58. recordObject.algorithmVendor = dataNodeRecordsRecord["AlgorithmVendor"].asString();
  59. if(!dataNodeRecordsRecord["CreateDate"].isNull())
  60. recordObject.createDate = dataNodeRecordsRecord["CreateDate"].asString();
  61. if(!dataNodeRecordsRecord["ModifiedDate"].isNull())
  62. recordObject.modifiedDate = dataNodeRecordsRecord["ModifiedDate"].asString();
  63. if(!dataNodeRecordsRecord["DeviceList"].isNull())
  64. recordObject.deviceList = dataNodeRecordsRecord["DeviceList"].asString();
  65. if(!dataNodeRecordsRecord["Attributes"].isNull())
  66. recordObject.attributes = dataNodeRecordsRecord["Attributes"].asString();
  67. if(!dataNodeRecordsRecord["RuleExpression"].isNull())
  68. recordObject.ruleExpression = dataNodeRecordsRecord["RuleExpression"].asString();
  69. if(!dataNodeRecordsRecord["NotifierType"].isNull())
  70. recordObject.notifierType = dataNodeRecordsRecord["NotifierType"].asString();
  71. if(!dataNodeRecordsRecord["NotifierExtra"].isNull())
  72. recordObject.notifierExtra = dataNodeRecordsRecord["NotifierExtra"].asString();
  73. if(!dataNodeRecordsRecord["Description"].isNull())
  74. recordObject.description = dataNodeRecordsRecord["Description"].asString();
  75. if(!dataNodeRecordsRecord["Expression"].isNull())
  76. recordObject.expression = dataNodeRecordsRecord["Expression"].asString();
  77. if(!dataNodeRecordsRecord["ImageMatch"].isNull())
  78. recordObject.imageMatch = dataNodeRecordsRecord["ImageMatch"].asString();
  79. data_.records.push_back(recordObject);
  80. }
  81. if(!value["Code"].isNull())
  82. code_ = value["Code"].asString();
  83. if(!value["Message"].isNull())
  84. message_ = value["Message"].asString();
  85. }
  86. std::string GetMonitorListResult::getMessage()const
  87. {
  88. return message_;
  89. }
  90. GetMonitorListResult::Data GetMonitorListResult::getData()const
  91. {
  92. return data_;
  93. }
  94. std::string GetMonitorListResult::getCode()const
  95. {
  96. return code_;
  97. }