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/AttachedPolicy.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
AttachedPolicy()23 AttachedPolicy::AttachedPolicy() :
24 m_policyNameHasBeenSet(false),
25 m_policyArnHasBeenSet(false)
26 {
27 }
28
AttachedPolicy(const XmlNode & xmlNode)29 AttachedPolicy::AttachedPolicy(const XmlNode& xmlNode) :
30 m_policyNameHasBeenSet(false),
31 m_policyArnHasBeenSet(false)
32 {
33 *this = xmlNode;
34 }
35
operator =(const XmlNode & xmlNode)36 AttachedPolicy& AttachedPolicy::operator =(const XmlNode& xmlNode)
37 {
38 XmlNode resultNode = xmlNode;
39
40 if(!resultNode.IsNull())
41 {
42 XmlNode policyNameNode = resultNode.FirstChild("PolicyName");
43 if(!policyNameNode.IsNull())
44 {
45 m_policyName = Aws::Utils::Xml::DecodeEscapedXmlText(policyNameNode.GetText());
46 m_policyNameHasBeenSet = true;
47 }
48 XmlNode policyArnNode = resultNode.FirstChild("PolicyArn");
49 if(!policyArnNode.IsNull())
50 {
51 m_policyArn = Aws::Utils::Xml::DecodeEscapedXmlText(policyArnNode.GetText());
52 m_policyArnHasBeenSet = true;
53 }
54 }
55
56 return *this;
57 }
58
OutputToStream(Aws::OStream & oStream,const char * location,unsigned index,const char * locationValue) const59 void AttachedPolicy::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
60 {
61 if(m_policyNameHasBeenSet)
62 {
63 oStream << location << index << locationValue << ".PolicyName=" << StringUtils::URLEncode(m_policyName.c_str()) << "&";
64 }
65
66 if(m_policyArnHasBeenSet)
67 {
68 oStream << location << index << locationValue << ".PolicyArn=" << StringUtils::URLEncode(m_policyArn.c_str()) << "&";
69 }
70
71 }
72
OutputToStream(Aws::OStream & oStream,const char * location) const73 void AttachedPolicy::OutputToStream(Aws::OStream& oStream, const char* location) const
74 {
75 if(m_policyNameHasBeenSet)
76 {
77 oStream << location << ".PolicyName=" << StringUtils::URLEncode(m_policyName.c_str()) << "&";
78 }
79 if(m_policyArnHasBeenSet)
80 {
81 oStream << location << ".PolicyArn=" << StringUtils::URLEncode(m_policyArn.c_str()) << "&";
82 }
83 }
84
85 } // namespace Model
86 } // namespace IAM
87 } // namespace Aws
88