GetPipelineInstanceGroupStatusResult.cc 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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/devops-rdc/model/GetPipelineInstanceGroupStatusResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Devops_rdc;
  19. using namespace AlibabaCloud::Devops_rdc::Model;
  20. GetPipelineInstanceGroupStatusResult::GetPipelineInstanceGroupStatusResult() :
  21. ServiceResult()
  22. {}
  23. GetPipelineInstanceGroupStatusResult::GetPipelineInstanceGroupStatusResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. GetPipelineInstanceGroupStatusResult::~GetPipelineInstanceGroupStatusResult()
  29. {}
  30. void GetPipelineInstanceGroupStatusResult::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 objectNode = value["Object"];
  37. if(!objectNode["Status"].isNull())
  38. object_.status = objectNode["Status"].asString();
  39. auto allGroupsNode = objectNode["Groups"]["group"];
  40. for (auto objectNodeGroupsgroup : allGroupsNode)
  41. {
  42. Object::Group groupObject;
  43. if(!objectNodeGroupsgroup["Status"].isNull())
  44. groupObject.status = objectNodeGroupsgroup["Status"].asString();
  45. if(!objectNodeGroupsgroup["Name"].isNull())
  46. groupObject.name = objectNodeGroupsgroup["Name"].asString();
  47. auto allStagesNode = objectNodeGroupsgroup["Stages"]["stage"];
  48. for (auto objectNodeGroupsgroupStagesstage : allStagesNode)
  49. {
  50. Object::Group::Stage stagesObject;
  51. if(!objectNodeGroupsgroupStagesstage["Status"].isNull())
  52. stagesObject.status = objectNodeGroupsgroupStagesstage["Status"].asString();
  53. if(!objectNodeGroupsgroupStagesstage["Sign"].isNull())
  54. stagesObject.sign = objectNodeGroupsgroupStagesstage["Sign"].asString();
  55. auto allComponentsNode = objectNodeGroupsgroupStagesstage["Components"]["component"];
  56. for (auto objectNodeGroupsgroupStagesstageComponentscomponent : allComponentsNode)
  57. {
  58. Object::Group::Stage::Component componentsObject;
  59. if(!objectNodeGroupsgroupStagesstageComponentscomponent["Status"].isNull())
  60. componentsObject.status = objectNodeGroupsgroupStagesstageComponentscomponent["Status"].asString();
  61. if(!objectNodeGroupsgroupStagesstageComponentscomponent["Name"].isNull())
  62. componentsObject.name = objectNodeGroupsgroupStagesstageComponentscomponent["Name"].asString();
  63. if(!objectNodeGroupsgroupStagesstageComponentscomponent["JobId"].isNull())
  64. componentsObject.jobId = objectNodeGroupsgroupStagesstageComponentscomponent["JobId"].asString();
  65. stagesObject.components.push_back(componentsObject);
  66. }
  67. groupObject.stages.push_back(stagesObject);
  68. }
  69. object_.groups.push_back(groupObject);
  70. }
  71. if(!value["ErrorMessage"].isNull())
  72. errorMessage_ = value["ErrorMessage"].asString();
  73. if(!value["Success"].isNull())
  74. success_ = value["Success"].asString() == "true";
  75. if(!value["ErrorCode"].isNull())
  76. errorCode_ = value["ErrorCode"].asString();
  77. }
  78. GetPipelineInstanceGroupStatusResult::Object GetPipelineInstanceGroupStatusResult::getObject()const
  79. {
  80. return object_;
  81. }
  82. std::string GetPipelineInstanceGroupStatusResult::getErrorCode()const
  83. {
  84. return errorCode_;
  85. }
  86. std::string GetPipelineInstanceGroupStatusResult::getErrorMessage()const
  87. {
  88. return errorMessage_;
  89. }
  90. bool GetPipelineInstanceGroupStatusResult::getSuccess()const
  91. {
  92. return success_;
  93. }