1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/glue/model/Schedule.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 Glue
17 {
18 namespace Model
19 {
20 
Schedule()21 Schedule::Schedule() :
22     m_scheduleExpressionHasBeenSet(false),
23     m_state(ScheduleState::NOT_SET),
24     m_stateHasBeenSet(false)
25 {
26 }
27 
Schedule(JsonView jsonValue)28 Schedule::Schedule(JsonView jsonValue) :
29     m_scheduleExpressionHasBeenSet(false),
30     m_state(ScheduleState::NOT_SET),
31     m_stateHasBeenSet(false)
32 {
33   *this = jsonValue;
34 }
35 
operator =(JsonView jsonValue)36 Schedule& Schedule::operator =(JsonView jsonValue)
37 {
38   if(jsonValue.ValueExists("ScheduleExpression"))
39   {
40     m_scheduleExpression = jsonValue.GetString("ScheduleExpression");
41 
42     m_scheduleExpressionHasBeenSet = true;
43   }
44 
45   if(jsonValue.ValueExists("State"))
46   {
47     m_state = ScheduleStateMapper::GetScheduleStateForName(jsonValue.GetString("State"));
48 
49     m_stateHasBeenSet = true;
50   }
51 
52   return *this;
53 }
54 
Jsonize() const55 JsonValue Schedule::Jsonize() const
56 {
57   JsonValue payload;
58 
59   if(m_scheduleExpressionHasBeenSet)
60   {
61    payload.WithString("ScheduleExpression", m_scheduleExpression);
62 
63   }
64 
65   if(m_stateHasBeenSet)
66   {
67    payload.WithString("State", ScheduleStateMapper::GetNameForScheduleState(m_state));
68   }
69 
70   return payload;
71 }
72 
73 } // namespace Model
74 } // namespace Glue
75 } // namespace Aws
76