ListVccsResult.cc 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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/eflo/model/ListVccsResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Eflo;
  19. using namespace AlibabaCloud::Eflo::Model;
  20. ListVccsResult::ListVccsResult() :
  21. ServiceResult()
  22. {}
  23. ListVccsResult::ListVccsResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. ListVccsResult::~ListVccsResult()
  29. {}
  30. void ListVccsResult::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 contentNode = value["Content"];
  37. if(!contentNode["Total"].isNull())
  38. content_.total = std::stol(contentNode["Total"].asString());
  39. auto allDataNode = contentNode["Data"]["DataItem"];
  40. for (auto contentNodeDataDataItem : allDataNode)
  41. {
  42. Content::DataItem dataItemObject;
  43. if(!contentNodeDataDataItem["TenantId"].isNull())
  44. dataItemObject.tenantId = contentNodeDataDataItem["TenantId"].asString();
  45. if(!contentNodeDataDataItem["RegionId"].isNull())
  46. dataItemObject.regionId = contentNodeDataDataItem["RegionId"].asString();
  47. if(!contentNodeDataDataItem["VccId"].isNull())
  48. dataItemObject.vccId = contentNodeDataDataItem["VccId"].asString();
  49. if(!contentNodeDataDataItem["VpdId"].isNull())
  50. dataItemObject.vpdId = contentNodeDataDataItem["VpdId"].asString();
  51. if(!contentNodeDataDataItem["VpcId"].isNull())
  52. dataItemObject.vpcId = contentNodeDataDataItem["VpcId"].asString();
  53. if(!contentNodeDataDataItem["CenId"].isNull())
  54. dataItemObject.cenId = contentNodeDataDataItem["CenId"].asString();
  55. if(!contentNodeDataDataItem["VccName"].isNull())
  56. dataItemObject.vccName = contentNodeDataDataItem["VccName"].asString();
  57. if(!contentNodeDataDataItem["AccessPointId"].isNull())
  58. dataItemObject.accessPointId = contentNodeDataDataItem["AccessPointId"].asString();
  59. if(!contentNodeDataDataItem["LineOperator"].isNull())
  60. dataItemObject.lineOperator = contentNodeDataDataItem["LineOperator"].asString();
  61. if(!contentNodeDataDataItem["Spec"].isNull())
  62. dataItemObject.spec = contentNodeDataDataItem["Spec"].asString();
  63. if(!contentNodeDataDataItem["PortType"].isNull())
  64. dataItemObject.portType = contentNodeDataDataItem["PortType"].asString();
  65. if(!contentNodeDataDataItem["Status"].isNull())
  66. dataItemObject.status = contentNodeDataDataItem["Status"].asString();
  67. if(!contentNodeDataDataItem["Message"].isNull())
  68. dataItemObject.message = contentNodeDataDataItem["Message"].asString();
  69. if(!contentNodeDataDataItem["CreateTime"].isNull())
  70. dataItemObject.createTime = contentNodeDataDataItem["CreateTime"].asString();
  71. if(!contentNodeDataDataItem["GmtModified"].isNull())
  72. dataItemObject.gmtModified = contentNodeDataDataItem["GmtModified"].asString();
  73. if(!contentNodeDataDataItem["Rate"].isNull())
  74. dataItemObject.rate = contentNodeDataDataItem["Rate"].asString();
  75. if(!contentNodeDataDataItem["BandwidthStr"].isNull())
  76. dataItemObject.bandwidthStr = contentNodeDataDataItem["BandwidthStr"].asString();
  77. if(!contentNodeDataDataItem["BgpCidr"].isNull())
  78. dataItemObject.bgpCidr = contentNodeDataDataItem["BgpCidr"].asString();
  79. auto vpdBaseInfoNode = value["VpdBaseInfo"];
  80. if(!vpdBaseInfoNode["VpdId"].isNull())
  81. dataItemObject.vpdBaseInfo.vpdId = vpdBaseInfoNode["VpdId"].asString();
  82. if(!vpdBaseInfoNode["Name"].isNull())
  83. dataItemObject.vpdBaseInfo.name = vpdBaseInfoNode["Name"].asString();
  84. if(!vpdBaseInfoNode["Cidr"].isNull())
  85. dataItemObject.vpdBaseInfo.cidr = vpdBaseInfoNode["Cidr"].asString();
  86. if(!vpdBaseInfoNode["GmtCreate"].isNull())
  87. dataItemObject.vpdBaseInfo.gmtCreate = vpdBaseInfoNode["GmtCreate"].asString();
  88. content_.data.push_back(dataItemObject);
  89. }
  90. if(!value["Code"].isNull())
  91. code_ = std::stoi(value["Code"].asString());
  92. if(!value["Message"].isNull())
  93. message_ = value["Message"].asString();
  94. }
  95. std::string ListVccsResult::getMessage()const
  96. {
  97. return message_;
  98. }
  99. ListVccsResult::Content ListVccsResult::getContent()const
  100. {
  101. return content_;
  102. }
  103. int ListVccsResult::getCode()const
  104. {
  105. return code_;
  106. }