DescribeOssIncrementCheckSettingResult.cc 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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/green/model/DescribeOssIncrementCheckSettingResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Green;
  19. using namespace AlibabaCloud::Green::Model;
  20. DescribeOssIncrementCheckSettingResult::DescribeOssIncrementCheckSettingResult() :
  21. ServiceResult()
  22. {}
  23. DescribeOssIncrementCheckSettingResult::DescribeOssIncrementCheckSettingResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeOssIncrementCheckSettingResult::~DescribeOssIncrementCheckSettingResult()
  29. {}
  30. void DescribeOssIncrementCheckSettingResult::parse(const std::string &payload)
  31. {
  32. Json::CharReaderBuilder builder;
  33. Json::CharReader *reader = builder.newCharReader();
  34. Json::Value *val;
  35. Json::Value value;
  36. JSONCPP_STRING *errs;
  37. reader->parse(payload.data(), payload.data() + payload.size(), val, errs);
  38. value = *val;
  39. setRequestId(value["RequestId"].asString());
  40. auto allBucketConfigList = value["BucketConfigList"]["BucketConfig"];
  41. for (auto value : allBucketConfigList)
  42. {
  43. BucketConfig bucketConfigListObject;
  44. if(!value["Selected"].isNull())
  45. bucketConfigListObject.selected = value["Selected"].asString() == "true";
  46. if(!value["Bucket"].isNull())
  47. bucketConfigListObject.bucket = value["Bucket"].asString();
  48. auto allPrefixes = value["Prefixes"]["Prefix"];
  49. for (auto value : allPrefixes)
  50. bucketConfigListObject.prefixes.push_back(value.asString());
  51. bucketConfigList_.push_back(bucketConfigListObject);
  52. }
  53. auto imageAutoFreezeNode = value["ImageAutoFreeze"];
  54. if(!imageAutoFreezeNode["Enabled"].isNull())
  55. imageAutoFreeze_.enabled = imageAutoFreezeNode["Enabled"].asString() == "true";
  56. if(!imageAutoFreezeNode["Porn"].isNull())
  57. imageAutoFreeze_.porn = imageAutoFreezeNode["Porn"].asString();
  58. if(!imageAutoFreezeNode["Terrorism"].isNull())
  59. imageAutoFreeze_.terrorism = imageAutoFreezeNode["Terrorism"].asString();
  60. auto allImageSceneList = value["ImageSceneList"]["ImageScene"];
  61. for (const auto &item : allImageSceneList)
  62. imageSceneList_.push_back(item.asString());
  63. auto allVideoSceneList = value["VideoSceneList"]["VideoScene"];
  64. for (const auto &item : allVideoSceneList)
  65. videoSceneList_.push_back(item.asString());
  66. auto allVideoAutoFreezeSceneList = value["VideoAutoFreezeSceneList"]["VideoAutoFreezeScene"];
  67. for (const auto &item : allVideoAutoFreezeSceneList)
  68. videoAutoFreezeSceneList_.push_back(item.asString());
  69. if(!value["ImageEnableLimit"].isNull())
  70. imageEnableLimit_ = value["ImageEnableLimit"].asString() == "true";
  71. if(!value["ImageScanLimit"].isNull())
  72. imageScanLimit_ = std::stol(value["ImageScanLimit"].asString());
  73. if(!value["VideoFrameInterval"].isNull())
  74. videoFrameInterval_ = std::stoi(value["VideoFrameInterval"].asString());
  75. if(!value["VideoMaxFrames"].isNull())
  76. videoMaxFrames_ = std::stoi(value["VideoMaxFrames"].asString());
  77. if(!value["VideoMaxSize"].isNull())
  78. videoMaxSize_ = std::stoi(value["VideoMaxSize"].asString());
  79. if(!value["AutoFreezeType"].isNull())
  80. autoFreezeType_ = value["AutoFreezeType"].asString();
  81. }
  82. std::vector<std::string> DescribeOssIncrementCheckSettingResult::getVideoAutoFreezeSceneList()const
  83. {
  84. return videoAutoFreezeSceneList_;
  85. }
  86. std::vector<std::string> DescribeOssIncrementCheckSettingResult::getVideoSceneList()const
  87. {
  88. return videoSceneList_;
  89. }
  90. bool DescribeOssIncrementCheckSettingResult::getImageEnableLimit()const
  91. {
  92. return imageEnableLimit_;
  93. }
  94. std::vector<std::string> DescribeOssIncrementCheckSettingResult::getImageSceneList()const
  95. {
  96. return imageSceneList_;
  97. }
  98. long DescribeOssIncrementCheckSettingResult::getImageScanLimit()const
  99. {
  100. return imageScanLimit_;
  101. }
  102. std::vector<DescribeOssIncrementCheckSettingResult::BucketConfig> DescribeOssIncrementCheckSettingResult::getBucketConfigList()const
  103. {
  104. return bucketConfigList_;
  105. }
  106. DescribeOssIncrementCheckSettingResult::ImageAutoFreeze DescribeOssIncrementCheckSettingResult::getImageAutoFreeze()const
  107. {
  108. return imageAutoFreeze_;
  109. }
  110. std::string DescribeOssIncrementCheckSettingResult::getAutoFreezeType()const
  111. {
  112. return autoFreezeType_;
  113. }
  114. int DescribeOssIncrementCheckSettingResult::getVideoFrameInterval()const
  115. {
  116. return videoFrameInterval_;
  117. }
  118. int DescribeOssIncrementCheckSettingResult::getVideoMaxFrames()const
  119. {
  120. return videoMaxFrames_;
  121. }
  122. int DescribeOssIncrementCheckSettingResult::getVideoMaxSize()const
  123. {
  124. return videoMaxSize_;
  125. }