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/ScheduledInstancesEbs.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 
ScheduledInstancesEbs()23 ScheduledInstancesEbs::ScheduledInstancesEbs() :
24     m_deleteOnTermination(false),
25     m_deleteOnTerminationHasBeenSet(false),
26     m_encrypted(false),
27     m_encryptedHasBeenSet(false),
28     m_iops(0),
29     m_iopsHasBeenSet(false),
30     m_snapshotIdHasBeenSet(false),
31     m_volumeSize(0),
32     m_volumeSizeHasBeenSet(false),
33     m_volumeTypeHasBeenSet(false)
34 {
35 }
36 
ScheduledInstancesEbs(const XmlNode & xmlNode)37 ScheduledInstancesEbs::ScheduledInstancesEbs(const XmlNode& xmlNode) :
38     m_deleteOnTermination(false),
39     m_deleteOnTerminationHasBeenSet(false),
40     m_encrypted(false),
41     m_encryptedHasBeenSet(false),
42     m_iops(0),
43     m_iopsHasBeenSet(false),
44     m_snapshotIdHasBeenSet(false),
45     m_volumeSize(0),
46     m_volumeSizeHasBeenSet(false),
47     m_volumeTypeHasBeenSet(false)
48 {
49   *this = xmlNode;
50 }
51 
operator =(const XmlNode & xmlNode)52 ScheduledInstancesEbs& ScheduledInstancesEbs::operator =(const XmlNode& xmlNode)
53 {
54   XmlNode resultNode = xmlNode;
55 
56   if(!resultNode.IsNull())
57   {
58     XmlNode deleteOnTerminationNode = resultNode.FirstChild("DeleteOnTermination");
59     if(!deleteOnTerminationNode.IsNull())
60     {
61       m_deleteOnTermination = StringUtils::ConvertToBool(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(deleteOnTerminationNode.GetText()).c_str()).c_str());
62       m_deleteOnTerminationHasBeenSet = true;
63     }
64     XmlNode encryptedNode = resultNode.FirstChild("Encrypted");
65     if(!encryptedNode.IsNull())
66     {
67       m_encrypted = StringUtils::ConvertToBool(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(encryptedNode.GetText()).c_str()).c_str());
68       m_encryptedHasBeenSet = true;
69     }
70     XmlNode iopsNode = resultNode.FirstChild("Iops");
71     if(!iopsNode.IsNull())
72     {
73       m_iops = StringUtils::ConvertToInt32(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(iopsNode.GetText()).c_str()).c_str());
74       m_iopsHasBeenSet = true;
75     }
76     XmlNode snapshotIdNode = resultNode.FirstChild("SnapshotId");
77     if(!snapshotIdNode.IsNull())
78     {
79       m_snapshotId = Aws::Utils::Xml::DecodeEscapedXmlText(snapshotIdNode.GetText());
80       m_snapshotIdHasBeenSet = true;
81     }
82     XmlNode volumeSizeNode = resultNode.FirstChild("VolumeSize");
83     if(!volumeSizeNode.IsNull())
84     {
85       m_volumeSize = StringUtils::ConvertToInt32(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(volumeSizeNode.GetText()).c_str()).c_str());
86       m_volumeSizeHasBeenSet = true;
87     }
88     XmlNode volumeTypeNode = resultNode.FirstChild("VolumeType");
89     if(!volumeTypeNode.IsNull())
90     {
91       m_volumeType = Aws::Utils::Xml::DecodeEscapedXmlText(volumeTypeNode.GetText());
92       m_volumeTypeHasBeenSet = true;
93     }
94   }
95 
96   return *this;
97 }
98 
OutputToStream(Aws::OStream & oStream,const char * location,unsigned index,const char * locationValue) const99 void ScheduledInstancesEbs::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
100 {
101   if(m_deleteOnTerminationHasBeenSet)
102   {
103       oStream << location << index << locationValue << ".DeleteOnTermination=" << std::boolalpha << m_deleteOnTermination << "&";
104   }
105 
106   if(m_encryptedHasBeenSet)
107   {
108       oStream << location << index << locationValue << ".Encrypted=" << std::boolalpha << m_encrypted << "&";
109   }
110 
111   if(m_iopsHasBeenSet)
112   {
113       oStream << location << index << locationValue << ".Iops=" << m_iops << "&";
114   }
115 
116   if(m_snapshotIdHasBeenSet)
117   {
118       oStream << location << index << locationValue << ".SnapshotId=" << StringUtils::URLEncode(m_snapshotId.c_str()) << "&";
119   }
120 
121   if(m_volumeSizeHasBeenSet)
122   {
123       oStream << location << index << locationValue << ".VolumeSize=" << m_volumeSize << "&";
124   }
125 
126   if(m_volumeTypeHasBeenSet)
127   {
128       oStream << location << index << locationValue << ".VolumeType=" << StringUtils::URLEncode(m_volumeType.c_str()) << "&";
129   }
130 
131 }
132 
OutputToStream(Aws::OStream & oStream,const char * location) const133 void ScheduledInstancesEbs::OutputToStream(Aws::OStream& oStream, const char* location) const
134 {
135   if(m_deleteOnTerminationHasBeenSet)
136   {
137       oStream << location << ".DeleteOnTermination=" << std::boolalpha << m_deleteOnTermination << "&";
138   }
139   if(m_encryptedHasBeenSet)
140   {
141       oStream << location << ".Encrypted=" << std::boolalpha << m_encrypted << "&";
142   }
143   if(m_iopsHasBeenSet)
144   {
145       oStream << location << ".Iops=" << m_iops << "&";
146   }
147   if(m_snapshotIdHasBeenSet)
148   {
149       oStream << location << ".SnapshotId=" << StringUtils::URLEncode(m_snapshotId.c_str()) << "&";
150   }
151   if(m_volumeSizeHasBeenSet)
152   {
153       oStream << location << ".VolumeSize=" << m_volumeSize << "&";
154   }
155   if(m_volumeTypeHasBeenSet)
156   {
157       oStream << location << ".VolumeType=" << StringUtils::URLEncode(m_volumeType.c_str()) << "&";
158   }
159 }
160 
161 } // namespace Model
162 } // namespace EC2
163 } // namespace Aws
164