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/AutoScalingGroupProvider.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
AutoScalingGroupProvider()21 AutoScalingGroupProvider::AutoScalingGroupProvider() :
22 m_autoScalingGroupArnHasBeenSet(false),
23 m_managedScalingHasBeenSet(false),
24 m_managedTerminationProtection(ManagedTerminationProtection::NOT_SET),
25 m_managedTerminationProtectionHasBeenSet(false)
26 {
27 }
28
AutoScalingGroupProvider(JsonView jsonValue)29 AutoScalingGroupProvider::AutoScalingGroupProvider(JsonView jsonValue) :
30 m_autoScalingGroupArnHasBeenSet(false),
31 m_managedScalingHasBeenSet(false),
32 m_managedTerminationProtection(ManagedTerminationProtection::NOT_SET),
33 m_managedTerminationProtectionHasBeenSet(false)
34 {
35 *this = jsonValue;
36 }
37
operator =(JsonView jsonValue)38 AutoScalingGroupProvider& AutoScalingGroupProvider::operator =(JsonView jsonValue)
39 {
40 if(jsonValue.ValueExists("autoScalingGroupArn"))
41 {
42 m_autoScalingGroupArn = jsonValue.GetString("autoScalingGroupArn");
43
44 m_autoScalingGroupArnHasBeenSet = true;
45 }
46
47 if(jsonValue.ValueExists("managedScaling"))
48 {
49 m_managedScaling = jsonValue.GetObject("managedScaling");
50
51 m_managedScalingHasBeenSet = true;
52 }
53
54 if(jsonValue.ValueExists("managedTerminationProtection"))
55 {
56 m_managedTerminationProtection = ManagedTerminationProtectionMapper::GetManagedTerminationProtectionForName(jsonValue.GetString("managedTerminationProtection"));
57
58 m_managedTerminationProtectionHasBeenSet = true;
59 }
60
61 return *this;
62 }
63
Jsonize() const64 JsonValue AutoScalingGroupProvider::Jsonize() const
65 {
66 JsonValue payload;
67
68 if(m_autoScalingGroupArnHasBeenSet)
69 {
70 payload.WithString("autoScalingGroupArn", m_autoScalingGroupArn);
71
72 }
73
74 if(m_managedScalingHasBeenSet)
75 {
76 payload.WithObject("managedScaling", m_managedScaling.Jsonize());
77
78 }
79
80 if(m_managedTerminationProtectionHasBeenSet)
81 {
82 payload.WithString("managedTerminationProtection", ManagedTerminationProtectionMapper::GetNameForManagedTerminationProtection(m_managedTerminationProtection));
83 }
84
85 return payload;
86 }
87
88 } // namespace Model
89 } // namespace ECS
90 } // namespace Aws
91