ListParametersResult.cc 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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/oos/model/ListParametersResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Oos;
  19. using namespace AlibabaCloud::Oos::Model;
  20. ListParametersResult::ListParametersResult() :
  21. ServiceResult()
  22. {}
  23. ListParametersResult::ListParametersResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. ListParametersResult::~ListParametersResult()
  29. {}
  30. void ListParametersResult::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 allParametersNode = value["Parameters"]["Parameter"];
  37. for (auto valueParametersParameter : allParametersNode)
  38. {
  39. _Parameter parametersObject;
  40. if(!valueParametersParameter["Name"].isNull())
  41. parametersObject.name = valueParametersParameter["Name"].asString();
  42. if(!valueParametersParameter["Id"].isNull())
  43. parametersObject.id = valueParametersParameter["Id"].asString();
  44. if(!valueParametersParameter["CreatedDate"].isNull())
  45. parametersObject.createdDate = valueParametersParameter["CreatedDate"].asString();
  46. if(!valueParametersParameter["CreatedBy"].isNull())
  47. parametersObject.createdBy = valueParametersParameter["CreatedBy"].asString();
  48. if(!valueParametersParameter["UpdatedDate"].isNull())
  49. parametersObject.updatedDate = valueParametersParameter["UpdatedDate"].asString();
  50. if(!valueParametersParameter["UpdatedBy"].isNull())
  51. parametersObject.updatedBy = valueParametersParameter["UpdatedBy"].asString();
  52. if(!valueParametersParameter["Description"].isNull())
  53. parametersObject.description = valueParametersParameter["Description"].asString();
  54. if(!valueParametersParameter["ShareType"].isNull())
  55. parametersObject.shareType = valueParametersParameter["ShareType"].asString();
  56. if(!valueParametersParameter["ParameterVersion"].isNull())
  57. parametersObject.parameterVersion = valueParametersParameter["ParameterVersion"].asString();
  58. if(!valueParametersParameter["Type"].isNull())
  59. parametersObject.type = valueParametersParameter["Type"].asString();
  60. if(!valueParametersParameter["Tags"].isNull())
  61. parametersObject.tags = valueParametersParameter["Tags"].asString();
  62. parameters_.push_back(parametersObject);
  63. }
  64. if(!value["MaxResults"].isNull())
  65. maxResults_ = std::stoi(value["MaxResults"].asString());
  66. if(!value["NextToken"].isNull())
  67. nextToken_ = value["NextToken"].asString();
  68. if(!value["TotalCount"].isNull())
  69. totalCount_ = std::stoi(value["TotalCount"].asString());
  70. }
  71. int ListParametersResult::getTotalCount()const
  72. {
  73. return totalCount_;
  74. }
  75. std::vector<ListParametersResult::_Parameter> ListParametersResult::getParameters()const
  76. {
  77. return parameters_;
  78. }
  79. std::string ListParametersResult::getNextToken()const
  80. {
  81. return nextToken_;
  82. }
  83. int ListParametersResult::getMaxResults()const
  84. {
  85. return maxResults_;
  86. }