DescribeScdnDomainLogResult.cc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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/scdn/model/DescribeScdnDomainLogResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Scdn;
  19. using namespace AlibabaCloud::Scdn::Model;
  20. DescribeScdnDomainLogResult::DescribeScdnDomainLogResult() :
  21. ServiceResult()
  22. {}
  23. DescribeScdnDomainLogResult::DescribeScdnDomainLogResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeScdnDomainLogResult::~DescribeScdnDomainLogResult()
  29. {}
  30. void DescribeScdnDomainLogResult::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 allDomainLogDetails = value["DomainLogDetails"]["DomainLogDetail"];
  37. for (auto value : allDomainLogDetails)
  38. {
  39. DomainLogDetail domainLogDetailsObject;
  40. if(!value["LogCount"].isNull())
  41. domainLogDetailsObject.logCount = std::stol(value["LogCount"].asString());
  42. auto allPageInfos = value["PageInfos"]["PageInfoDetail"];
  43. for (auto value : allPageInfos)
  44. {
  45. DomainLogDetail::PageInfoDetail pageInfosObject;
  46. if(!value["PageIndex"].isNull())
  47. pageInfosObject.pageIndex = std::stol(value["PageIndex"].asString());
  48. if(!value["PageSize"].isNull())
  49. pageInfosObject.pageSize = std::stol(value["PageSize"].asString());
  50. if(!value["Total"].isNull())
  51. pageInfosObject.total = std::stol(value["Total"].asString());
  52. domainLogDetailsObject.pageInfos.push_back(pageInfosObject);
  53. }
  54. auto allLogInfos = value["LogInfos"]["LogInfoDetail"];
  55. for (auto value : allLogInfos)
  56. {
  57. DomainLogDetail::LogInfoDetail logInfosObject;
  58. if(!value["LogName"].isNull())
  59. logInfosObject.logName = value["LogName"].asString();
  60. if(!value["LogPath"].isNull())
  61. logInfosObject.logPath = value["LogPath"].asString();
  62. if(!value["LogSize"].isNull())
  63. logInfosObject.logSize = std::stol(value["LogSize"].asString());
  64. if(!value["StartTime"].isNull())
  65. logInfosObject.startTime = value["StartTime"].asString();
  66. if(!value["EndTime"].isNull())
  67. logInfosObject.endTime = value["EndTime"].asString();
  68. domainLogDetailsObject.logInfos.push_back(logInfosObject);
  69. }
  70. domainLogDetails_.push_back(domainLogDetailsObject);
  71. }
  72. if(!value["DomainName"].isNull())
  73. domainName_ = value["DomainName"].asString();
  74. }
  75. std::string DescribeScdnDomainLogResult::getDomainName()const
  76. {
  77. return domainName_;
  78. }
  79. std::vector<DescribeScdnDomainLogResult::DomainLogDetail> DescribeScdnDomainLogResult::getDomainLogDetails()const
  80. {
  81. return domainLogDetails_;
  82. }