DescribeVpnConnectionResult.cc 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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/vpc/model/DescribeVpnConnectionResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Vpc;
  19. using namespace AlibabaCloud::Vpc::Model;
  20. DescribeVpnConnectionResult::DescribeVpnConnectionResult() :
  21. ServiceResult()
  22. {}
  23. DescribeVpnConnectionResult::DescribeVpnConnectionResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeVpnConnectionResult::~DescribeVpnConnectionResult()
  29. {}
  30. void DescribeVpnConnectionResult::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 ikeConfigNode = value["IkeConfig"];
  37. if(!ikeConfigNode["Psk"].isNull())
  38. ikeConfig_.psk = ikeConfigNode["Psk"].asString();
  39. if(!ikeConfigNode["IkeVersion"].isNull())
  40. ikeConfig_.ikeVersion = ikeConfigNode["IkeVersion"].asString();
  41. if(!ikeConfigNode["IkeMode"].isNull())
  42. ikeConfig_.ikeMode = ikeConfigNode["IkeMode"].asString();
  43. if(!ikeConfigNode["IkeEncAlg"].isNull())
  44. ikeConfig_.ikeEncAlg = ikeConfigNode["IkeEncAlg"].asString();
  45. if(!ikeConfigNode["IkeAuthAlg"].isNull())
  46. ikeConfig_.ikeAuthAlg = ikeConfigNode["IkeAuthAlg"].asString();
  47. if(!ikeConfigNode["IkePfs"].isNull())
  48. ikeConfig_.ikePfs = ikeConfigNode["IkePfs"].asString();
  49. if(!ikeConfigNode["IkeLifetime"].isNull())
  50. ikeConfig_.ikeLifetime = std::stol(ikeConfigNode["IkeLifetime"].asString());
  51. if(!ikeConfigNode["LocalId"].isNull())
  52. ikeConfig_.localId = ikeConfigNode["LocalId"].asString();
  53. if(!ikeConfigNode["RemoteId"].isNull())
  54. ikeConfig_.remoteId = ikeConfigNode["RemoteId"].asString();
  55. auto ipsecConfigNode = value["IpsecConfig"];
  56. if(!ipsecConfigNode["IpsecEncAlg"].isNull())
  57. ipsecConfig_.ipsecEncAlg = ipsecConfigNode["IpsecEncAlg"].asString();
  58. if(!ipsecConfigNode["IpsecAuthAlg"].isNull())
  59. ipsecConfig_.ipsecAuthAlg = ipsecConfigNode["IpsecAuthAlg"].asString();
  60. if(!ipsecConfigNode["IpsecPfs"].isNull())
  61. ipsecConfig_.ipsecPfs = ipsecConfigNode["IpsecPfs"].asString();
  62. if(!ipsecConfigNode["IpsecLifetime"].isNull())
  63. ipsecConfig_.ipsecLifetime = std::stol(ipsecConfigNode["IpsecLifetime"].asString());
  64. auto vcoHealthCheckNode = value["VcoHealthCheck"];
  65. if(!vcoHealthCheckNode["Enable"].isNull())
  66. vcoHealthCheck_.enable = vcoHealthCheckNode["Enable"].asString();
  67. if(!vcoHealthCheckNode["Sip"].isNull())
  68. vcoHealthCheck_.sip = vcoHealthCheckNode["Sip"].asString();
  69. if(!vcoHealthCheckNode["Dip"].isNull())
  70. vcoHealthCheck_.dip = vcoHealthCheckNode["Dip"].asString();
  71. if(!vcoHealthCheckNode["Interval"].isNull())
  72. vcoHealthCheck_.interval = std::stoi(vcoHealthCheckNode["Interval"].asString());
  73. if(!vcoHealthCheckNode["Retry"].isNull())
  74. vcoHealthCheck_.retry = std::stoi(vcoHealthCheckNode["Retry"].asString());
  75. if(!vcoHealthCheckNode["Status"].isNull())
  76. vcoHealthCheck_.status = vcoHealthCheckNode["Status"].asString();
  77. if(!value["VpnConnectionId"].isNull())
  78. vpnConnectionId_ = value["VpnConnectionId"].asString();
  79. if(!value["CustomerGatewayId"].isNull())
  80. customerGatewayId_ = value["CustomerGatewayId"].asString();
  81. if(!value["VpnGatewayId"].isNull())
  82. vpnGatewayId_ = value["VpnGatewayId"].asString();
  83. if(!value["Name"].isNull())
  84. name_ = value["Name"].asString();
  85. if(!value["LocalSubnet"].isNull())
  86. localSubnet_ = value["LocalSubnet"].asString();
  87. if(!value["RemoteSubnet"].isNull())
  88. remoteSubnet_ = value["RemoteSubnet"].asString();
  89. if(!value["CreateTime"].isNull())
  90. createTime_ = std::stol(value["CreateTime"].asString());
  91. if(!value["EffectImmediately"].isNull())
  92. effectImmediately_ = value["EffectImmediately"].asString() == "true";
  93. if(!value["Status"].isNull())
  94. status_ = value["Status"].asString();
  95. }
  96. std::string DescribeVpnConnectionResult::getLocalSubnet()const
  97. {
  98. return localSubnet_;
  99. }
  100. bool DescribeVpnConnectionResult::getEffectImmediately()const
  101. {
  102. return effectImmediately_;
  103. }
  104. std::string DescribeVpnConnectionResult::getStatus()const
  105. {
  106. return status_;
  107. }
  108. DescribeVpnConnectionResult::VcoHealthCheck DescribeVpnConnectionResult::getVcoHealthCheck()const
  109. {
  110. return vcoHealthCheck_;
  111. }
  112. std::string DescribeVpnConnectionResult::getRemoteSubnet()const
  113. {
  114. return remoteSubnet_;
  115. }
  116. std::string DescribeVpnConnectionResult::getCustomerGatewayId()const
  117. {
  118. return customerGatewayId_;
  119. }
  120. std::string DescribeVpnConnectionResult::getVpnGatewayId()const
  121. {
  122. return vpnGatewayId_;
  123. }
  124. DescribeVpnConnectionResult::IpsecConfig DescribeVpnConnectionResult::getIpsecConfig()const
  125. {
  126. return ipsecConfig_;
  127. }
  128. long DescribeVpnConnectionResult::getCreateTime()const
  129. {
  130. return createTime_;
  131. }
  132. std::string DescribeVpnConnectionResult::getVpnConnectionId()const
  133. {
  134. return vpnConnectionId_;
  135. }
  136. DescribeVpnConnectionResult::IkeConfig DescribeVpnConnectionResult::getIkeConfig()const
  137. {
  138. return ikeConfig_;
  139. }
  140. std::string DescribeVpnConnectionResult::getName()const
  141. {
  142. return name_;
  143. }