1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/opsworks/model/EbsBlockDevice.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 OpsWorks
17 {
18 namespace Model
19 {
20
EbsBlockDevice()21 EbsBlockDevice::EbsBlockDevice() :
22 m_snapshotIdHasBeenSet(false),
23 m_iops(0),
24 m_iopsHasBeenSet(false),
25 m_volumeSize(0),
26 m_volumeSizeHasBeenSet(false),
27 m_volumeType(VolumeType::NOT_SET),
28 m_volumeTypeHasBeenSet(false),
29 m_deleteOnTermination(false),
30 m_deleteOnTerminationHasBeenSet(false)
31 {
32 }
33
EbsBlockDevice(JsonView jsonValue)34 EbsBlockDevice::EbsBlockDevice(JsonView jsonValue) :
35 m_snapshotIdHasBeenSet(false),
36 m_iops(0),
37 m_iopsHasBeenSet(false),
38 m_volumeSize(0),
39 m_volumeSizeHasBeenSet(false),
40 m_volumeType(VolumeType::NOT_SET),
41 m_volumeTypeHasBeenSet(false),
42 m_deleteOnTermination(false),
43 m_deleteOnTerminationHasBeenSet(false)
44 {
45 *this = jsonValue;
46 }
47
operator =(JsonView jsonValue)48 EbsBlockDevice& EbsBlockDevice::operator =(JsonView jsonValue)
49 {
50 if(jsonValue.ValueExists("SnapshotId"))
51 {
52 m_snapshotId = jsonValue.GetString("SnapshotId");
53
54 m_snapshotIdHasBeenSet = true;
55 }
56
57 if(jsonValue.ValueExists("Iops"))
58 {
59 m_iops = jsonValue.GetInteger("Iops");
60
61 m_iopsHasBeenSet = true;
62 }
63
64 if(jsonValue.ValueExists("VolumeSize"))
65 {
66 m_volumeSize = jsonValue.GetInteger("VolumeSize");
67
68 m_volumeSizeHasBeenSet = true;
69 }
70
71 if(jsonValue.ValueExists("VolumeType"))
72 {
73 m_volumeType = VolumeTypeMapper::GetVolumeTypeForName(jsonValue.GetString("VolumeType"));
74
75 m_volumeTypeHasBeenSet = true;
76 }
77
78 if(jsonValue.ValueExists("DeleteOnTermination"))
79 {
80 m_deleteOnTermination = jsonValue.GetBool("DeleteOnTermination");
81
82 m_deleteOnTerminationHasBeenSet = true;
83 }
84
85 return *this;
86 }
87
Jsonize() const88 JsonValue EbsBlockDevice::Jsonize() const
89 {
90 JsonValue payload;
91
92 if(m_snapshotIdHasBeenSet)
93 {
94 payload.WithString("SnapshotId", m_snapshotId);
95
96 }
97
98 if(m_iopsHasBeenSet)
99 {
100 payload.WithInteger("Iops", m_iops);
101
102 }
103
104 if(m_volumeSizeHasBeenSet)
105 {
106 payload.WithInteger("VolumeSize", m_volumeSize);
107
108 }
109
110 if(m_volumeTypeHasBeenSet)
111 {
112 payload.WithString("VolumeType", VolumeTypeMapper::GetNameForVolumeType(m_volumeType));
113 }
114
115 if(m_deleteOnTerminationHasBeenSet)
116 {
117 payload.WithBool("DeleteOnTermination", m_deleteOnTermination);
118
119 }
120
121 return payload;
122 }
123
124 } // namespace Model
125 } // namespace OpsWorks
126 } // namespace Aws
127