DescribeBackupPlanBillingResult.cc 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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/DescribeBackupPlanBillingResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Dbs;
  19. using namespace AlibabaCloud::Dbs::Model;
  20. DescribeBackupPlanBillingResult::DescribeBackupPlanBillingResult() :
  21. ServiceResult()
  22. {}
  23. DescribeBackupPlanBillingResult::DescribeBackupPlanBillingResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeBackupPlanBillingResult::~DescribeBackupPlanBillingResult()
  29. {}
  30. void DescribeBackupPlanBillingResult::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 itemNode = value["Item"];
  37. if(!itemNode["BuySpec"].isNull())
  38. item_.buySpec = itemNode["BuySpec"].asString();
  39. if(!itemNode["BuyChargeType"].isNull())
  40. item_.buyChargeType = itemNode["BuyChargeType"].asString();
  41. if(!itemNode["BuyExpiredTimestamp"].isNull())
  42. item_.buyExpiredTimestamp = std::stol(itemNode["BuyExpiredTimestamp"].asString());
  43. if(!itemNode["TotalFreeBytes"].isNull())
  44. item_.totalFreeBytes = std::stol(itemNode["TotalFreeBytes"].asString());
  45. if(!itemNode["PaiedBytes"].isNull())
  46. item_.paiedBytes = std::stol(itemNode["PaiedBytes"].asString());
  47. if(!itemNode["UsedFullBytes"].isNull())
  48. item_.usedFullBytes = std::stol(itemNode["UsedFullBytes"].asString());
  49. if(!itemNode["UsedIncrementBytes"].isNull())
  50. item_.usedIncrementBytes = std::stol(itemNode["UsedIncrementBytes"].asString());
  51. if(!itemNode["QuotaStartTimestamp"].isNull())
  52. item_.quotaStartTimestamp = std::stol(itemNode["QuotaStartTimestamp"].asString());
  53. if(!itemNode["QuotaEndTimestamp"].isNull())
  54. item_.quotaEndTimestamp = std::stol(itemNode["QuotaEndTimestamp"].asString());
  55. if(!itemNode["BuyCreateTimestamp"].isNull())
  56. item_.buyCreateTimestamp = std::stol(itemNode["BuyCreateTimestamp"].asString());
  57. if(!itemNode["FullStorageSize"].isNull())
  58. item_.fullStorageSize = std::stol(itemNode["FullStorageSize"].asString());
  59. if(!itemNode["ContStorageSize"].isNull())
  60. item_.contStorageSize = std::stol(itemNode["ContStorageSize"].asString());
  61. if(!itemNode["IsExpired"].isNull())
  62. item_.isExpired = itemNode["IsExpired"].asString() == "true";
  63. if(!itemNode["IsFreeBytesUnlimited"].isNull())
  64. item_.isFreeBytesUnlimited = itemNode["IsFreeBytesUnlimited"].asString() == "true";
  65. if(!value["Success"].isNull())
  66. success_ = value["Success"].asString() == "true";
  67. if(!value["ErrCode"].isNull())
  68. errCode_ = value["ErrCode"].asString();
  69. if(!value["ErrMessage"].isNull())
  70. errMessage_ = value["ErrMessage"].asString();
  71. if(!value["HttpStatusCode"].isNull())
  72. httpStatusCode_ = std::stoi(value["HttpStatusCode"].asString());
  73. }
  74. DescribeBackupPlanBillingResult::Item DescribeBackupPlanBillingResult::getItem()const
  75. {
  76. return item_;
  77. }
  78. int DescribeBackupPlanBillingResult::getHttpStatusCode()const
  79. {
  80. return httpStatusCode_;
  81. }
  82. std::string DescribeBackupPlanBillingResult::getErrMessage()const
  83. {
  84. return errMessage_;
  85. }
  86. bool DescribeBackupPlanBillingResult::getSuccess()const
  87. {
  88. return success_;
  89. }
  90. std::string DescribeBackupPlanBillingResult::getErrCode()const
  91. {
  92. return errCode_;
  93. }