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