ListDcdnRealTimeDeliveryProjectResult.cc 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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/dcdn/model/ListDcdnRealTimeDeliveryProjectResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Dcdn;
  19. using namespace AlibabaCloud::Dcdn::Model;
  20. ListDcdnRealTimeDeliveryProjectResult::ListDcdnRealTimeDeliveryProjectResult() :
  21. ServiceResult()
  22. {}
  23. ListDcdnRealTimeDeliveryProjectResult::ListDcdnRealTimeDeliveryProjectResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. ListDcdnRealTimeDeliveryProjectResult::~ListDcdnRealTimeDeliveryProjectResult()
  29. {}
  30. void ListDcdnRealTimeDeliveryProjectResult::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 allContentNode = value["Content"]["Projects"];
  37. for (auto valueContentProjects : allContentNode)
  38. {
  39. Projects contentObject;
  40. if(!valueContentProjects["ProjectName"].isNull())
  41. contentObject.projectName = valueContentProjects["ProjectName"].asString();
  42. if(!valueContentProjects["Type"].isNull())
  43. contentObject.type = valueContentProjects["Type"].asString();
  44. if(!valueContentProjects["DomainName"].isNull())
  45. contentObject.domainName = valueContentProjects["DomainName"].asString();
  46. if(!valueContentProjects["FieldName"].isNull())
  47. contentObject.fieldName = valueContentProjects["FieldName"].asString();
  48. if(!valueContentProjects["SamplingRate"].isNull())
  49. contentObject.samplingRate = std::stof(valueContentProjects["SamplingRate"].asString());
  50. if(!valueContentProjects["DataCenter"].isNull())
  51. contentObject.dataCenter = valueContentProjects["DataCenter"].asString();
  52. if(!valueContentProjects["SLSRegion"].isNull())
  53. contentObject.sLSRegion = valueContentProjects["SLSRegion"].asString();
  54. if(!valueContentProjects["SLSProject"].isNull())
  55. contentObject.sLSProject = valueContentProjects["SLSProject"].asString();
  56. if(!valueContentProjects["SLSLogStore"].isNull())
  57. contentObject.sLSLogStore = valueContentProjects["SLSLogStore"].asString();
  58. if(!valueContentProjects["BusinessType"].isNull())
  59. contentObject.businessType = valueContentProjects["BusinessType"].asString();
  60. content_.push_back(contentObject);
  61. }
  62. if(!value["TotalCount"].isNull())
  63. totalCount_ = std::stoi(value["TotalCount"].asString());
  64. }
  65. int ListDcdnRealTimeDeliveryProjectResult::getTotalCount()const
  66. {
  67. return totalCount_;
  68. }
  69. std::vector<ListDcdnRealTimeDeliveryProjectResult::Projects> ListDcdnRealTimeDeliveryProjectResult::getContent()const
  70. {
  71. return content_;
  72. }