1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/firehose/model/S3DestinationUpdate.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 Firehose
17 {
18 namespace Model
19 {
20 
S3DestinationUpdate()21 S3DestinationUpdate::S3DestinationUpdate() :
22     m_roleARNHasBeenSet(false),
23     m_bucketARNHasBeenSet(false),
24     m_prefixHasBeenSet(false),
25     m_errorOutputPrefixHasBeenSet(false),
26     m_bufferingHintsHasBeenSet(false),
27     m_compressionFormat(CompressionFormat::NOT_SET),
28     m_compressionFormatHasBeenSet(false),
29     m_encryptionConfigurationHasBeenSet(false),
30     m_cloudWatchLoggingOptionsHasBeenSet(false)
31 {
32 }
33 
S3DestinationUpdate(JsonView jsonValue)34 S3DestinationUpdate::S3DestinationUpdate(JsonView jsonValue) :
35     m_roleARNHasBeenSet(false),
36     m_bucketARNHasBeenSet(false),
37     m_prefixHasBeenSet(false),
38     m_errorOutputPrefixHasBeenSet(false),
39     m_bufferingHintsHasBeenSet(false),
40     m_compressionFormat(CompressionFormat::NOT_SET),
41     m_compressionFormatHasBeenSet(false),
42     m_encryptionConfigurationHasBeenSet(false),
43     m_cloudWatchLoggingOptionsHasBeenSet(false)
44 {
45   *this = jsonValue;
46 }
47 
operator =(JsonView jsonValue)48 S3DestinationUpdate& S3DestinationUpdate::operator =(JsonView jsonValue)
49 {
50   if(jsonValue.ValueExists("RoleARN"))
51   {
52     m_roleARN = jsonValue.GetString("RoleARN");
53 
54     m_roleARNHasBeenSet = true;
55   }
56 
57   if(jsonValue.ValueExists("BucketARN"))
58   {
59     m_bucketARN = jsonValue.GetString("BucketARN");
60 
61     m_bucketARNHasBeenSet = true;
62   }
63 
64   if(jsonValue.ValueExists("Prefix"))
65   {
66     m_prefix = jsonValue.GetString("Prefix");
67 
68     m_prefixHasBeenSet = true;
69   }
70 
71   if(jsonValue.ValueExists("ErrorOutputPrefix"))
72   {
73     m_errorOutputPrefix = jsonValue.GetString("ErrorOutputPrefix");
74 
75     m_errorOutputPrefixHasBeenSet = true;
76   }
77 
78   if(jsonValue.ValueExists("BufferingHints"))
79   {
80     m_bufferingHints = jsonValue.GetObject("BufferingHints");
81 
82     m_bufferingHintsHasBeenSet = true;
83   }
84 
85   if(jsonValue.ValueExists("CompressionFormat"))
86   {
87     m_compressionFormat = CompressionFormatMapper::GetCompressionFormatForName(jsonValue.GetString("CompressionFormat"));
88 
89     m_compressionFormatHasBeenSet = true;
90   }
91 
92   if(jsonValue.ValueExists("EncryptionConfiguration"))
93   {
94     m_encryptionConfiguration = jsonValue.GetObject("EncryptionConfiguration");
95 
96     m_encryptionConfigurationHasBeenSet = true;
97   }
98 
99   if(jsonValue.ValueExists("CloudWatchLoggingOptions"))
100   {
101     m_cloudWatchLoggingOptions = jsonValue.GetObject("CloudWatchLoggingOptions");
102 
103     m_cloudWatchLoggingOptionsHasBeenSet = true;
104   }
105 
106   return *this;
107 }
108 
Jsonize() const109 JsonValue S3DestinationUpdate::Jsonize() const
110 {
111   JsonValue payload;
112 
113   if(m_roleARNHasBeenSet)
114   {
115    payload.WithString("RoleARN", m_roleARN);
116 
117   }
118 
119   if(m_bucketARNHasBeenSet)
120   {
121    payload.WithString("BucketARN", m_bucketARN);
122 
123   }
124 
125   if(m_prefixHasBeenSet)
126   {
127    payload.WithString("Prefix", m_prefix);
128 
129   }
130 
131   if(m_errorOutputPrefixHasBeenSet)
132   {
133    payload.WithString("ErrorOutputPrefix", m_errorOutputPrefix);
134 
135   }
136 
137   if(m_bufferingHintsHasBeenSet)
138   {
139    payload.WithObject("BufferingHints", m_bufferingHints.Jsonize());
140 
141   }
142 
143   if(m_compressionFormatHasBeenSet)
144   {
145    payload.WithString("CompressionFormat", CompressionFormatMapper::GetNameForCompressionFormat(m_compressionFormat));
146   }
147 
148   if(m_encryptionConfigurationHasBeenSet)
149   {
150    payload.WithObject("EncryptionConfiguration", m_encryptionConfiguration.Jsonize());
151 
152   }
153 
154   if(m_cloudWatchLoggingOptionsHasBeenSet)
155   {
156    payload.WithObject("CloudWatchLoggingOptions", m_cloudWatchLoggingOptions.Jsonize());
157 
158   }
159 
160   return payload;
161 }
162 
163 } // namespace Model
164 } // namespace Firehose
165 } // namespace Aws
166