DescribeClusterServiceConfigHistoryResult.cc 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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/emr/model/DescribeClusterServiceConfigHistoryResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Emr;
  19. using namespace AlibabaCloud::Emr::Model;
  20. DescribeClusterServiceConfigHistoryResult::DescribeClusterServiceConfigHistoryResult() :
  21. ServiceResult()
  22. {}
  23. DescribeClusterServiceConfigHistoryResult::DescribeClusterServiceConfigHistoryResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeClusterServiceConfigHistoryResult::~DescribeClusterServiceConfigHistoryResult()
  29. {}
  30. void DescribeClusterServiceConfigHistoryResult::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 configNode = value["Config"];
  37. if(!configNode["ServiceName"].isNull())
  38. config_.serviceName = configNode["ServiceName"].asString();
  39. if(!configNode["ConfigVersion"].isNull())
  40. config_.configVersion = configNode["ConfigVersion"].asString();
  41. if(!configNode["Applied"].isNull())
  42. config_.applied = configNode["Applied"].asString() == "true";
  43. if(!configNode["CreateTime"].isNull())
  44. config_.createTime = configNode["CreateTime"].asString();
  45. if(!configNode["Author"].isNull())
  46. config_.author = configNode["Author"].asString();
  47. if(!configNode["Comment"].isNull())
  48. config_.comment = configNode["Comment"].asString();
  49. auto allConfigValueList = value["ConfigValueList"]["ConfigValue"];
  50. for (auto value : allConfigValueList)
  51. {
  52. Config::ConfigValue configValueObject;
  53. if(!value["ConfigName"].isNull())
  54. configValueObject.configName = value["ConfigName"].asString();
  55. auto allConfigItemValueList = value["ConfigItemValueList"]["ConfigItemValue"];
  56. for (auto value : allConfigItemValueList)
  57. {
  58. Config::ConfigValue::ConfigItemValue configItemValueListObject;
  59. if(!value["ItemName"].isNull())
  60. configItemValueListObject.itemName = value["ItemName"].asString();
  61. if(!value["Value"].isNull())
  62. configItemValueListObject.value = value["Value"].asString();
  63. if(!value["OldValue"].isNull())
  64. configItemValueListObject.oldValue = value["OldValue"].asString();
  65. if(!value["ChangeType"].isNull())
  66. configItemValueListObject.changeType = value["ChangeType"].asString();
  67. configValueObject.configItemValueList.push_back(configItemValueListObject);
  68. }
  69. config_.configValueList.push_back(configValueObject);
  70. }
  71. }
  72. DescribeClusterServiceConfigHistoryResult::Config DescribeClusterServiceConfigHistoryResult::getConfig()const
  73. {
  74. return config_;
  75. }