@aws-sdk/client-iot-events-data 3.131.0 → 3.142.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +1 -1
  3. package/dist-cjs/commands/BatchAcknowledgeAlarmCommand.js +2 -2
  4. package/dist-cjs/commands/BatchDeleteDetectorCommand.js +2 -2
  5. package/dist-cjs/commands/BatchDisableAlarmCommand.js +2 -2
  6. package/dist-cjs/commands/BatchEnableAlarmCommand.js +2 -2
  7. package/dist-cjs/commands/BatchPutMessageCommand.js +2 -2
  8. package/dist-cjs/commands/BatchResetAlarmCommand.js +2 -2
  9. package/dist-cjs/commands/BatchSnoozeAlarmCommand.js +2 -2
  10. package/dist-cjs/commands/BatchUpdateDetectorCommand.js +2 -2
  11. package/dist-cjs/commands/DescribeAlarmCommand.js +2 -2
  12. package/dist-cjs/commands/DescribeDetectorCommand.js +2 -2
  13. package/dist-cjs/commands/ListAlarmsCommand.js +2 -2
  14. package/dist-cjs/commands/ListDetectorsCommand.js +2 -2
  15. package/dist-cjs/models/models_0.js +238 -356
  16. package/dist-cjs/protocols/Aws_restJson1.js +140 -255
  17. package/dist-es/commands/BatchAcknowledgeAlarmCommand.js +3 -3
  18. package/dist-es/commands/BatchDeleteDetectorCommand.js +3 -3
  19. package/dist-es/commands/BatchDisableAlarmCommand.js +3 -3
  20. package/dist-es/commands/BatchEnableAlarmCommand.js +3 -3
  21. package/dist-es/commands/BatchPutMessageCommand.js +3 -3
  22. package/dist-es/commands/BatchResetAlarmCommand.js +3 -3
  23. package/dist-es/commands/BatchSnoozeAlarmCommand.js +3 -3
  24. package/dist-es/commands/BatchUpdateDetectorCommand.js +3 -3
  25. package/dist-es/commands/DescribeAlarmCommand.js +3 -3
  26. package/dist-es/commands/DescribeDetectorCommand.js +3 -3
  27. package/dist-es/commands/ListAlarmsCommand.js +3 -3
  28. package/dist-es/commands/ListDetectorsCommand.js +3 -3
  29. package/dist-es/models/models_0.js +59 -236
  30. package/dist-es/protocols/Aws_restJson1.js +181 -249
  31. package/dist-types/models/models_0.d.ts +236 -354
  32. package/dist-types/ts3.4/models/models_0.d.ts +118 -236
  33. package/package.json +6 -6
