ListLibrariesResult.cc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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/emr/model/ListLibrariesResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Emr;
  19. using namespace AlibabaCloud::Emr::Model;
  20. ListLibrariesResult::ListLibrariesResult() :
  21. ServiceResult()
  22. {}
  23. ListLibrariesResult::ListLibrariesResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. ListLibrariesResult::~ListLibrariesResult()
  29. {}
  30. void ListLibrariesResult::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 allItemsNode = value["Items"]["Item"];
  37. for (auto valueItemsItem : allItemsNode)
  38. {
  39. Item itemsObject;
  40. if(!valueItemsItem["BizId"].isNull())
  41. itemsObject.bizId = valueItemsItem["BizId"].asString();
  42. if(!valueItemsItem["CreateTime"].isNull())
  43. itemsObject.createTime = std::stol(valueItemsItem["CreateTime"].asString());
  44. if(!valueItemsItem["Type"].isNull())
  45. itemsObject.type = valueItemsItem["Type"].asString();
  46. if(!valueItemsItem["Name"].isNull())
  47. itemsObject.name = valueItemsItem["Name"].asString();
  48. if(!valueItemsItem["LibraryVersion"].isNull())
  49. itemsObject.libraryVersion = valueItemsItem["LibraryVersion"].asString();
  50. if(!valueItemsItem["SourceType"].isNull())
  51. itemsObject.sourceType = valueItemsItem["SourceType"].asString();
  52. if(!valueItemsItem["SourceLocation"].isNull())
  53. itemsObject.sourceLocation = valueItemsItem["SourceLocation"].asString();
  54. if(!valueItemsItem["Scope"].isNull())
  55. itemsObject.scope = valueItemsItem["Scope"].asString();
  56. if(!valueItemsItem["Properties"].isNull())
  57. itemsObject.properties = valueItemsItem["Properties"].asString();
  58. if(!valueItemsItem["UserId"].isNull())
  59. itemsObject.userId = valueItemsItem["UserId"].asString();
  60. items_.push_back(itemsObject);
  61. }
  62. if(!value["PageNumber"].isNull())
  63. pageNumber_ = std::stoi(value["PageNumber"].asString());
  64. if(!value["PageSize"].isNull())
  65. pageSize_ = std::stoi(value["PageSize"].asString());
  66. if(!value["TotalCount"].isNull())
  67. totalCount_ = std::stoi(value["TotalCount"].asString());
  68. if(!value["NextToken"].isNull())
  69. nextToken_ = value["NextToken"].asString();
  70. }
  71. int ListLibrariesResult::getTotalCount()const
  72. {
  73. return totalCount_;
  74. }
  75. int ListLibrariesResult::getPageSize()const
  76. {
  77. return pageSize_;
  78. }
  79. std::string ListLibrariesResult::getNextToken()const
  80. {
  81. return nextToken_;
  82. }
  83. int ListLibrariesResult::getPageNumber()const
  84. {
  85. return pageNumber_;
  86. }
  87. std::vector<ListLibrariesResult::Item> ListLibrariesResult::getItems()const
  88. {
  89. return items_;
  90. }