ListLibraryInstallTasksResult.cc 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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/ListLibraryInstallTasksResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Emr;
  19. using namespace AlibabaCloud::Emr::Model;
  20. ListLibraryInstallTasksResult::ListLibraryInstallTasksResult() :
  21. ServiceResult()
  22. {}
  23. ListLibraryInstallTasksResult::ListLibraryInstallTasksResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. ListLibraryInstallTasksResult::~ListLibraryInstallTasksResult()
  29. {}
  30. void ListLibraryInstallTasksResult::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["LibraryBizId"].isNull())
  41. itemsObject.libraryBizId = valueItemsItem["LibraryBizId"].asString();
  42. if(!valueItemsItem["TaskGroupId"].isNull())
  43. itemsObject.taskGroupId = valueItemsItem["TaskGroupId"].asString();
  44. if(!valueItemsItem["TaskId"].isNull())
  45. itemsObject.taskId = valueItemsItem["TaskId"].asString();
  46. if(!valueItemsItem["TaskStatus"].isNull())
  47. itemsObject.taskStatus = valueItemsItem["TaskStatus"].asString();
  48. if(!valueItemsItem["StartTime"].isNull())
  49. itemsObject.startTime = std::stol(valueItemsItem["StartTime"].asString());
  50. if(!valueItemsItem["EndTime"].isNull())
  51. itemsObject.endTime = std::stol(valueItemsItem["EndTime"].asString());
  52. if(!valueItemsItem["ExecuteTime"].isNull())
  53. itemsObject.executeTime = std::stol(valueItemsItem["ExecuteTime"].asString());
  54. if(!valueItemsItem["TaskProcess"].isNull())
  55. itemsObject.taskProcess = std::stoi(valueItemsItem["TaskProcess"].asString());
  56. if(!valueItemsItem["TaskType"].isNull())
  57. itemsObject.taskType = valueItemsItem["TaskType"].asString();
  58. if(!valueItemsItem["Detail"].isNull())
  59. itemsObject.detail = valueItemsItem["Detail"].asString();
  60. if(!valueItemsItem["ClusterBizId"].isNull())
  61. itemsObject.clusterBizId = valueItemsItem["ClusterBizId"].asString();
  62. if(!valueItemsItem["Hostname"].isNull())
  63. itemsObject.hostname = valueItemsItem["Hostname"].asString();
  64. items_.push_back(itemsObject);
  65. }
  66. if(!value["PageNumber"].isNull())
  67. pageNumber_ = std::stoi(value["PageNumber"].asString());
  68. if(!value["PageSize"].isNull())
  69. pageSize_ = std::stoi(value["PageSize"].asString());
  70. if(!value["TotalCount"].isNull())
  71. totalCount_ = std::stoi(value["TotalCount"].asString());
  72. if(!value["NextToken"].isNull())
  73. nextToken_ = value["NextToken"].asString();
  74. }
  75. int ListLibraryInstallTasksResult::getTotalCount()const
  76. {
  77. return totalCount_;
  78. }
  79. int ListLibraryInstallTasksResult::getPageSize()const
  80. {
  81. return pageSize_;
  82. }
  83. std::string ListLibraryInstallTasksResult::getNextToken()const
  84. {
  85. return nextToken_;
  86. }
  87. int ListLibraryInstallTasksResult::getPageNumber()const
  88. {
  89. return pageNumber_;
  90. }
  91. std::vector<ListLibraryInstallTasksResult::Item> ListLibraryInstallTasksResult::getItems()const
  92. {
  93. return items_;
  94. }