DescribeShardingNetworkAddressResult.cc 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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/dds/model/DescribeShardingNetworkAddressResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Dds;
  19. using namespace AlibabaCloud::Dds::Model;
  20. DescribeShardingNetworkAddressResult::DescribeShardingNetworkAddressResult() :
  21. ServiceResult()
  22. {}
  23. DescribeShardingNetworkAddressResult::DescribeShardingNetworkAddressResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeShardingNetworkAddressResult::~DescribeShardingNetworkAddressResult()
  29. {}
  30. void DescribeShardingNetworkAddressResult::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 allCompatibleConnectionsNode = value["CompatibleConnections"]["CompatibleConnection"];
  37. for (auto valueCompatibleConnectionsCompatibleConnection : allCompatibleConnectionsNode)
  38. {
  39. CompatibleConnection compatibleConnectionsObject;
  40. if(!valueCompatibleConnectionsCompatibleConnection["VswitchId"].isNull())
  41. compatibleConnectionsObject.vswitchId = valueCompatibleConnectionsCompatibleConnection["VswitchId"].asString();
  42. if(!valueCompatibleConnectionsCompatibleConnection["ExpiredTime"].isNull())
  43. compatibleConnectionsObject.expiredTime = valueCompatibleConnectionsCompatibleConnection["ExpiredTime"].asString();
  44. if(!valueCompatibleConnectionsCompatibleConnection["NetworkType"].isNull())
  45. compatibleConnectionsObject.networkType = valueCompatibleConnectionsCompatibleConnection["NetworkType"].asString();
  46. if(!valueCompatibleConnectionsCompatibleConnection["Port"].isNull())
  47. compatibleConnectionsObject.port = valueCompatibleConnectionsCompatibleConnection["Port"].asString();
  48. if(!valueCompatibleConnectionsCompatibleConnection["NetworkAddress"].isNull())
  49. compatibleConnectionsObject.networkAddress = valueCompatibleConnectionsCompatibleConnection["NetworkAddress"].asString();
  50. if(!valueCompatibleConnectionsCompatibleConnection["VPCId"].isNull())
  51. compatibleConnectionsObject.vPCId = valueCompatibleConnectionsCompatibleConnection["VPCId"].asString();
  52. if(!valueCompatibleConnectionsCompatibleConnection["IPAddress"].isNull())
  53. compatibleConnectionsObject.iPAddress = valueCompatibleConnectionsCompatibleConnection["IPAddress"].asString();
  54. compatibleConnections_.push_back(compatibleConnectionsObject);
  55. }
  56. auto allNetworkAddressesNode = value["NetworkAddresses"]["NetworkAddress"];
  57. for (auto valueNetworkAddressesNetworkAddress : allNetworkAddressesNode)
  58. {
  59. NetworkAddress networkAddressesObject;
  60. if(!valueNetworkAddressesNetworkAddress["NodeType"].isNull())
  61. networkAddressesObject.nodeType = valueNetworkAddressesNetworkAddress["NodeType"].asString();
  62. if(!valueNetworkAddressesNetworkAddress["VswitchId"].isNull())
  63. networkAddressesObject.vswitchId = valueNetworkAddressesNetworkAddress["VswitchId"].asString();
  64. if(!valueNetworkAddressesNetworkAddress["ExpiredTime"].isNull())
  65. networkAddressesObject.expiredTime = valueNetworkAddressesNetworkAddress["ExpiredTime"].asString();
  66. if(!valueNetworkAddressesNetworkAddress["NetworkType"].isNull())
  67. networkAddressesObject.networkType = valueNetworkAddressesNetworkAddress["NetworkType"].asString();
  68. if(!valueNetworkAddressesNetworkAddress["Role"].isNull())
  69. networkAddressesObject.role = valueNetworkAddressesNetworkAddress["Role"].asString();
  70. if(!valueNetworkAddressesNetworkAddress["Port"].isNull())
  71. networkAddressesObject.port = valueNetworkAddressesNetworkAddress["Port"].asString();
  72. if(!valueNetworkAddressesNetworkAddress["VPCId"].isNull())
  73. networkAddressesObject.vPCId = valueNetworkAddressesNetworkAddress["VPCId"].asString();
  74. if(!valueNetworkAddressesNetworkAddress["NetworkAddress"].isNull())
  75. networkAddressesObject.networkAddress = valueNetworkAddressesNetworkAddress["NetworkAddress"].asString();
  76. if(!valueNetworkAddressesNetworkAddress["NodeId"].isNull())
  77. networkAddressesObject.nodeId = valueNetworkAddressesNetworkAddress["NodeId"].asString();
  78. if(!valueNetworkAddressesNetworkAddress["IPAddress"].isNull())
  79. networkAddressesObject.iPAddress = valueNetworkAddressesNetworkAddress["IPAddress"].asString();
  80. if(!valueNetworkAddressesNetworkAddress["ConnectionType"].isNull())
  81. networkAddressesObject.connectionType = valueNetworkAddressesNetworkAddress["ConnectionType"].asString();
  82. if(!valueNetworkAddressesNetworkAddress["TxtRecord"].isNull())
  83. networkAddressesObject.txtRecord = valueNetworkAddressesNetworkAddress["TxtRecord"].asString();
  84. networkAddresses_.push_back(networkAddressesObject);
  85. }
  86. }
  87. std::vector<DescribeShardingNetworkAddressResult::CompatibleConnection> DescribeShardingNetworkAddressResult::getCompatibleConnections()const
  88. {
  89. return compatibleConnections_;
  90. }
  91. std::vector<DescribeShardingNetworkAddressResult::NetworkAddress> DescribeShardingNetworkAddressResult::getNetworkAddresses()const
  92. {
  93. return networkAddresses_;
  94. }