GetBackInfoResult.cc 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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/GetBackInfoResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Emr;
  19. using namespace AlibabaCloud::Emr::Model;
  20. GetBackInfoResult::GetBackInfoResult() :
  21. ServiceResult()
  22. {}
  23. GetBackInfoResult::GetBackInfoResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. GetBackInfoResult::~GetBackInfoResult()
  29. {}
  30. void GetBackInfoResult::parse(const std::string &payload)
  31. {
  32. Json::CharReaderBuilder builder;
  33. Json::CharReader *reader = builder.newCharReader();
  34. Json::Value *val;
  35. Json::Value value;
  36. JSONCPP_STRING *errs;
  37. reader->parse(payload.data(), payload.data() + payload.size(), val, errs);
  38. value = *val;
  39. setRequestId(value["RequestId"].asString());
  40. auto metadataInfoNode = value["MetadataInfo"];
  41. if(!metadataInfoNode["MetadataType"].isNull())
  42. metadataInfo_.metadataType = metadataInfoNode["MetadataType"].asString();
  43. if(!metadataInfoNode["Properties"].isNull())
  44. metadataInfo_.properties = metadataInfoNode["Properties"].asString();
  45. if(!value["Paging"].isNull())
  46. paging_ = value["Paging"].asString() == "true";
  47. if(!value["Id"].isNull())
  48. id_ = value["Id"].asString();
  49. if(!value["BackupPlanId"].isNull())
  50. backupPlanId_ = value["BackupPlanId"].asString();
  51. if(!value["ClusterId"].isNull())
  52. clusterId_ = value["ClusterId"].asString();
  53. if(!value["CreateTime"].isNull())
  54. createTime_ = std::stol(value["CreateTime"].asString());
  55. if(!value["Md5"].isNull())
  56. md5_ = value["Md5"].asString();
  57. if(!value["TarFileName"].isNull())
  58. tarFileName_ = value["TarFileName"].asString();
  59. if(!value["StorePath"].isNull())
  60. storePath_ = value["StorePath"].asString();
  61. if(!value["Status"].isNull())
  62. status_ = value["Status"].asString();
  63. }
  64. std::string GetBackInfoResult::getStatus()const
  65. {
  66. return status_;
  67. }
  68. GetBackInfoResult::MetadataInfo GetBackInfoResult::getMetadataInfo()const
  69. {
  70. return metadataInfo_;
  71. }
  72. std::string GetBackInfoResult::getTarFileName()const
  73. {
  74. return tarFileName_;
  75. }
  76. std::string GetBackInfoResult::getClusterId()const
  77. {
  78. return clusterId_;
  79. }
  80. bool GetBackInfoResult::getPaging()const
  81. {
  82. return paging_;
  83. }
  84. long GetBackInfoResult::getCreateTime()const
  85. {
  86. return createTime_;
  87. }
  88. std::string GetBackInfoResult::getBackupPlanId()const
  89. {
  90. return backupPlanId_;
  91. }
  92. std::string GetBackInfoResult::getId()const
  93. {
  94. return id_;
  95. }
  96. std::string GetBackInfoResult::getMd5()const
  97. {
  98. return md5_;
  99. }
  100. std::string GetBackInfoResult::getStorePath()const
  101. {
  102. return storePath_;
  103. }