1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/cloudformation/model/TypeVersionSummary.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 CloudFormation
19 {
20 namespace Model
21 {
22
TypeVersionSummary()23 TypeVersionSummary::TypeVersionSummary() :
24 m_type(RegistryType::NOT_SET),
25 m_typeHasBeenSet(false),
26 m_typeNameHasBeenSet(false),
27 m_versionIdHasBeenSet(false),
28 m_isDefaultVersion(false),
29 m_isDefaultVersionHasBeenSet(false),
30 m_arnHasBeenSet(false),
31 m_timeCreatedHasBeenSet(false),
32 m_descriptionHasBeenSet(false),
33 m_publicVersionNumberHasBeenSet(false)
34 {
35 }
36
TypeVersionSummary(const XmlNode & xmlNode)37 TypeVersionSummary::TypeVersionSummary(const XmlNode& xmlNode) :
38 m_type(RegistryType::NOT_SET),
39 m_typeHasBeenSet(false),
40 m_typeNameHasBeenSet(false),
41 m_versionIdHasBeenSet(false),
42 m_isDefaultVersion(false),
43 m_isDefaultVersionHasBeenSet(false),
44 m_arnHasBeenSet(false),
45 m_timeCreatedHasBeenSet(false),
46 m_descriptionHasBeenSet(false),
47 m_publicVersionNumberHasBeenSet(false)
48 {
49 *this = xmlNode;
50 }
51
operator =(const XmlNode & xmlNode)52 TypeVersionSummary& TypeVersionSummary::operator =(const XmlNode& xmlNode)
53 {
54 XmlNode resultNode = xmlNode;
55
56 if(!resultNode.IsNull())
57 {
58 XmlNode typeNode = resultNode.FirstChild("Type");
59 if(!typeNode.IsNull())
60 {
61 m_type = RegistryTypeMapper::GetRegistryTypeForName(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(typeNode.GetText()).c_str()).c_str());
62 m_typeHasBeenSet = true;
63 }
64 XmlNode typeNameNode = resultNode.FirstChild("TypeName");
65 if(!typeNameNode.IsNull())
66 {
67 m_typeName = Aws::Utils::Xml::DecodeEscapedXmlText(typeNameNode.GetText());
68 m_typeNameHasBeenSet = true;
69 }
70 XmlNode versionIdNode = resultNode.FirstChild("VersionId");
71 if(!versionIdNode.IsNull())
72 {
73 m_versionId = Aws::Utils::Xml::DecodeEscapedXmlText(versionIdNode.GetText());
74 m_versionIdHasBeenSet = true;
75 }
76 XmlNode isDefaultVersionNode = resultNode.FirstChild("IsDefaultVersion");
77 if(!isDefaultVersionNode.IsNull())
78 {
79 m_isDefaultVersion = StringUtils::ConvertToBool(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(isDefaultVersionNode.GetText()).c_str()).c_str());
80 m_isDefaultVersionHasBeenSet = true;
81 }
82 XmlNode arnNode = resultNode.FirstChild("Arn");
83 if(!arnNode.IsNull())
84 {
85 m_arn = Aws::Utils::Xml::DecodeEscapedXmlText(arnNode.GetText());
86 m_arnHasBeenSet = true;
87 }
88 XmlNode timeCreatedNode = resultNode.FirstChild("TimeCreated");
89 if(!timeCreatedNode.IsNull())
90 {
91 m_timeCreated = DateTime(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(timeCreatedNode.GetText()).c_str()).c_str(), DateFormat::ISO_8601);
92 m_timeCreatedHasBeenSet = true;
93 }
94 XmlNode descriptionNode = resultNode.FirstChild("Description");
95 if(!descriptionNode.IsNull())
96 {
97 m_description = Aws::Utils::Xml::DecodeEscapedXmlText(descriptionNode.GetText());
98 m_descriptionHasBeenSet = true;
99 }
100 XmlNode publicVersionNumberNode = resultNode.FirstChild("PublicVersionNumber");
101 if(!publicVersionNumberNode.IsNull())
102 {
103 m_publicVersionNumber = Aws::Utils::Xml::DecodeEscapedXmlText(publicVersionNumberNode.GetText());
104 m_publicVersionNumberHasBeenSet = true;
105 }
106 }
107
108 return *this;
109 }
110
OutputToStream(Aws::OStream & oStream,const char * location,unsigned index,const char * locationValue) const111 void TypeVersionSummary::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
112 {
113 if(m_typeHasBeenSet)
114 {
115 oStream << location << index << locationValue << ".Type=" << RegistryTypeMapper::GetNameForRegistryType(m_type) << "&";
116 }
117
118 if(m_typeNameHasBeenSet)
119 {
120 oStream << location << index << locationValue << ".TypeName=" << StringUtils::URLEncode(m_typeName.c_str()) << "&";
121 }
122
123 if(m_versionIdHasBeenSet)
124 {
125 oStream << location << index << locationValue << ".VersionId=" << StringUtils::URLEncode(m_versionId.c_str()) << "&";
126 }
127
128 if(m_isDefaultVersionHasBeenSet)
129 {
130 oStream << location << index << locationValue << ".IsDefaultVersion=" << std::boolalpha << m_isDefaultVersion << "&";
131 }
132
133 if(m_arnHasBeenSet)
134 {
135 oStream << location << index << locationValue << ".Arn=" << StringUtils::URLEncode(m_arn.c_str()) << "&";
136 }
137
138 if(m_timeCreatedHasBeenSet)
139 {
140 oStream << location << index << locationValue << ".TimeCreated=" << StringUtils::URLEncode(m_timeCreated.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
141 }
142
143 if(m_descriptionHasBeenSet)
144 {
145 oStream << location << index << locationValue << ".Description=" << StringUtils::URLEncode(m_description.c_str()) << "&";
146 }
147
148 if(m_publicVersionNumberHasBeenSet)
149 {
150 oStream << location << index << locationValue << ".PublicVersionNumber=" << StringUtils::URLEncode(m_publicVersionNumber.c_str()) << "&";
151 }
152
153 }
154
OutputToStream(Aws::OStream & oStream,const char * location) const155 void TypeVersionSummary::OutputToStream(Aws::OStream& oStream, const char* location) const
156 {
157 if(m_typeHasBeenSet)
158 {
159 oStream << location << ".Type=" << RegistryTypeMapper::GetNameForRegistryType(m_type) << "&";
160 }
161 if(m_typeNameHasBeenSet)
162 {
163 oStream << location << ".TypeName=" << StringUtils::URLEncode(m_typeName.c_str()) << "&";
164 }
165 if(m_versionIdHasBeenSet)
166 {
167 oStream << location << ".VersionId=" << StringUtils::URLEncode(m_versionId.c_str()) << "&";
168 }
169 if(m_isDefaultVersionHasBeenSet)
170 {
171 oStream << location << ".IsDefaultVersion=" << std::boolalpha << m_isDefaultVersion << "&";
172 }
173 if(m_arnHasBeenSet)
174 {
175 oStream << location << ".Arn=" << StringUtils::URLEncode(m_arn.c_str()) << "&";
176 }
177 if(m_timeCreatedHasBeenSet)
178 {
179 oStream << location << ".TimeCreated=" << StringUtils::URLEncode(m_timeCreated.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
180 }
181 if(m_descriptionHasBeenSet)
182 {
183 oStream << location << ".Description=" << StringUtils::URLEncode(m_description.c_str()) << "&";
184 }
185 if(m_publicVersionNumberHasBeenSet)
186 {
187 oStream << location << ".PublicVersionNumber=" << StringUtils::URLEncode(m_publicVersionNumber.c_str()) << "&";
188 }
189 }
190
191 } // namespace Model
192 } // namespace CloudFormation
193 } // namespace Aws
194