DescribeMonitorResourceQuotaAttributeResult.cc 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  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/DescribeMonitorResourceQuotaAttributeResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Cms;
  19. using namespace AlibabaCloud::Cms::Model;
  20. DescribeMonitorResourceQuotaAttributeResult::DescribeMonitorResourceQuotaAttributeResult() :
  21. ServiceResult()
  22. {}
  23. DescribeMonitorResourceQuotaAttributeResult::DescribeMonitorResourceQuotaAttributeResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeMonitorResourceQuotaAttributeResult::~DescribeMonitorResourceQuotaAttributeResult()
  29. {}
  30. void DescribeMonitorResourceQuotaAttributeResult::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 resourceQuotaNode = value["ResourceQuota"];
  37. if(!resourceQuotaNode["SuitInfo"].isNull())
  38. resourceQuota_.suitInfo = resourceQuotaNode["SuitInfo"].asString();
  39. if(!resourceQuotaNode["InstanceId"].isNull())
  40. resourceQuota_.instanceId = resourceQuotaNode["InstanceId"].asString();
  41. if(!resourceQuotaNode["ExpireTime"].isNull())
  42. resourceQuota_.expireTime = resourceQuotaNode["ExpireTime"].asString();
  43. if(!resourceQuotaNode["CRMType"].isNull())
  44. resourceQuota_.cRMType = resourceQuotaNode["CRMType"].asString();
  45. auto siteMonitorEcsProbeNode = resourceQuotaNode["SiteMonitorEcsProbe"];
  46. if(!siteMonitorEcsProbeNode["QuotaLimit"].isNull())
  47. resourceQuota_.siteMonitorEcsProbe.quotaLimit = std::stoi(siteMonitorEcsProbeNode["QuotaLimit"].asString());
  48. if(!siteMonitorEcsProbeNode["QuotaPackage"].isNull())
  49. resourceQuota_.siteMonitorEcsProbe.quotaPackage = std::stoi(siteMonitorEcsProbeNode["QuotaPackage"].asString());
  50. if(!siteMonitorEcsProbeNode["QuotaUsed"].isNull())
  51. resourceQuota_.siteMonitorEcsProbe.quotaUsed = std::stoi(siteMonitorEcsProbeNode["QuotaUsed"].asString());
  52. auto siteMonitorOperatorProbeNode = resourceQuotaNode["SiteMonitorOperatorProbe"];
  53. if(!siteMonitorOperatorProbeNode["QuotaLimit"].isNull())
  54. resourceQuota_.siteMonitorOperatorProbe.quotaLimit = std::stoi(siteMonitorOperatorProbeNode["QuotaLimit"].asString());
  55. if(!siteMonitorOperatorProbeNode["QuotaPackage"].isNull())
  56. resourceQuota_.siteMonitorOperatorProbe.quotaPackage = std::stoi(siteMonitorOperatorProbeNode["QuotaPackage"].asString());
  57. if(!siteMonitorOperatorProbeNode["QuotaUsed"].isNull())
  58. resourceQuota_.siteMonitorOperatorProbe.quotaUsed = std::stoi(siteMonitorOperatorProbeNode["QuotaUsed"].asString());
  59. auto siteMonitorTaskNode = resourceQuotaNode["SiteMonitorTask"];
  60. if(!siteMonitorTaskNode["QuotaLimit"].isNull())
  61. resourceQuota_.siteMonitorTask.quotaLimit = std::stoi(siteMonitorTaskNode["QuotaLimit"].asString());
  62. if(!siteMonitorTaskNode["QuotaPackage"].isNull())
  63. resourceQuota_.siteMonitorTask.quotaPackage = std::stoi(siteMonitorTaskNode["QuotaPackage"].asString());
  64. if(!siteMonitorTaskNode["QuotaUsed"].isNull())
  65. resourceQuota_.siteMonitorTask.quotaUsed = std::stoi(siteMonitorTaskNode["QuotaUsed"].asString());
  66. auto customMonitorNode = resourceQuotaNode["CustomMonitor"];
  67. if(!customMonitorNode["QuotaLimit"].isNull())
  68. resourceQuota_.customMonitor.quotaLimit = std::stoi(customMonitorNode["QuotaLimit"].asString());
  69. if(!customMonitorNode["QuotaPackage"].isNull())
  70. resourceQuota_.customMonitor.quotaPackage = std::stoi(customMonitorNode["QuotaPackage"].asString());
  71. if(!customMonitorNode["QuotaUsed"].isNull())
  72. resourceQuota_.customMonitor.quotaUsed = std::stoi(customMonitorNode["QuotaUsed"].asString());
  73. auto eventMonitorNode = resourceQuotaNode["EventMonitor"];
  74. if(!eventMonitorNode["QuotaLimit"].isNull())
  75. resourceQuota_.eventMonitor.quotaLimit = std::stoi(eventMonitorNode["QuotaLimit"].asString());
  76. if(!eventMonitorNode["QuotaPackage"].isNull())
  77. resourceQuota_.eventMonitor.quotaPackage = std::stoi(eventMonitorNode["QuotaPackage"].asString());
  78. if(!eventMonitorNode["QuotaUsed"].isNull())
  79. resourceQuota_.eventMonitor.quotaUsed = std::stoi(eventMonitorNode["QuotaUsed"].asString());
  80. auto logMonitorNode = resourceQuotaNode["LogMonitor"];
  81. if(!logMonitorNode["QuotaLimit"].isNull())
  82. resourceQuota_.logMonitor.quotaLimit = std::stoi(logMonitorNode["QuotaLimit"].asString());
  83. if(!logMonitorNode["QuotaPackage"].isNull())
  84. resourceQuota_.logMonitor.quotaPackage = std::stoi(logMonitorNode["QuotaPackage"].asString());
  85. if(!logMonitorNode["QuotaUsed"].isNull())
  86. resourceQuota_.logMonitor.quotaUsed = std::stoi(logMonitorNode["QuotaUsed"].asString());
  87. auto apiNode = resourceQuotaNode["Api"];
  88. if(!apiNode["QuotaLimit"].isNull())
  89. resourceQuota_.api.quotaLimit = std::stoi(apiNode["QuotaLimit"].asString());
  90. if(!apiNode["QuotaPackage"].isNull())
  91. resourceQuota_.api.quotaPackage = std::stoi(apiNode["QuotaPackage"].asString());
  92. if(!apiNode["QuotaUsed"].isNull())
  93. resourceQuota_.api.quotaUsed = std::stoi(apiNode["QuotaUsed"].asString());
  94. auto sMSNode = resourceQuotaNode["SMS"];
  95. if(!sMSNode["QuotaLimit"].isNull())
  96. resourceQuota_.sMS.quotaLimit = std::stoi(sMSNode["QuotaLimit"].asString());
  97. if(!sMSNode["QuotaPackage"].isNull())
  98. resourceQuota_.sMS.quotaPackage = std::stoi(sMSNode["QuotaPackage"].asString());
  99. if(!sMSNode["QuotaUsed"].isNull())
  100. resourceQuota_.sMS.quotaUsed = std::stoi(sMSNode["QuotaUsed"].asString());
  101. auto phoneNode = resourceQuotaNode["Phone"];
  102. if(!phoneNode["QuotaLimit"].isNull())
  103. resourceQuota_.phone.quotaLimit = std::stoi(phoneNode["QuotaLimit"].asString());
  104. if(!phoneNode["QuotaPackage"].isNull())
  105. resourceQuota_.phone.quotaPackage = std::stoi(phoneNode["QuotaPackage"].asString());
  106. if(!phoneNode["QuotaUsed"].isNull())
  107. resourceQuota_.phone.quotaUsed = std::stoi(phoneNode["QuotaUsed"].asString());
  108. auto enterpriseQuotaNode = resourceQuotaNode["EnterpriseQuota"];
  109. if(!enterpriseQuotaNode["SuitInfo"].isNull())
  110. resourceQuota_.enterpriseQuota.suitInfo = enterpriseQuotaNode["SuitInfo"].asString();
  111. if(!enterpriseQuotaNode["InstanceId"].isNull())
  112. resourceQuota_.enterpriseQuota.instanceId = enterpriseQuotaNode["InstanceId"].asString();
  113. auto nAAMNode = resourceQuotaNode["NAAM"];
  114. if(!nAAMNode["EffectTime"].isNull())
  115. resourceQuota_.nAAM.effectTime = nAAMNode["EffectTime"].asString();
  116. if(!nAAMNode["InstanceId"].isNull())
  117. resourceQuota_.nAAM.instanceId = nAAMNode["InstanceId"].asString();
  118. if(!nAAMNode["SuitInfo"].isNull())
  119. resourceQuota_.nAAM.suitInfo = nAAMNode["SuitInfo"].asString();
  120. if(!value["Code"].isNull())
  121. code_ = value["Code"].asString();
  122. if(!value["Message"].isNull())
  123. message_ = value["Message"].asString();
  124. }
  125. DescribeMonitorResourceQuotaAttributeResult::ResourceQuota DescribeMonitorResourceQuotaAttributeResult::getResourceQuota()const
  126. {
  127. return resourceQuota_;
  128. }
  129. std::string DescribeMonitorResourceQuotaAttributeResult::getMessage()const
  130. {
  131. return message_;
  132. }
  133. std::string DescribeMonitorResourceQuotaAttributeResult::getCode()const
  134. {
  135. return code_;
  136. }