ListCoverPipelineResult.cc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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/mts/model/ListCoverPipelineResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Mts;
  19. using namespace AlibabaCloud::Mts::Model;
  20. ListCoverPipelineResult::ListCoverPipelineResult() :
  21. ServiceResult()
  22. {}
  23. ListCoverPipelineResult::ListCoverPipelineResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. ListCoverPipelineResult::~ListCoverPipelineResult()
  29. {}
  30. void ListCoverPipelineResult::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 allPipelineListNode = value["PipelineList"]["Pipeline"];
  37. for (auto valuePipelineListPipeline : allPipelineListNode)
  38. {
  39. Pipeline pipelineListObject;
  40. if(!valuePipelineListPipeline["UserId"].isNull())
  41. pipelineListObject.userId = std::stol(valuePipelineListPipeline["UserId"].asString());
  42. if(!valuePipelineListPipeline["PipelineId"].isNull())
  43. pipelineListObject.pipelineId = valuePipelineListPipeline["PipelineId"].asString();
  44. if(!valuePipelineListPipeline["Name"].isNull())
  45. pipelineListObject.name = valuePipelineListPipeline["Name"].asString();
  46. if(!valuePipelineListPipeline["State"].isNull())
  47. pipelineListObject.state = valuePipelineListPipeline["State"].asString();
  48. if(!valuePipelineListPipeline["Priority"].isNull())
  49. pipelineListObject.priority = valuePipelineListPipeline["Priority"].asString();
  50. if(!valuePipelineListPipeline["quotaNum"].isNull())
  51. pipelineListObject.quotaNum = std::stoi(valuePipelineListPipeline["quotaNum"].asString());
  52. if(!valuePipelineListPipeline["quotaUsed"].isNull())
  53. pipelineListObject.quotaUsed = std::stoi(valuePipelineListPipeline["quotaUsed"].asString());
  54. if(!valuePipelineListPipeline["NotifyConfig"].isNull())
  55. pipelineListObject.notifyConfig = valuePipelineListPipeline["NotifyConfig"].asString();
  56. if(!valuePipelineListPipeline["Role"].isNull())
  57. pipelineListObject.role = valuePipelineListPipeline["Role"].asString();
  58. if(!valuePipelineListPipeline["ExtendConfig"].isNull())
  59. pipelineListObject.extendConfig = valuePipelineListPipeline["ExtendConfig"].asString();
  60. pipelineList_.push_back(pipelineListObject);
  61. }
  62. if(!value["TotalCount"].isNull())
  63. totalCount_ = std::stol(value["TotalCount"].asString());
  64. if(!value["PageNumber"].isNull())
  65. pageNumber_ = std::stol(value["PageNumber"].asString());
  66. if(!value["PageSize"].isNull())
  67. pageSize_ = std::stol(value["PageSize"].asString());
  68. }
  69. long ListCoverPipelineResult::getTotalCount()const
  70. {
  71. return totalCount_;
  72. }
  73. long ListCoverPipelineResult::getPageSize()const
  74. {
  75. return pageSize_;
  76. }
  77. long ListCoverPipelineResult::getPageNumber()const
  78. {
  79. return pageNumber_;
  80. }
  81. std::vector<ListCoverPipelineResult::Pipeline> ListCoverPipelineResult::getPipelineList()const
  82. {
  83. return pipelineList_;
  84. }