DescribeVpnConnectionResult.cc 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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. if(!value["VpnConnectionId"].isNull())
  65. vpnConnectionId_ = value["VpnConnectionId"].asString();
  66. if(!value["CustomerGatewayId"].isNull())
  67. customerGatewayId_ = value["CustomerGatewayId"].asString();
  68. if(!value["VpnGatewayId"].isNull())
  69. vpnGatewayId_ = value["VpnGatewayId"].asString();
  70. if(!value["Name"].isNull())
  71. name_ = value["Name"].asString();
  72. if(!value["LocalSubnet"].isNull())
  73. localSubnet_ = value["LocalSubnet"].asString();
  74. if(!value["RemoteSubnet"].isNull())
  75. remoteSubnet_ = value["RemoteSubnet"].asString();
  76. if(!value["CreateTime"].isNull())
  77. createTime_ = std::stol(value["CreateTime"].asString());
  78. if(!value["EffectImmediately"].isNull())
  79. effectImmediately_ = value["EffectImmediately"].asString() == "true";
  80. if(!value["Status"].isNull())
  81. status_ = value["Status"].asString();
  82. }
  83. std::string DescribeVpnConnectionResult::getLocalSubnet()const
  84. {
  85. return localSubnet_;
  86. }
  87. bool DescribeVpnConnectionResult::getEffectImmediately()const
  88. {
  89. return effectImmediately_;
  90. }
  91. std::string DescribeVpnConnectionResult::getStatus()const
  92. {
  93. return status_;
  94. }
  95. std::string DescribeVpnConnectionResult::getRemoteSubnet()const
  96. {
  97. return remoteSubnet_;
  98. }
  99. std::string DescribeVpnConnectionResult::getCustomerGatewayId()const
  100. {
  101. return customerGatewayId_;
  102. }
  103. std::string DescribeVpnConnectionResult::getVpnGatewayId()const
  104. {
  105. return vpnGatewayId_;
  106. }
  107. DescribeVpnConnectionResult::IpsecConfig DescribeVpnConnectionResult::getIpsecConfig()const
  108. {
  109. return ipsecConfig_;
  110. }
  111. long DescribeVpnConnectionResult::getCreateTime()const
  112. {
  113. return createTime_;
  114. }
  115. std::string DescribeVpnConnectionResult::getVpnConnectionId()const
  116. {
  117. return vpnConnectionId_;
  118. }
  119. DescribeVpnConnectionResult::IkeConfig DescribeVpnConnectionResult::getIkeConfig()const
  120. {
  121. return ikeConfig_;
  122. }
  123. std::string DescribeVpnConnectionResult::getName()const
  124. {
  125. return name_;
  126. }