@@ -191,19 +191,10 @@ const serializeAws_restJson1DescribeAlarmCommand = async (input, context) => {
191
191
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
192
192
  const headers = {};
193
193
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/alarms/{alarmModelName}/keyValues";
194
- if (input.alarmModelName !== undefined) {
195
- const labelValue = input.alarmModelName;
196
- if (labelValue.length <= 0) {
197
- throw new Error("Empty value provided for input HTTP label: alarmModelName.");
198
- }
199
- resolvedPath = resolvedPath.replace("{alarmModelName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
200
- }
201
- else {
202
- throw new Error("No value provided for input HTTP label: alarmModelName.");
203
- }
204
- const query = {
205
- ...(input.keyValue !== undefined && { keyValue: input.keyValue }),
206
- };
194
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "alarmModelName", () => input.alarmModelName, "{alarmModelName}", false);
195
+ const query = map({
196
+ keyValue: [, input.keyValue],
197
+ });
207
198
  let body;
208
199
  return new protocol_http_1.HttpRequest({
209
200
  protocol,
@@ -221,19 +212,10 @@ const serializeAws_restJson1DescribeDetectorCommand = async (input, context) =>
221
212
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
222
213
  const headers = {};
223
214
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detectors/{detectorModelName}/keyValues";
224
- if (input.detectorModelName !== undefined) {
225
- const labelValue = input.detectorModelName;
226
- if (labelValue.length <= 0) {
227
- throw new Error("Empty value provided for input HTTP label: detectorModelName.");
228
- }
229
- resolvedPath = resolvedPath.replace("{detectorModelName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
230
- }
231
- else {
232
- throw new Error("No value provided for input HTTP label: detectorModelName.");
233
- }
234
- const query = {
235
- ...(input.keyValue !== undefined && { keyValue: input.keyValue }),
236
- };
215
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "detectorModelName", () => input.detectorModelName, "{detectorModelName}", false);
216
+ const query = map({
217
+ keyValue: [, input.keyValue],
218
+ });
237
219
  let body;
238
220
  return new protocol_http_1.HttpRequest({
239
221
  protocol,
@@ -251,20 +233,11 @@ const serializeAws_restJson1ListAlarmsCommand = async (input, context) => {
251
233
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
252
234
  const headers = {};
253
235
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/alarms/{alarmModelName}";
254
- if (input.alarmModelName !== undefined) {
255
- const labelValue = input.alarmModelName;
256
- if (labelValue.length <= 0) {
257
- throw new Error("Empty value provided for input HTTP label: alarmModelName.");
258
- }
259
- resolvedPath = resolvedPath.replace("{alarmModelName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
260
- }
261
- else {
262
- throw new Error("No value provided for input HTTP label: alarmModelName.");
263
- }
264
- const query = {
265
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
266
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
267
- };
236
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "alarmModelName", () => input.alarmModelName, "{alarmModelName}", false);
237
+ const query = map({
238
+ nextToken: [, input.nextToken],
239
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
240
+ });
268
241
  let body;
269
242
  return new protocol_http_1.HttpRequest({
270
243
  protocol,
@@ -282,21 +255,12 @@ const serializeAws_restJson1ListDetectorsCommand = async (input, context) => {
282
255
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
283
256
  const headers = {};
284
257
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/detectors/{detectorModelName}";
285
- if (input.detectorModelName !== undefined) {
286
- const labelValue = input.detectorModelName;
287
- if (labelValue.length <= 0) {
288
- throw new Error("Empty value provided for input HTTP label: detectorModelName.");
289
- }
290
- resolvedPath = resolvedPath.replace("{detectorModelName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
291
- }
292
- else {
293
- throw new Error("No value provided for input HTTP label: detectorModelName.");
294
- }
295
- const query = {
296
- ...(input.stateName !== undefined && { stateName: input.stateName }),
297
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
298
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
299
- };
258
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "detectorModelName", () => input.detectorModelName, "{detectorModelName}", false);
259
+ const query = map({
260
+ stateName: [, input.stateName],
261
+ nextToken: [, input.nextToken],
262
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
263
+ });
300
264
  let body;
301
265
  return new protocol_http_1.HttpRequest({
302
266
  protocol,
@@ -314,15 +278,14 @@ const deserializeAws_restJson1BatchAcknowledgeAlarmCommand = async (output, cont
314
278
  if (output.statusCode !== 202 && output.statusCode >= 300) {
315
279
  return deserializeAws_restJson1BatchAcknowledgeAlarmCommandError(output, context);
316
280
  }
317
- const contents = {
281
+ const contents = map({
318
282
  $metadata: deserializeMetadata(output),
319
- errorEntries: undefined,
320
- };
283
+ });
321
284
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
322
- if (data.errorEntries !== undefined && data.errorEntries !== null) {
285
+ if (data.errorEntries != null) {
323
286
  contents.errorEntries = deserializeAws_restJson1BatchAlarmActionErrorEntries(data.errorEntries, context);
324
287
  }
325
- return Promise.resolve(contents);
288
+ return contents;
326
289
  };
327
290
  exports.deserializeAws_restJson1BatchAcknowledgeAlarmCommand = deserializeAws_restJson1BatchAcknowledgeAlarmCommand;
328
291
  const deserializeAws_restJson1BatchAcknowledgeAlarmCommandError = async (output, context) => {
@@ -330,7 +293,6 @@ const deserializeAws_restJson1BatchAcknowledgeAlarmCommandError = async (output,
330
293
  ...output,
331
294
  body: await parseBody(output.body, context),
332
295
  };
333
- let response;
334
296
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
335
297
  switch (errorCode) {
336
298
  case "InternalFailureException":
@@ -347,29 +309,26 @@ const deserializeAws_restJson1BatchAcknowledgeAlarmCommandError = async (output,
347
309
  throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
348
310
  default:
349
311
  const parsedBody = parsedOutput.body;
350
- const $metadata = deserializeMetadata(output);
351
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
352
- response = new IoTEventsDataServiceException_1.IoTEventsDataServiceException({
353
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
354
- $fault: "client",
355
- $metadata,
312
+ (0, smithy_client_1.throwDefaultError)({
313
+ output,
314
+ parsedBody,
315
+ exceptionCtor: IoTEventsDataServiceException_1.IoTEventsDataServiceException,
316
+ errorCode,
356
317
  });
357
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
358
318
  }
359
319
  };
360
320
  const deserializeAws_restJson1BatchDeleteDetectorCommand = async (output, context) => {
361
321
  if (output.statusCode !== 200 && output.statusCode >= 300) {
362
322
  return deserializeAws_restJson1BatchDeleteDetectorCommandError(output, context);
363
323
  }
364
- const contents = {
324
+ const contents = map({
365
325
  $metadata: deserializeMetadata(output),
366
- batchDeleteDetectorErrorEntries: undefined,
367
- };
326
+ });
368
327
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
369
- if (data.batchDeleteDetectorErrorEntries !== undefined && data.batchDeleteDetectorErrorEntries !== null) {
328
+ if (data.batchDeleteDetectorErrorEntries != null) {
370
329
  contents.batchDeleteDetectorErrorEntries = deserializeAws_restJson1BatchDeleteDetectorErrorEntries(data.batchDeleteDetectorErrorEntries, context);
371
330
  }
372
- return Promise.resolve(contents);
331
+ return contents;
373
332
  };
374
333
  exports.deserializeAws_restJson1BatchDeleteDetectorCommand = deserializeAws_restJson1BatchDeleteDetectorCommand;
375
334
  const deserializeAws_restJson1BatchDeleteDetectorCommandError = async (output, context) => {
@@ -377,7 +336,6 @@ const deserializeAws_restJson1BatchDeleteDetectorCommandError = async (output, c
377
336
  ...output,
378
337
  body: await parseBody(output.body, context),
379
338
  };
380
- let response;
381
339
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
382
340
  switch (errorCode) {
383
341
  case "InternalFailureException":
@@ -394,29 +352,26 @@ const deserializeAws_restJson1BatchDeleteDetectorCommandError = async (output, c
394
352
  throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
395
353
  default:
396
354
  const parsedBody = parsedOutput.body;
397
- const $metadata = deserializeMetadata(output);
398
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
399
- response = new IoTEventsDataServiceException_1.IoTEventsDataServiceException({
400
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
401
- $fault: "client",
402
- $metadata,
355
+ (0, smithy_client_1.throwDefaultError)({
356
+ output,
357
+ parsedBody,
358
+ exceptionCtor: IoTEventsDataServiceException_1.IoTEventsDataServiceException,
359
+ errorCode,
403
360
  });
404
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
405
361
  }
406
362
  };
407
363
  const deserializeAws_restJson1BatchDisableAlarmCommand = async (output, context) => {
408
364
  if (output.statusCode !== 202 && output.statusCode >= 300) {
409
365
  return deserializeAws_restJson1BatchDisableAlarmCommandError(output, context);
410
366
  }
411
- const contents = {
367
+ const contents = map({
412
368
  $metadata: deserializeMetadata(output),
413
- errorEntries: undefined,
414
- };
369
+ });
415
370
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
416
- if (data.errorEntries !== undefined && data.errorEntries !== null) {
371
+ if (data.errorEntries != null) {
417
372
  contents.errorEntries = deserializeAws_restJson1BatchAlarmActionErrorEntries(data.errorEntries, context);
418
373
  }
419
- return Promise.resolve(contents);
374
+ return contents;
420
375
  };
421
376
  exports.deserializeAws_restJson1BatchDisableAlarmCommand = deserializeAws_restJson1BatchDisableAlarmCommand;
422
377
  const deserializeAws_restJson1BatchDisableAlarmCommandError = async (output, context) => {
@@ -424,7 +379,6 @@ const deserializeAws_restJson1BatchDisableAlarmCommandError = async (output, con
424
379
  ...output,
425
380
  body: await parseBody(output.body, context),
426
381
  };
427
- let response;
428
382
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
429
383
  switch (errorCode) {
430
384
  case "InternalFailureException":
@@ -441,29 +395,26 @@ const deserializeAws_restJson1BatchDisableAlarmCommandError = async (output, con
441
395
  throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
442
396
  default:
443
397
  const parsedBody = parsedOutput.body;
444
- const $metadata = deserializeMetadata(output);
445
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
446
- response = new IoTEventsDataServiceException_1.IoTEventsDataServiceException({
447
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
448
- $fault: "client",
449
- $metadata,
398
+ (0, smithy_client_1.throwDefaultError)({
399
+ output,
400
+ parsedBody,
401
+ exceptionCtor: IoTEventsDataServiceException_1.IoTEventsDataServiceException,
402
+ errorCode,
450
403
  });
451
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
452
404
  }
453
405
  };
454
406
  const deserializeAws_restJson1BatchEnableAlarmCommand = async (output, context) => {
455
407
  if (output.statusCode !== 202 && output.statusCode >= 300) {
456
408
  return deserializeAws_restJson1BatchEnableAlarmCommandError(output, context);
457
409
  }
458
- const contents = {
410
+ const contents = map({
459
411
  $metadata: deserializeMetadata(output),
460
- errorEntries: undefined,
461
- };
412
+ });
462
413
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
463
- if (data.errorEntries !== undefined && data.errorEntries !== null) {
414
+ if (data.errorEntries != null) {
464
415
  contents.errorEntries = deserializeAws_restJson1BatchAlarmActionErrorEntries(data.errorEntries, context);
465
416
  }
466
- return Promise.resolve(contents);
417
+ return contents;
467
418
  };
468
419
  exports.deserializeAws_restJson1BatchEnableAlarmCommand = deserializeAws_restJson1BatchEnableAlarmCommand;
469
420
  const deserializeAws_restJson1BatchEnableAlarmCommandError = async (output, context) => {
@@ -471,7 +422,6 @@ const deserializeAws_restJson1BatchEnableAlarmCommandError = async (output, cont
471
422
  ...output,
472
423
  body: await parseBody(output.body, context),
473
424
  };
474
- let response;
475
425
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
476
426
  switch (errorCode) {
477
427
  case "InternalFailureException":
@@ -488,29 +438,26 @@ const deserializeAws_restJson1BatchEnableAlarmCommandError = async (output, cont
488
438
  throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
489
439
  default:
490
440
  const parsedBody = parsedOutput.body;
491
- const $metadata = deserializeMetadata(output);
492
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
493
- response = new IoTEventsDataServiceException_1.IoTEventsDataServiceException({
494
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
495
- $fault: "client",
496
- $metadata,
441
+ (0, smithy_client_1.throwDefaultError)({
442
+ output,
443
+ parsedBody,
444
+ exceptionCtor: IoTEventsDataServiceException_1.IoTEventsDataServiceException,
445
+ errorCode,
497
446
  });
498
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
499
447
  }
500
448
  };
501
449
  const deserializeAws_restJson1BatchPutMessageCommand = async (output, context) => {
502
450
  if (output.statusCode !== 200 && output.statusCode >= 300) {
503
451
  return deserializeAws_restJson1BatchPutMessageCommandError(output, context);
504
452
  }
505
- const contents = {
453
+ const contents = map({
506
454
  $metadata: deserializeMetadata(output),
507
- BatchPutMessageErrorEntries: undefined,
508
- };
455
+ });
509
456
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
510
- if (data.BatchPutMessageErrorEntries !== undefined && data.BatchPutMessageErrorEntries !== null) {
457
+ if (data.BatchPutMessageErrorEntries != null) {
511
458
  contents.BatchPutMessageErrorEntries = deserializeAws_restJson1BatchPutMessageErrorEntries(data.BatchPutMessageErrorEntries, context);
512
459
  }
513
- return Promise.resolve(contents);
460
+ return contents;
514
461
  };
515
462
  exports.deserializeAws_restJson1BatchPutMessageCommand = deserializeAws_restJson1BatchPutMessageCommand;
516
463
  const deserializeAws_restJson1BatchPutMessageCommandError = async (output, context) => {
@@ -518,7 +465,6 @@ const deserializeAws_restJson1BatchPutMessageCommandError = async (output, conte
518
465
  ...output,
519
466
  body: await parseBody(output.body, context),
520
467
  };
521
- let response;
522
468
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
523
469
  switch (errorCode) {
524
470
  case "InternalFailureException":
@@ -535,29 +481,26 @@ const deserializeAws_restJson1BatchPutMessageCommandError = async (output, conte
535
481
  throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
536
482
  default:
537
483
  const parsedBody = parsedOutput.body;
538
- const $metadata = deserializeMetadata(output);
539
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
540
- response = new IoTEventsDataServiceException_1.IoTEventsDataServiceException({
541
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
542
- $fault: "client",
543
- $metadata,
484
+ (0, smithy_client_1.throwDefaultError)({
485
+ output,
486
+ parsedBody,
487
+ exceptionCtor: IoTEventsDataServiceException_1.IoTEventsDataServiceException,
488
+ errorCode,
544
489
  });
545
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
546
490
  }
547
491
  };
548
492
  const deserializeAws_restJson1BatchResetAlarmCommand = async (output, context) => {
549
493
  if (output.statusCode !== 202 && output.statusCode >= 300) {
550
494
  return deserializeAws_restJson1BatchResetAlarmCommandError(output, context);
551
495
  }
552
- const contents = {
496
+ const contents = map({
553
497
  $metadata: deserializeMetadata(output),
554
- errorEntries: undefined,
555
- };
498
+ });
556
499
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
557
- if (data.errorEntries !== undefined && data.errorEntries !== null) {
500
+ if (data.errorEntries != null) {
558
501
  contents.errorEntries = deserializeAws_restJson1BatchAlarmActionErrorEntries(data.errorEntries, context);
559
502
  }
560
- return Promise.resolve(contents);
503
+ return contents;
561
504
  };
562
505
  exports.deserializeAws_restJson1BatchResetAlarmCommand = deserializeAws_restJson1BatchResetAlarmCommand;
563
506
  const deserializeAws_restJson1BatchResetAlarmCommandError = async (output, context) => {
@@ -565,7 +508,6 @@ const deserializeAws_restJson1BatchResetAlarmCommandError = async (output, conte
565
508
  ...output,
566
509
  body: await parseBody(output.body, context),
567
510
  };
568
- let response;
569
511
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
570
512
  switch (errorCode) {
571
513
  case "InternalFailureException":
@@ -582,29 +524,26 @@ const deserializeAws_restJson1BatchResetAlarmCommandError = async (output, conte
582
524
  throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
583
525
  default:
584
526
  const parsedBody = parsedOutput.body;
585
- const $metadata = deserializeMetadata(output);
586
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
587
- response = new IoTEventsDataServiceException_1.IoTEventsDataServiceException({
588
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
589
- $fault: "client",
590
- $metadata,
527
+ (0, smithy_client_1.throwDefaultError)({
528
+ output,
529
+ parsedBody,
530
+ exceptionCtor: IoTEventsDataServiceException_1.IoTEventsDataServiceException,
531
+ errorCode,
591
532
  });
592
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
593
533
  }
594
534
  };
595
535
  const deserializeAws_restJson1BatchSnoozeAlarmCommand = async (output, context) => {
596
536
  if (output.statusCode !== 202 && output.statusCode >= 300) {
597
537
  return deserializeAws_restJson1BatchSnoozeAlarmCommandError(output, context);
598
538
  }
599
- const contents = {
539
+ const contents = map({
600
540
  $metadata: deserializeMetadata(output),
601
- errorEntries: undefined,
602
- };
541
+ });
603
542
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
604
- if (data.errorEntries !== undefined && data.errorEntries !== null) {
543
+ if (data.errorEntries != null) {
605
544
  contents.errorEntries = deserializeAws_restJson1BatchAlarmActionErrorEntries(data.errorEntries, context);
606
545
  }
607
- return Promise.resolve(contents);
546
+ return contents;
608
547
  };
609
548
  exports.deserializeAws_restJson1BatchSnoozeAlarmCommand = deserializeAws_restJson1BatchSnoozeAlarmCommand;
610
549
  const deserializeAws_restJson1BatchSnoozeAlarmCommandError = async (output, context) => {
@@ -612,7 +551,6 @@ const deserializeAws_restJson1BatchSnoozeAlarmCommandError = async (output, cont
612
551
  ...output,
613
552
  body: await parseBody(output.body, context),
614
553
  };
615
- let response;
616
554
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
617
555
  switch (errorCode) {
618
556
  case "InternalFailureException":
@@ -629,29 +567,26 @@ const deserializeAws_restJson1BatchSnoozeAlarmCommandError = async (output, cont
629
567
  throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
630
568
  default:
631
569
  const parsedBody = parsedOutput.body;
632
- const $metadata = deserializeMetadata(output);
633
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
634
- response = new IoTEventsDataServiceException_1.IoTEventsDataServiceException({
635
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
636
- $fault: "client",
637
- $metadata,
570
+ (0, smithy_client_1.throwDefaultError)({
571
+ output,
572
+ parsedBody,
573
+ exceptionCtor: IoTEventsDataServiceException_1.IoTEventsDataServiceException,
574
+ errorCode,
638
575
  });
639
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
640
576
  }
641
577
  };
642
578
  const deserializeAws_restJson1BatchUpdateDetectorCommand = async (output, context) => {
643
579
  if (output.statusCode !== 200 && output.statusCode >= 300) {
644
580
  return deserializeAws_restJson1BatchUpdateDetectorCommandError(output, context);
645
581
  }
646
- const contents = {
582
+ const contents = map({
647
583
  $metadata: deserializeMetadata(output),
648
- batchUpdateDetectorErrorEntries: undefined,
649
- };
584
+ });
650
585
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
651
- if (data.batchUpdateDetectorErrorEntries !== undefined && data.batchUpdateDetectorErrorEntries !== null) {
586
+ if (data.batchUpdateDetectorErrorEntries != null) {
652
587
  contents.batchUpdateDetectorErrorEntries = deserializeAws_restJson1BatchUpdateDetectorErrorEntries(data.batchUpdateDetectorErrorEntries, context);
653
588
  }
654
- return Promise.resolve(contents);
589
+ return contents;
655
590
  };
656
591
  exports.deserializeAws_restJson1BatchUpdateDetectorCommand = deserializeAws_restJson1BatchUpdateDetectorCommand;
657
592
  const deserializeAws_restJson1BatchUpdateDetectorCommandError = async (output, context) => {
@@ -659,7 +594,6 @@ const deserializeAws_restJson1BatchUpdateDetectorCommandError = async (output, c
659
594
  ...output,
660
595
  body: await parseBody(output.body, context),
661
596
  };
662
- let response;
663
597
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
664
598
  switch (errorCode) {
665
599
  case "InternalFailureException":
@@ -676,29 +610,26 @@ const deserializeAws_restJson1BatchUpdateDetectorCommandError = async (output, c
676
610
  throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
677
611
  default:
678
612
  const parsedBody = parsedOutput.body;
679
- const $metadata = deserializeMetadata(output);
680
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
681
- response = new IoTEventsDataServiceException_1.IoTEventsDataServiceException({
682
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
683
- $fault: "client",
684
- $metadata,
613
+ (0, smithy_client_1.throwDefaultError)({
614
+ output,
615
+ parsedBody,
616
+ exceptionCtor: IoTEventsDataServiceException_1.IoTEventsDataServiceException,
617
+ errorCode,
685
618
  });
686
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
687
619
  }
688
620
  };
689
621
  const deserializeAws_restJson1DescribeAlarmCommand = async (output, context) => {
690
622
  if (output.statusCode !== 200 && output.statusCode >= 300) {
691
623
  return deserializeAws_restJson1DescribeAlarmCommandError(output, context);
692
624
  }
693
- const contents = {
625
+ const contents = map({
694
626
  $metadata: deserializeMetadata(output),
695
- alarm: undefined,
696
- };
627
+ });
697
628
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
698
- if (data.alarm !== undefined && data.alarm !== null) {
629
+ if (data.alarm != null) {
699
630
  contents.alarm = deserializeAws_restJson1Alarm(data.alarm, context);
700
631
  }
701
- return Promise.resolve(contents);
632
+ return contents;
702
633
  };
703
634
  exports.deserializeAws_restJson1DescribeAlarmCommand = deserializeAws_restJson1DescribeAlarmCommand;
704
635
  const deserializeAws_restJson1DescribeAlarmCommandError = async (output, context) => {
@@ -706,7 +637,6 @@ const deserializeAws_restJson1DescribeAlarmCommandError = async (output, context
706
637
  ...output,
707
638
  body: await parseBody(output.body, context),
708
639
  };
709
- let response;
710
640
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
711
641
  switch (errorCode) {
712
642
  case "InternalFailureException":
@@ -726,29 +656,26 @@ const deserializeAws_restJson1DescribeAlarmCommandError = async (output, context
726
656
  throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
727
657
  default:
728
658
  const parsedBody = parsedOutput.body;
729
- const $metadata = deserializeMetadata(output);
730
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
731
- response = new IoTEventsDataServiceException_1.IoTEventsDataServiceException({
732
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
733
- $fault: "client",
734
- $metadata,
659
+ (0, smithy_client_1.throwDefaultError)({
660
+ output,
661
+ parsedBody,
662
+ exceptionCtor: IoTEventsDataServiceException_1.IoTEventsDataServiceException,
663
+ errorCode,
735
664
  });
736
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
737
665
  }
738
666
  };
739
667
  const deserializeAws_restJson1DescribeDetectorCommand = async (output, context) => {
740
668
  if (output.statusCode !== 200 && output.statusCode >= 300) {
741
669
  return deserializeAws_restJson1DescribeDetectorCommandError(output, context);
742
670
  }
743
- const contents = {
671
+ const contents = map({
744
672
  $metadata: deserializeMetadata(output),
745
- detector: undefined,
746
- };
673
+ });
747
674
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
748
- if (data.detector !== undefined && data.detector !== null) {
675
+ if (data.detector != null) {
749
676
  contents.detector = deserializeAws_restJson1Detector(data.detector, context);
750
677
  }
751
- return Promise.resolve(contents);
678
+ return contents;
752
679
  };
753
680
  exports.deserializeAws_restJson1DescribeDetectorCommand = deserializeAws_restJson1DescribeDetectorCommand;
754
681
  const deserializeAws_restJson1DescribeDetectorCommandError = async (output, context) => {
@@ -756,7 +683,6 @@ const deserializeAws_restJson1DescribeDetectorCommandError = async (output, cont
756
683
  ...output,
757
684
  body: await parseBody(output.body, context),
758
685
  };
759
- let response;
760
686
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
761
687
  switch (errorCode) {
762
688
  case "InternalFailureException":
@@ -776,33 +702,29 @@ const deserializeAws_restJson1DescribeDetectorCommandError = async (output, cont
776
702
  throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
777
703
  default:
778
704
  const parsedBody = parsedOutput.body;
779
- const $metadata = deserializeMetadata(output);
780
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
781
- response = new IoTEventsDataServiceException_1.IoTEventsDataServiceException({
782
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
783
- $fault: "client",
784
- $metadata,
705
+ (0, smithy_client_1.throwDefaultError)({
706
+ output,
707
+ parsedBody,
708
+ exceptionCtor: IoTEventsDataServiceException_1.IoTEventsDataServiceException,
709
+ errorCode,
785
710
  });
786
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
787
711
  }
788
712
  };
789
713
  const deserializeAws_restJson1ListAlarmsCommand = async (output, context) => {
790
714
  if (output.statusCode !== 200 && output.statusCode >= 300) {
791
715
  return deserializeAws_restJson1ListAlarmsCommandError(output, context);
792
716
  }
793
- const contents = {
717
+ const contents = map({
794
718
  $metadata: deserializeMetadata(output),
795
- alarmSummaries: undefined,
796
- nextToken: undefined,
797
- };
719
+ });
798
720
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
799
- if (data.alarmSummaries !== undefined && data.alarmSummaries !== null) {
721
+ if (data.alarmSummaries != null) {
800
722
  contents.alarmSummaries = deserializeAws_restJson1AlarmSummaries(data.alarmSummaries, context);
801
723
  }
802
- if (data.nextToken !== undefined && data.nextToken !== null) {
724
+ if (data.nextToken != null) {
803
725
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
804
726
  }
805
- return Promise.resolve(contents);
727
+ return contents;
806
728
  };
807
729
  exports.deserializeAws_restJson1ListAlarmsCommand = deserializeAws_restJson1ListAlarmsCommand;
808
730
  const deserializeAws_restJson1ListAlarmsCommandError = async (output, context) => {
@@ -810,7 +732,6 @@ const deserializeAws_restJson1ListAlarmsCommandError = async (output, context) =
810
732
  ...output,
811
733
  body: await parseBody(output.body, context),
812
734
  };
813
- let response;
814
735
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
815
736
  switch (errorCode) {
816
737
  case "InternalFailureException":
@@ -830,33 +751,29 @@ const deserializeAws_restJson1ListAlarmsCommandError = async (output, context) =
830
751
  throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
831
752
  default:
832
753
  const parsedBody = parsedOutput.body;
833
- const $metadata = deserializeMetadata(output);
834
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
835
- response = new IoTEventsDataServiceException_1.IoTEventsDataServiceException({
836
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
837
- $fault: "client",
838
- $metadata,
754
+ (0, smithy_client_1.throwDefaultError)({
755
+ output,
756
+ parsedBody,
757
+ exceptionCtor: IoTEventsDataServiceException_1.IoTEventsDataServiceException,
758
+ errorCode,
839
759
  });
840
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
841
760
  }
842
761
  };
843
762
  const deserializeAws_restJson1ListDetectorsCommand = async (output, context) => {
844
763
  if (output.statusCode !== 200 && output.statusCode >= 300) {
845
764
  return deserializeAws_restJson1ListDetectorsCommandError(output, context);
846
765
  }
847
- const contents = {
766
+ const contents = map({
848
767
  $metadata: deserializeMetadata(output),
849
- detectorSummaries: undefined,
850
- nextToken: undefined,
851
- };
768
+ });
852
769
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
853
- if (data.detectorSummaries !== undefined && data.detectorSummaries !== null) {
770
+ if (data.detectorSummaries != null) {
854
771
  contents.detectorSummaries = deserializeAws_restJson1DetectorSummaries(data.detectorSummaries, context);
855
772
  }
856
- if (data.nextToken !== undefined && data.nextToken !== null) {
773
+ if (data.nextToken != null) {
857
774
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
858
775
  }
859
- return Promise.resolve(contents);
776
+ return contents;
860
777
  };
861
778
  exports.deserializeAws_restJson1ListDetectorsCommand = deserializeAws_restJson1ListDetectorsCommand;
862
779
  const deserializeAws_restJson1ListDetectorsCommandError = async (output, context) => {
@@ -864,7 +781,6 @@ const deserializeAws_restJson1ListDetectorsCommandError = async (output, context
864
781
  ...output,
865
782
  body: await parseBody(output.body, context),
866
783
  };
867
- let response;
868
784
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
869
785
  switch (errorCode) {
870
786
  case "InternalFailureException":
@@ -884,20 +800,19 @@ const deserializeAws_restJson1ListDetectorsCommandError = async (output, context
884
800
  throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
885
801
  default:
886
802
  const parsedBody = parsedOutput.body;
887
- const $metadata = deserializeMetadata(output);
888
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
889
- response = new IoTEventsDataServiceException_1.IoTEventsDataServiceException({
890
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
891
- $fault: "client",
892
- $metadata,
803
+ (0, smithy_client_1.throwDefaultError)({
804
+ output,
805
+ parsedBody,
806
+ exceptionCtor: IoTEventsDataServiceException_1.IoTEventsDataServiceException,
807
+ errorCode,
893
808
  });
894
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
895
809
  }
896
810
  };
811
+ const map = smithy_client_1.map;
897
812
  const deserializeAws_restJson1InternalFailureExceptionResponse = async (parsedOutput, context) => {
898
- const contents = {};
813
+ const contents = map({});
899
814
  const data = parsedOutput.body;
900
- if (data.message !== undefined && data.message !== null) {
815
+ if (data.message != null) {
901
816
  contents.message = (0, smithy_client_1.expectString)(data.message);
902
817
  }
903
818
  const exception = new models_0_1.InternalFailureException({
@@ -907,9 +822,9 @@ const deserializeAws_restJson1InternalFailureExceptionResponse = async (parsedOu
907
822
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
908
823
  };
909
824
  const deserializeAws_restJson1InvalidRequestExceptionResponse = async (parsedOutput, context) => {
910
- const contents = {};
825
+ const contents = map({});
911
826
  const data = parsedOutput.body;
912
- if (data.message !== undefined && data.message !== null) {
827
+ if (data.message != null) {
913
828
  contents.message = (0, smithy_client_1.expectString)(data.message);
914
829
  }
915
830
  const exception = new models_0_1.InvalidRequestException({
@@ -919,9 +834,9 @@ const deserializeAws_restJson1InvalidRequestExceptionResponse = async (parsedOut
919
834
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
920
835
  };
921
836
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
922
- const contents = {};
837
+ const contents = map({});
923
838
  const data = parsedOutput.body;
924
- if (data.message !== undefined && data.message !== null) {
839
+ if (data.message != null) {
925
840
  contents.message = (0, smithy_client_1.expectString)(data.message);
926
841
  }
927
842
  const exception = new models_0_1.ResourceNotFoundException({
@@ -931,9 +846,9 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
931
846
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
932
847
  };
933
848
  const deserializeAws_restJson1ServiceUnavailableExceptionResponse = async (parsedOutput, context) => {
934
- const contents = {};
849
+ const contents = map({});
935
850
  const data = parsedOutput.body;
936
- if (data.message !== undefined && data.message !== null) {
851
+ if (data.message != null) {
937
852
  contents.message = (0, smithy_client_1.expectString)(data.message);
938
853
  }
939
854
  const exception = new models_0_1.ServiceUnavailableException({
@@ -943,9 +858,9 @@ const deserializeAws_restJson1ServiceUnavailableExceptionResponse = async (parse
943
858
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
944
859
  };
945
860
  const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
946
- const contents = {};
861
+ const contents = map({});
947
862
  const data = parsedOutput.body;
948
- if (data.message !== undefined && data.message !== null) {
863
+ if (data.message != null) {
949
864
  contents.message = (0, smithy_client_1.expectString)(data.message);
950
865
  }
951
866
  const exception = new models_0_1.ThrottlingException({
@@ -966,9 +881,6 @@ const serializeAws_restJson1AcknowledgeAlarmActionRequests = (input, context) =>
966
881
  return input
967
882
  .filter((e) => e != null)
968
883
  .map((entry) => {
969
- if (entry === null) {
970
- return null;
971
- }
972
884
  return serializeAws_restJson1AcknowledgeAlarmActionRequest(entry, context);
973
885
  });
974
886
  };
@@ -983,9 +895,6 @@ const serializeAws_restJson1DeleteDetectorRequests = (input, context) => {
983
895
  return input
984
896
  .filter((e) => e != null)
985
897
  .map((entry) => {
986
- if (entry === null) {
987
- return null;
988
- }
989
898
  return serializeAws_restJson1DeleteDetectorRequest(entry, context);
990
899
  });
991
900
  };
@@ -1008,9 +917,6 @@ const serializeAws_restJson1DisableAlarmActionRequests = (input, context) => {
1008
917
  return input
1009
918
  .filter((e) => e != null)
1010
919
  .map((entry) => {
1011
- if (entry === null) {
1012
- return null;
1013
- }
1014
920
  return serializeAws_restJson1DisableAlarmActionRequest(entry, context);
1015
921
  });
1016
922
  };
@@ -1026,9 +932,6 @@ const serializeAws_restJson1EnableAlarmActionRequests = (input, context) => {
1026
932
  return input
1027
933
  .filter((e) => e != null)
1028
934
  .map((entry) => {
1029
- if (entry === null) {
1030
- return null;
1031
- }
1032
935
  return serializeAws_restJson1EnableAlarmActionRequest(entry, context);
1033
936
  });
1034
937
  };
@@ -1044,9 +947,6 @@ const serializeAws_restJson1Messages = (input, context) => {
1044
947
  return input
1045
948
  .filter((e) => e != null)
1046
949
  .map((entry) => {
1047
- if (entry === null) {
1048
- return null;
1049
- }
1050
950
  return serializeAws_restJson1Message(entry, context);
1051
951
  });
1052
952
  };
@@ -1062,9 +962,6 @@ const serializeAws_restJson1ResetAlarmActionRequests = (input, context) => {
1062
962
  return input
1063
963
  .filter((e) => e != null)
1064
964
  .map((entry) => {
1065
- if (entry === null) {
1066
- return null;
1067
- }
1068
965
  return serializeAws_restJson1ResetAlarmActionRequest(entry, context);
1069
966
  });
1070
967
  };
@@ -1081,9 +978,6 @@ const serializeAws_restJson1SnoozeAlarmActionRequests = (input, context) => {
1081
978
  return input
1082
979
  .filter((e) => e != null)
1083
980
  .map((entry) => {
1084
- if (entry === null) {
1085
- return null;
1086
- }
1087
981
  return serializeAws_restJson1SnoozeAlarmActionRequest(entry, context);
1088
982
  });
1089
983
  };
@@ -1097,9 +991,6 @@ const serializeAws_restJson1TimerDefinitions = (input, context) => {
1097
991
  return input
1098
992
  .filter((e) => e != null)
1099
993
  .map((entry) => {
1100
- if (entry === null) {
1101
- return null;
1102
- }
1103
994
  return serializeAws_restJson1TimerDefinition(entry, context);
1104
995
  });
1105
996
  };
@@ -1120,9 +1011,6 @@ const serializeAws_restJson1UpdateDetectorRequests = (input, context) => {
1120
1011
  return input
1121
1012
  .filter((e) => e != null)
1122
1013
  .map((entry) => {
1123
- if (entry === null) {
1124
- return null;
1125
- }
1126
1014
  return serializeAws_restJson1UpdateDetectorRequest(entry, context);
1127
1015
  });
1128
1016
  };
@@ -1136,9 +1024,6 @@ const serializeAws_restJson1VariableDefinitions = (input, context) => {
1136
1024
  return input
1137
1025
  .filter((e) => e != null)
1138
1026
  .map((entry) => {
1139
- if (entry === null) {
1140
- return null;
1141
- }
1142
1027
  return serializeAws_restJson1VariableDefinition(entry, context);
1143
1028
  });
1144
1029
  };