1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/neptune/model/DBSubnetGroup.h>
7 #include <aws/core/utils/xml/XmlSerializer.h>
8 #include <aws/core/utils/StringUtils.h>
9 #include <aws/core/utils/memory/stl/AWSStringStream.h>
10
11 #include <utility>
12
13 using namespace Aws::Utils::Xml;
14 using namespace Aws::Utils;
15
16 namespace Aws
17 {
18 namespace Neptune
19 {
20 namespace Model
21 {
22
DBSubnetGroup()23 DBSubnetGroup::DBSubnetGroup() :
24 m_dBSubnetGroupNameHasBeenSet(false),
25 m_dBSubnetGroupDescriptionHasBeenSet(false),
26 m_vpcIdHasBeenSet(false),
27 m_subnetGroupStatusHasBeenSet(false),
28 m_subnetsHasBeenSet(false),
29 m_dBSubnetGroupArnHasBeenSet(false)
30 {
31 }
32
DBSubnetGroup(const XmlNode & xmlNode)33 DBSubnetGroup::DBSubnetGroup(const XmlNode& xmlNode) :
34 m_dBSubnetGroupNameHasBeenSet(false),
35 m_dBSubnetGroupDescriptionHasBeenSet(false),
36 m_vpcIdHasBeenSet(false),
37 m_subnetGroupStatusHasBeenSet(false),
38 m_subnetsHasBeenSet(false),
39 m_dBSubnetGroupArnHasBeenSet(false)
40 {
41 *this = xmlNode;
42 }
43
operator =(const XmlNode & xmlNode)44 DBSubnetGroup& DBSubnetGroup::operator =(const XmlNode& xmlNode)
45 {
46 XmlNode resultNode = xmlNode;
47
48 if(!resultNode.IsNull())
49 {
50 XmlNode dBSubnetGroupNameNode = resultNode.FirstChild("DBSubnetGroupName");
51 if(!dBSubnetGroupNameNode.IsNull())
52 {
53 m_dBSubnetGroupName = Aws::Utils::Xml::DecodeEscapedXmlText(dBSubnetGroupNameNode.GetText());
54 m_dBSubnetGroupNameHasBeenSet = true;
55 }
56 XmlNode dBSubnetGroupDescriptionNode = resultNode.FirstChild("DBSubnetGroupDescription");
57 if(!dBSubnetGroupDescriptionNode.IsNull())
58 {
59 m_dBSubnetGroupDescription = Aws::Utils::Xml::DecodeEscapedXmlText(dBSubnetGroupDescriptionNode.GetText());
60 m_dBSubnetGroupDescriptionHasBeenSet = true;
61 }
62 XmlNode vpcIdNode = resultNode.FirstChild("VpcId");
63 if(!vpcIdNode.IsNull())
64 {
65 m_vpcId = Aws::Utils::Xml::DecodeEscapedXmlText(vpcIdNode.GetText());
66 m_vpcIdHasBeenSet = true;
67 }
68 XmlNode subnetGroupStatusNode = resultNode.FirstChild("SubnetGroupStatus");
69 if(!subnetGroupStatusNode.IsNull())
70 {
71 m_subnetGroupStatus = Aws::Utils::Xml::DecodeEscapedXmlText(subnetGroupStatusNode.GetText());
72 m_subnetGroupStatusHasBeenSet = true;
73 }
74 XmlNode subnetsNode = resultNode.FirstChild("Subnets");
75 if(!subnetsNode.IsNull())
76 {
77 XmlNode subnetsMember = subnetsNode.FirstChild("Subnet");
78 while(!subnetsMember.IsNull())
79 {
80 m_subnets.push_back(subnetsMember);
81 subnetsMember = subnetsMember.NextNode("Subnet");
82 }
83
84 m_subnetsHasBeenSet = true;
85 }
86 XmlNode dBSubnetGroupArnNode = resultNode.FirstChild("DBSubnetGroupArn");
87 if(!dBSubnetGroupArnNode.IsNull())
88 {
89 m_dBSubnetGroupArn = Aws::Utils::Xml::DecodeEscapedXmlText(dBSubnetGroupArnNode.GetText());
90 m_dBSubnetGroupArnHasBeenSet = true;
91 }
92 }
93
94 return *this;
95 }
96
OutputToStream(Aws::OStream & oStream,const char * location,unsigned index,const char * locationValue) const97 void DBSubnetGroup::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
98 {
99 if(m_dBSubnetGroupNameHasBeenSet)
100 {
101 oStream << location << index << locationValue << ".DBSubnetGroupName=" << StringUtils::URLEncode(m_dBSubnetGroupName.c_str()) << "&";
102 }
103
104 if(m_dBSubnetGroupDescriptionHasBeenSet)
105 {
106 oStream << location << index << locationValue << ".DBSubnetGroupDescription=" << StringUtils::URLEncode(m_dBSubnetGroupDescription.c_str()) << "&";
107 }
108
109 if(m_vpcIdHasBeenSet)
110 {
111 oStream << location << index << locationValue << ".VpcId=" << StringUtils::URLEncode(m_vpcId.c_str()) << "&";
112 }
113
114 if(m_subnetGroupStatusHasBeenSet)
115 {
116 oStream << location << index << locationValue << ".SubnetGroupStatus=" << StringUtils::URLEncode(m_subnetGroupStatus.c_str()) << "&";
117 }
118
119 if(m_subnetsHasBeenSet)
120 {
121 unsigned subnetsIdx = 1;
122 for(auto& item : m_subnets)
123 {
124 Aws::StringStream subnetsSs;
125 subnetsSs << location << index << locationValue << ".Subnet." << subnetsIdx++;
126 item.OutputToStream(oStream, subnetsSs.str().c_str());
127 }
128 }
129
130 if(m_dBSubnetGroupArnHasBeenSet)
131 {
132 oStream << location << index << locationValue << ".DBSubnetGroupArn=" << StringUtils::URLEncode(m_dBSubnetGroupArn.c_str()) << "&";
133 }
134
135 }
136
OutputToStream(Aws::OStream & oStream,const char * location) const137 void DBSubnetGroup::OutputToStream(Aws::OStream& oStream, const char* location) const
138 {
139 if(m_dBSubnetGroupNameHasBeenSet)
140 {
141 oStream << location << ".DBSubnetGroupName=" << StringUtils::URLEncode(m_dBSubnetGroupName.c_str()) << "&";
142 }
143 if(m_dBSubnetGroupDescriptionHasBeenSet)
144 {
145 oStream << location << ".DBSubnetGroupDescription=" << StringUtils::URLEncode(m_dBSubnetGroupDescription.c_str()) << "&";
146 }
147 if(m_vpcIdHasBeenSet)
148 {
149 oStream << location << ".VpcId=" << StringUtils::URLEncode(m_vpcId.c_str()) << "&";
150 }
151 if(m_subnetGroupStatusHasBeenSet)
152 {
153 oStream << location << ".SubnetGroupStatus=" << StringUtils::URLEncode(m_subnetGroupStatus.c_str()) << "&";
154 }
155 if(m_subnetsHasBeenSet)
156 {
157 unsigned subnetsIdx = 1;
158 for(auto& item : m_subnets)
159 {
160 Aws::StringStream subnetsSs;
161 subnetsSs << location << ".Subnet." << subnetsIdx++;
162 item.OutputToStream(oStream, subnetsSs.str().c_str());
163 }
164 }
165 if(m_dBSubnetGroupArnHasBeenSet)
166 {
167 oStream << location << ".DBSubnetGroupArn=" << StringUtils::URLEncode(m_dBSubnetGroupArn.c_str()) << "&";
168 }
169 }
170
171 } // namespace Model
172 } // namespace Neptune
173 } // namespace Aws
174