1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/events/model/Replay.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 CloudWatchEvents
17 {
18 namespace Model
19 {
20
Replay()21 Replay::Replay() :
22 m_replayNameHasBeenSet(false),
23 m_eventSourceArnHasBeenSet(false),
24 m_state(ReplayState::NOT_SET),
25 m_stateHasBeenSet(false),
26 m_stateReasonHasBeenSet(false),
27 m_eventStartTimeHasBeenSet(false),
28 m_eventEndTimeHasBeenSet(false),
29 m_eventLastReplayedTimeHasBeenSet(false),
30 m_replayStartTimeHasBeenSet(false),
31 m_replayEndTimeHasBeenSet(false)
32 {
33 }
34
Replay(JsonView jsonValue)35 Replay::Replay(JsonView jsonValue) :
36 m_replayNameHasBeenSet(false),
37 m_eventSourceArnHasBeenSet(false),
38 m_state(ReplayState::NOT_SET),
39 m_stateHasBeenSet(false),
40 m_stateReasonHasBeenSet(false),
41 m_eventStartTimeHasBeenSet(false),
42 m_eventEndTimeHasBeenSet(false),
43 m_eventLastReplayedTimeHasBeenSet(false),
44 m_replayStartTimeHasBeenSet(false),
45 m_replayEndTimeHasBeenSet(false)
46 {
47 *this = jsonValue;
48 }
49
operator =(JsonView jsonValue)50 Replay& Replay::operator =(JsonView jsonValue)
51 {
52 if(jsonValue.ValueExists("ReplayName"))
53 {
54 m_replayName = jsonValue.GetString("ReplayName");
55
56 m_replayNameHasBeenSet = true;
57 }
58
59 if(jsonValue.ValueExists("EventSourceArn"))
60 {
61 m_eventSourceArn = jsonValue.GetString("EventSourceArn");
62
63 m_eventSourceArnHasBeenSet = true;
64 }
65
66 if(jsonValue.ValueExists("State"))
67 {
68 m_state = ReplayStateMapper::GetReplayStateForName(jsonValue.GetString("State"));
69
70 m_stateHasBeenSet = true;
71 }
72
73 if(jsonValue.ValueExists("StateReason"))
74 {
75 m_stateReason = jsonValue.GetString("StateReason");
76
77 m_stateReasonHasBeenSet = true;
78 }
79
80 if(jsonValue.ValueExists("EventStartTime"))
81 {
82 m_eventStartTime = jsonValue.GetDouble("EventStartTime");
83
84 m_eventStartTimeHasBeenSet = true;
85 }
86
87 if(jsonValue.ValueExists("EventEndTime"))
88 {
89 m_eventEndTime = jsonValue.GetDouble("EventEndTime");
90
91 m_eventEndTimeHasBeenSet = true;
92 }
93
94 if(jsonValue.ValueExists("EventLastReplayedTime"))
95 {
96 m_eventLastReplayedTime = jsonValue.GetDouble("EventLastReplayedTime");
97
98 m_eventLastReplayedTimeHasBeenSet = true;
99 }
100
101 if(jsonValue.ValueExists("ReplayStartTime"))
102 {
103 m_replayStartTime = jsonValue.GetDouble("ReplayStartTime");
104
105 m_replayStartTimeHasBeenSet = true;
106 }
107
108 if(jsonValue.ValueExists("ReplayEndTime"))
109 {
110 m_replayEndTime = jsonValue.GetDouble("ReplayEndTime");
111
112 m_replayEndTimeHasBeenSet = true;
113 }
114
115 return *this;
116 }
117
Jsonize() const118 JsonValue Replay::Jsonize() const
119 {
120 JsonValue payload;
121
122 if(m_replayNameHasBeenSet)
123 {
124 payload.WithString("ReplayName", m_replayName);
125
126 }
127
128 if(m_eventSourceArnHasBeenSet)
129 {
130 payload.WithString("EventSourceArn", m_eventSourceArn);
131
132 }
133
134 if(m_stateHasBeenSet)
135 {
136 payload.WithString("State", ReplayStateMapper::GetNameForReplayState(m_state));
137 }
138
139 if(m_stateReasonHasBeenSet)
140 {
141 payload.WithString("StateReason", m_stateReason);
142
143 }
144
145 if(m_eventStartTimeHasBeenSet)
146 {
147 payload.WithDouble("EventStartTime", m_eventStartTime.SecondsWithMSPrecision());
148 }
149
150 if(m_eventEndTimeHasBeenSet)
151 {
152 payload.WithDouble("EventEndTime", m_eventEndTime.SecondsWithMSPrecision());
153 }
154
155 if(m_eventLastReplayedTimeHasBeenSet)
156 {
157 payload.WithDouble("EventLastReplayedTime", m_eventLastReplayedTime.SecondsWithMSPrecision());
158 }
159
160 if(m_replayStartTimeHasBeenSet)
161 {
162 payload.WithDouble("ReplayStartTime", m_replayStartTime.SecondsWithMSPrecision());
163 }
164
165 if(m_replayEndTimeHasBeenSet)
166 {
167 payload.WithDouble("ReplayEndTime", m_replayEndTime.SecondsWithMSPrecision());
168 }
169
170 return payload;
171 }
172
173 } // namespace Model
174 } // namespace CloudWatchEvents
175 } // namespace Aws
176