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/LaunchTemplateEbsBlockDeviceRequest.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
LaunchTemplateEbsBlockDeviceRequest()23 LaunchTemplateEbsBlockDeviceRequest::LaunchTemplateEbsBlockDeviceRequest() :
24 m_encrypted(false),
25 m_encryptedHasBeenSet(false),
26 m_deleteOnTermination(false),
27 m_deleteOnTerminationHasBeenSet(false),
28 m_iops(0),
29 m_iopsHasBeenSet(false),
30 m_kmsKeyIdHasBeenSet(false),
31 m_snapshotIdHasBeenSet(false),
32 m_volumeSize(0),
33 m_volumeSizeHasBeenSet(false),
34 m_volumeType(VolumeType::NOT_SET),
35 m_volumeTypeHasBeenSet(false),
36 m_throughput(0),
37 m_throughputHasBeenSet(false)
38 {
39 }
40
LaunchTemplateEbsBlockDeviceRequest(const XmlNode & xmlNode)41 LaunchTemplateEbsBlockDeviceRequest::LaunchTemplateEbsBlockDeviceRequest(const XmlNode& xmlNode) :
42 m_encrypted(false),
43 m_encryptedHasBeenSet(false),
44 m_deleteOnTermination(false),
45 m_deleteOnTerminationHasBeenSet(false),
46 m_iops(0),
47 m_iopsHasBeenSet(false),
48 m_kmsKeyIdHasBeenSet(false),
49 m_snapshotIdHasBeenSet(false),
50 m_volumeSize(0),
51 m_volumeSizeHasBeenSet(false),
52 m_volumeType(VolumeType::NOT_SET),
53 m_volumeTypeHasBeenSet(false),
54 m_throughput(0),
55 m_throughputHasBeenSet(false)
56 {
57 *this = xmlNode;
58 }
59
operator =(const XmlNode & xmlNode)60 LaunchTemplateEbsBlockDeviceRequest& LaunchTemplateEbsBlockDeviceRequest::operator =(const XmlNode& xmlNode)
61 {
62 XmlNode resultNode = xmlNode;
63
64 if(!resultNode.IsNull())
65 {
66 XmlNode encryptedNode = resultNode.FirstChild("Encrypted");
67 if(!encryptedNode.IsNull())
68 {
69 m_encrypted = StringUtils::ConvertToBool(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(encryptedNode.GetText()).c_str()).c_str());
70 m_encryptedHasBeenSet = true;
71 }
72 XmlNode deleteOnTerminationNode = resultNode.FirstChild("DeleteOnTermination");
73 if(!deleteOnTerminationNode.IsNull())
74 {
75 m_deleteOnTermination = StringUtils::ConvertToBool(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(deleteOnTerminationNode.GetText()).c_str()).c_str());
76 m_deleteOnTerminationHasBeenSet = true;
77 }
78 XmlNode iopsNode = resultNode.FirstChild("Iops");
79 if(!iopsNode.IsNull())
80 {
81 m_iops = StringUtils::ConvertToInt32(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(iopsNode.GetText()).c_str()).c_str());
82 m_iopsHasBeenSet = true;
83 }
84 XmlNode kmsKeyIdNode = resultNode.FirstChild("KmsKeyId");
85 if(!kmsKeyIdNode.IsNull())
86 {
87 m_kmsKeyId = Aws::Utils::Xml::DecodeEscapedXmlText(kmsKeyIdNode.GetText());
88 m_kmsKeyIdHasBeenSet = true;
89 }
90 XmlNode snapshotIdNode = resultNode.FirstChild("SnapshotId");
91 if(!snapshotIdNode.IsNull())
92 {
93 m_snapshotId = Aws::Utils::Xml::DecodeEscapedXmlText(snapshotIdNode.GetText());
94 m_snapshotIdHasBeenSet = true;
95 }
96 XmlNode volumeSizeNode = resultNode.FirstChild("VolumeSize");
97 if(!volumeSizeNode.IsNull())
98 {
99 m_volumeSize = StringUtils::ConvertToInt32(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(volumeSizeNode.GetText()).c_str()).c_str());
100 m_volumeSizeHasBeenSet = true;
101 }
102 XmlNode volumeTypeNode = resultNode.FirstChild("VolumeType");
103 if(!volumeTypeNode.IsNull())
104 {
105 m_volumeType = VolumeTypeMapper::GetVolumeTypeForName(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(volumeTypeNode.GetText()).c_str()).c_str());
106 m_volumeTypeHasBeenSet = true;
107 }
108 XmlNode throughputNode = resultNode.FirstChild("Throughput");
109 if(!throughputNode.IsNull())
110 {
111 m_throughput = StringUtils::ConvertToInt32(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(throughputNode.GetText()).c_str()).c_str());
112 m_throughputHasBeenSet = true;
113 }
114 }
115
116 return *this;
117 }
118
OutputToStream(Aws::OStream & oStream,const char * location,unsigned index,const char * locationValue) const119 void LaunchTemplateEbsBlockDeviceRequest::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
120 {
121 if(m_encryptedHasBeenSet)
122 {
123 oStream << location << index << locationValue << ".Encrypted=" << std::boolalpha << m_encrypted << "&";
124 }
125
126 if(m_deleteOnTerminationHasBeenSet)
127 {
128 oStream << location << index << locationValue << ".DeleteOnTermination=" << std::boolalpha << m_deleteOnTermination << "&";
129 }
130
131 if(m_iopsHasBeenSet)
132 {
133 oStream << location << index << locationValue << ".Iops=" << m_iops << "&";
134 }
135
136 if(m_kmsKeyIdHasBeenSet)
137 {
138 oStream << location << index << locationValue << ".KmsKeyId=" << StringUtils::URLEncode(m_kmsKeyId.c_str()) << "&";
139 }
140
141 if(m_snapshotIdHasBeenSet)
142 {
143 oStream << location << index << locationValue << ".SnapshotId=" << StringUtils::URLEncode(m_snapshotId.c_str()) << "&";
144 }
145
146 if(m_volumeSizeHasBeenSet)
147 {
148 oStream << location << index << locationValue << ".VolumeSize=" << m_volumeSize << "&";
149 }
150
151 if(m_volumeTypeHasBeenSet)
152 {
153 oStream << location << index << locationValue << ".VolumeType=" << VolumeTypeMapper::GetNameForVolumeType(m_volumeType) << "&";
154 }
155
156 if(m_throughputHasBeenSet)
157 {
158 oStream << location << index << locationValue << ".Throughput=" << m_throughput << "&";
159 }
160
161 }
162
OutputToStream(Aws::OStream & oStream,const char * location) const163 void LaunchTemplateEbsBlockDeviceRequest::OutputToStream(Aws::OStream& oStream, const char* location) const
164 {
165 if(m_encryptedHasBeenSet)
166 {
167 oStream << location << ".Encrypted=" << std::boolalpha << m_encrypted << "&";
168 }
169 if(m_deleteOnTerminationHasBeenSet)
170 {
171 oStream << location << ".DeleteOnTermination=" << std::boolalpha << m_deleteOnTermination << "&";
172 }
173 if(m_iopsHasBeenSet)
174 {
175 oStream << location << ".Iops=" << m_iops << "&";
176 }
177 if(m_kmsKeyIdHasBeenSet)
178 {
179 oStream << location << ".KmsKeyId=" << StringUtils::URLEncode(m_kmsKeyId.c_str()) << "&";
180 }
181 if(m_snapshotIdHasBeenSet)
182 {
183 oStream << location << ".SnapshotId=" << StringUtils::URLEncode(m_snapshotId.c_str()) << "&";
184 }
185 if(m_volumeSizeHasBeenSet)
186 {
187 oStream << location << ".VolumeSize=" << m_volumeSize << "&";
188 }
189 if(m_volumeTypeHasBeenSet)
190 {
191 oStream << location << ".VolumeType=" << VolumeTypeMapper::GetNameForVolumeType(m_volumeType) << "&";
192 }
193 if(m_throughputHasBeenSet)
194 {
195 oStream << location << ".Throughput=" << m_throughput << "&";
196 }
197 }
198
199 } // namespace Model
200 } // namespace EC2
201 } // namespace Aws
202