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/DiskImageVolumeDescription.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
DiskImageVolumeDescription()23 DiskImageVolumeDescription::DiskImageVolumeDescription() :
24 m_idHasBeenSet(false),
25 m_size(0),
26 m_sizeHasBeenSet(false)
27 {
28 }
29
DiskImageVolumeDescription(const XmlNode & xmlNode)30 DiskImageVolumeDescription::DiskImageVolumeDescription(const XmlNode& xmlNode) :
31 m_idHasBeenSet(false),
32 m_size(0),
33 m_sizeHasBeenSet(false)
34 {
35 *this = xmlNode;
36 }
37
operator =(const XmlNode & xmlNode)38 DiskImageVolumeDescription& DiskImageVolumeDescription::operator =(const XmlNode& xmlNode)
39 {
40 XmlNode resultNode = xmlNode;
41
42 if(!resultNode.IsNull())
43 {
44 XmlNode idNode = resultNode.FirstChild("id");
45 if(!idNode.IsNull())
46 {
47 m_id = Aws::Utils::Xml::DecodeEscapedXmlText(idNode.GetText());
48 m_idHasBeenSet = true;
49 }
50 XmlNode sizeNode = resultNode.FirstChild("size");
51 if(!sizeNode.IsNull())
52 {
53 m_size = StringUtils::ConvertToInt64(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(sizeNode.GetText()).c_str()).c_str());
54 m_sizeHasBeenSet = true;
55 }
56 }
57
58 return *this;
59 }
60
OutputToStream(Aws::OStream & oStream,const char * location,unsigned index,const char * locationValue) const61 void DiskImageVolumeDescription::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
62 {
63 if(m_idHasBeenSet)
64 {
65 oStream << location << index << locationValue << ".Id=" << StringUtils::URLEncode(m_id.c_str()) << "&";
66 }
67
68 if(m_sizeHasBeenSet)
69 {
70 oStream << location << index << locationValue << ".Size=" << m_size << "&";
71 }
72
73 }
74
OutputToStream(Aws::OStream & oStream,const char * location) const75 void DiskImageVolumeDescription::OutputToStream(Aws::OStream& oStream, const char* location) const
76 {
77 if(m_idHasBeenSet)
78 {
79 oStream << location << ".Id=" << StringUtils::URLEncode(m_id.c_str()) << "&";
80 }
81 if(m_sizeHasBeenSet)
82 {
83 oStream << location << ".Size=" << m_size << "&";
84 }
85 }
86
87 } // namespace Model
88 } // namespace EC2
89 } // namespace Aws
90