DescribeDomainAdvanceConfigsResult.cc 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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/waf-openapi/model/DescribeDomainAdvanceConfigsResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Waf_openapi;
  19. using namespace AlibabaCloud::Waf_openapi::Model;
  20. DescribeDomainAdvanceConfigsResult::DescribeDomainAdvanceConfigsResult() :
  21. ServiceResult()
  22. {}
  23. DescribeDomainAdvanceConfigsResult::DescribeDomainAdvanceConfigsResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeDomainAdvanceConfigsResult::~DescribeDomainAdvanceConfigsResult()
  29. {}
  30. void DescribeDomainAdvanceConfigsResult::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 allDomainConfigsNode = value["DomainConfigs"]["DomainConfig"];
  37. for (auto valueDomainConfigsDomainConfig : allDomainConfigsNode)
  38. {
  39. DomainConfig domainConfigsObject;
  40. if(!valueDomainConfigsDomainConfig["Domain"].isNull())
  41. domainConfigsObject.domain = valueDomainConfigsDomainConfig["Domain"].asString();
  42. auto profileNode = value["Profile"];
  43. if(!profileNode["Ipv6Status"].isNull())
  44. domainConfigsObject.profile.ipv6Status = std::stoi(profileNode["Ipv6Status"].asString());
  45. if(!profileNode["GSLBStatus"].isNull())
  46. domainConfigsObject.profile.gSLBStatus = profileNode["GSLBStatus"].asString();
  47. if(!profileNode["VipServiceStatus"].isNull())
  48. domainConfigsObject.profile.vipServiceStatus = std::stoi(profileNode["VipServiceStatus"].asString());
  49. if(!profileNode["ClusterType"].isNull())
  50. domainConfigsObject.profile.clusterType = std::stoi(profileNode["ClusterType"].asString());
  51. if(!profileNode["ExclusiveVipStatus"].isNull())
  52. domainConfigsObject.profile.exclusiveVipStatus = std::stoi(profileNode["ExclusiveVipStatus"].asString());
  53. if(!profileNode["Cname"].isNull())
  54. domainConfigsObject.profile.cname = profileNode["Cname"].asString();
  55. if(!profileNode["CertStatus"].isNull())
  56. domainConfigsObject.profile.certStatus = std::stoi(profileNode["CertStatus"].asString());
  57. if(!profileNode["ResolvedType"].isNull())
  58. domainConfigsObject.profile.resolvedType = std::stoi(profileNode["ResolvedType"].asString());
  59. auto allHttp2Port = profileNode["Http2Port"]["Http2Port"];
  60. for (auto value : allHttp2Port)
  61. domainConfigsObject.profile.http2Port.push_back(value.asString());
  62. auto allHttpPort = profileNode["HttpPort"]["HttpPort"];
  63. for (auto value : allHttpPort)
  64. domainConfigsObject.profile.httpPort.push_back(value.asString());
  65. auto allRs = profileNode["Rs"]["Rs"];
  66. for (auto value : allRs)
  67. domainConfigsObject.profile.rs.push_back(value.asString());
  68. auto allHttpsPort = profileNode["HttpsPort"]["HttpsPort"];
  69. for (auto value : allHttpsPort)
  70. domainConfigsObject.profile.httpsPort.push_back(value.asString());
  71. domainConfigs_.push_back(domainConfigsObject);
  72. }
  73. }
  74. std::vector<DescribeDomainAdvanceConfigsResult::DomainConfig> DescribeDomainAdvanceConfigsResult::getDomainConfigs()const
  75. {
  76. return domainConfigs_;
  77. }