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