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/AccessDetail.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
AccessDetail()23 AccessDetail::AccessDetail() :
24 m_serviceNameHasBeenSet(false),
25 m_serviceNamespaceHasBeenSet(false),
26 m_regionHasBeenSet(false),
27 m_entityPathHasBeenSet(false),
28 m_lastAuthenticatedTimeHasBeenSet(false),
29 m_totalAuthenticatedEntities(0),
30 m_totalAuthenticatedEntitiesHasBeenSet(false)
31 {
32 }
33
AccessDetail(const XmlNode & xmlNode)34 AccessDetail::AccessDetail(const XmlNode& xmlNode) :
35 m_serviceNameHasBeenSet(false),
36 m_serviceNamespaceHasBeenSet(false),
37 m_regionHasBeenSet(false),
38 m_entityPathHasBeenSet(false),
39 m_lastAuthenticatedTimeHasBeenSet(false),
40 m_totalAuthenticatedEntities(0),
41 m_totalAuthenticatedEntitiesHasBeenSet(false)
42 {
43 *this = xmlNode;
44 }
45
operator =(const XmlNode & xmlNode)46 AccessDetail& AccessDetail::operator =(const XmlNode& xmlNode)
47 {
48 XmlNode resultNode = xmlNode;
49
50 if(!resultNode.IsNull())
51 {
52 XmlNode serviceNameNode = resultNode.FirstChild("ServiceName");
53 if(!serviceNameNode.IsNull())
54 {
55 m_serviceName = Aws::Utils::Xml::DecodeEscapedXmlText(serviceNameNode.GetText());
56 m_serviceNameHasBeenSet = true;
57 }
58 XmlNode serviceNamespaceNode = resultNode.FirstChild("ServiceNamespace");
59 if(!serviceNamespaceNode.IsNull())
60 {
61 m_serviceNamespace = Aws::Utils::Xml::DecodeEscapedXmlText(serviceNamespaceNode.GetText());
62 m_serviceNamespaceHasBeenSet = true;
63 }
64 XmlNode regionNode = resultNode.FirstChild("Region");
65 if(!regionNode.IsNull())
66 {
67 m_region = Aws::Utils::Xml::DecodeEscapedXmlText(regionNode.GetText());
68 m_regionHasBeenSet = true;
69 }
70 XmlNode entityPathNode = resultNode.FirstChild("EntityPath");
71 if(!entityPathNode.IsNull())
72 {
73 m_entityPath = Aws::Utils::Xml::DecodeEscapedXmlText(entityPathNode.GetText());
74 m_entityPathHasBeenSet = true;
75 }
76 XmlNode lastAuthenticatedTimeNode = resultNode.FirstChild("LastAuthenticatedTime");
77 if(!lastAuthenticatedTimeNode.IsNull())
78 {
79 m_lastAuthenticatedTime = DateTime(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(lastAuthenticatedTimeNode.GetText()).c_str()).c_str(), DateFormat::ISO_8601);
80 m_lastAuthenticatedTimeHasBeenSet = true;
81 }
82 XmlNode totalAuthenticatedEntitiesNode = resultNode.FirstChild("TotalAuthenticatedEntities");
83 if(!totalAuthenticatedEntitiesNode.IsNull())
84 {
85 m_totalAuthenticatedEntities = StringUtils::ConvertToInt32(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(totalAuthenticatedEntitiesNode.GetText()).c_str()).c_str());
86 m_totalAuthenticatedEntitiesHasBeenSet = true;
87 }
88 }
89
90 return *this;
91 }
92
OutputToStream(Aws::OStream & oStream,const char * location,unsigned index,const char * locationValue) const93 void AccessDetail::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
94 {
95 if(m_serviceNameHasBeenSet)
96 {
97 oStream << location << index << locationValue << ".ServiceName=" << StringUtils::URLEncode(m_serviceName.c_str()) << "&";
98 }
99
100 if(m_serviceNamespaceHasBeenSet)
101 {
102 oStream << location << index << locationValue << ".ServiceNamespace=" << StringUtils::URLEncode(m_serviceNamespace.c_str()) << "&";
103 }
104
105 if(m_regionHasBeenSet)
106 {
107 oStream << location << index << locationValue << ".Region=" << StringUtils::URLEncode(m_region.c_str()) << "&";
108 }
109
110 if(m_entityPathHasBeenSet)
111 {
112 oStream << location << index << locationValue << ".EntityPath=" << StringUtils::URLEncode(m_entityPath.c_str()) << "&";
113 }
114
115 if(m_lastAuthenticatedTimeHasBeenSet)
116 {
117 oStream << location << index << locationValue << ".LastAuthenticatedTime=" << StringUtils::URLEncode(m_lastAuthenticatedTime.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
118 }
119
120 if(m_totalAuthenticatedEntitiesHasBeenSet)
121 {
122 oStream << location << index << locationValue << ".TotalAuthenticatedEntities=" << m_totalAuthenticatedEntities << "&";
123 }
124
125 }
126
OutputToStream(Aws::OStream & oStream,const char * location) const127 void AccessDetail::OutputToStream(Aws::OStream& oStream, const char* location) const
128 {
129 if(m_serviceNameHasBeenSet)
130 {
131 oStream << location << ".ServiceName=" << StringUtils::URLEncode(m_serviceName.c_str()) << "&";
132 }
133 if(m_serviceNamespaceHasBeenSet)
134 {
135 oStream << location << ".ServiceNamespace=" << StringUtils::URLEncode(m_serviceNamespace.c_str()) << "&";
136 }
137 if(m_regionHasBeenSet)
138 {
139 oStream << location << ".Region=" << StringUtils::URLEncode(m_region.c_str()) << "&";
140 }
141 if(m_entityPathHasBeenSet)
142 {
143 oStream << location << ".EntityPath=" << StringUtils::URLEncode(m_entityPath.c_str()) << "&";
144 }
145 if(m_lastAuthenticatedTimeHasBeenSet)
146 {
147 oStream << location << ".LastAuthenticatedTime=" << StringUtils::URLEncode(m_lastAuthenticatedTime.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
148 }
149 if(m_totalAuthenticatedEntitiesHasBeenSet)
150 {
151 oStream << location << ".TotalAuthenticatedEntities=" << m_totalAuthenticatedEntities << "&";
152 }
153 }
154
155 } // namespace Model
156 } // namespace IAM
157 } // namespace Aws
158