1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/ec2/model/StaleSecurityGroup.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 EC2
19 {
20 namespace Model
21 {
22
StaleSecurityGroup()23 StaleSecurityGroup::StaleSecurityGroup() :
24 m_descriptionHasBeenSet(false),
25 m_groupIdHasBeenSet(false),
26 m_groupNameHasBeenSet(false),
27 m_staleIpPermissionsHasBeenSet(false),
28 m_staleIpPermissionsEgressHasBeenSet(false),
29 m_vpcIdHasBeenSet(false)
30 {
31 }
32
StaleSecurityGroup(const XmlNode & xmlNode)33 StaleSecurityGroup::StaleSecurityGroup(const XmlNode& xmlNode) :
34 m_descriptionHasBeenSet(false),
35 m_groupIdHasBeenSet(false),
36 m_groupNameHasBeenSet(false),
37 m_staleIpPermissionsHasBeenSet(false),
38 m_staleIpPermissionsEgressHasBeenSet(false),
39 m_vpcIdHasBeenSet(false)
40 {
41 *this = xmlNode;
42 }
43
operator =(const XmlNode & xmlNode)44 StaleSecurityGroup& StaleSecurityGroup::operator =(const XmlNode& xmlNode)
45 {
46 XmlNode resultNode = xmlNode;
47
48 if(!resultNode.IsNull())
49 {
50 XmlNode descriptionNode = resultNode.FirstChild("description");
51 if(!descriptionNode.IsNull())
52 {
53 m_description = Aws::Utils::Xml::DecodeEscapedXmlText(descriptionNode.GetText());
54 m_descriptionHasBeenSet = true;
55 }
56 XmlNode groupIdNode = resultNode.FirstChild("groupId");
57 if(!groupIdNode.IsNull())
58 {
59 m_groupId = Aws::Utils::Xml::DecodeEscapedXmlText(groupIdNode.GetText());
60 m_groupIdHasBeenSet = true;
61 }
62 XmlNode groupNameNode = resultNode.FirstChild("groupName");
63 if(!groupNameNode.IsNull())
64 {
65 m_groupName = Aws::Utils::Xml::DecodeEscapedXmlText(groupNameNode.GetText());
66 m_groupNameHasBeenSet = true;
67 }
68 XmlNode staleIpPermissionsNode = resultNode.FirstChild("staleIpPermissions");
69 if(!staleIpPermissionsNode.IsNull())
70 {
71 XmlNode staleIpPermissionsMember = staleIpPermissionsNode.FirstChild("item");
72 while(!staleIpPermissionsMember.IsNull())
73 {
74 m_staleIpPermissions.push_back(staleIpPermissionsMember);
75 staleIpPermissionsMember = staleIpPermissionsMember.NextNode("item");
76 }
77
78 m_staleIpPermissionsHasBeenSet = true;
79 }
80 XmlNode staleIpPermissionsEgressNode = resultNode.FirstChild("staleIpPermissionsEgress");
81 if(!staleIpPermissionsEgressNode.IsNull())
82 {
83 XmlNode staleIpPermissionsEgressMember = staleIpPermissionsEgressNode.FirstChild("item");
84 while(!staleIpPermissionsEgressMember.IsNull())
85 {
86 m_staleIpPermissionsEgress.push_back(staleIpPermissionsEgressMember);
87 staleIpPermissionsEgressMember = staleIpPermissionsEgressMember.NextNode("item");
88 }
89
90 m_staleIpPermissionsEgressHasBeenSet = true;
91 }
92 XmlNode vpcIdNode = resultNode.FirstChild("vpcId");
93 if(!vpcIdNode.IsNull())
94 {
95 m_vpcId = Aws::Utils::Xml::DecodeEscapedXmlText(vpcIdNode.GetText());
96 m_vpcIdHasBeenSet = true;
97 }
98 }
99
100 return *this;
101 }
102
OutputToStream(Aws::OStream & oStream,const char * location,unsigned index,const char * locationValue) const103 void StaleSecurityGroup::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
104 {
105 if(m_descriptionHasBeenSet)
106 {
107 oStream << location << index << locationValue << ".Description=" << StringUtils::URLEncode(m_description.c_str()) << "&";
108 }
109
110 if(m_groupIdHasBeenSet)
111 {
112 oStream << location << index << locationValue << ".GroupId=" << StringUtils::URLEncode(m_groupId.c_str()) << "&";
113 }
114
115 if(m_groupNameHasBeenSet)
116 {
117 oStream << location << index << locationValue << ".GroupName=" << StringUtils::URLEncode(m_groupName.c_str()) << "&";
118 }
119
120 if(m_staleIpPermissionsHasBeenSet)
121 {
122 unsigned staleIpPermissionsIdx = 1;
123 for(auto& item : m_staleIpPermissions)
124 {
125 Aws::StringStream staleIpPermissionsSs;
126 staleIpPermissionsSs << location << index << locationValue << ".StaleIpPermissions." << staleIpPermissionsIdx++;
127 item.OutputToStream(oStream, staleIpPermissionsSs.str().c_str());
128 }
129 }
130
131 if(m_staleIpPermissionsEgressHasBeenSet)
132 {
133 unsigned staleIpPermissionsEgressIdx = 1;
134 for(auto& item : m_staleIpPermissionsEgress)
135 {
136 Aws::StringStream staleIpPermissionsEgressSs;
137 staleIpPermissionsEgressSs << location << index << locationValue << ".StaleIpPermissionsEgress." << staleIpPermissionsEgressIdx++;
138 item.OutputToStream(oStream, staleIpPermissionsEgressSs.str().c_str());
139 }
140 }
141
142 if(m_vpcIdHasBeenSet)
143 {
144 oStream << location << index << locationValue << ".VpcId=" << StringUtils::URLEncode(m_vpcId.c_str()) << "&";
145 }
146
147 }
148
OutputToStream(Aws::OStream & oStream,const char * location) const149 void StaleSecurityGroup::OutputToStream(Aws::OStream& oStream, const char* location) const
150 {
151 if(m_descriptionHasBeenSet)
152 {
153 oStream << location << ".Description=" << StringUtils::URLEncode(m_description.c_str()) << "&";
154 }
155 if(m_groupIdHasBeenSet)
156 {
157 oStream << location << ".GroupId=" << StringUtils::URLEncode(m_groupId.c_str()) << "&";
158 }
159 if(m_groupNameHasBeenSet)
160 {
161 oStream << location << ".GroupName=" << StringUtils::URLEncode(m_groupName.c_str()) << "&";
162 }
163 if(m_staleIpPermissionsHasBeenSet)
164 {
165 unsigned staleIpPermissionsIdx = 1;
166 for(auto& item : m_staleIpPermissions)
167 {
168 Aws::StringStream staleIpPermissionsSs;
169 staleIpPermissionsSs << location << ".StaleIpPermissions." << staleIpPermissionsIdx++;
170 item.OutputToStream(oStream, staleIpPermissionsSs.str().c_str());
171 }
172 }
173 if(m_staleIpPermissionsEgressHasBeenSet)
174 {
175 unsigned staleIpPermissionsEgressIdx = 1;
176 for(auto& item : m_staleIpPermissionsEgress)
177 {
178 Aws::StringStream staleIpPermissionsEgressSs;
179 staleIpPermissionsEgressSs << location << ".StaleIpPermissionsEgress." << staleIpPermissionsEgressIdx++;
180 item.OutputToStream(oStream, staleIpPermissionsEgressSs.str().c_str());
181 }
182 }
183 if(m_vpcIdHasBeenSet)
184 {
185 oStream << location << ".VpcId=" << StringUtils::URLEncode(m_vpcId.c_str()) << "&";
186 }
187 }
188
189 } // namespace Model
190 } // namespace EC2
191 } // namespace Aws
192