1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/monitoring/model/PartialFailure.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 CloudWatch
19 {
20 namespace Model
21 {
22 
PartialFailure()23 PartialFailure::PartialFailure() :
24     m_failureResourceHasBeenSet(false),
25     m_exceptionTypeHasBeenSet(false),
26     m_failureCodeHasBeenSet(false),
27     m_failureDescriptionHasBeenSet(false)
28 {
29 }
30 
PartialFailure(const XmlNode & xmlNode)31 PartialFailure::PartialFailure(const XmlNode& xmlNode) :
32     m_failureResourceHasBeenSet(false),
33     m_exceptionTypeHasBeenSet(false),
34     m_failureCodeHasBeenSet(false),
35     m_failureDescriptionHasBeenSet(false)
36 {
37   *this = xmlNode;
38 }
39 
operator =(const XmlNode & xmlNode)40 PartialFailure& PartialFailure::operator =(const XmlNode& xmlNode)
41 {
42   XmlNode resultNode = xmlNode;
43 
44   if(!resultNode.IsNull())
45   {
46     XmlNode failureResourceNode = resultNode.FirstChild("FailureResource");
47     if(!failureResourceNode.IsNull())
48     {
49       m_failureResource = Aws::Utils::Xml::DecodeEscapedXmlText(failureResourceNode.GetText());
50       m_failureResourceHasBeenSet = true;
51     }
52     XmlNode exceptionTypeNode = resultNode.FirstChild("ExceptionType");
53     if(!exceptionTypeNode.IsNull())
54     {
55       m_exceptionType = Aws::Utils::Xml::DecodeEscapedXmlText(exceptionTypeNode.GetText());
56       m_exceptionTypeHasBeenSet = true;
57     }
58     XmlNode failureCodeNode = resultNode.FirstChild("FailureCode");
59     if(!failureCodeNode.IsNull())
60     {
61       m_failureCode = Aws::Utils::Xml::DecodeEscapedXmlText(failureCodeNode.GetText());
62       m_failureCodeHasBeenSet = true;
63     }
64     XmlNode failureDescriptionNode = resultNode.FirstChild("FailureDescription");
65     if(!failureDescriptionNode.IsNull())
66     {
67       m_failureDescription = Aws::Utils::Xml::DecodeEscapedXmlText(failureDescriptionNode.GetText());
68       m_failureDescriptionHasBeenSet = true;
69     }
70   }
71 
72   return *this;
73 }
74 
OutputToStream(Aws::OStream & oStream,const char * location,unsigned index,const char * locationValue) const75 void PartialFailure::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
76 {
77   if(m_failureResourceHasBeenSet)
78   {
79       oStream << location << index << locationValue << ".FailureResource=" << StringUtils::URLEncode(m_failureResource.c_str()) << "&";
80   }
81 
82   if(m_exceptionTypeHasBeenSet)
83   {
84       oStream << location << index << locationValue << ".ExceptionType=" << StringUtils::URLEncode(m_exceptionType.c_str()) << "&";
85   }
86 
87   if(m_failureCodeHasBeenSet)
88   {
89       oStream << location << index << locationValue << ".FailureCode=" << StringUtils::URLEncode(m_failureCode.c_str()) << "&";
90   }
91 
92   if(m_failureDescriptionHasBeenSet)
93   {
94       oStream << location << index << locationValue << ".FailureDescription=" << StringUtils::URLEncode(m_failureDescription.c_str()) << "&";
95   }
96 
97 }
98 
OutputToStream(Aws::OStream & oStream,const char * location) const99 void PartialFailure::OutputToStream(Aws::OStream& oStream, const char* location) const
100 {
101   if(m_failureResourceHasBeenSet)
102   {
103       oStream << location << ".FailureResource=" << StringUtils::URLEncode(m_failureResource.c_str()) << "&";
104   }
105   if(m_exceptionTypeHasBeenSet)
106   {
107       oStream << location << ".ExceptionType=" << StringUtils::URLEncode(m_exceptionType.c_str()) << "&";
108   }
109   if(m_failureCodeHasBeenSet)
110   {
111       oStream << location << ".FailureCode=" << StringUtils::URLEncode(m_failureCode.c_str()) << "&";
112   }
113   if(m_failureDescriptionHasBeenSet)
114   {
115       oStream << location << ".FailureDescription=" << StringUtils::URLEncode(m_failureDescription.c_str()) << "&";
116   }
117 }
118 
119 } // namespace Model
120 } // namespace CloudWatch
121 } // namespace Aws
122