DescribeDomainRecordsResult.cc 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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/alidns/model/DescribeDomainRecordsResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Alidns;
  19. using namespace AlibabaCloud::Alidns::Model;
  20. DescribeDomainRecordsResult::DescribeDomainRecordsResult() :
  21. ServiceResult()
  22. {}
  23. DescribeDomainRecordsResult::DescribeDomainRecordsResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeDomainRecordsResult::~DescribeDomainRecordsResult()
  29. {}
  30. void DescribeDomainRecordsResult::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 allDomainRecordsNode = value["DomainRecords"]["Record"];
  37. for (auto valueDomainRecordsRecord : allDomainRecordsNode)
  38. {
  39. Record domainRecordsObject;
  40. if(!valueDomainRecordsRecord["DomainName"].isNull())
  41. domainRecordsObject.domainName = valueDomainRecordsRecord["DomainName"].asString();
  42. if(!valueDomainRecordsRecord["RecordId"].isNull())
  43. domainRecordsObject.recordId = valueDomainRecordsRecord["RecordId"].asString();
  44. if(!valueDomainRecordsRecord["RR"].isNull())
  45. domainRecordsObject.rR = valueDomainRecordsRecord["RR"].asString();
  46. if(!valueDomainRecordsRecord["Type"].isNull())
  47. domainRecordsObject.type = valueDomainRecordsRecord["Type"].asString();
  48. if(!valueDomainRecordsRecord["Value"].isNull())
  49. domainRecordsObject.value = valueDomainRecordsRecord["Value"].asString();
  50. if(!valueDomainRecordsRecord["TTL"].isNull())
  51. domainRecordsObject.tTL = std::stol(valueDomainRecordsRecord["TTL"].asString());
  52. if(!valueDomainRecordsRecord["Priority"].isNull())
  53. domainRecordsObject.priority = std::stol(valueDomainRecordsRecord["Priority"].asString());
  54. if(!valueDomainRecordsRecord["Line"].isNull())
  55. domainRecordsObject.line = valueDomainRecordsRecord["Line"].asString();
  56. if(!valueDomainRecordsRecord["Status"].isNull())
  57. domainRecordsObject.status = valueDomainRecordsRecord["Status"].asString();
  58. if(!valueDomainRecordsRecord["Locked"].isNull())
  59. domainRecordsObject.locked = valueDomainRecordsRecord["Locked"].asString() == "true";
  60. if(!valueDomainRecordsRecord["Weight"].isNull())
  61. domainRecordsObject.weight = std::stoi(valueDomainRecordsRecord["Weight"].asString());
  62. if(!valueDomainRecordsRecord["Remark"].isNull())
  63. domainRecordsObject.remark = valueDomainRecordsRecord["Remark"].asString();
  64. domainRecords_.push_back(domainRecordsObject);
  65. }
  66. if(!value["TotalCount"].isNull())
  67. totalCount_ = std::stol(value["TotalCount"].asString());
  68. if(!value["PageNumber"].isNull())
  69. pageNumber_ = std::stol(value["PageNumber"].asString());
  70. if(!value["PageSize"].isNull())
  71. pageSize_ = std::stol(value["PageSize"].asString());
  72. }
  73. long DescribeDomainRecordsResult::getTotalCount()const
  74. {
  75. return totalCount_;
  76. }
  77. std::vector<DescribeDomainRecordsResult::Record> DescribeDomainRecordsResult::getDomainRecords()const
  78. {
  79. return domainRecords_;
  80. }
  81. long DescribeDomainRecordsResult::getPageSize()const
  82. {
  83. return pageSize_;
  84. }
  85. long DescribeDomainRecordsResult::getPageNumber()const
  86. {
  87. return pageNumber_;
  88. }