1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/redshift/model/EndpointAccess.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 Redshift
19 {
20 namespace Model
21 {
22
EndpointAccess()23 EndpointAccess::EndpointAccess() :
24 m_clusterIdentifierHasBeenSet(false),
25 m_resourceOwnerHasBeenSet(false),
26 m_subnetGroupNameHasBeenSet(false),
27 m_endpointStatusHasBeenSet(false),
28 m_endpointNameHasBeenSet(false),
29 m_endpointCreateTimeHasBeenSet(false),
30 m_port(0),
31 m_portHasBeenSet(false),
32 m_addressHasBeenSet(false),
33 m_vpcSecurityGroupsHasBeenSet(false),
34 m_vpcEndpointHasBeenSet(false),
35 m_responseMetadataHasBeenSet(false)
36 {
37 }
38
EndpointAccess(const XmlNode & xmlNode)39 EndpointAccess::EndpointAccess(const XmlNode& xmlNode) :
40 m_clusterIdentifierHasBeenSet(false),
41 m_resourceOwnerHasBeenSet(false),
42 m_subnetGroupNameHasBeenSet(false),
43 m_endpointStatusHasBeenSet(false),
44 m_endpointNameHasBeenSet(false),
45 m_endpointCreateTimeHasBeenSet(false),
46 m_port(0),
47 m_portHasBeenSet(false),
48 m_addressHasBeenSet(false),
49 m_vpcSecurityGroupsHasBeenSet(false),
50 m_vpcEndpointHasBeenSet(false),
51 m_responseMetadataHasBeenSet(false)
52 {
53 *this = xmlNode;
54 }
55
operator =(const XmlNode & xmlNode)56 EndpointAccess& EndpointAccess::operator =(const XmlNode& xmlNode)
57 {
58 XmlNode resultNode = xmlNode;
59
60 if(!resultNode.IsNull())
61 {
62 XmlNode clusterIdentifierNode = resultNode.FirstChild("ClusterIdentifier");
63 if(!clusterIdentifierNode.IsNull())
64 {
65 m_clusterIdentifier = Aws::Utils::Xml::DecodeEscapedXmlText(clusterIdentifierNode.GetText());
66 m_clusterIdentifierHasBeenSet = true;
67 }
68 XmlNode resourceOwnerNode = resultNode.FirstChild("ResourceOwner");
69 if(!resourceOwnerNode.IsNull())
70 {
71 m_resourceOwner = Aws::Utils::Xml::DecodeEscapedXmlText(resourceOwnerNode.GetText());
72 m_resourceOwnerHasBeenSet = true;
73 }
74 XmlNode subnetGroupNameNode = resultNode.FirstChild("SubnetGroupName");
75 if(!subnetGroupNameNode.IsNull())
76 {
77 m_subnetGroupName = Aws::Utils::Xml::DecodeEscapedXmlText(subnetGroupNameNode.GetText());
78 m_subnetGroupNameHasBeenSet = true;
79 }
80 XmlNode endpointStatusNode = resultNode.FirstChild("EndpointStatus");
81 if(!endpointStatusNode.IsNull())
82 {
83 m_endpointStatus = Aws::Utils::Xml::DecodeEscapedXmlText(endpointStatusNode.GetText());
84 m_endpointStatusHasBeenSet = true;
85 }
86 XmlNode endpointNameNode = resultNode.FirstChild("EndpointName");
87 if(!endpointNameNode.IsNull())
88 {
89 m_endpointName = Aws::Utils::Xml::DecodeEscapedXmlText(endpointNameNode.GetText());
90 m_endpointNameHasBeenSet = true;
91 }
92 XmlNode endpointCreateTimeNode = resultNode.FirstChild("EndpointCreateTime");
93 if(!endpointCreateTimeNode.IsNull())
94 {
95 m_endpointCreateTime = DateTime(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(endpointCreateTimeNode.GetText()).c_str()).c_str(), DateFormat::ISO_8601);
96 m_endpointCreateTimeHasBeenSet = true;
97 }
98 XmlNode portNode = resultNode.FirstChild("Port");
99 if(!portNode.IsNull())
100 {
101 m_port = StringUtils::ConvertToInt32(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(portNode.GetText()).c_str()).c_str());
102 m_portHasBeenSet = true;
103 }
104 XmlNode addressNode = resultNode.FirstChild("Address");
105 if(!addressNode.IsNull())
106 {
107 m_address = Aws::Utils::Xml::DecodeEscapedXmlText(addressNode.GetText());
108 m_addressHasBeenSet = true;
109 }
110 XmlNode vpcSecurityGroupsNode = resultNode.FirstChild("VpcSecurityGroups");
111 if(!vpcSecurityGroupsNode.IsNull())
112 {
113 XmlNode vpcSecurityGroupsMember = vpcSecurityGroupsNode.FirstChild("VpcSecurityGroup");
114 while(!vpcSecurityGroupsMember.IsNull())
115 {
116 m_vpcSecurityGroups.push_back(vpcSecurityGroupsMember);
117 vpcSecurityGroupsMember = vpcSecurityGroupsMember.NextNode("VpcSecurityGroup");
118 }
119
120 m_vpcSecurityGroupsHasBeenSet = true;
121 }
122 XmlNode vpcEndpointNode = resultNode.FirstChild("VpcEndpoint");
123 if(!vpcEndpointNode.IsNull())
124 {
125 m_vpcEndpoint = vpcEndpointNode;
126 m_vpcEndpointHasBeenSet = true;
127 }
128 }
129
130 return *this;
131 }
132
OutputToStream(Aws::OStream & oStream,const char * location,unsigned index,const char * locationValue) const133 void EndpointAccess::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
134 {
135 if(m_clusterIdentifierHasBeenSet)
136 {
137 oStream << location << index << locationValue << ".ClusterIdentifier=" << StringUtils::URLEncode(m_clusterIdentifier.c_str()) << "&";
138 }
139
140 if(m_resourceOwnerHasBeenSet)
141 {
142 oStream << location << index << locationValue << ".ResourceOwner=" << StringUtils::URLEncode(m_resourceOwner.c_str()) << "&";
143 }
144
145 if(m_subnetGroupNameHasBeenSet)
146 {
147 oStream << location << index << locationValue << ".SubnetGroupName=" << StringUtils::URLEncode(m_subnetGroupName.c_str()) << "&";
148 }
149
150 if(m_endpointStatusHasBeenSet)
151 {
152 oStream << location << index << locationValue << ".EndpointStatus=" << StringUtils::URLEncode(m_endpointStatus.c_str()) << "&";
153 }
154
155 if(m_endpointNameHasBeenSet)
156 {
157 oStream << location << index << locationValue << ".EndpointName=" << StringUtils::URLEncode(m_endpointName.c_str()) << "&";
158 }
159
160 if(m_endpointCreateTimeHasBeenSet)
161 {
162 oStream << location << index << locationValue << ".EndpointCreateTime=" << StringUtils::URLEncode(m_endpointCreateTime.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
163 }
164
165 if(m_portHasBeenSet)
166 {
167 oStream << location << index << locationValue << ".Port=" << m_port << "&";
168 }
169
170 if(m_addressHasBeenSet)
171 {
172 oStream << location << index << locationValue << ".Address=" << StringUtils::URLEncode(m_address.c_str()) << "&";
173 }
174
175 if(m_vpcSecurityGroupsHasBeenSet)
176 {
177 unsigned vpcSecurityGroupsIdx = 1;
178 for(auto& item : m_vpcSecurityGroups)
179 {
180 Aws::StringStream vpcSecurityGroupsSs;
181 vpcSecurityGroupsSs << location << index << locationValue << ".VpcSecurityGroup." << vpcSecurityGroupsIdx++;
182 item.OutputToStream(oStream, vpcSecurityGroupsSs.str().c_str());
183 }
184 }
185
186 if(m_vpcEndpointHasBeenSet)
187 {
188 Aws::StringStream vpcEndpointLocationAndMemberSs;
189 vpcEndpointLocationAndMemberSs << location << index << locationValue << ".VpcEndpoint";
190 m_vpcEndpoint.OutputToStream(oStream, vpcEndpointLocationAndMemberSs.str().c_str());
191 }
192
193 if(m_responseMetadataHasBeenSet)
194 {
195 Aws::StringStream responseMetadataLocationAndMemberSs;
196 responseMetadataLocationAndMemberSs << location << index << locationValue << ".ResponseMetadata";
197 m_responseMetadata.OutputToStream(oStream, responseMetadataLocationAndMemberSs.str().c_str());
198 }
199
200 }
201
OutputToStream(Aws::OStream & oStream,const char * location) const202 void EndpointAccess::OutputToStream(Aws::OStream& oStream, const char* location) const
203 {
204 if(m_clusterIdentifierHasBeenSet)
205 {
206 oStream << location << ".ClusterIdentifier=" << StringUtils::URLEncode(m_clusterIdentifier.c_str()) << "&";
207 }
208 if(m_resourceOwnerHasBeenSet)
209 {
210 oStream << location << ".ResourceOwner=" << StringUtils::URLEncode(m_resourceOwner.c_str()) << "&";
211 }
212 if(m_subnetGroupNameHasBeenSet)
213 {
214 oStream << location << ".SubnetGroupName=" << StringUtils::URLEncode(m_subnetGroupName.c_str()) << "&";
215 }
216 if(m_endpointStatusHasBeenSet)
217 {
218 oStream << location << ".EndpointStatus=" << StringUtils::URLEncode(m_endpointStatus.c_str()) << "&";
219 }
220 if(m_endpointNameHasBeenSet)
221 {
222 oStream << location << ".EndpointName=" << StringUtils::URLEncode(m_endpointName.c_str()) << "&";
223 }
224 if(m_endpointCreateTimeHasBeenSet)
225 {
226 oStream << location << ".EndpointCreateTime=" << StringUtils::URLEncode(m_endpointCreateTime.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
227 }
228 if(m_portHasBeenSet)
229 {
230 oStream << location << ".Port=" << m_port << "&";
231 }
232 if(m_addressHasBeenSet)
233 {
234 oStream << location << ".Address=" << StringUtils::URLEncode(m_address.c_str()) << "&";
235 }
236 if(m_vpcSecurityGroupsHasBeenSet)
237 {
238 unsigned vpcSecurityGroupsIdx = 1;
239 for(auto& item : m_vpcSecurityGroups)
240 {
241 Aws::StringStream vpcSecurityGroupsSs;
242 vpcSecurityGroupsSs << location << ".VpcSecurityGroup." << vpcSecurityGroupsIdx++;
243 item.OutputToStream(oStream, vpcSecurityGroupsSs.str().c_str());
244 }
245 }
246 if(m_vpcEndpointHasBeenSet)
247 {
248 Aws::String vpcEndpointLocationAndMember(location);
249 vpcEndpointLocationAndMember += ".VpcEndpoint";
250 m_vpcEndpoint.OutputToStream(oStream, vpcEndpointLocationAndMember.c_str());
251 }
252 if(m_responseMetadataHasBeenSet)
253 {
254 Aws::String responseMetadataLocationAndMember(location);
255 responseMetadataLocationAndMember += ".ResponseMetadata";
256 m_responseMetadata.OutputToStream(oStream, responseMetadataLocationAndMember.c_str());
257 }
258 }
259
260 } // namespace Model
261 } // namespace Redshift
262 } // namespace Aws
263