QueryEdgeInstanceHistoricDeploymentResult.cc 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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/iot/model/QueryEdgeInstanceHistoricDeploymentResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Iot;
  19. using namespace AlibabaCloud::Iot::Model;
  20. QueryEdgeInstanceHistoricDeploymentResult::QueryEdgeInstanceHistoricDeploymentResult() :
  21. ServiceResult()
  22. {}
  23. QueryEdgeInstanceHistoricDeploymentResult::QueryEdgeInstanceHistoricDeploymentResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. QueryEdgeInstanceHistoricDeploymentResult::~QueryEdgeInstanceHistoricDeploymentResult()
  29. {}
  30. void QueryEdgeInstanceHistoricDeploymentResult::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["Total"].isNull())
  38. data_.total = std::stoi(dataNode["Total"].asString());
  39. if(!dataNode["PageSize"].isNull())
  40. data_.pageSize = std::stoi(dataNode["PageSize"].asString());
  41. if(!dataNode["CurrentPage"].isNull())
  42. data_.currentPage = std::stoi(dataNode["CurrentPage"].asString());
  43. auto allDeploymentListNode = dataNode["DeploymentList"]["Deployment"];
  44. for (auto dataNodeDeploymentListDeployment : allDeploymentListNode)
  45. {
  46. Data::Deployment deploymentObject;
  47. if(!dataNodeDeploymentListDeployment["GmtCreate"].isNull())
  48. deploymentObject.gmtCreate = dataNodeDeploymentListDeployment["GmtCreate"].asString();
  49. if(!dataNodeDeploymentListDeployment["GmtModified"].isNull())
  50. deploymentObject.gmtModified = dataNodeDeploymentListDeployment["GmtModified"].asString();
  51. if(!dataNodeDeploymentListDeployment["GmtCompleted"].isNull())
  52. deploymentObject.gmtCompleted = dataNodeDeploymentListDeployment["GmtCompleted"].asString();
  53. if(!dataNodeDeploymentListDeployment["DeploymentId"].isNull())
  54. deploymentObject.deploymentId = dataNodeDeploymentListDeployment["DeploymentId"].asString();
  55. if(!dataNodeDeploymentListDeployment["Description"].isNull())
  56. deploymentObject.description = dataNodeDeploymentListDeployment["Description"].asString();
  57. if(!dataNodeDeploymentListDeployment["Status"].isNull())
  58. deploymentObject.status = std::stoi(dataNodeDeploymentListDeployment["Status"].asString());
  59. if(!dataNodeDeploymentListDeployment["Type"].isNull())
  60. deploymentObject.type = dataNodeDeploymentListDeployment["Type"].asString();
  61. data_.deploymentList.push_back(deploymentObject);
  62. }
  63. if(!value["Success"].isNull())
  64. success_ = value["Success"].asString() == "true";
  65. if(!value["Code"].isNull())
  66. code_ = value["Code"].asString();
  67. if(!value["ErrorMessage"].isNull())
  68. errorMessage_ = value["ErrorMessage"].asString();
  69. }
  70. QueryEdgeInstanceHistoricDeploymentResult::Data QueryEdgeInstanceHistoricDeploymentResult::getData()const
  71. {
  72. return data_;
  73. }
  74. std::string QueryEdgeInstanceHistoricDeploymentResult::getErrorMessage()const
  75. {
  76. return errorMessage_;
  77. }
  78. std::string QueryEdgeInstanceHistoricDeploymentResult::getCode()const
  79. {
  80. return code_;
  81. }
  82. bool QueryEdgeInstanceHistoricDeploymentResult::getSuccess()const
  83. {
  84. return success_;
  85. }