1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/glue/model/EncryptionConfiguration.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 Glue
17 {
18 namespace Model
19 {
20 
EncryptionConfiguration()21 EncryptionConfiguration::EncryptionConfiguration() :
22     m_s3EncryptionHasBeenSet(false),
23     m_cloudWatchEncryptionHasBeenSet(false),
24     m_jobBookmarksEncryptionHasBeenSet(false)
25 {
26 }
27 
EncryptionConfiguration(JsonView jsonValue)28 EncryptionConfiguration::EncryptionConfiguration(JsonView jsonValue) :
29     m_s3EncryptionHasBeenSet(false),
30     m_cloudWatchEncryptionHasBeenSet(false),
31     m_jobBookmarksEncryptionHasBeenSet(false)
32 {
33   *this = jsonValue;
34 }
35 
operator =(JsonView jsonValue)36 EncryptionConfiguration& EncryptionConfiguration::operator =(JsonView jsonValue)
37 {
38   if(jsonValue.ValueExists("S3Encryption"))
39   {
40     Array<JsonView> s3EncryptionJsonList = jsonValue.GetArray("S3Encryption");
41     for(unsigned s3EncryptionIndex = 0; s3EncryptionIndex < s3EncryptionJsonList.GetLength(); ++s3EncryptionIndex)
42     {
43       m_s3Encryption.push_back(s3EncryptionJsonList[s3EncryptionIndex].AsObject());
44     }
45     m_s3EncryptionHasBeenSet = true;
46   }
47 
48   if(jsonValue.ValueExists("CloudWatchEncryption"))
49   {
50     m_cloudWatchEncryption = jsonValue.GetObject("CloudWatchEncryption");
51 
52     m_cloudWatchEncryptionHasBeenSet = true;
53   }
54 
55   if(jsonValue.ValueExists("JobBookmarksEncryption"))
56   {
57     m_jobBookmarksEncryption = jsonValue.GetObject("JobBookmarksEncryption");
58 
59     m_jobBookmarksEncryptionHasBeenSet = true;
60   }
61 
62   return *this;
63 }
64 
Jsonize() const65 JsonValue EncryptionConfiguration::Jsonize() const
66 {
67   JsonValue payload;
68 
69   if(m_s3EncryptionHasBeenSet)
70   {
71    Array<JsonValue> s3EncryptionJsonList(m_s3Encryption.size());
72    for(unsigned s3EncryptionIndex = 0; s3EncryptionIndex < s3EncryptionJsonList.GetLength(); ++s3EncryptionIndex)
73    {
74      s3EncryptionJsonList[s3EncryptionIndex].AsObject(m_s3Encryption[s3EncryptionIndex].Jsonize());
75    }
76    payload.WithArray("S3Encryption", std::move(s3EncryptionJsonList));
77 
78   }
79 
80   if(m_cloudWatchEncryptionHasBeenSet)
81   {
82    payload.WithObject("CloudWatchEncryption", m_cloudWatchEncryption.Jsonize());
83 
84   }
85 
86   if(m_jobBookmarksEncryptionHasBeenSet)
87   {
88    payload.WithObject("JobBookmarksEncryption", m_jobBookmarksEncryption.Jsonize());
89 
90   }
91 
92   return payload;
93 }
94 
95 } // namespace Model
96 } // namespace Glue
97 } // namespace Aws
98