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/DashboardEntry.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
DashboardEntry()23 DashboardEntry::DashboardEntry() :
24 m_dashboardNameHasBeenSet(false),
25 m_dashboardArnHasBeenSet(false),
26 m_lastModifiedHasBeenSet(false),
27 m_size(0),
28 m_sizeHasBeenSet(false)
29 {
30 }
31
DashboardEntry(const XmlNode & xmlNode)32 DashboardEntry::DashboardEntry(const XmlNode& xmlNode) :
33 m_dashboardNameHasBeenSet(false),
34 m_dashboardArnHasBeenSet(false),
35 m_lastModifiedHasBeenSet(false),
36 m_size(0),
37 m_sizeHasBeenSet(false)
38 {
39 *this = xmlNode;
40 }
41
operator =(const XmlNode & xmlNode)42 DashboardEntry& DashboardEntry::operator =(const XmlNode& xmlNode)
43 {
44 XmlNode resultNode = xmlNode;
45
46 if(!resultNode.IsNull())
47 {
48 XmlNode dashboardNameNode = resultNode.FirstChild("DashboardName");
49 if(!dashboardNameNode.IsNull())
50 {
51 m_dashboardName = Aws::Utils::Xml::DecodeEscapedXmlText(dashboardNameNode.GetText());
52 m_dashboardNameHasBeenSet = true;
53 }
54 XmlNode dashboardArnNode = resultNode.FirstChild("DashboardArn");
55 if(!dashboardArnNode.IsNull())
56 {
57 m_dashboardArn = Aws::Utils::Xml::DecodeEscapedXmlText(dashboardArnNode.GetText());
58 m_dashboardArnHasBeenSet = true;
59 }
60 XmlNode lastModifiedNode = resultNode.FirstChild("LastModified");
61 if(!lastModifiedNode.IsNull())
62 {
63 m_lastModified = DateTime(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(lastModifiedNode.GetText()).c_str()).c_str(), DateFormat::ISO_8601);
64 m_lastModifiedHasBeenSet = true;
65 }
66 XmlNode sizeNode = resultNode.FirstChild("Size");
67 if(!sizeNode.IsNull())
68 {
69 m_size = StringUtils::ConvertToInt64(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(sizeNode.GetText()).c_str()).c_str());
70 m_sizeHasBeenSet = true;
71 }
72 }
73
74 return *this;
75 }
76
OutputToStream(Aws::OStream & oStream,const char * location,unsigned index,const char * locationValue) const77 void DashboardEntry::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
78 {
79 if(m_dashboardNameHasBeenSet)
80 {
81 oStream << location << index << locationValue << ".DashboardName=" << StringUtils::URLEncode(m_dashboardName.c_str()) << "&";
82 }
83
84 if(m_dashboardArnHasBeenSet)
85 {
86 oStream << location << index << locationValue << ".DashboardArn=" << StringUtils::URLEncode(m_dashboardArn.c_str()) << "&";
87 }
88
89 if(m_lastModifiedHasBeenSet)
90 {
91 oStream << location << index << locationValue << ".LastModified=" << StringUtils::URLEncode(m_lastModified.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
92 }
93
94 if(m_sizeHasBeenSet)
95 {
96 oStream << location << index << locationValue << ".Size=" << m_size << "&";
97 }
98
99 }
100
OutputToStream(Aws::OStream & oStream,const char * location) const101 void DashboardEntry::OutputToStream(Aws::OStream& oStream, const char* location) const
102 {
103 if(m_dashboardNameHasBeenSet)
104 {
105 oStream << location << ".DashboardName=" << StringUtils::URLEncode(m_dashboardName.c_str()) << "&";
106 }
107 if(m_dashboardArnHasBeenSet)
108 {
109 oStream << location << ".DashboardArn=" << StringUtils::URLEncode(m_dashboardArn.c_str()) << "&";
110 }
111 if(m_lastModifiedHasBeenSet)
112 {
113 oStream << location << ".LastModified=" << StringUtils::URLEncode(m_lastModified.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
114 }
115 if(m_sizeHasBeenSet)
116 {
117 oStream << location << ".Size=" << m_size << "&";
118 }
119 }
120
121 } // namespace Model
122 } // namespace CloudWatch
123 } // namespace Aws
124