DescribeParameterGroupResult.cc 3.8 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/rds/model/DescribeParameterGroupResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Rds;
  19. using namespace AlibabaCloud::Rds::Model;
  20. DescribeParameterGroupResult::DescribeParameterGroupResult() :
  21. ServiceResult()
  22. {}
  23. DescribeParameterGroupResult::DescribeParameterGroupResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeParameterGroupResult::~DescribeParameterGroupResult()
  29. {}
  30. void DescribeParameterGroupResult::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 allParamGroupNode = value["ParamGroup"]["ParameterGroup"];
  37. for (auto valueParamGroupParameterGroup : allParamGroupNode)
  38. {
  39. ParameterGroup paramGroupObject;
  40. if(!valueParamGroupParameterGroup["ParameterGroupType"].isNull())
  41. paramGroupObject.parameterGroupType = std::stoi(valueParamGroupParameterGroup["ParameterGroupType"].asString());
  42. if(!valueParamGroupParameterGroup["ParameterGroupName"].isNull())
  43. paramGroupObject.parameterGroupName = valueParamGroupParameterGroup["ParameterGroupName"].asString();
  44. if(!valueParamGroupParameterGroup["ParamCounts"].isNull())
  45. paramGroupObject.paramCounts = std::stoi(valueParamGroupParameterGroup["ParamCounts"].asString());
  46. if(!valueParamGroupParameterGroup["ParameterGroupDesc"].isNull())
  47. paramGroupObject.parameterGroupDesc = valueParamGroupParameterGroup["ParameterGroupDesc"].asString();
  48. if(!valueParamGroupParameterGroup["ForceRestart"].isNull())
  49. paramGroupObject.forceRestart = std::stoi(valueParamGroupParameterGroup["ForceRestart"].asString());
  50. if(!valueParamGroupParameterGroup["Engine"].isNull())
  51. paramGroupObject.engine = valueParamGroupParameterGroup["Engine"].asString();
  52. if(!valueParamGroupParameterGroup["EngineVersion"].isNull())
  53. paramGroupObject.engineVersion = valueParamGroupParameterGroup["EngineVersion"].asString();
  54. if(!valueParamGroupParameterGroup["ParameterGroupId"].isNull())
  55. paramGroupObject.parameterGroupId = std::stoi(valueParamGroupParameterGroup["ParameterGroupId"].asString());
  56. if(!valueParamGroupParameterGroup["CreateTime"].isNull())
  57. paramGroupObject.createTime = valueParamGroupParameterGroup["CreateTime"].asString();
  58. if(!valueParamGroupParameterGroup["UpdateTime"].isNull())
  59. paramGroupObject.updateTime = valueParamGroupParameterGroup["UpdateTime"].asString();
  60. auto allParamDetailNode = allParamGroupNode["ParamDetail"]["ParameterDetail"];
  61. for (auto allParamGroupNodeParamDetailParameterDetail : allParamDetailNode)
  62. {
  63. ParameterGroup::ParameterDetail paramDetailObject;
  64. if(!allParamGroupNodeParamDetailParameterDetail["ParamName"].isNull())
  65. paramDetailObject.paramName = allParamGroupNodeParamDetailParameterDetail["ParamName"].asString();
  66. if(!allParamGroupNodeParamDetailParameterDetail["ParamValue"].isNull())
  67. paramDetailObject.paramValue = allParamGroupNodeParamDetailParameterDetail["ParamValue"].asString();
  68. paramGroupObject.paramDetail.push_back(paramDetailObject);
  69. }
  70. paramGroup_.push_back(paramGroupObject);
  71. }
  72. }
  73. std::vector<DescribeParameterGroupResult::ParameterGroup> DescribeParameterGroupResult::getParamGroup()const
  74. {
  75. return paramGroup_;
  76. }