1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/storagegateway/model/PoolInfo.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 StorageGateway
17 {
18 namespace Model
19 {
20
PoolInfo()21 PoolInfo::PoolInfo() :
22 m_poolARNHasBeenSet(false),
23 m_poolNameHasBeenSet(false),
24 m_storageClass(TapeStorageClass::NOT_SET),
25 m_storageClassHasBeenSet(false),
26 m_retentionLockType(RetentionLockType::NOT_SET),
27 m_retentionLockTypeHasBeenSet(false),
28 m_retentionLockTimeInDays(0),
29 m_retentionLockTimeInDaysHasBeenSet(false),
30 m_poolStatus(PoolStatus::NOT_SET),
31 m_poolStatusHasBeenSet(false)
32 {
33 }
34
PoolInfo(JsonView jsonValue)35 PoolInfo::PoolInfo(JsonView jsonValue) :
36 m_poolARNHasBeenSet(false),
37 m_poolNameHasBeenSet(false),
38 m_storageClass(TapeStorageClass::NOT_SET),
39 m_storageClassHasBeenSet(false),
40 m_retentionLockType(RetentionLockType::NOT_SET),
41 m_retentionLockTypeHasBeenSet(false),
42 m_retentionLockTimeInDays(0),
43 m_retentionLockTimeInDaysHasBeenSet(false),
44 m_poolStatus(PoolStatus::NOT_SET),
45 m_poolStatusHasBeenSet(false)
46 {
47 *this = jsonValue;
48 }
49
operator =(JsonView jsonValue)50 PoolInfo& PoolInfo::operator =(JsonView jsonValue)
51 {
52 if(jsonValue.ValueExists("PoolARN"))
53 {
54 m_poolARN = jsonValue.GetString("PoolARN");
55
56 m_poolARNHasBeenSet = true;
57 }
58
59 if(jsonValue.ValueExists("PoolName"))
60 {
61 m_poolName = jsonValue.GetString("PoolName");
62
63 m_poolNameHasBeenSet = true;
64 }
65
66 if(jsonValue.ValueExists("StorageClass"))
67 {
68 m_storageClass = TapeStorageClassMapper::GetTapeStorageClassForName(jsonValue.GetString("StorageClass"));
69
70 m_storageClassHasBeenSet = true;
71 }
72
73 if(jsonValue.ValueExists("RetentionLockType"))
74 {
75 m_retentionLockType = RetentionLockTypeMapper::GetRetentionLockTypeForName(jsonValue.GetString("RetentionLockType"));
76
77 m_retentionLockTypeHasBeenSet = true;
78 }
79
80 if(jsonValue.ValueExists("RetentionLockTimeInDays"))
81 {
82 m_retentionLockTimeInDays = jsonValue.GetInteger("RetentionLockTimeInDays");
83
84 m_retentionLockTimeInDaysHasBeenSet = true;
85 }
86
87 if(jsonValue.ValueExists("PoolStatus"))
88 {
89 m_poolStatus = PoolStatusMapper::GetPoolStatusForName(jsonValue.GetString("PoolStatus"));
90
91 m_poolStatusHasBeenSet = true;
92 }
93
94 return *this;
95 }
96
Jsonize() const97 JsonValue PoolInfo::Jsonize() const
98 {
99 JsonValue payload;
100
101 if(m_poolARNHasBeenSet)
102 {
103 payload.WithString("PoolARN", m_poolARN);
104
105 }
106
107 if(m_poolNameHasBeenSet)
108 {
109 payload.WithString("PoolName", m_poolName);
110
111 }
112
113 if(m_storageClassHasBeenSet)
114 {
115 payload.WithString("StorageClass", TapeStorageClassMapper::GetNameForTapeStorageClass(m_storageClass));
116 }
117
118 if(m_retentionLockTypeHasBeenSet)
119 {
120 payload.WithString("RetentionLockType", RetentionLockTypeMapper::GetNameForRetentionLockType(m_retentionLockType));
121 }
122
123 if(m_retentionLockTimeInDaysHasBeenSet)
124 {
125 payload.WithInteger("RetentionLockTimeInDays", m_retentionLockTimeInDays);
126
127 }
128
129 if(m_poolStatusHasBeenSet)
130 {
131 payload.WithString("PoolStatus", PoolStatusMapper::GetNameForPoolStatus(m_poolStatus));
132 }
133
134 return payload;
135 }
136
137 } // namespace Model
138 } // namespace StorageGateway
139 } // namespace Aws
140