DescribeClusterAddonUpgradeStatusResult.cc 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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/cs/model/DescribeClusterAddonUpgradeStatusResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::CS;
  19. using namespace AlibabaCloud::CS::Model;
  20. DescribeClusterAddonUpgradeStatusResult::DescribeClusterAddonUpgradeStatusResult() :
  21. ServiceResult()
  22. {}
  23. DescribeClusterAddonUpgradeStatusResult::DescribeClusterAddonUpgradeStatusResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeClusterAddonUpgradeStatusResult::~DescribeClusterAddonUpgradeStatusResult()
  29. {}
  30. void DescribeClusterAddonUpgradeStatusResult::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 componentIdNode = value["ComponentId"];
  37. if(!componentIdNode["template"].isNull())
  38. componentId_._template = componentIdNode["template"].asString();
  39. if(!componentIdNode["can_upgrade"].isNull())
  40. componentId_.can_upgrade = componentIdNode["can_upgrade"].asString() == "true";
  41. if(!componentIdNode["changed"].isNull())
  42. componentId_.changed = componentIdNode["changed"].asString();
  43. auto addon_infoNode = componentIdNode["addon_info"];
  44. if(!addon_infoNode["component_name"].isNull())
  45. componentId_.addon_info.component_name = addon_infoNode["component_name"].asString();
  46. if(!addon_infoNode["ready_to_upgrade"].isNull())
  47. componentId_.addon_info.ready_to_upgrade = addon_infoNode["ready_to_upgrade"].asString();
  48. if(!addon_infoNode["message"].isNull())
  49. componentId_.addon_info.message = addon_infoNode["message"].asString();
  50. if(!addon_infoNode["version"].isNull())
  51. componentId_.addon_info.version = addon_infoNode["version"].asString();
  52. if(!addon_infoNode["yaml"].isNull())
  53. componentId_.addon_info.yaml = addon_infoNode["yaml"].asString();
  54. auto tasksNode = componentIdNode["tasks"];
  55. if(!tasksNode["finished_at"].isNull())
  56. componentId_.tasks.finished_at = tasksNode["finished_at"].asString();
  57. if(!tasksNode["master_url"].isNull())
  58. componentId_.tasks.master_url = tasksNode["master_url"].asString();
  59. if(!tasksNode["created_at"].isNull())
  60. componentId_.tasks.created_at = tasksNode["created_at"].asString();
  61. if(!tasksNode["status"].isNull())
  62. componentId_.tasks.status = tasksNode["status"].asString();
  63. }
  64. DescribeClusterAddonUpgradeStatusResult::ComponentId DescribeClusterAddonUpgradeStatusResult::getComponentId()const
  65. {
  66. return componentId_;
  67. }