1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/route53-recovery-control-config/model/GatingRuleUpdate.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 Route53RecoveryControlConfig
17 {
18 namespace Model
19 {
20 
GatingRuleUpdate()21 GatingRuleUpdate::GatingRuleUpdate() :
22     m_nameHasBeenSet(false),
23     m_safetyRuleArnHasBeenSet(false),
24     m_waitPeriodMs(0),
25     m_waitPeriodMsHasBeenSet(false)
26 {
27 }
28 
GatingRuleUpdate(JsonView jsonValue)29 GatingRuleUpdate::GatingRuleUpdate(JsonView jsonValue) :
30     m_nameHasBeenSet(false),
31     m_safetyRuleArnHasBeenSet(false),
32     m_waitPeriodMs(0),
33     m_waitPeriodMsHasBeenSet(false)
34 {
35   *this = jsonValue;
36 }
37 
operator =(JsonView jsonValue)38 GatingRuleUpdate& GatingRuleUpdate::operator =(JsonView jsonValue)
39 {
40   if(jsonValue.ValueExists("Name"))
41   {
42     m_name = jsonValue.GetString("Name");
43 
44     m_nameHasBeenSet = true;
45   }
46 
47   if(jsonValue.ValueExists("SafetyRuleArn"))
48   {
49     m_safetyRuleArn = jsonValue.GetString("SafetyRuleArn");
50 
51     m_safetyRuleArnHasBeenSet = true;
52   }
53 
54   if(jsonValue.ValueExists("WaitPeriodMs"))
55   {
56     m_waitPeriodMs = jsonValue.GetInteger("WaitPeriodMs");
57 
58     m_waitPeriodMsHasBeenSet = true;
59   }
60 
61   return *this;
62 }
63 
Jsonize() const64 JsonValue GatingRuleUpdate::Jsonize() const
65 {
66   JsonValue payload;
67 
68   if(m_nameHasBeenSet)
69   {
70    payload.WithString("Name", m_name);
71 
72   }
73 
74   if(m_safetyRuleArnHasBeenSet)
75   {
76    payload.WithString("SafetyRuleArn", m_safetyRuleArn);
77 
78   }
79 
80   if(m_waitPeriodMsHasBeenSet)
81   {
82    payload.WithInteger("WaitPeriodMs", m_waitPeriodMs);
83 
84   }
85 
86   return payload;
87 }
88 
89 } // namespace Model
90 } // namespace Route53RecoveryControlConfig
91 } // namespace Aws
92