DescribeScheduleTasksResult.cc 4.3 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/polardb/model/DescribeScheduleTasksResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Polardb;
  19. using namespace AlibabaCloud::Polardb::Model;
  20. DescribeScheduleTasksResult::DescribeScheduleTasksResult() :
  21. ServiceResult()
  22. {}
  23. DescribeScheduleTasksResult::DescribeScheduleTasksResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeScheduleTasksResult::~DescribeScheduleTasksResult()
  29. {}
  30. void DescribeScheduleTasksResult::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 dataNode = value["Data"];
  37. if(!dataNode["TotalRecordCount"].isNull())
  38. data_.totalRecordCount = std::stoi(dataNode["TotalRecordCount"].asString());
  39. if(!dataNode["PageNumber"].isNull())
  40. data_.pageNumber = std::stoi(dataNode["PageNumber"].asString());
  41. if(!dataNode["PageSize"].isNull())
  42. data_.pageSize = std::stoi(dataNode["PageSize"].asString());
  43. auto allTimerInfosNode = dataNode["TimerInfos"]["timerInfosItem"];
  44. for (auto dataNodeTimerInfostimerInfosItem : allTimerInfosNode)
  45. {
  46. Data::TimerInfosItem timerInfosItemObject;
  47. if(!dataNodeTimerInfostimerInfosItem["Status"].isNull())
  48. timerInfosItemObject.status = dataNodeTimerInfostimerInfosItem["Status"].asString();
  49. if(!dataNodeTimerInfostimerInfosItem["Action"].isNull())
  50. timerInfosItemObject.action = dataNodeTimerInfostimerInfosItem["Action"].asString();
  51. if(!dataNodeTimerInfostimerInfosItem["PlannedEndTime"].isNull())
  52. timerInfosItemObject.plannedEndTime = dataNodeTimerInfostimerInfosItem["PlannedEndTime"].asString();
  53. if(!dataNodeTimerInfostimerInfosItem["PlannedTime"].isNull())
  54. timerInfosItemObject.plannedTime = dataNodeTimerInfostimerInfosItem["PlannedTime"].asString();
  55. if(!dataNodeTimerInfostimerInfosItem["DBClusterId"].isNull())
  56. timerInfosItemObject.dBClusterId = dataNodeTimerInfostimerInfosItem["DBClusterId"].asString();
  57. if(!dataNodeTimerInfostimerInfosItem["Region"].isNull())
  58. timerInfosItemObject.region = dataNodeTimerInfostimerInfosItem["Region"].asString();
  59. if(!dataNodeTimerInfostimerInfosItem["PlannedStartTime"].isNull())
  60. timerInfosItemObject.plannedStartTime = dataNodeTimerInfostimerInfosItem["PlannedStartTime"].asString();
  61. if(!dataNodeTimerInfostimerInfosItem["TaskId"].isNull())
  62. timerInfosItemObject.taskId = dataNodeTimerInfostimerInfosItem["TaskId"].asString();
  63. if(!dataNodeTimerInfostimerInfosItem["OrderId"].isNull())
  64. timerInfosItemObject.orderId = dataNodeTimerInfostimerInfosItem["OrderId"].asString();
  65. if(!dataNodeTimerInfostimerInfosItem["DbClusterStatus"].isNull())
  66. timerInfosItemObject.dbClusterStatus = dataNodeTimerInfostimerInfosItem["DbClusterStatus"].asString();
  67. if(!dataNodeTimerInfostimerInfosItem["DbClusterDescription"].isNull())
  68. timerInfosItemObject.dbClusterDescription = dataNodeTimerInfostimerInfosItem["DbClusterDescription"].asString();
  69. if(!dataNodeTimerInfostimerInfosItem["TaskCancel"].isNull())
  70. timerInfosItemObject.taskCancel = dataNodeTimerInfostimerInfosItem["TaskCancel"].asString() == "true";
  71. data_.timerInfos.push_back(timerInfosItemObject);
  72. }
  73. if(!value["Message"].isNull())
  74. message_ = value["Message"].asString();
  75. if(!value["Code"].isNull())
  76. code_ = value["Code"].asString();
  77. if(!value["Success"].isNull())
  78. success_ = value["Success"].asString() == "true";
  79. }
  80. std::string DescribeScheduleTasksResult::getMessage()const
  81. {
  82. return message_;
  83. }
  84. DescribeScheduleTasksResult::Data DescribeScheduleTasksResult::getData()const
  85. {
  86. return data_;
  87. }
  88. std::string DescribeScheduleTasksResult::getCode()const
  89. {
  90. return code_;
  91. }
  92. bool DescribeScheduleTasksResult::getSuccess()const
  93. {
  94. return success_;
  95. }