1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/dynamodb/model/ReplicaGlobalSecondaryIndexAutoScalingDescription.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 DynamoDB
17 {
18 namespace Model
19 {
20 
ReplicaGlobalSecondaryIndexAutoScalingDescription()21 ReplicaGlobalSecondaryIndexAutoScalingDescription::ReplicaGlobalSecondaryIndexAutoScalingDescription() :
22     m_indexNameHasBeenSet(false),
23     m_indexStatus(IndexStatus::NOT_SET),
24     m_indexStatusHasBeenSet(false),
25     m_provisionedReadCapacityAutoScalingSettingsHasBeenSet(false),
26     m_provisionedWriteCapacityAutoScalingSettingsHasBeenSet(false)
27 {
28 }
29 
ReplicaGlobalSecondaryIndexAutoScalingDescription(JsonView jsonValue)30 ReplicaGlobalSecondaryIndexAutoScalingDescription::ReplicaGlobalSecondaryIndexAutoScalingDescription(JsonView jsonValue) :
31     m_indexNameHasBeenSet(false),
32     m_indexStatus(IndexStatus::NOT_SET),
33     m_indexStatusHasBeenSet(false),
34     m_provisionedReadCapacityAutoScalingSettingsHasBeenSet(false),
35     m_provisionedWriteCapacityAutoScalingSettingsHasBeenSet(false)
36 {
37   *this = jsonValue;
38 }
39 
operator =(JsonView jsonValue)40 ReplicaGlobalSecondaryIndexAutoScalingDescription& ReplicaGlobalSecondaryIndexAutoScalingDescription::operator =(JsonView jsonValue)
41 {
42   if(jsonValue.ValueExists("IndexName"))
43   {
44     m_indexName = jsonValue.GetString("IndexName");
45 
46     m_indexNameHasBeenSet = true;
47   }
48 
49   if(jsonValue.ValueExists("IndexStatus"))
50   {
51     m_indexStatus = IndexStatusMapper::GetIndexStatusForName(jsonValue.GetString("IndexStatus"));
52 
53     m_indexStatusHasBeenSet = true;
54   }
55 
56   if(jsonValue.ValueExists("ProvisionedReadCapacityAutoScalingSettings"))
57   {
58     m_provisionedReadCapacityAutoScalingSettings = jsonValue.GetObject("ProvisionedReadCapacityAutoScalingSettings");
59 
60     m_provisionedReadCapacityAutoScalingSettingsHasBeenSet = true;
61   }
62 
63   if(jsonValue.ValueExists("ProvisionedWriteCapacityAutoScalingSettings"))
64   {
65     m_provisionedWriteCapacityAutoScalingSettings = jsonValue.GetObject("ProvisionedWriteCapacityAutoScalingSettings");
66 
67     m_provisionedWriteCapacityAutoScalingSettingsHasBeenSet = true;
68   }
69 
70   return *this;
71 }
72 
Jsonize() const73 JsonValue ReplicaGlobalSecondaryIndexAutoScalingDescription::Jsonize() const
74 {
75   JsonValue payload;
76 
77   if(m_indexNameHasBeenSet)
78   {
79    payload.WithString("IndexName", m_indexName);
80 
81   }
82 
83   if(m_indexStatusHasBeenSet)
84   {
85    payload.WithString("IndexStatus", IndexStatusMapper::GetNameForIndexStatus(m_indexStatus));
86   }
87 
88   if(m_provisionedReadCapacityAutoScalingSettingsHasBeenSet)
89   {
90    payload.WithObject("ProvisionedReadCapacityAutoScalingSettings", m_provisionedReadCapacityAutoScalingSettings.Jsonize());
91 
92   }
93 
94   if(m_provisionedWriteCapacityAutoScalingSettingsHasBeenSet)
95   {
96    payload.WithObject("ProvisionedWriteCapacityAutoScalingSettings", m_provisionedWriteCapacityAutoScalingSettings.Jsonize());
97 
98   }
99 
100   return payload;
101 }
102 
103 } // namespace Model
104 } // namespace DynamoDB
105 } // namespace Aws
106