DescribeRestoreTaskListResult.cc 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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/dbs/model/DescribeRestoreTaskListResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Dbs;
  19. using namespace AlibabaCloud::Dbs::Model;
  20. DescribeRestoreTaskListResult::DescribeRestoreTaskListResult() :
  21. ServiceResult()
  22. {}
  23. DescribeRestoreTaskListResult::DescribeRestoreTaskListResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeRestoreTaskListResult::~DescribeRestoreTaskListResult()
  29. {}
  30. void DescribeRestoreTaskListResult::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 allItems = value["Items"]["RestoreTaskDetail"];
  37. for (auto value : allItems)
  38. {
  39. RestoreTaskDetail itemsObject;
  40. if(!value["BackupPlanId"].isNull())
  41. itemsObject.backupPlanId = value["BackupPlanId"].asString();
  42. if(!value["DestinationEndpointInstanceType"].isNull())
  43. itemsObject.destinationEndpointInstanceType = value["DestinationEndpointInstanceType"].asString();
  44. if(!value["DestinationEndpointRegion"].isNull())
  45. itemsObject.destinationEndpointRegion = value["DestinationEndpointRegion"].asString();
  46. if(!value["DestinationEndpointInstanceID"].isNull())
  47. itemsObject.destinationEndpointInstanceID = value["DestinationEndpointInstanceID"].asString();
  48. if(!value["DestinationEndpointIpPort"].isNull())
  49. itemsObject.destinationEndpointIpPort = value["DestinationEndpointIpPort"].asString();
  50. if(!value["DestinationEndpointDatabaseName"].isNull())
  51. itemsObject.destinationEndpointDatabaseName = value["DestinationEndpointDatabaseName"].asString();
  52. if(!value["DestinationEndpointUserName"].isNull())
  53. itemsObject.destinationEndpointUserName = value["DestinationEndpointUserName"].asString();
  54. if(!value["DestinationEndpointOracleSID"].isNull())
  55. itemsObject.destinationEndpointOracleSID = value["DestinationEndpointOracleSID"].asString();
  56. if(!value["RestoreObjects"].isNull())
  57. itemsObject.restoreObjects = value["RestoreObjects"].asString();
  58. if(!value["BackupGatewayId"].isNull())
  59. itemsObject.backupGatewayId = std::stol(value["BackupGatewayId"].asString());
  60. if(!value["RestoreDir"].isNull())
  61. itemsObject.restoreDir = value["RestoreDir"].asString();
  62. if(!value["RestoreTaskName"].isNull())
  63. itemsObject.restoreTaskName = value["RestoreTaskName"].asString();
  64. if(!value["BackupSetId"].isNull())
  65. itemsObject.backupSetId = value["BackupSetId"].asString();
  66. if(!value["RestoreTime"].isNull())
  67. itemsObject.restoreTime = std::stol(value["RestoreTime"].asString());
  68. if(!value["RestoreTaskCreateTime"].isNull())
  69. itemsObject.restoreTaskCreateTime = std::stol(value["RestoreTaskCreateTime"].asString());
  70. if(!value["RestoreTaskFinishTime"].isNull())
  71. itemsObject.restoreTaskFinishTime = std::stol(value["RestoreTaskFinishTime"].asString());
  72. if(!value["RestoreStatus"].isNull())
  73. itemsObject.restoreStatus = value["RestoreStatus"].asString();
  74. if(!value["RestoreTaskId"].isNull())
  75. itemsObject.restoreTaskId = value["RestoreTaskId"].asString();
  76. if(!value["FullStruforeRestoreProgress"].isNull())
  77. itemsObject.fullStruforeRestoreProgress = std::stoi(value["FullStruforeRestoreProgress"].asString());
  78. if(!value["FullDataRestoreProgress"].isNull())
  79. itemsObject.fullDataRestoreProgress = std::stoi(value["FullDataRestoreProgress"].asString());
  80. if(!value["ContinuousRestoreProgress"].isNull())
  81. itemsObject.continuousRestoreProgress = std::stoi(value["ContinuousRestoreProgress"].asString());
  82. if(!value["FullStruAfterRestoreProgress"].isNull())
  83. itemsObject.fullStruAfterRestoreProgress = std::stoi(value["FullStruAfterRestoreProgress"].asString());
  84. if(!value["ErrMessage"].isNull())
  85. itemsObject.errMessage = value["ErrMessage"].asString();
  86. items_.push_back(itemsObject);
  87. }
  88. if(!value["Success"].isNull())
  89. success_ = value["Success"].asString() == "true";
  90. if(!value["ErrCode"].isNull())
  91. errCode_ = value["ErrCode"].asString();
  92. if(!value["ErrMessage"].isNull())
  93. errMessage_ = value["ErrMessage"].asString();
  94. if(!value["HttpStatusCode"].isNull())
  95. httpStatusCode_ = std::stoi(value["HttpStatusCode"].asString());
  96. if(!value["TotalPages"].isNull())
  97. totalPages_ = std::stoi(value["TotalPages"].asString());
  98. if(!value["PageSize"].isNull())
  99. pageSize_ = std::stoi(value["PageSize"].asString());
  100. if(!value["PageNum"].isNull())
  101. pageNum_ = std::stoi(value["PageNum"].asString());
  102. if(!value["TotalElements"].isNull())
  103. totalElements_ = std::stoi(value["TotalElements"].asString());
  104. }
  105. int DescribeRestoreTaskListResult::getPageSize()const
  106. {
  107. return pageSize_;
  108. }
  109. int DescribeRestoreTaskListResult::getPageNum()const
  110. {
  111. return pageNum_;
  112. }
  113. int DescribeRestoreTaskListResult::getHttpStatusCode()const
  114. {
  115. return httpStatusCode_;
  116. }
  117. int DescribeRestoreTaskListResult::getTotalElements()const
  118. {
  119. return totalElements_;
  120. }
  121. std::vector<DescribeRestoreTaskListResult::RestoreTaskDetail> DescribeRestoreTaskListResult::getItems()const
  122. {
  123. return items_;
  124. }
  125. int DescribeRestoreTaskListResult::getTotalPages()const
  126. {
  127. return totalPages_;
  128. }
  129. std::string DescribeRestoreTaskListResult::getErrMessage()const
  130. {
  131. return errMessage_;
  132. }
  133. bool DescribeRestoreTaskListResult::getSuccess()const
  134. {
  135. return success_;
  136. }
  137. std::string DescribeRestoreTaskListResult::getErrCode()const
  138. {
  139. return errCode_;
  140. }