ListFlowProjectUserResult.cc 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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/ListFlowProjectUserResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Emr;
  19. using namespace AlibabaCloud::Emr::Model;
  20. ListFlowProjectUserResult::ListFlowProjectUserResult() :
  21. ServiceResult()
  22. {}
  23. ListFlowProjectUserResult::ListFlowProjectUserResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. ListFlowProjectUserResult::~ListFlowProjectUserResult()
  29. {}
  30. void ListFlowProjectUserResult::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 allUsersNode = value["Users"]["User"];
  37. for (auto valueUsersUser : allUsersNode)
  38. {
  39. User usersObject;
  40. if(!valueUsersUser["GmtCreate"].isNull())
  41. usersObject.gmtCreate = std::stol(valueUsersUser["GmtCreate"].asString());
  42. if(!valueUsersUser["GmtModified"].isNull())
  43. usersObject.gmtModified = std::stol(valueUsersUser["GmtModified"].asString());
  44. if(!valueUsersUser["ProjectId"].isNull())
  45. usersObject.projectId = valueUsersUser["ProjectId"].asString();
  46. if(!valueUsersUser["OwnerId"].isNull())
  47. usersObject.ownerId = valueUsersUser["OwnerId"].asString();
  48. if(!valueUsersUser["UserName"].isNull())
  49. usersObject.userName = valueUsersUser["UserName"].asString();
  50. if(!valueUsersUser["AccountUserId"].isNull())
  51. usersObject.accountUserId = valueUsersUser["AccountUserId"].asString();
  52. users_.push_back(usersObject);
  53. }
  54. if(!value["PageNumber"].isNull())
  55. pageNumber_ = std::stoi(value["PageNumber"].asString());
  56. if(!value["PageSize"].isNull())
  57. pageSize_ = std::stoi(value["PageSize"].asString());
  58. if(!value["Total"].isNull())
  59. total_ = std::stoi(value["Total"].asString());
  60. }
  61. int ListFlowProjectUserResult::getPageSize()const
  62. {
  63. return pageSize_;
  64. }
  65. int ListFlowProjectUserResult::getPageNumber()const
  66. {
  67. return pageNumber_;
  68. }
  69. int ListFlowProjectUserResult::getTotal()const
  70. {
  71. return total_;
  72. }
  73. std::vector<ListFlowProjectUserResult::User> ListFlowProjectUserResult::getUsers()const
  74. {
  75. return users_;
  76. }