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/ConnectionLogResponseOptions.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
ConnectionLogResponseOptions()23 ConnectionLogResponseOptions::ConnectionLogResponseOptions() :
24 m_enabled(false),
25 m_enabledHasBeenSet(false),
26 m_cloudwatchLogGroupHasBeenSet(false),
27 m_cloudwatchLogStreamHasBeenSet(false)
28 {
29 }
30
ConnectionLogResponseOptions(const XmlNode & xmlNode)31 ConnectionLogResponseOptions::ConnectionLogResponseOptions(const XmlNode& xmlNode) :
32 m_enabled(false),
33 m_enabledHasBeenSet(false),
34 m_cloudwatchLogGroupHasBeenSet(false),
35 m_cloudwatchLogStreamHasBeenSet(false)
36 {
37 *this = xmlNode;
38 }
39
operator =(const XmlNode & xmlNode)40 ConnectionLogResponseOptions& ConnectionLogResponseOptions::operator =(const XmlNode& xmlNode)
41 {
42 XmlNode resultNode = xmlNode;
43
44 if(!resultNode.IsNull())
45 {
46 XmlNode enabledNode = resultNode.FirstChild("Enabled");
47 if(!enabledNode.IsNull())
48 {
49 m_enabled = StringUtils::ConvertToBool(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(enabledNode.GetText()).c_str()).c_str());
50 m_enabledHasBeenSet = true;
51 }
52 XmlNode cloudwatchLogGroupNode = resultNode.FirstChild("CloudwatchLogGroup");
53 if(!cloudwatchLogGroupNode.IsNull())
54 {
55 m_cloudwatchLogGroup = Aws::Utils::Xml::DecodeEscapedXmlText(cloudwatchLogGroupNode.GetText());
56 m_cloudwatchLogGroupHasBeenSet = true;
57 }
58 XmlNode cloudwatchLogStreamNode = resultNode.FirstChild("CloudwatchLogStream");
59 if(!cloudwatchLogStreamNode.IsNull())
60 {
61 m_cloudwatchLogStream = Aws::Utils::Xml::DecodeEscapedXmlText(cloudwatchLogStreamNode.GetText());
62 m_cloudwatchLogStreamHasBeenSet = true;
63 }
64 }
65
66 return *this;
67 }
68
OutputToStream(Aws::OStream & oStream,const char * location,unsigned index,const char * locationValue) const69 void ConnectionLogResponseOptions::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
70 {
71 if(m_enabledHasBeenSet)
72 {
73 oStream << location << index << locationValue << ".Enabled=" << std::boolalpha << m_enabled << "&";
74 }
75
76 if(m_cloudwatchLogGroupHasBeenSet)
77 {
78 oStream << location << index << locationValue << ".CloudwatchLogGroup=" << StringUtils::URLEncode(m_cloudwatchLogGroup.c_str()) << "&";
79 }
80
81 if(m_cloudwatchLogStreamHasBeenSet)
82 {
83 oStream << location << index << locationValue << ".CloudwatchLogStream=" << StringUtils::URLEncode(m_cloudwatchLogStream.c_str()) << "&";
84 }
85
86 }
87
OutputToStream(Aws::OStream & oStream,const char * location) const88 void ConnectionLogResponseOptions::OutputToStream(Aws::OStream& oStream, const char* location) const
89 {
90 if(m_enabledHasBeenSet)
91 {
92 oStream << location << ".Enabled=" << std::boolalpha << m_enabled << "&";
93 }
94 if(m_cloudwatchLogGroupHasBeenSet)
95 {
96 oStream << location << ".CloudwatchLogGroup=" << StringUtils::URLEncode(m_cloudwatchLogGroup.c_str()) << "&";
97 }
98 if(m_cloudwatchLogStreamHasBeenSet)
99 {
100 oStream << location << ".CloudwatchLogStream=" << StringUtils::URLEncode(m_cloudwatchLogStream.c_str()) << "&";
101 }
102 }
103
104 } // namespace Model
105 } // namespace EC2
106 } // namespace Aws
107