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/SplunkDestinationUpdate.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 
SplunkDestinationUpdate()21 SplunkDestinationUpdate::SplunkDestinationUpdate() :
22     m_hECEndpointHasBeenSet(false),
23     m_hECEndpointType(HECEndpointType::NOT_SET),
24     m_hECEndpointTypeHasBeenSet(false),
25     m_hECTokenHasBeenSet(false),
26     m_hECAcknowledgmentTimeoutInSeconds(0),
27     m_hECAcknowledgmentTimeoutInSecondsHasBeenSet(false),
28     m_retryOptionsHasBeenSet(false),
29     m_s3BackupMode(SplunkS3BackupMode::NOT_SET),
30     m_s3BackupModeHasBeenSet(false),
31     m_s3UpdateHasBeenSet(false),
32     m_processingConfigurationHasBeenSet(false),
33     m_cloudWatchLoggingOptionsHasBeenSet(false)
34 {
35 }
36 
SplunkDestinationUpdate(JsonView jsonValue)37 SplunkDestinationUpdate::SplunkDestinationUpdate(JsonView jsonValue) :
38     m_hECEndpointHasBeenSet(false),
39     m_hECEndpointType(HECEndpointType::NOT_SET),
40     m_hECEndpointTypeHasBeenSet(false),
41     m_hECTokenHasBeenSet(false),
42     m_hECAcknowledgmentTimeoutInSeconds(0),
43     m_hECAcknowledgmentTimeoutInSecondsHasBeenSet(false),
44     m_retryOptionsHasBeenSet(false),
45     m_s3BackupMode(SplunkS3BackupMode::NOT_SET),
46     m_s3BackupModeHasBeenSet(false),
47     m_s3UpdateHasBeenSet(false),
48     m_processingConfigurationHasBeenSet(false),
49     m_cloudWatchLoggingOptionsHasBeenSet(false)
50 {
51   *this = jsonValue;
52 }
53 
operator =(JsonView jsonValue)54 SplunkDestinationUpdate& SplunkDestinationUpdate::operator =(JsonView jsonValue)
55 {
56   if(jsonValue.ValueExists("HECEndpoint"))
57   {
58     m_hECEndpoint = jsonValue.GetString("HECEndpoint");
59 
60     m_hECEndpointHasBeenSet = true;
61   }
62 
63   if(jsonValue.ValueExists("HECEndpointType"))
64   {
65     m_hECEndpointType = HECEndpointTypeMapper::GetHECEndpointTypeForName(jsonValue.GetString("HECEndpointType"));
66 
67     m_hECEndpointTypeHasBeenSet = true;
68   }
69 
70   if(jsonValue.ValueExists("HECToken"))
71   {
72     m_hECToken = jsonValue.GetString("HECToken");
73 
74     m_hECTokenHasBeenSet = true;
75   }
76 
77   if(jsonValue.ValueExists("HECAcknowledgmentTimeoutInSeconds"))
78   {
79     m_hECAcknowledgmentTimeoutInSeconds = jsonValue.GetInteger("HECAcknowledgmentTimeoutInSeconds");
80 
81     m_hECAcknowledgmentTimeoutInSecondsHasBeenSet = true;
82   }
83 
84   if(jsonValue.ValueExists("RetryOptions"))
85   {
86     m_retryOptions = jsonValue.GetObject("RetryOptions");
87 
88     m_retryOptionsHasBeenSet = true;
89   }
90 
91   if(jsonValue.ValueExists("S3BackupMode"))
92   {
93     m_s3BackupMode = SplunkS3BackupModeMapper::GetSplunkS3BackupModeForName(jsonValue.GetString("S3BackupMode"));
94 
95     m_s3BackupModeHasBeenSet = true;
96   }
97 
98   if(jsonValue.ValueExists("S3Update"))
99   {
100     m_s3Update = jsonValue.GetObject("S3Update");
101 
102     m_s3UpdateHasBeenSet = true;
103   }
104 
105   if(jsonValue.ValueExists("ProcessingConfiguration"))
106   {
107     m_processingConfiguration = jsonValue.GetObject("ProcessingConfiguration");
108 
109     m_processingConfigurationHasBeenSet = true;
110   }
111 
112   if(jsonValue.ValueExists("CloudWatchLoggingOptions"))
113   {
114     m_cloudWatchLoggingOptions = jsonValue.GetObject("CloudWatchLoggingOptions");
115 
116     m_cloudWatchLoggingOptionsHasBeenSet = true;
117   }
118 
119   return *this;
120 }
121 
Jsonize() const122 JsonValue SplunkDestinationUpdate::Jsonize() const
123 {
124   JsonValue payload;
125 
126   if(m_hECEndpointHasBeenSet)
127   {
128    payload.WithString("HECEndpoint", m_hECEndpoint);
129 
130   }
131 
132   if(m_hECEndpointTypeHasBeenSet)
133   {
134    payload.WithString("HECEndpointType", HECEndpointTypeMapper::GetNameForHECEndpointType(m_hECEndpointType));
135   }
136 
137   if(m_hECTokenHasBeenSet)
138   {
139    payload.WithString("HECToken", m_hECToken);
140 
141   }
142 
143   if(m_hECAcknowledgmentTimeoutInSecondsHasBeenSet)
144   {
145    payload.WithInteger("HECAcknowledgmentTimeoutInSeconds", m_hECAcknowledgmentTimeoutInSeconds);
146 
147   }
148 
149   if(m_retryOptionsHasBeenSet)
150   {
151    payload.WithObject("RetryOptions", m_retryOptions.Jsonize());
152 
153   }
154 
155   if(m_s3BackupModeHasBeenSet)
156   {
157    payload.WithString("S3BackupMode", SplunkS3BackupModeMapper::GetNameForSplunkS3BackupMode(m_s3BackupMode));
158   }
159 
160   if(m_s3UpdateHasBeenSet)
161   {
162    payload.WithObject("S3Update", m_s3Update.Jsonize());
163 
164   }
165 
166   if(m_processingConfigurationHasBeenSet)
167   {
168    payload.WithObject("ProcessingConfiguration", m_processingConfiguration.Jsonize());
169 
170   }
171 
172   if(m_cloudWatchLoggingOptionsHasBeenSet)
173   {
174    payload.WithObject("CloudWatchLoggingOptions", m_cloudWatchLoggingOptions.Jsonize());
175 
176   }
177 
178   return payload;
179 }
180 
181 } // namespace Model
182 } // namespace Firehose
183 } // namespace Aws
184