1 /**
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 * SPDX-License-Identifier: Apache-2.0.
4 */
5
6 #include <aws/core/utils/Outcome.h>
7 #include <aws/core/auth/AWSAuthSigner.h>
8 #include <aws/core/client/CoreErrors.h>
9 #include <aws/core/client/RetryStrategy.h>
10 #include <aws/core/http/HttpClient.h>
11 #include <aws/core/http/HttpResponse.h>
12 #include <aws/core/http/HttpClientFactory.h>
13 #include <aws/core/auth/AWSCredentialsProviderChain.h>
14 #include <aws/core/utils/json/JsonSerializer.h>
15 #include <aws/core/utils/memory/stl/AWSStringStream.h>
16 #include <aws/core/utils/threading/Executor.h>
17 #include <aws/core/utils/DNS.h>
18 #include <aws/core/utils/logging/LogMacros.h>
19
20 #include <aws/iotevents-data/IoTEventsDataClient.h>
21 #include <aws/iotevents-data/IoTEventsDataEndpoint.h>
22 #include <aws/iotevents-data/IoTEventsDataErrorMarshaller.h>
23 #include <aws/iotevents-data/model/BatchAcknowledgeAlarmRequest.h>
24 #include <aws/iotevents-data/model/BatchDisableAlarmRequest.h>
25 #include <aws/iotevents-data/model/BatchEnableAlarmRequest.h>
26 #include <aws/iotevents-data/model/BatchPutMessageRequest.h>
27 #include <aws/iotevents-data/model/BatchResetAlarmRequest.h>
28 #include <aws/iotevents-data/model/BatchSnoozeAlarmRequest.h>
29 #include <aws/iotevents-data/model/BatchUpdateDetectorRequest.h>
30 #include <aws/iotevents-data/model/DescribeAlarmRequest.h>
31 #include <aws/iotevents-data/model/DescribeDetectorRequest.h>
32 #include <aws/iotevents-data/model/ListAlarmsRequest.h>
33 #include <aws/iotevents-data/model/ListDetectorsRequest.h>
34
35 using namespace Aws;
36 using namespace Aws::Auth;
37 using namespace Aws::Client;
38 using namespace Aws::IoTEventsData;
39 using namespace Aws::IoTEventsData::Model;
40 using namespace Aws::Http;
41 using namespace Aws::Utils::Json;
42
43 static const char* SERVICE_NAME = "ioteventsdata";
44 static const char* ALLOCATION_TAG = "IoTEventsDataClient";
45
46
IoTEventsDataClient(const Client::ClientConfiguration & clientConfiguration)47 IoTEventsDataClient::IoTEventsDataClient(const Client::ClientConfiguration& clientConfiguration) :
48 BASECLASS(clientConfiguration,
49 Aws::MakeShared<AWSAuthV4Signer>(ALLOCATION_TAG, Aws::MakeShared<DefaultAWSCredentialsProviderChain>(ALLOCATION_TAG),
50 SERVICE_NAME, Aws::Region::ComputeSignerRegion(clientConfiguration.region)),
51 Aws::MakeShared<IoTEventsDataErrorMarshaller>(ALLOCATION_TAG)),
52 m_executor(clientConfiguration.executor)
53 {
54 init(clientConfiguration);
55 }
56
IoTEventsDataClient(const AWSCredentials & credentials,const Client::ClientConfiguration & clientConfiguration)57 IoTEventsDataClient::IoTEventsDataClient(const AWSCredentials& credentials, const Client::ClientConfiguration& clientConfiguration) :
58 BASECLASS(clientConfiguration,
59 Aws::MakeShared<AWSAuthV4Signer>(ALLOCATION_TAG, Aws::MakeShared<SimpleAWSCredentialsProvider>(ALLOCATION_TAG, credentials),
60 SERVICE_NAME, Aws::Region::ComputeSignerRegion(clientConfiguration.region)),
61 Aws::MakeShared<IoTEventsDataErrorMarshaller>(ALLOCATION_TAG)),
62 m_executor(clientConfiguration.executor)
63 {
64 init(clientConfiguration);
65 }
66
IoTEventsDataClient(const std::shared_ptr<AWSCredentialsProvider> & credentialsProvider,const Client::ClientConfiguration & clientConfiguration)67 IoTEventsDataClient::IoTEventsDataClient(const std::shared_ptr<AWSCredentialsProvider>& credentialsProvider,
68 const Client::ClientConfiguration& clientConfiguration) :
69 BASECLASS(clientConfiguration,
70 Aws::MakeShared<AWSAuthV4Signer>(ALLOCATION_TAG, credentialsProvider,
71 SERVICE_NAME, Aws::Region::ComputeSignerRegion(clientConfiguration.region)),
72 Aws::MakeShared<IoTEventsDataErrorMarshaller>(ALLOCATION_TAG)),
73 m_executor(clientConfiguration.executor)
74 {
75 init(clientConfiguration);
76 }
77
~IoTEventsDataClient()78 IoTEventsDataClient::~IoTEventsDataClient()
79 {
80 }
81
init(const Client::ClientConfiguration & config)82 void IoTEventsDataClient::init(const Client::ClientConfiguration& config)
83 {
84 SetServiceClientName("IoT Events Data");
85 m_configScheme = SchemeMapper::ToString(config.scheme);
86 if (config.endpointOverride.empty())
87 {
88 m_uri = m_configScheme + "://" + IoTEventsDataEndpoint::ForRegion(config.region, config.useDualStack);
89 }
90 else
91 {
92 OverrideEndpoint(config.endpointOverride);
93 }
94 }
95
OverrideEndpoint(const Aws::String & endpoint)96 void IoTEventsDataClient::OverrideEndpoint(const Aws::String& endpoint)
97 {
98 if (endpoint.compare(0, 7, "http://") == 0 || endpoint.compare(0, 8, "https://") == 0)
99 {
100 m_uri = endpoint;
101 }
102 else
103 {
104 m_uri = m_configScheme + "://" + endpoint;
105 }
106 }
107
BatchAcknowledgeAlarm(const BatchAcknowledgeAlarmRequest & request) const108 BatchAcknowledgeAlarmOutcome IoTEventsDataClient::BatchAcknowledgeAlarm(const BatchAcknowledgeAlarmRequest& request) const
109 {
110 Aws::Http::URI uri = m_uri;
111 uri.AddPathSegments("/alarms/acknowledge");
112 return BatchAcknowledgeAlarmOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER));
113 }
114
BatchAcknowledgeAlarmCallable(const BatchAcknowledgeAlarmRequest & request) const115 BatchAcknowledgeAlarmOutcomeCallable IoTEventsDataClient::BatchAcknowledgeAlarmCallable(const BatchAcknowledgeAlarmRequest& request) const
116 {
117 auto task = Aws::MakeShared< std::packaged_task< BatchAcknowledgeAlarmOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->BatchAcknowledgeAlarm(request); } );
118 auto packagedFunction = [task]() { (*task)(); };
119 m_executor->Submit(packagedFunction);
120 return task->get_future();
121 }
122
BatchAcknowledgeAlarmAsync(const BatchAcknowledgeAlarmRequest & request,const BatchAcknowledgeAlarmResponseReceivedHandler & handler,const std::shared_ptr<const Aws::Client::AsyncCallerContext> & context) const123 void IoTEventsDataClient::BatchAcknowledgeAlarmAsync(const BatchAcknowledgeAlarmRequest& request, const BatchAcknowledgeAlarmResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
124 {
125 m_executor->Submit( [this, request, handler, context](){ this->BatchAcknowledgeAlarmAsyncHelper( request, handler, context ); } );
126 }
127
BatchAcknowledgeAlarmAsyncHelper(const BatchAcknowledgeAlarmRequest & request,const BatchAcknowledgeAlarmResponseReceivedHandler & handler,const std::shared_ptr<const Aws::Client::AsyncCallerContext> & context) const128 void IoTEventsDataClient::BatchAcknowledgeAlarmAsyncHelper(const BatchAcknowledgeAlarmRequest& request, const BatchAcknowledgeAlarmResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
129 {
130 handler(this, request, BatchAcknowledgeAlarm(request), context);
131 }
132
BatchDisableAlarm(const BatchDisableAlarmRequest & request) const133 BatchDisableAlarmOutcome IoTEventsDataClient::BatchDisableAlarm(const BatchDisableAlarmRequest& request) const
134 {
135 Aws::Http::URI uri = m_uri;
136 uri.AddPathSegments("/alarms/disable");
137 return BatchDisableAlarmOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER));
138 }
139
BatchDisableAlarmCallable(const BatchDisableAlarmRequest & request) const140 BatchDisableAlarmOutcomeCallable IoTEventsDataClient::BatchDisableAlarmCallable(const BatchDisableAlarmRequest& request) const
141 {
142 auto task = Aws::MakeShared< std::packaged_task< BatchDisableAlarmOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->BatchDisableAlarm(request); } );
143 auto packagedFunction = [task]() { (*task)(); };
144 m_executor->Submit(packagedFunction);
145 return task->get_future();
146 }
147
BatchDisableAlarmAsync(const BatchDisableAlarmRequest & request,const BatchDisableAlarmResponseReceivedHandler & handler,const std::shared_ptr<const Aws::Client::AsyncCallerContext> & context) const148 void IoTEventsDataClient::BatchDisableAlarmAsync(const BatchDisableAlarmRequest& request, const BatchDisableAlarmResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
149 {
150 m_executor->Submit( [this, request, handler, context](){ this->BatchDisableAlarmAsyncHelper( request, handler, context ); } );
151 }
152
BatchDisableAlarmAsyncHelper(const BatchDisableAlarmRequest & request,const BatchDisableAlarmResponseReceivedHandler & handler,const std::shared_ptr<const Aws::Client::AsyncCallerContext> & context) const153 void IoTEventsDataClient::BatchDisableAlarmAsyncHelper(const BatchDisableAlarmRequest& request, const BatchDisableAlarmResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
154 {
155 handler(this, request, BatchDisableAlarm(request), context);
156 }
157
BatchEnableAlarm(const BatchEnableAlarmRequest & request) const158 BatchEnableAlarmOutcome IoTEventsDataClient::BatchEnableAlarm(const BatchEnableAlarmRequest& request) const
159 {
160 Aws::Http::URI uri = m_uri;
161 uri.AddPathSegments("/alarms/enable");
162 return BatchEnableAlarmOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER));
163 }
164
BatchEnableAlarmCallable(const BatchEnableAlarmRequest & request) const165 BatchEnableAlarmOutcomeCallable IoTEventsDataClient::BatchEnableAlarmCallable(const BatchEnableAlarmRequest& request) const
166 {
167 auto task = Aws::MakeShared< std::packaged_task< BatchEnableAlarmOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->BatchEnableAlarm(request); } );
168 auto packagedFunction = [task]() { (*task)(); };
169 m_executor->Submit(packagedFunction);
170 return task->get_future();
171 }
172
BatchEnableAlarmAsync(const BatchEnableAlarmRequest & request,const BatchEnableAlarmResponseReceivedHandler & handler,const std::shared_ptr<const Aws::Client::AsyncCallerContext> & context) const173 void IoTEventsDataClient::BatchEnableAlarmAsync(const BatchEnableAlarmRequest& request, const BatchEnableAlarmResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
174 {
175 m_executor->Submit( [this, request, handler, context](){ this->BatchEnableAlarmAsyncHelper( request, handler, context ); } );
176 }
177
BatchEnableAlarmAsyncHelper(const BatchEnableAlarmRequest & request,const BatchEnableAlarmResponseReceivedHandler & handler,const std::shared_ptr<const Aws::Client::AsyncCallerContext> & context) const178 void IoTEventsDataClient::BatchEnableAlarmAsyncHelper(const BatchEnableAlarmRequest& request, const BatchEnableAlarmResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
179 {
180 handler(this, request, BatchEnableAlarm(request), context);
181 }
182
BatchPutMessage(const BatchPutMessageRequest & request) const183 BatchPutMessageOutcome IoTEventsDataClient::BatchPutMessage(const BatchPutMessageRequest& request) const
184 {
185 Aws::Http::URI uri = m_uri;
186 uri.AddPathSegments("/inputs/messages");
187 return BatchPutMessageOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER));
188 }
189
BatchPutMessageCallable(const BatchPutMessageRequest & request) const190 BatchPutMessageOutcomeCallable IoTEventsDataClient::BatchPutMessageCallable(const BatchPutMessageRequest& request) const
191 {
192 auto task = Aws::MakeShared< std::packaged_task< BatchPutMessageOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->BatchPutMessage(request); } );
193 auto packagedFunction = [task]() { (*task)(); };
194 m_executor->Submit(packagedFunction);
195 return task->get_future();
196 }
197
BatchPutMessageAsync(const BatchPutMessageRequest & request,const BatchPutMessageResponseReceivedHandler & handler,const std::shared_ptr<const Aws::Client::AsyncCallerContext> & context) const198 void IoTEventsDataClient::BatchPutMessageAsync(const BatchPutMessageRequest& request, const BatchPutMessageResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
199 {
200 m_executor->Submit( [this, request, handler, context](){ this->BatchPutMessageAsyncHelper( request, handler, context ); } );
201 }
202
BatchPutMessageAsyncHelper(const BatchPutMessageRequest & request,const BatchPutMessageResponseReceivedHandler & handler,const std::shared_ptr<const Aws::Client::AsyncCallerContext> & context) const203 void IoTEventsDataClient::BatchPutMessageAsyncHelper(const BatchPutMessageRequest& request, const BatchPutMessageResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
204 {
205 handler(this, request, BatchPutMessage(request), context);
206 }
207
BatchResetAlarm(const BatchResetAlarmRequest & request) const208 BatchResetAlarmOutcome IoTEventsDataClient::BatchResetAlarm(const BatchResetAlarmRequest& request) const
209 {
210 Aws::Http::URI uri = m_uri;
211 uri.AddPathSegments("/alarms/reset");
212 return BatchResetAlarmOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER));
213 }
214
BatchResetAlarmCallable(const BatchResetAlarmRequest & request) const215 BatchResetAlarmOutcomeCallable IoTEventsDataClient::BatchResetAlarmCallable(const BatchResetAlarmRequest& request) const
216 {
217 auto task = Aws::MakeShared< std::packaged_task< BatchResetAlarmOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->BatchResetAlarm(request); } );
218 auto packagedFunction = [task]() { (*task)(); };
219 m_executor->Submit(packagedFunction);
220 return task->get_future();
221 }
222
BatchResetAlarmAsync(const BatchResetAlarmRequest & request,const BatchResetAlarmResponseReceivedHandler & handler,const std::shared_ptr<const Aws::Client::AsyncCallerContext> & context) const223 void IoTEventsDataClient::BatchResetAlarmAsync(const BatchResetAlarmRequest& request, const BatchResetAlarmResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
224 {
225 m_executor->Submit( [this, request, handler, context](){ this->BatchResetAlarmAsyncHelper( request, handler, context ); } );
226 }
227
BatchResetAlarmAsyncHelper(const BatchResetAlarmRequest & request,const BatchResetAlarmResponseReceivedHandler & handler,const std::shared_ptr<const Aws::Client::AsyncCallerContext> & context) const228 void IoTEventsDataClient::BatchResetAlarmAsyncHelper(const BatchResetAlarmRequest& request, const BatchResetAlarmResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
229 {
230 handler(this, request, BatchResetAlarm(request), context);
231 }
232
BatchSnoozeAlarm(const BatchSnoozeAlarmRequest & request) const233 BatchSnoozeAlarmOutcome IoTEventsDataClient::BatchSnoozeAlarm(const BatchSnoozeAlarmRequest& request) const
234 {
235 Aws::Http::URI uri = m_uri;
236 uri.AddPathSegments("/alarms/snooze");
237 return BatchSnoozeAlarmOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER));
238 }
239
BatchSnoozeAlarmCallable(const BatchSnoozeAlarmRequest & request) const240 BatchSnoozeAlarmOutcomeCallable IoTEventsDataClient::BatchSnoozeAlarmCallable(const BatchSnoozeAlarmRequest& request) const
241 {
242 auto task = Aws::MakeShared< std::packaged_task< BatchSnoozeAlarmOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->BatchSnoozeAlarm(request); } );
243 auto packagedFunction = [task]() { (*task)(); };
244 m_executor->Submit(packagedFunction);
245 return task->get_future();
246 }
247
BatchSnoozeAlarmAsync(const BatchSnoozeAlarmRequest & request,const BatchSnoozeAlarmResponseReceivedHandler & handler,const std::shared_ptr<const Aws::Client::AsyncCallerContext> & context) const248 void IoTEventsDataClient::BatchSnoozeAlarmAsync(const BatchSnoozeAlarmRequest& request, const BatchSnoozeAlarmResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
249 {
250 m_executor->Submit( [this, request, handler, context](){ this->BatchSnoozeAlarmAsyncHelper( request, handler, context ); } );
251 }
252
BatchSnoozeAlarmAsyncHelper(const BatchSnoozeAlarmRequest & request,const BatchSnoozeAlarmResponseReceivedHandler & handler,const std::shared_ptr<const Aws::Client::AsyncCallerContext> & context) const253 void IoTEventsDataClient::BatchSnoozeAlarmAsyncHelper(const BatchSnoozeAlarmRequest& request, const BatchSnoozeAlarmResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
254 {
255 handler(this, request, BatchSnoozeAlarm(request), context);
256 }
257
BatchUpdateDetector(const BatchUpdateDetectorRequest & request) const258 BatchUpdateDetectorOutcome IoTEventsDataClient::BatchUpdateDetector(const BatchUpdateDetectorRequest& request) const
259 {
260 Aws::Http::URI uri = m_uri;
261 uri.AddPathSegments("/detectors");
262 return BatchUpdateDetectorOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_POST, Aws::Auth::SIGV4_SIGNER));
263 }
264
BatchUpdateDetectorCallable(const BatchUpdateDetectorRequest & request) const265 BatchUpdateDetectorOutcomeCallable IoTEventsDataClient::BatchUpdateDetectorCallable(const BatchUpdateDetectorRequest& request) const
266 {
267 auto task = Aws::MakeShared< std::packaged_task< BatchUpdateDetectorOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->BatchUpdateDetector(request); } );
268 auto packagedFunction = [task]() { (*task)(); };
269 m_executor->Submit(packagedFunction);
270 return task->get_future();
271 }
272
BatchUpdateDetectorAsync(const BatchUpdateDetectorRequest & request,const BatchUpdateDetectorResponseReceivedHandler & handler,const std::shared_ptr<const Aws::Client::AsyncCallerContext> & context) const273 void IoTEventsDataClient::BatchUpdateDetectorAsync(const BatchUpdateDetectorRequest& request, const BatchUpdateDetectorResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
274 {
275 m_executor->Submit( [this, request, handler, context](){ this->BatchUpdateDetectorAsyncHelper( request, handler, context ); } );
276 }
277
BatchUpdateDetectorAsyncHelper(const BatchUpdateDetectorRequest & request,const BatchUpdateDetectorResponseReceivedHandler & handler,const std::shared_ptr<const Aws::Client::AsyncCallerContext> & context) const278 void IoTEventsDataClient::BatchUpdateDetectorAsyncHelper(const BatchUpdateDetectorRequest& request, const BatchUpdateDetectorResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
279 {
280 handler(this, request, BatchUpdateDetector(request), context);
281 }
282
DescribeAlarm(const DescribeAlarmRequest & request) const283 DescribeAlarmOutcome IoTEventsDataClient::DescribeAlarm(const DescribeAlarmRequest& request) const
284 {
285 if (!request.AlarmModelNameHasBeenSet())
286 {
287 AWS_LOGSTREAM_ERROR("DescribeAlarm", "Required field: AlarmModelName, is not set");
288 return DescribeAlarmOutcome(Aws::Client::AWSError<IoTEventsDataErrors>(IoTEventsDataErrors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [AlarmModelName]", false));
289 }
290 Aws::Http::URI uri = m_uri;
291 uri.AddPathSegments("/alarms/");
292 uri.AddPathSegment(request.GetAlarmModelName());
293 uri.AddPathSegments("/keyValues/");
294 return DescribeAlarmOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_GET, Aws::Auth::SIGV4_SIGNER));
295 }
296
DescribeAlarmCallable(const DescribeAlarmRequest & request) const297 DescribeAlarmOutcomeCallable IoTEventsDataClient::DescribeAlarmCallable(const DescribeAlarmRequest& request) const
298 {
299 auto task = Aws::MakeShared< std::packaged_task< DescribeAlarmOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->DescribeAlarm(request); } );
300 auto packagedFunction = [task]() { (*task)(); };
301 m_executor->Submit(packagedFunction);
302 return task->get_future();
303 }
304
DescribeAlarmAsync(const DescribeAlarmRequest & request,const DescribeAlarmResponseReceivedHandler & handler,const std::shared_ptr<const Aws::Client::AsyncCallerContext> & context) const305 void IoTEventsDataClient::DescribeAlarmAsync(const DescribeAlarmRequest& request, const DescribeAlarmResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
306 {
307 m_executor->Submit( [this, request, handler, context](){ this->DescribeAlarmAsyncHelper( request, handler, context ); } );
308 }
309
DescribeAlarmAsyncHelper(const DescribeAlarmRequest & request,const DescribeAlarmResponseReceivedHandler & handler,const std::shared_ptr<const Aws::Client::AsyncCallerContext> & context) const310 void IoTEventsDataClient::DescribeAlarmAsyncHelper(const DescribeAlarmRequest& request, const DescribeAlarmResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
311 {
312 handler(this, request, DescribeAlarm(request), context);
313 }
314
DescribeDetector(const DescribeDetectorRequest & request) const315 DescribeDetectorOutcome IoTEventsDataClient::DescribeDetector(const DescribeDetectorRequest& request) const
316 {
317 if (!request.DetectorModelNameHasBeenSet())
318 {
319 AWS_LOGSTREAM_ERROR("DescribeDetector", "Required field: DetectorModelName, is not set");
320 return DescribeDetectorOutcome(Aws::Client::AWSError<IoTEventsDataErrors>(IoTEventsDataErrors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [DetectorModelName]", false));
321 }
322 Aws::Http::URI uri = m_uri;
323 uri.AddPathSegments("/detectors/");
324 uri.AddPathSegment(request.GetDetectorModelName());
325 uri.AddPathSegments("/keyValues/");
326 return DescribeDetectorOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_GET, Aws::Auth::SIGV4_SIGNER));
327 }
328
DescribeDetectorCallable(const DescribeDetectorRequest & request) const329 DescribeDetectorOutcomeCallable IoTEventsDataClient::DescribeDetectorCallable(const DescribeDetectorRequest& request) const
330 {
331 auto task = Aws::MakeShared< std::packaged_task< DescribeDetectorOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->DescribeDetector(request); } );
332 auto packagedFunction = [task]() { (*task)(); };
333 m_executor->Submit(packagedFunction);
334 return task->get_future();
335 }
336
DescribeDetectorAsync(const DescribeDetectorRequest & request,const DescribeDetectorResponseReceivedHandler & handler,const std::shared_ptr<const Aws::Client::AsyncCallerContext> & context) const337 void IoTEventsDataClient::DescribeDetectorAsync(const DescribeDetectorRequest& request, const DescribeDetectorResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
338 {
339 m_executor->Submit( [this, request, handler, context](){ this->DescribeDetectorAsyncHelper( request, handler, context ); } );
340 }
341
DescribeDetectorAsyncHelper(const DescribeDetectorRequest & request,const DescribeDetectorResponseReceivedHandler & handler,const std::shared_ptr<const Aws::Client::AsyncCallerContext> & context) const342 void IoTEventsDataClient::DescribeDetectorAsyncHelper(const DescribeDetectorRequest& request, const DescribeDetectorResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
343 {
344 handler(this, request, DescribeDetector(request), context);
345 }
346
ListAlarms(const ListAlarmsRequest & request) const347 ListAlarmsOutcome IoTEventsDataClient::ListAlarms(const ListAlarmsRequest& request) const
348 {
349 if (!request.AlarmModelNameHasBeenSet())
350 {
351 AWS_LOGSTREAM_ERROR("ListAlarms", "Required field: AlarmModelName, is not set");
352 return ListAlarmsOutcome(Aws::Client::AWSError<IoTEventsDataErrors>(IoTEventsDataErrors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [AlarmModelName]", false));
353 }
354 Aws::Http::URI uri = m_uri;
355 uri.AddPathSegments("/alarms/");
356 uri.AddPathSegment(request.GetAlarmModelName());
357 return ListAlarmsOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_GET, Aws::Auth::SIGV4_SIGNER));
358 }
359
ListAlarmsCallable(const ListAlarmsRequest & request) const360 ListAlarmsOutcomeCallable IoTEventsDataClient::ListAlarmsCallable(const ListAlarmsRequest& request) const
361 {
362 auto task = Aws::MakeShared< std::packaged_task< ListAlarmsOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->ListAlarms(request); } );
363 auto packagedFunction = [task]() { (*task)(); };
364 m_executor->Submit(packagedFunction);
365 return task->get_future();
366 }
367
ListAlarmsAsync(const ListAlarmsRequest & request,const ListAlarmsResponseReceivedHandler & handler,const std::shared_ptr<const Aws::Client::AsyncCallerContext> & context) const368 void IoTEventsDataClient::ListAlarmsAsync(const ListAlarmsRequest& request, const ListAlarmsResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
369 {
370 m_executor->Submit( [this, request, handler, context](){ this->ListAlarmsAsyncHelper( request, handler, context ); } );
371 }
372
ListAlarmsAsyncHelper(const ListAlarmsRequest & request,const ListAlarmsResponseReceivedHandler & handler,const std::shared_ptr<const Aws::Client::AsyncCallerContext> & context) const373 void IoTEventsDataClient::ListAlarmsAsyncHelper(const ListAlarmsRequest& request, const ListAlarmsResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
374 {
375 handler(this, request, ListAlarms(request), context);
376 }
377
ListDetectors(const ListDetectorsRequest & request) const378 ListDetectorsOutcome IoTEventsDataClient::ListDetectors(const ListDetectorsRequest& request) const
379 {
380 if (!request.DetectorModelNameHasBeenSet())
381 {
382 AWS_LOGSTREAM_ERROR("ListDetectors", "Required field: DetectorModelName, is not set");
383 return ListDetectorsOutcome(Aws::Client::AWSError<IoTEventsDataErrors>(IoTEventsDataErrors::MISSING_PARAMETER, "MISSING_PARAMETER", "Missing required field [DetectorModelName]", false));
384 }
385 Aws::Http::URI uri = m_uri;
386 uri.AddPathSegments("/detectors/");
387 uri.AddPathSegment(request.GetDetectorModelName());
388 return ListDetectorsOutcome(MakeRequest(uri, request, Aws::Http::HttpMethod::HTTP_GET, Aws::Auth::SIGV4_SIGNER));
389 }
390
ListDetectorsCallable(const ListDetectorsRequest & request) const391 ListDetectorsOutcomeCallable IoTEventsDataClient::ListDetectorsCallable(const ListDetectorsRequest& request) const
392 {
393 auto task = Aws::MakeShared< std::packaged_task< ListDetectorsOutcome() > >(ALLOCATION_TAG, [this, request](){ return this->ListDetectors(request); } );
394 auto packagedFunction = [task]() { (*task)(); };
395 m_executor->Submit(packagedFunction);
396 return task->get_future();
397 }
398
ListDetectorsAsync(const ListDetectorsRequest & request,const ListDetectorsResponseReceivedHandler & handler,const std::shared_ptr<const Aws::Client::AsyncCallerContext> & context) const399 void IoTEventsDataClient::ListDetectorsAsync(const ListDetectorsRequest& request, const ListDetectorsResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
400 {
401 m_executor->Submit( [this, request, handler, context](){ this->ListDetectorsAsyncHelper( request, handler, context ); } );
402 }
403
ListDetectorsAsyncHelper(const ListDetectorsRequest & request,const ListDetectorsResponseReceivedHandler & handler,const std::shared_ptr<const Aws::Client::AsyncCallerContext> & context) const404 void IoTEventsDataClient::ListDetectorsAsyncHelper(const ListDetectorsRequest& request, const ListDetectorsResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const
405 {
406 handler(this, request, ListDetectors(request), context);
407 }
408
409