DescribeDomainResult.cc 3.5 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/waf-openapi/model/DescribeDomainResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Waf_openapi;
  19. using namespace AlibabaCloud::Waf_openapi::Model;
  20. DescribeDomainResult::DescribeDomainResult() :
  21. ServiceResult()
  22. {}
  23. DescribeDomainResult::DescribeDomainResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeDomainResult::~DescribeDomainResult()
  29. {}
  30. void DescribeDomainResult::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 domainNode = value["Domain"];
  37. if(!domainNode["HttpToUserIp"].isNull())
  38. domain_.httpToUserIp = std::stoi(domainNode["HttpToUserIp"].asString());
  39. if(!domainNode["HttpsRedirect"].isNull())
  40. domain_.httpsRedirect = std::stoi(domainNode["HttpsRedirect"].asString());
  41. if(!domainNode["LoadBalancing"].isNull())
  42. domain_.loadBalancing = std::stoi(domainNode["LoadBalancing"].asString());
  43. if(!domainNode["Cname"].isNull())
  44. domain_.cname = domainNode["Cname"].asString();
  45. if(!domainNode["IsAccessProduct"].isNull())
  46. domain_.isAccessProduct = std::stoi(domainNode["IsAccessProduct"].asString());
  47. if(!domainNode["Version"].isNull())
  48. domain_.version = std::stol(domainNode["Version"].asString());
  49. if(!domainNode["ClusterType"].isNull())
  50. domain_.clusterType = std::stoi(domainNode["ClusterType"].asString());
  51. if(!domainNode["ConnectionTime"].isNull())
  52. domain_.connectionTime = std::stoi(domainNode["ConnectionTime"].asString());
  53. if(!domainNode["ReadTime"].isNull())
  54. domain_.readTime = std::stoi(domainNode["ReadTime"].asString());
  55. if(!domainNode["WriteTime"].isNull())
  56. domain_.writeTime = std::stoi(domainNode["WriteTime"].asString());
  57. if(!domainNode["ResourceGroupId"].isNull())
  58. domain_.resourceGroupId = domainNode["ResourceGroupId"].asString();
  59. auto allLogHeadersNode = domainNode["LogHeaders"]["LogHeader"];
  60. for (auto domainNodeLogHeadersLogHeader : allLogHeadersNode)
  61. {
  62. Domain::LogHeader logHeaderObject;
  63. if(!domainNodeLogHeadersLogHeader["v"].isNull())
  64. logHeaderObject.v = domainNodeLogHeadersLogHeader["v"].asString();
  65. if(!domainNodeLogHeadersLogHeader["k"].isNull())
  66. logHeaderObject.k = domainNodeLogHeadersLogHeader["k"].asString();
  67. domain_.logHeaders.push_back(logHeaderObject);
  68. }
  69. auto allSourceIps = domainNode["SourceIps"]["SourceIp"];
  70. for (auto value : allSourceIps)
  71. domain_.sourceIps.push_back(value.asString());
  72. auto allHttp2Port = domainNode["Http2Port"]["Http2Port"];
  73. for (auto value : allHttp2Port)
  74. domain_.http2Port.push_back(value.asString());
  75. auto allHttpPort = domainNode["HttpPort"]["HttpPort"];
  76. for (auto value : allHttpPort)
  77. domain_.httpPort.push_back(value.asString());
  78. auto allHttpsPort = domainNode["HttpsPort"]["HttpsPort"];
  79. for (auto value : allHttpsPort)
  80. domain_.httpsPort.push_back(value.asString());
  81. }
  82. DescribeDomainResult::Domain DescribeDomainResult::getDomain()const
  83. {
  84. return domain_;
  85. }