ListSmartGroupResult.cc 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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/ListSmartGroupResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Devops_rdc;
  19. using namespace AlibabaCloud::Devops_rdc::Model;
  20. ListSmartGroupResult::ListSmartGroupResult() :
  21. ServiceResult()
  22. {}
  23. ListSmartGroupResult::ListSmartGroupResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. ListSmartGroupResult::~ListSmartGroupResult()
  29. {}
  30. void ListSmartGroupResult::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 allObjectNode = value["Object"]["SmartGroup"];
  37. for (auto valueObjectSmartGroup : allObjectNode)
  38. {
  39. SmartGroup objectObject;
  40. if(!valueObjectSmartGroup["Id"].isNull())
  41. objectObject.id = valueObjectSmartGroup["Id"].asString();
  42. if(!valueObjectSmartGroup["Type"].isNull())
  43. objectObject.type = valueObjectSmartGroup["Type"].asString();
  44. object_.push_back(objectObject);
  45. }
  46. if(!value["Successful"].isNull())
  47. successful_ = value["Successful"].asString() == "true";
  48. if(!value["ErrorCode"].isNull())
  49. errorCode_ = value["ErrorCode"].asString();
  50. if(!value["ErrorMsg"].isNull())
  51. errorMsg_ = value["ErrorMsg"].asString();
  52. }
  53. std::string ListSmartGroupResult::getErrorMsg()const
  54. {
  55. return errorMsg_;
  56. }
  57. std::vector<ListSmartGroupResult::SmartGroup> ListSmartGroupResult::getObject()const
  58. {
  59. return object_;
  60. }
  61. std::string ListSmartGroupResult::getErrorCode()const
  62. {
  63. return errorCode_;
  64. }
  65. bool ListSmartGroupResult::getSuccessful()const
  66. {
  67. return successful_;
  68. }