ListAlertUserGroupResult.cc 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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/ListAlertUserGroupResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Emr;
  19. using namespace AlibabaCloud::Emr::Model;
  20. ListAlertUserGroupResult::ListAlertUserGroupResult() :
  21. ServiceResult()
  22. {}
  23. ListAlertUserGroupResult::ListAlertUserGroupResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. ListAlertUserGroupResult::~ListAlertUserGroupResult()
  29. {}
  30. void ListAlertUserGroupResult::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 allAlertUserGroupList = value["AlertUserGroupList"]["Group"];
  37. for (auto value : allAlertUserGroupList)
  38. {
  39. Group alertUserGroupListObject;
  40. if(!value["Id"].isNull())
  41. alertUserGroupListObject.id = std::stol(value["Id"].asString());
  42. if(!value["GmtCreate"].isNull())
  43. alertUserGroupListObject.gmtCreate = value["GmtCreate"].asString();
  44. if(!value["GmtModified"].isNull())
  45. alertUserGroupListObject.gmtModified = value["GmtModified"].asString();
  46. if(!value["BizId"].isNull())
  47. alertUserGroupListObject.bizId = value["BizId"].asString();
  48. if(!value["Name"].isNull())
  49. alertUserGroupListObject.name = value["Name"].asString();
  50. if(!value["Description"].isNull())
  51. alertUserGroupListObject.description = value["Description"].asString();
  52. auto allUserList = value["UserList"]["UserInfo"];
  53. for (auto value : allUserList)
  54. {
  55. Group::UserInfo userListObject;
  56. if(!value["UserId"].isNull())
  57. userListObject.userId = value["UserId"].asString();
  58. if(!value["UserName"].isNull())
  59. userListObject.userName = value["UserName"].asString();
  60. if(!value["EnableSMS"].isNull())
  61. userListObject.enableSMS = value["EnableSMS"].asString() == "true";
  62. if(!value["EnableEmail"].isNull())
  63. userListObject.enableEmail = value["EnableEmail"].asString() == "true";
  64. alertUserGroupListObject.userList.push_back(userListObject);
  65. }
  66. alertUserGroupList_.push_back(alertUserGroupListObject);
  67. }
  68. }
  69. std::vector<ListAlertUserGroupResult::Group> ListAlertUserGroupResult::getAlertUserGroupList()const
  70. {
  71. return alertUserGroupList_;
  72. }