QueryBillToOSSSubscriptionResult.cc 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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/bssopenapi/model/QueryBillToOSSSubscriptionResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::BssOpenApi;
  19. using namespace AlibabaCloud::BssOpenApi::Model;
  20. QueryBillToOSSSubscriptionResult::QueryBillToOSSSubscriptionResult() :
  21. ServiceResult()
  22. {}
  23. QueryBillToOSSSubscriptionResult::QueryBillToOSSSubscriptionResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. QueryBillToOSSSubscriptionResult::~QueryBillToOSSSubscriptionResult()
  29. {}
  30. void QueryBillToOSSSubscriptionResult::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["AccountName"].isNull())
  38. data_.accountName = dataNode["AccountName"].asString();
  39. if(!dataNode["AccountID"].isNull())
  40. data_.accountID = dataNode["AccountID"].asString();
  41. auto allItemsNode = dataNode["Items"]["Item"];
  42. for (auto dataNodeItemsItem : allItemsNode)
  43. {
  44. Data::Item itemObject;
  45. if(!dataNodeItemsItem["BucketOwnerId"].isNull())
  46. itemObject.bucketOwnerId = std::stol(dataNodeItemsItem["BucketOwnerId"].asString());
  47. if(!dataNodeItemsItem["SubscribeType"].isNull())
  48. itemObject.subscribeType = dataNodeItemsItem["SubscribeType"].asString();
  49. if(!dataNodeItemsItem["SubscribeBucket"].isNull())
  50. itemObject.subscribeBucket = dataNodeItemsItem["SubscribeBucket"].asString();
  51. if(!dataNodeItemsItem["SubscribeTime"].isNull())
  52. itemObject.subscribeTime = dataNodeItemsItem["SubscribeTime"].asString();
  53. if(!dataNodeItemsItem["SubscribeLanguage"].isNull())
  54. itemObject.subscribeLanguage = dataNodeItemsItem["SubscribeLanguage"].asString();
  55. if(!dataNodeItemsItem["MultAccountRelSubscribe"].isNull())
  56. itemObject.multAccountRelSubscribe = dataNodeItemsItem["MultAccountRelSubscribe"].asString();
  57. if(!dataNodeItemsItem["BucketPath"].isNull())
  58. itemObject.bucketPath = dataNodeItemsItem["BucketPath"].asString();
  59. data_.items.push_back(itemObject);
  60. }
  61. if(!value["Code"].isNull())
  62. code_ = value["Code"].asString();
  63. if(!value["Message"].isNull())
  64. message_ = value["Message"].asString();
  65. if(!value["Success"].isNull())
  66. success_ = value["Success"].asString() == "true";
  67. }
  68. std::string QueryBillToOSSSubscriptionResult::getMessage()const
  69. {
  70. return message_;
  71. }
  72. QueryBillToOSSSubscriptionResult::Data QueryBillToOSSSubscriptionResult::getData()const
  73. {
  74. return data_;
  75. }
  76. std::string QueryBillToOSSSubscriptionResult::getCode()const
  77. {
  78. return code_;
  79. }
  80. bool QueryBillToOSSSubscriptionResult::getSuccess()const
  81. {
  82. return success_;
  83. }