1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/iam/model/GroupDetail.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 IAM
19 {
20 namespace Model
21 {
22
GroupDetail()23 GroupDetail::GroupDetail() :
24 m_pathHasBeenSet(false),
25 m_groupNameHasBeenSet(false),
26 m_groupIdHasBeenSet(false),
27 m_arnHasBeenSet(false),
28 m_createDateHasBeenSet(false),
29 m_groupPolicyListHasBeenSet(false),
30 m_attachedManagedPoliciesHasBeenSet(false)
31 {
32 }
33
GroupDetail(const XmlNode & xmlNode)34 GroupDetail::GroupDetail(const XmlNode& xmlNode) :
35 m_pathHasBeenSet(false),
36 m_groupNameHasBeenSet(false),
37 m_groupIdHasBeenSet(false),
38 m_arnHasBeenSet(false),
39 m_createDateHasBeenSet(false),
40 m_groupPolicyListHasBeenSet(false),
41 m_attachedManagedPoliciesHasBeenSet(false)
42 {
43 *this = xmlNode;
44 }
45
operator =(const XmlNode & xmlNode)46 GroupDetail& GroupDetail::operator =(const XmlNode& xmlNode)
47 {
48 XmlNode resultNode = xmlNode;
49
50 if(!resultNode.IsNull())
51 {
52 XmlNode pathNode = resultNode.FirstChild("Path");
53 if(!pathNode.IsNull())
54 {
55 m_path = Aws::Utils::Xml::DecodeEscapedXmlText(pathNode.GetText());
56 m_pathHasBeenSet = true;
57 }
58 XmlNode groupNameNode = resultNode.FirstChild("GroupName");
59 if(!groupNameNode.IsNull())
60 {
61 m_groupName = Aws::Utils::Xml::DecodeEscapedXmlText(groupNameNode.GetText());
62 m_groupNameHasBeenSet = true;
63 }
64 XmlNode groupIdNode = resultNode.FirstChild("GroupId");
65 if(!groupIdNode.IsNull())
66 {
67 m_groupId = Aws::Utils::Xml::DecodeEscapedXmlText(groupIdNode.GetText());
68 m_groupIdHasBeenSet = true;
69 }
70 XmlNode arnNode = resultNode.FirstChild("Arn");
71 if(!arnNode.IsNull())
72 {
73 m_arn = Aws::Utils::Xml::DecodeEscapedXmlText(arnNode.GetText());
74 m_arnHasBeenSet = true;
75 }
76 XmlNode createDateNode = resultNode.FirstChild("CreateDate");
77 if(!createDateNode.IsNull())
78 {
79 m_createDate = DateTime(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(createDateNode.GetText()).c_str()).c_str(), DateFormat::ISO_8601);
80 m_createDateHasBeenSet = true;
81 }
82 XmlNode groupPolicyListNode = resultNode.FirstChild("GroupPolicyList");
83 if(!groupPolicyListNode.IsNull())
84 {
85 XmlNode groupPolicyListMember = groupPolicyListNode.FirstChild("member");
86 while(!groupPolicyListMember.IsNull())
87 {
88 m_groupPolicyList.push_back(groupPolicyListMember);
89 groupPolicyListMember = groupPolicyListMember.NextNode("member");
90 }
91
92 m_groupPolicyListHasBeenSet = true;
93 }
94 XmlNode attachedManagedPoliciesNode = resultNode.FirstChild("AttachedManagedPolicies");
95 if(!attachedManagedPoliciesNode.IsNull())
96 {
97 XmlNode attachedManagedPoliciesMember = attachedManagedPoliciesNode.FirstChild("member");
98 while(!attachedManagedPoliciesMember.IsNull())
99 {
100 m_attachedManagedPolicies.push_back(attachedManagedPoliciesMember);
101 attachedManagedPoliciesMember = attachedManagedPoliciesMember.NextNode("member");
102 }
103
104 m_attachedManagedPoliciesHasBeenSet = true;
105 }
106 }
107
108 return *this;
109 }
110
OutputToStream(Aws::OStream & oStream,const char * location,unsigned index,const char * locationValue) const111 void GroupDetail::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
112 {
113 if(m_pathHasBeenSet)
114 {
115 oStream << location << index << locationValue << ".Path=" << StringUtils::URLEncode(m_path.c_str()) << "&";
116 }
117
118 if(m_groupNameHasBeenSet)
119 {
120 oStream << location << index << locationValue << ".GroupName=" << StringUtils::URLEncode(m_groupName.c_str()) << "&";
121 }
122
123 if(m_groupIdHasBeenSet)
124 {
125 oStream << location << index << locationValue << ".GroupId=" << StringUtils::URLEncode(m_groupId.c_str()) << "&";
126 }
127
128 if(m_arnHasBeenSet)
129 {
130 oStream << location << index << locationValue << ".Arn=" << StringUtils::URLEncode(m_arn.c_str()) << "&";
131 }
132
133 if(m_createDateHasBeenSet)
134 {
135 oStream << location << index << locationValue << ".CreateDate=" << StringUtils::URLEncode(m_createDate.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
136 }
137
138 if(m_groupPolicyListHasBeenSet)
139 {
140 unsigned groupPolicyListIdx = 1;
141 for(auto& item : m_groupPolicyList)
142 {
143 Aws::StringStream groupPolicyListSs;
144 groupPolicyListSs << location << index << locationValue << ".GroupPolicyList.member." << groupPolicyListIdx++;
145 item.OutputToStream(oStream, groupPolicyListSs.str().c_str());
146 }
147 }
148
149 if(m_attachedManagedPoliciesHasBeenSet)
150 {
151 unsigned attachedManagedPoliciesIdx = 1;
152 for(auto& item : m_attachedManagedPolicies)
153 {
154 Aws::StringStream attachedManagedPoliciesSs;
155 attachedManagedPoliciesSs << location << index << locationValue << ".AttachedManagedPolicies.member." << attachedManagedPoliciesIdx++;
156 item.OutputToStream(oStream, attachedManagedPoliciesSs.str().c_str());
157 }
158 }
159
160 }
161
OutputToStream(Aws::OStream & oStream,const char * location) const162 void GroupDetail::OutputToStream(Aws::OStream& oStream, const char* location) const
163 {
164 if(m_pathHasBeenSet)
165 {
166 oStream << location << ".Path=" << StringUtils::URLEncode(m_path.c_str()) << "&";
167 }
168 if(m_groupNameHasBeenSet)
169 {
170 oStream << location << ".GroupName=" << StringUtils::URLEncode(m_groupName.c_str()) << "&";
171 }
172 if(m_groupIdHasBeenSet)
173 {
174 oStream << location << ".GroupId=" << StringUtils::URLEncode(m_groupId.c_str()) << "&";
175 }
176 if(m_arnHasBeenSet)
177 {
178 oStream << location << ".Arn=" << StringUtils::URLEncode(m_arn.c_str()) << "&";
179 }
180 if(m_createDateHasBeenSet)
181 {
182 oStream << location << ".CreateDate=" << StringUtils::URLEncode(m_createDate.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
183 }
184 if(m_groupPolicyListHasBeenSet)
185 {
186 unsigned groupPolicyListIdx = 1;
187 for(auto& item : m_groupPolicyList)
188 {
189 Aws::StringStream groupPolicyListSs;
190 groupPolicyListSs << location << ".GroupPolicyList.member." << groupPolicyListIdx++;
191 item.OutputToStream(oStream, groupPolicyListSs.str().c_str());
192 }
193 }
194 if(m_attachedManagedPoliciesHasBeenSet)
195 {
196 unsigned attachedManagedPoliciesIdx = 1;
197 for(auto& item : m_attachedManagedPolicies)
198 {
199 Aws::StringStream attachedManagedPoliciesSs;
200 attachedManagedPoliciesSs << location << ".AttachedManagedPolicies.member." << attachedManagedPoliciesIdx++;
201 item.OutputToStream(oStream, attachedManagedPoliciesSs.str().c_str());
202 }
203 }
204 }
205
206 } // namespace Model
207 } // namespace IAM
208 } // namespace Aws
209