1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/securityhub/model/AwsAutoScalingAutoScalingGroupDetails.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 SecurityHub
17 {
18 namespace Model
19 {
20 
AwsAutoScalingAutoScalingGroupDetails()21 AwsAutoScalingAutoScalingGroupDetails::AwsAutoScalingAutoScalingGroupDetails() :
22     m_launchConfigurationNameHasBeenSet(false),
23     m_loadBalancerNamesHasBeenSet(false),
24     m_healthCheckTypeHasBeenSet(false),
25     m_healthCheckGracePeriod(0),
26     m_healthCheckGracePeriodHasBeenSet(false),
27     m_createdTimeHasBeenSet(false)
28 {
29 }
30 
AwsAutoScalingAutoScalingGroupDetails(JsonView jsonValue)31 AwsAutoScalingAutoScalingGroupDetails::AwsAutoScalingAutoScalingGroupDetails(JsonView jsonValue) :
32     m_launchConfigurationNameHasBeenSet(false),
33     m_loadBalancerNamesHasBeenSet(false),
34     m_healthCheckTypeHasBeenSet(false),
35     m_healthCheckGracePeriod(0),
36     m_healthCheckGracePeriodHasBeenSet(false),
37     m_createdTimeHasBeenSet(false)
38 {
39   *this = jsonValue;
40 }
41 
operator =(JsonView jsonValue)42 AwsAutoScalingAutoScalingGroupDetails& AwsAutoScalingAutoScalingGroupDetails::operator =(JsonView jsonValue)
43 {
44   if(jsonValue.ValueExists("LaunchConfigurationName"))
45   {
46     m_launchConfigurationName = jsonValue.GetString("LaunchConfigurationName");
47 
48     m_launchConfigurationNameHasBeenSet = true;
49   }
50 
51   if(jsonValue.ValueExists("LoadBalancerNames"))
52   {
53     Array<JsonView> loadBalancerNamesJsonList = jsonValue.GetArray("LoadBalancerNames");
54     for(unsigned loadBalancerNamesIndex = 0; loadBalancerNamesIndex < loadBalancerNamesJsonList.GetLength(); ++loadBalancerNamesIndex)
55     {
56       m_loadBalancerNames.push_back(loadBalancerNamesJsonList[loadBalancerNamesIndex].AsString());
57     }
58     m_loadBalancerNamesHasBeenSet = true;
59   }
60 
61   if(jsonValue.ValueExists("HealthCheckType"))
62   {
63     m_healthCheckType = jsonValue.GetString("HealthCheckType");
64 
65     m_healthCheckTypeHasBeenSet = true;
66   }
67 
68   if(jsonValue.ValueExists("HealthCheckGracePeriod"))
69   {
70     m_healthCheckGracePeriod = jsonValue.GetInteger("HealthCheckGracePeriod");
71 
72     m_healthCheckGracePeriodHasBeenSet = true;
73   }
74 
75   if(jsonValue.ValueExists("CreatedTime"))
76   {
77     m_createdTime = jsonValue.GetString("CreatedTime");
78 
79     m_createdTimeHasBeenSet = true;
80   }
81 
82   return *this;
83 }
84 
Jsonize() const85 JsonValue AwsAutoScalingAutoScalingGroupDetails::Jsonize() const
86 {
87   JsonValue payload;
88 
89   if(m_launchConfigurationNameHasBeenSet)
90   {
91    payload.WithString("LaunchConfigurationName", m_launchConfigurationName);
92 
93   }
94 
95   if(m_loadBalancerNamesHasBeenSet)
96   {
97    Array<JsonValue> loadBalancerNamesJsonList(m_loadBalancerNames.size());
98    for(unsigned loadBalancerNamesIndex = 0; loadBalancerNamesIndex < loadBalancerNamesJsonList.GetLength(); ++loadBalancerNamesIndex)
99    {
100      loadBalancerNamesJsonList[loadBalancerNamesIndex].AsString(m_loadBalancerNames[loadBalancerNamesIndex]);
101    }
102    payload.WithArray("LoadBalancerNames", std::move(loadBalancerNamesJsonList));
103 
104   }
105 
106   if(m_healthCheckTypeHasBeenSet)
107   {
108    payload.WithString("HealthCheckType", m_healthCheckType);
109 
110   }
111 
112   if(m_healthCheckGracePeriodHasBeenSet)
113   {
114    payload.WithInteger("HealthCheckGracePeriod", m_healthCheckGracePeriod);
115 
116   }
117 
118   if(m_createdTimeHasBeenSet)
119   {
120    payload.WithString("CreatedTime", m_createdTime);
121 
122   }
123 
124   return payload;
125 }
126 
127 } // namespace Model
128 } // namespace SecurityHub
129 } // namespace Aws
130