1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/autoscaling/model/ScheduledUpdateGroupAction.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 AutoScaling
19 {
20 namespace Model
21 {
22
ScheduledUpdateGroupAction()23 ScheduledUpdateGroupAction::ScheduledUpdateGroupAction() :
24 m_autoScalingGroupNameHasBeenSet(false),
25 m_scheduledActionNameHasBeenSet(false),
26 m_scheduledActionARNHasBeenSet(false),
27 m_timeHasBeenSet(false),
28 m_startTimeHasBeenSet(false),
29 m_endTimeHasBeenSet(false),
30 m_recurrenceHasBeenSet(false),
31 m_minSize(0),
32 m_minSizeHasBeenSet(false),
33 m_maxSize(0),
34 m_maxSizeHasBeenSet(false),
35 m_desiredCapacity(0),
36 m_desiredCapacityHasBeenSet(false),
37 m_timeZoneHasBeenSet(false)
38 {
39 }
40
ScheduledUpdateGroupAction(const XmlNode & xmlNode)41 ScheduledUpdateGroupAction::ScheduledUpdateGroupAction(const XmlNode& xmlNode) :
42 m_autoScalingGroupNameHasBeenSet(false),
43 m_scheduledActionNameHasBeenSet(false),
44 m_scheduledActionARNHasBeenSet(false),
45 m_timeHasBeenSet(false),
46 m_startTimeHasBeenSet(false),
47 m_endTimeHasBeenSet(false),
48 m_recurrenceHasBeenSet(false),
49 m_minSize(0),
50 m_minSizeHasBeenSet(false),
51 m_maxSize(0),
52 m_maxSizeHasBeenSet(false),
53 m_desiredCapacity(0),
54 m_desiredCapacityHasBeenSet(false),
55 m_timeZoneHasBeenSet(false)
56 {
57 *this = xmlNode;
58 }
59
operator =(const XmlNode & xmlNode)60 ScheduledUpdateGroupAction& ScheduledUpdateGroupAction::operator =(const XmlNode& xmlNode)
61 {
62 XmlNode resultNode = xmlNode;
63
64 if(!resultNode.IsNull())
65 {
66 XmlNode autoScalingGroupNameNode = resultNode.FirstChild("AutoScalingGroupName");
67 if(!autoScalingGroupNameNode.IsNull())
68 {
69 m_autoScalingGroupName = Aws::Utils::Xml::DecodeEscapedXmlText(autoScalingGroupNameNode.GetText());
70 m_autoScalingGroupNameHasBeenSet = true;
71 }
72 XmlNode scheduledActionNameNode = resultNode.FirstChild("ScheduledActionName");
73 if(!scheduledActionNameNode.IsNull())
74 {
75 m_scheduledActionName = Aws::Utils::Xml::DecodeEscapedXmlText(scheduledActionNameNode.GetText());
76 m_scheduledActionNameHasBeenSet = true;
77 }
78 XmlNode scheduledActionARNNode = resultNode.FirstChild("ScheduledActionARN");
79 if(!scheduledActionARNNode.IsNull())
80 {
81 m_scheduledActionARN = Aws::Utils::Xml::DecodeEscapedXmlText(scheduledActionARNNode.GetText());
82 m_scheduledActionARNHasBeenSet = true;
83 }
84 XmlNode timeNode = resultNode.FirstChild("Time");
85 if(!timeNode.IsNull())
86 {
87 m_time = DateTime(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(timeNode.GetText()).c_str()).c_str(), DateFormat::ISO_8601);
88 m_timeHasBeenSet = true;
89 }
90 XmlNode startTimeNode = resultNode.FirstChild("StartTime");
91 if(!startTimeNode.IsNull())
92 {
93 m_startTime = DateTime(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(startTimeNode.GetText()).c_str()).c_str(), DateFormat::ISO_8601);
94 m_startTimeHasBeenSet = true;
95 }
96 XmlNode endTimeNode = resultNode.FirstChild("EndTime");
97 if(!endTimeNode.IsNull())
98 {
99 m_endTime = DateTime(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(endTimeNode.GetText()).c_str()).c_str(), DateFormat::ISO_8601);
100 m_endTimeHasBeenSet = true;
101 }
102 XmlNode recurrenceNode = resultNode.FirstChild("Recurrence");
103 if(!recurrenceNode.IsNull())
104 {
105 m_recurrence = Aws::Utils::Xml::DecodeEscapedXmlText(recurrenceNode.GetText());
106 m_recurrenceHasBeenSet = true;
107 }
108 XmlNode minSizeNode = resultNode.FirstChild("MinSize");
109 if(!minSizeNode.IsNull())
110 {
111 m_minSize = StringUtils::ConvertToInt32(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(minSizeNode.GetText()).c_str()).c_str());
112 m_minSizeHasBeenSet = true;
113 }
114 XmlNode maxSizeNode = resultNode.FirstChild("MaxSize");
115 if(!maxSizeNode.IsNull())
116 {
117 m_maxSize = StringUtils::ConvertToInt32(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(maxSizeNode.GetText()).c_str()).c_str());
118 m_maxSizeHasBeenSet = true;
119 }
120 XmlNode desiredCapacityNode = resultNode.FirstChild("DesiredCapacity");
121 if(!desiredCapacityNode.IsNull())
122 {
123 m_desiredCapacity = StringUtils::ConvertToInt32(StringUtils::Trim(Aws::Utils::Xml::DecodeEscapedXmlText(desiredCapacityNode.GetText()).c_str()).c_str());
124 m_desiredCapacityHasBeenSet = true;
125 }
126 XmlNode timeZoneNode = resultNode.FirstChild("TimeZone");
127 if(!timeZoneNode.IsNull())
128 {
129 m_timeZone = Aws::Utils::Xml::DecodeEscapedXmlText(timeZoneNode.GetText());
130 m_timeZoneHasBeenSet = true;
131 }
132 }
133
134 return *this;
135 }
136
OutputToStream(Aws::OStream & oStream,const char * location,unsigned index,const char * locationValue) const137 void ScheduledUpdateGroupAction::OutputToStream(Aws::OStream& oStream, const char* location, unsigned index, const char* locationValue) const
138 {
139 if(m_autoScalingGroupNameHasBeenSet)
140 {
141 oStream << location << index << locationValue << ".AutoScalingGroupName=" << StringUtils::URLEncode(m_autoScalingGroupName.c_str()) << "&";
142 }
143
144 if(m_scheduledActionNameHasBeenSet)
145 {
146 oStream << location << index << locationValue << ".ScheduledActionName=" << StringUtils::URLEncode(m_scheduledActionName.c_str()) << "&";
147 }
148
149 if(m_scheduledActionARNHasBeenSet)
150 {
151 oStream << location << index << locationValue << ".ScheduledActionARN=" << StringUtils::URLEncode(m_scheduledActionARN.c_str()) << "&";
152 }
153
154 if(m_timeHasBeenSet)
155 {
156 oStream << location << index << locationValue << ".Time=" << StringUtils::URLEncode(m_time.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
157 }
158
159 if(m_startTimeHasBeenSet)
160 {
161 oStream << location << index << locationValue << ".StartTime=" << StringUtils::URLEncode(m_startTime.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
162 }
163
164 if(m_endTimeHasBeenSet)
165 {
166 oStream << location << index << locationValue << ".EndTime=" << StringUtils::URLEncode(m_endTime.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
167 }
168
169 if(m_recurrenceHasBeenSet)
170 {
171 oStream << location << index << locationValue << ".Recurrence=" << StringUtils::URLEncode(m_recurrence.c_str()) << "&";
172 }
173
174 if(m_minSizeHasBeenSet)
175 {
176 oStream << location << index << locationValue << ".MinSize=" << m_minSize << "&";
177 }
178
179 if(m_maxSizeHasBeenSet)
180 {
181 oStream << location << index << locationValue << ".MaxSize=" << m_maxSize << "&";
182 }
183
184 if(m_desiredCapacityHasBeenSet)
185 {
186 oStream << location << index << locationValue << ".DesiredCapacity=" << m_desiredCapacity << "&";
187 }
188
189 if(m_timeZoneHasBeenSet)
190 {
191 oStream << location << index << locationValue << ".TimeZone=" << StringUtils::URLEncode(m_timeZone.c_str()) << "&";
192 }
193
194 }
195
OutputToStream(Aws::OStream & oStream,const char * location) const196 void ScheduledUpdateGroupAction::OutputToStream(Aws::OStream& oStream, const char* location) const
197 {
198 if(m_autoScalingGroupNameHasBeenSet)
199 {
200 oStream << location << ".AutoScalingGroupName=" << StringUtils::URLEncode(m_autoScalingGroupName.c_str()) << "&";
201 }
202 if(m_scheduledActionNameHasBeenSet)
203 {
204 oStream << location << ".ScheduledActionName=" << StringUtils::URLEncode(m_scheduledActionName.c_str()) << "&";
205 }
206 if(m_scheduledActionARNHasBeenSet)
207 {
208 oStream << location << ".ScheduledActionARN=" << StringUtils::URLEncode(m_scheduledActionARN.c_str()) << "&";
209 }
210 if(m_timeHasBeenSet)
211 {
212 oStream << location << ".Time=" << StringUtils::URLEncode(m_time.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
213 }
214 if(m_startTimeHasBeenSet)
215 {
216 oStream << location << ".StartTime=" << StringUtils::URLEncode(m_startTime.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
217 }
218 if(m_endTimeHasBeenSet)
219 {
220 oStream << location << ".EndTime=" << StringUtils::URLEncode(m_endTime.ToGmtString(DateFormat::ISO_8601).c_str()) << "&";
221 }
222 if(m_recurrenceHasBeenSet)
223 {
224 oStream << location << ".Recurrence=" << StringUtils::URLEncode(m_recurrence.c_str()) << "&";
225 }
226 if(m_minSizeHasBeenSet)
227 {
228 oStream << location << ".MinSize=" << m_minSize << "&";
229 }
230 if(m_maxSizeHasBeenSet)
231 {
232 oStream << location << ".MaxSize=" << m_maxSize << "&";
233 }
234 if(m_desiredCapacityHasBeenSet)
235 {
236 oStream << location << ".DesiredCapacity=" << m_desiredCapacity << "&";
237 }
238 if(m_timeZoneHasBeenSet)
239 {
240 oStream << location << ".TimeZone=" << StringUtils::URLEncode(m_timeZone.c_str()) << "&";
241 }
242 }
243
244 } // namespace Model
245 } // namespace AutoScaling
246 } // namespace Aws
247