DescribeSubDomainRecordsResult.cc 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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/DescribeSubDomainRecordsResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Alidns;
  19. using namespace AlibabaCloud::Alidns::Model;
  20. DescribeSubDomainRecordsResult::DescribeSubDomainRecordsResult() :
  21. ServiceResult()
  22. {}
  23. DescribeSubDomainRecordsResult::DescribeSubDomainRecordsResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeSubDomainRecordsResult::~DescribeSubDomainRecordsResult()
  29. {}
  30. void DescribeSubDomainRecordsResult::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. domainRecords_.push_back(domainRecordsObject);
  63. }
  64. if(!value["TotalCount"].isNull())
  65. totalCount_ = std::stol(value["TotalCount"].asString());
  66. if(!value["PageNumber"].isNull())
  67. pageNumber_ = std::stol(value["PageNumber"].asString());
  68. if(!value["PageSize"].isNull())
  69. pageSize_ = std::stol(value["PageSize"].asString());
  70. }
  71. long DescribeSubDomainRecordsResult::getTotalCount()const
  72. {
  73. return totalCount_;
  74. }
  75. std::vector<DescribeSubDomainRecordsResult::Record> DescribeSubDomainRecordsResult::getDomainRecords()const
  76. {
  77. return domainRecords_;
  78. }
  79. long DescribeSubDomainRecordsResult::getPageSize()const
  80. {
  81. return pageSize_;
  82. }
  83. long DescribeSubDomainRecordsResult::getPageNumber()const
  84. {
  85. return pageNumber_;
  86. }