CreateSiteMonitorResult.cc 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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/CreateSiteMonitorResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Cms;
  19. using namespace AlibabaCloud::Cms::Model;
  20. CreateSiteMonitorResult::CreateSiteMonitorResult() :
  21. ServiceResult()
  22. {}
  23. CreateSiteMonitorResult::CreateSiteMonitorResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. CreateSiteMonitorResult::~CreateSiteMonitorResult()
  29. {}
  30. void CreateSiteMonitorResult::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. auto allAttachAlertResultNode = dataNode["AttachAlertResult"]["Contact"];
  38. for (auto dataNodeAttachAlertResultContact : allAttachAlertResultNode)
  39. {
  40. Data::Contact contactObject;
  41. if(!dataNodeAttachAlertResultContact["Message"].isNull())
  42. contactObject.message = dataNodeAttachAlertResultContact["Message"].asString();
  43. if(!dataNodeAttachAlertResultContact["RequestId"].isNull())
  44. contactObject.requestId = dataNodeAttachAlertResultContact["RequestId"].asString();
  45. if(!dataNodeAttachAlertResultContact["Code"].isNull())
  46. contactObject.code = dataNodeAttachAlertResultContact["Code"].asString();
  47. if(!dataNodeAttachAlertResultContact["Success"].isNull())
  48. contactObject.success = dataNodeAttachAlertResultContact["Success"].asString();
  49. if(!dataNodeAttachAlertResultContact["RuleId"].isNull())
  50. contactObject.ruleId = dataNodeAttachAlertResultContact["RuleId"].asString();
  51. data_.attachAlertResult.push_back(contactObject);
  52. }
  53. if(!value["Code"].isNull())
  54. code_ = value["Code"].asString();
  55. if(!value["Message"].isNull())
  56. message_ = value["Message"].asString();
  57. if(!value["Success"].isNull())
  58. success_ = value["Success"].asString();
  59. if(!value["AlertRule"].isNull())
  60. alertRule_ = value["AlertRule"].asString();
  61. }
  62. std::string CreateSiteMonitorResult::getMessage()const
  63. {
  64. return message_;
  65. }
  66. CreateSiteMonitorResult::Data CreateSiteMonitorResult::getData()const
  67. {
  68. return data_;
  69. }
  70. std::string CreateSiteMonitorResult::getCode()const
  71. {
  72. return code_;
  73. }
  74. std::string CreateSiteMonitorResult::getSuccess()const
  75. {
  76. return success_;
  77. }
  78. std::string CreateSiteMonitorResult::getAlertRule()const
  79. {
  80. return alertRule_;
  81. }