1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/application-autoscaling/model/ScheduledAction.h>
7 #include <aws/core/utils/json/JsonSerializer.h>
8
9 #include <utility>
10
11 using namespace Aws::Utils::Json;
12 using namespace Aws::Utils;
13
14 namespace Aws
15 {
16 namespace ApplicationAutoScaling
17 {
18 namespace Model
19 {
20
ScheduledAction()21 ScheduledAction::ScheduledAction() :
22 m_scheduledActionNameHasBeenSet(false),
23 m_scheduledActionARNHasBeenSet(false),
24 m_serviceNamespace(ServiceNamespace::NOT_SET),
25 m_serviceNamespaceHasBeenSet(false),
26 m_scheduleHasBeenSet(false),
27 m_timezoneHasBeenSet(false),
28 m_resourceIdHasBeenSet(false),
29 m_scalableDimension(ScalableDimension::NOT_SET),
30 m_scalableDimensionHasBeenSet(false),
31 m_startTimeHasBeenSet(false),
32 m_endTimeHasBeenSet(false),
33 m_scalableTargetActionHasBeenSet(false),
34 m_creationTimeHasBeenSet(false)
35 {
36 }
37
ScheduledAction(JsonView jsonValue)38 ScheduledAction::ScheduledAction(JsonView jsonValue) :
39 m_scheduledActionNameHasBeenSet(false),
40 m_scheduledActionARNHasBeenSet(false),
41 m_serviceNamespace(ServiceNamespace::NOT_SET),
42 m_serviceNamespaceHasBeenSet(false),
43 m_scheduleHasBeenSet(false),
44 m_timezoneHasBeenSet(false),
45 m_resourceIdHasBeenSet(false),
46 m_scalableDimension(ScalableDimension::NOT_SET),
47 m_scalableDimensionHasBeenSet(false),
48 m_startTimeHasBeenSet(false),
49 m_endTimeHasBeenSet(false),
50 m_scalableTargetActionHasBeenSet(false),
51 m_creationTimeHasBeenSet(false)
52 {
53 *this = jsonValue;
54 }
55
operator =(JsonView jsonValue)56 ScheduledAction& ScheduledAction::operator =(JsonView jsonValue)
57 {
58 if(jsonValue.ValueExists("ScheduledActionName"))
59 {
60 m_scheduledActionName = jsonValue.GetString("ScheduledActionName");
61
62 m_scheduledActionNameHasBeenSet = true;
63 }
64
65 if(jsonValue.ValueExists("ScheduledActionARN"))
66 {
67 m_scheduledActionARN = jsonValue.GetString("ScheduledActionARN");
68
69 m_scheduledActionARNHasBeenSet = true;
70 }
71
72 if(jsonValue.ValueExists("ServiceNamespace"))
73 {
74 m_serviceNamespace = ServiceNamespaceMapper::GetServiceNamespaceForName(jsonValue.GetString("ServiceNamespace"));
75
76 m_serviceNamespaceHasBeenSet = true;
77 }
78
79 if(jsonValue.ValueExists("Schedule"))
80 {
81 m_schedule = jsonValue.GetString("Schedule");
82
83 m_scheduleHasBeenSet = true;
84 }
85
86 if(jsonValue.ValueExists("Timezone"))
87 {
88 m_timezone = jsonValue.GetString("Timezone");
89
90 m_timezoneHasBeenSet = true;
91 }
92
93 if(jsonValue.ValueExists("ResourceId"))
94 {
95 m_resourceId = jsonValue.GetString("ResourceId");
96
97 m_resourceIdHasBeenSet = true;
98 }
99
100 if(jsonValue.ValueExists("ScalableDimension"))
101 {
102 m_scalableDimension = ScalableDimensionMapper::GetScalableDimensionForName(jsonValue.GetString("ScalableDimension"));
103
104 m_scalableDimensionHasBeenSet = true;
105 }
106
107 if(jsonValue.ValueExists("StartTime"))
108 {
109 m_startTime = jsonValue.GetDouble("StartTime");
110
111 m_startTimeHasBeenSet = true;
112 }
113
114 if(jsonValue.ValueExists("EndTime"))
115 {
116 m_endTime = jsonValue.GetDouble("EndTime");
117
118 m_endTimeHasBeenSet = true;
119 }
120
121 if(jsonValue.ValueExists("ScalableTargetAction"))
122 {
123 m_scalableTargetAction = jsonValue.GetObject("ScalableTargetAction");
124
125 m_scalableTargetActionHasBeenSet = true;
126 }
127
128 if(jsonValue.ValueExists("CreationTime"))
129 {
130 m_creationTime = jsonValue.GetDouble("CreationTime");
131
132 m_creationTimeHasBeenSet = true;
133 }
134
135 return *this;
136 }
137
Jsonize() const138 JsonValue ScheduledAction::Jsonize() const
139 {
140 JsonValue payload;
141
142 if(m_scheduledActionNameHasBeenSet)
143 {
144 payload.WithString("ScheduledActionName", m_scheduledActionName);
145
146 }
147
148 if(m_scheduledActionARNHasBeenSet)
149 {
150 payload.WithString("ScheduledActionARN", m_scheduledActionARN);
151
152 }
153
154 if(m_serviceNamespaceHasBeenSet)
155 {
156 payload.WithString("ServiceNamespace", ServiceNamespaceMapper::GetNameForServiceNamespace(m_serviceNamespace));
157 }
158
159 if(m_scheduleHasBeenSet)
160 {
161 payload.WithString("Schedule", m_schedule);
162
163 }
164
165 if(m_timezoneHasBeenSet)
166 {
167 payload.WithString("Timezone", m_timezone);
168
169 }
170
171 if(m_resourceIdHasBeenSet)
172 {
173 payload.WithString("ResourceId", m_resourceId);
174
175 }
176
177 if(m_scalableDimensionHasBeenSet)
178 {
179 payload.WithString("ScalableDimension", ScalableDimensionMapper::GetNameForScalableDimension(m_scalableDimension));
180 }
181
182 if(m_startTimeHasBeenSet)
183 {
184 payload.WithDouble("StartTime", m_startTime.SecondsWithMSPrecision());
185 }
186
187 if(m_endTimeHasBeenSet)
188 {
189 payload.WithDouble("EndTime", m_endTime.SecondsWithMSPrecision());
190 }
191
192 if(m_scalableTargetActionHasBeenSet)
193 {
194 payload.WithObject("ScalableTargetAction", m_scalableTargetAction.Jsonize());
195
196 }
197
198 if(m_creationTimeHasBeenSet)
199 {
200 payload.WithDouble("CreationTime", m_creationTime.SecondsWithMSPrecision());
201 }
202
203 return payload;
204 }
205
206 } // namespace Model
207 } // namespace ApplicationAutoScaling
208 } // namespace Aws
209