DescribeVodDomainLogResult.cc 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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/vod/model/DescribeVodDomainLogResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Vod;
  19. using namespace AlibabaCloud::Vod::Model;
  20. DescribeVodDomainLogResult::DescribeVodDomainLogResult() :
  21. ServiceResult()
  22. {}
  23. DescribeVodDomainLogResult::DescribeVodDomainLogResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeVodDomainLogResult::~DescribeVodDomainLogResult()
  29. {}
  30. void DescribeVodDomainLogResult::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["DomainName"].isNull())
  41. domainLogDetailsObject.domainName = value["DomainName"].asString();
  42. if(!value["LogCount"].isNull())
  43. domainLogDetailsObject.logCount = std::stol(value["LogCount"].asString());
  44. auto allLogInfos = value["LogInfos"]["LogInfoDetail"];
  45. for (auto value : allLogInfos)
  46. {
  47. DomainLogDetail::LogInfoDetail logInfosObject;
  48. if(!value["LogName"].isNull())
  49. logInfosObject.logName = value["LogName"].asString();
  50. if(!value["LogPath"].isNull())
  51. logInfosObject.logPath = value["LogPath"].asString();
  52. if(!value["LogSize"].isNull())
  53. logInfosObject.logSize = std::stol(value["LogSize"].asString());
  54. if(!value["StartTime"].isNull())
  55. logInfosObject.startTime = value["StartTime"].asString();
  56. if(!value["EndTime"].isNull())
  57. logInfosObject.endTime = value["EndTime"].asString();
  58. domainLogDetailsObject.logInfos.push_back(logInfosObject);
  59. }
  60. auto pageInfosNode = value["PageInfos"];
  61. if(!pageInfosNode["PageNumber"].isNull())
  62. domainLogDetailsObject.pageInfos.pageNumber = std::stol(pageInfosNode["PageNumber"].asString());
  63. if(!pageInfosNode["PageSize"].isNull())
  64. domainLogDetailsObject.pageInfos.pageSize = std::stol(pageInfosNode["PageSize"].asString());
  65. if(!pageInfosNode["Total"].isNull())
  66. domainLogDetailsObject.pageInfos.total = std::stol(pageInfosNode["Total"].asString());
  67. domainLogDetails_.push_back(domainLogDetailsObject);
  68. }
  69. }
  70. std::vector<DescribeVodDomainLogResult::DomainLogDetail> DescribeVodDomainLogResult::getDomainLogDetails()const
  71. {
  72. return domainLogDetails_;
  73. }