@aws-sdk/client-iot-data-plane 3.312.0 → 3.316.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.
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.IoTDataPlane = void 0;
4
+ const smithy_client_1 = require("@aws-sdk/smithy-client");
4
5
  const DeleteThingShadowCommand_1 = require("./commands/DeleteThingShadowCommand");
5
6
  const GetRetainedMessageCommand_1 = require("./commands/GetRetainedMessageCommand");
6
7
  const GetThingShadowCommand_1 = require("./commands/GetThingShadowCommand");
@@ -9,104 +10,16 @@ const ListRetainedMessagesCommand_1 = require("./commands/ListRetainedMessagesCo
9
10
  const PublishCommand_1 = require("./commands/PublishCommand");
10
11
  const UpdateThingShadowCommand_1 = require("./commands/UpdateThingShadowCommand");
11
12
  const IoTDataPlaneClient_1 = require("./IoTDataPlaneClient");
13
+ const commands = {
14
+ DeleteThingShadowCommand: DeleteThingShadowCommand_1.DeleteThingShadowCommand,
15
+ GetRetainedMessageCommand: GetRetainedMessageCommand_1.GetRetainedMessageCommand,
16
+ GetThingShadowCommand: GetThingShadowCommand_1.GetThingShadowCommand,
17
+ ListNamedShadowsForThingCommand: ListNamedShadowsForThingCommand_1.ListNamedShadowsForThingCommand,
18
+ ListRetainedMessagesCommand: ListRetainedMessagesCommand_1.ListRetainedMessagesCommand,
19
+ PublishCommand: PublishCommand_1.PublishCommand,
20
+ UpdateThingShadowCommand: UpdateThingShadowCommand_1.UpdateThingShadowCommand,
21
+ };
12
22
  class IoTDataPlane extends IoTDataPlaneClient_1.IoTDataPlaneClient {
13
- deleteThingShadow(args, optionsOrCb, cb) {
14
- const command = new DeleteThingShadowCommand_1.DeleteThingShadowCommand(args);
15
- if (typeof optionsOrCb === "function") {
16
- this.send(command, optionsOrCb);
17
- }
18
- else if (typeof cb === "function") {
19
- if (typeof optionsOrCb !== "object")
20
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
21
- this.send(command, optionsOrCb || {}, cb);
22
- }
23
- else {
24
- return this.send(command, optionsOrCb);
25
- }
26
- }
27
- getRetainedMessage(args, optionsOrCb, cb) {
28
- const command = new GetRetainedMessageCommand_1.GetRetainedMessageCommand(args);
29
- if (typeof optionsOrCb === "function") {
30
- this.send(command, optionsOrCb);
31
- }
32
- else if (typeof cb === "function") {
33
- if (typeof optionsOrCb !== "object")
34
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
35
- this.send(command, optionsOrCb || {}, cb);
36
- }
37
- else {
38
- return this.send(command, optionsOrCb);
39
- }
40
- }
41
- getThingShadow(args, optionsOrCb, cb) {
42
- const command = new GetThingShadowCommand_1.GetThingShadowCommand(args);
43
- if (typeof optionsOrCb === "function") {
44
- this.send(command, optionsOrCb);
45
- }
46
- else if (typeof cb === "function") {
47
- if (typeof optionsOrCb !== "object")
48
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
49
- this.send(command, optionsOrCb || {}, cb);
50
- }
51
- else {
52
- return this.send(command, optionsOrCb);
53
- }
54
- }
55
- listNamedShadowsForThing(args, optionsOrCb, cb) {
56
- const command = new ListNamedShadowsForThingCommand_1.ListNamedShadowsForThingCommand(args);
57
- if (typeof optionsOrCb === "function") {
58
- this.send(command, optionsOrCb);
59
- }
60
- else if (typeof cb === "function") {
61
- if (typeof optionsOrCb !== "object")
62
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
63
- this.send(command, optionsOrCb || {}, cb);
64
- }
65
- else {
66
- return this.send(command, optionsOrCb);
67
- }
68
- }
69
- listRetainedMessages(args, optionsOrCb, cb) {
70
- const command = new ListRetainedMessagesCommand_1.ListRetainedMessagesCommand(args);
71
- if (typeof optionsOrCb === "function") {
72
- this.send(command, optionsOrCb);
73
- }
74
- else if (typeof cb === "function") {
75
- if (typeof optionsOrCb !== "object")
76
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
77
- this.send(command, optionsOrCb || {}, cb);
78
- }
79
- else {
80
- return this.send(command, optionsOrCb);
81
- }
82
- }
83
- publish(args, optionsOrCb, cb) {
84
- const command = new PublishCommand_1.PublishCommand(args);
85
- if (typeof optionsOrCb === "function") {
86
- this.send(command, optionsOrCb);
87
- }
88
- else if (typeof cb === "function") {
89
- if (typeof optionsOrCb !== "object")
90
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
91
- this.send(command, optionsOrCb || {}, cb);
92
- }
93
- else {
94
- return this.send(command, optionsOrCb);
95
- }
96
- }
97
- updateThingShadow(args, optionsOrCb, cb) {
98
- const command = new UpdateThingShadowCommand_1.UpdateThingShadowCommand(args);
99
- if (typeof optionsOrCb === "function") {
100
- this.send(command, optionsOrCb);
101
- }
102
- else if (typeof cb === "function") {
103
- if (typeof optionsOrCb !== "object")
104
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
105
- this.send(command, optionsOrCb || {}, cb);
106
- }
107
- else {
108
- return this.send(command, optionsOrCb);
109
- }
110
- }
111
23
  }
112
24
  exports.IoTDataPlane = IoTDataPlane;
25
+ (0, smithy_client_1.createAggregatedClient)(commands, IoTDataPlane);
@@ -10,7 +10,7 @@ const se_DeleteThingShadowCommand = async (input, context) => {
10
10
  const headers = {};
11
11
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/shadow";
12
12
  resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "thingName", () => input.thingName, "{thingName}", false);
13
- const query = map({
13
+ const query = (0, smithy_client_1.map)({
14
14
  name: [, input.shadowName],
15
15
  });
16
16
  let body;
@@ -48,7 +48,7 @@ const se_GetThingShadowCommand = async (input, context) => {
48
48
  const headers = {};
49
49
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/shadow";
50
50
  resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "thingName", () => input.thingName, "{thingName}", false);
51
- const query = map({
51
+ const query = (0, smithy_client_1.map)({
52
52
  name: [, input.shadowName],
53
53
  });
54
54
  let body;
@@ -70,7 +70,7 @@ const se_ListNamedShadowsForThingCommand = async (input, context) => {
70
70
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
71
71
  "/api/things/shadow/ListNamedShadowsForThing/{thingName}";
72
72
  resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "thingName", () => input.thingName, "{thingName}", false);
73
- const query = map({
73
+ const query = (0, smithy_client_1.map)({
74
74
  nextToken: [, input.nextToken],
75
75
  pageSize: [() => input.pageSize !== void 0, () => input.pageSize.toString()],
76
76
  });
@@ -91,7 +91,7 @@ const se_ListRetainedMessagesCommand = async (input, context) => {
91
91
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
92
92
  const headers = {};
93
93
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/retainedMessage";
94
- const query = map({
94
+ const query = (0, smithy_client_1.map)({
95
95
  nextToken: [, input.nextToken],
96
96
  maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
97
97
  });
@@ -110,7 +110,7 @@ const se_ListRetainedMessagesCommand = async (input, context) => {
110
110
  exports.se_ListRetainedMessagesCommand = se_ListRetainedMessagesCommand;
111
111
  const se_PublishCommand = async (input, context) => {
112
112
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
113
- const headers = map({}, isSerializableHeaderValue, {
113
+ const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
114
114
  "content-type": "application/octet-stream",
115
115
  "x-amz-mqtt5-user-properties": [
116
116
  () => isSerializableHeaderValue(input.userProperties),
@@ -121,7 +121,7 @@ const se_PublishCommand = async (input, context) => {
121
121
  });
122
122
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/topics/{topic}";
123
123
  resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "topic", () => input.topic, "{topic}", false);
124
- const query = map({
124
+ const query = (0, smithy_client_1.map)({
125
125
  qos: [() => input.qos !== void 0, () => input.qos.toString()],
126
126
  retain: [() => input.retain !== void 0, () => input.retain.toString()],
127
127
  contentType: [, input.contentType],
@@ -151,7 +151,7 @@ const se_UpdateThingShadowCommand = async (input, context) => {
151
151
  };
152
152
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/shadow";
153
153
  resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "thingName", () => input.thingName, "{thingName}", false);
154
- const query = map({
154
+ const query = (0, smithy_client_1.map)({
155
155
  name: [, input.shadowName],
156
156
  });
157
157
  let body;
@@ -174,7 +174,7 @@ const de_DeleteThingShadowCommand = async (output, context) => {
174
174
  if (output.statusCode !== 200 && output.statusCode >= 300) {
175
175
  return de_DeleteThingShadowCommandError(output, context);
176
176
  }
177
- const contents = map({
177
+ const contents = (0, smithy_client_1.map)({
178
178
  $metadata: deserializeMetadata(output),
179
179
  });
180
180
  const data = await collectBody(output.body, context);
@@ -215,10 +215,9 @@ const de_DeleteThingShadowCommandError = async (output, context) => {
215
215
  throw await de_UnsupportedDocumentEncodingExceptionRes(parsedOutput, context);
216
216
  default:
217
217
  const parsedBody = parsedOutput.body;
218
- (0, smithy_client_1.throwDefaultError)({
218
+ return throwDefaultError({
219
219
  output,
220
220
  parsedBody,
221
- exceptionCtor: IoTDataPlaneServiceException_1.IoTDataPlaneServiceException,
222
221
  errorCode,
223
222
  });
224
223
  }
@@ -227,25 +226,18 @@ const de_GetRetainedMessageCommand = async (output, context) => {
227
226
  if (output.statusCode !== 200 && output.statusCode >= 300) {
228
227
  return de_GetRetainedMessageCommandError(output, context);
229
228
  }
230
- const contents = map({
229
+ const contents = (0, smithy_client_1.map)({
231
230
  $metadata: deserializeMetadata(output),
232
231
  });
233
232
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
234
- if (data.lastModifiedTime != null) {
235
- contents.lastModifiedTime = (0, smithy_client_1.expectLong)(data.lastModifiedTime);
236
- }
237
- if (data.payload != null) {
238
- contents.payload = context.base64Decoder(data.payload);
239
- }
240
- if (data.qos != null) {
241
- contents.qos = (0, smithy_client_1.expectInt32)(data.qos);
242
- }
243
- if (data.topic != null) {
244
- contents.topic = (0, smithy_client_1.expectString)(data.topic);
245
- }
246
- if (data.userProperties != null) {
247
- contents.userProperties = context.base64Decoder(data.userProperties);
248
- }
233
+ const doc = (0, smithy_client_1.take)(data, {
234
+ lastModifiedTime: smithy_client_1.expectLong,
235
+ payload: context.base64Decoder,
236
+ qos: smithy_client_1.expectInt32,
237
+ topic: smithy_client_1.expectString,
238
+ userProperties: context.base64Decoder,
239
+ });
240
+ Object.assign(contents, doc);
249
241
  return contents;
250
242
  };
251
243
  exports.de_GetRetainedMessageCommand = de_GetRetainedMessageCommand;
@@ -279,10 +271,9 @@ const de_GetRetainedMessageCommandError = async (output, context) => {
279
271
  throw await de_UnauthorizedExceptionRes(parsedOutput, context);
280
272
  default:
281
273
  const parsedBody = parsedOutput.body;
282
- (0, smithy_client_1.throwDefaultError)({
274
+ return throwDefaultError({
283
275
  output,
284
276
  parsedBody,
285
- exceptionCtor: IoTDataPlaneServiceException_1.IoTDataPlaneServiceException,
286
277
  errorCode,
287
278
  });
288
279
  }
@@ -291,7 +282,7 @@ const de_GetThingShadowCommand = async (output, context) => {
291
282
  if (output.statusCode !== 200 && output.statusCode >= 300) {
292
283
  return de_GetThingShadowCommandError(output, context);
293
284
  }
294
- const contents = map({
285
+ const contents = (0, smithy_client_1.map)({
295
286
  $metadata: deserializeMetadata(output),
296
287
  });
297
288
  const data = await collectBody(output.body, context);
@@ -332,10 +323,9 @@ const de_GetThingShadowCommandError = async (output, context) => {
332
323
  throw await de_UnsupportedDocumentEncodingExceptionRes(parsedOutput, context);
333
324
  default:
334
325
  const parsedBody = parsedOutput.body;
335
- (0, smithy_client_1.throwDefaultError)({
326
+ return throwDefaultError({
336
327
  output,
337
328
  parsedBody,
338
- exceptionCtor: IoTDataPlaneServiceException_1.IoTDataPlaneServiceException,
339
329
  errorCode,
340
330
  });
341
331
  }
@@ -344,19 +334,16 @@ const de_ListNamedShadowsForThingCommand = async (output, context) => {
344
334
  if (output.statusCode !== 200 && output.statusCode >= 300) {
345
335
  return de_ListNamedShadowsForThingCommandError(output, context);
346
336
  }
347
- const contents = map({
337
+ const contents = (0, smithy_client_1.map)({
348
338
  $metadata: deserializeMetadata(output),
349
339
  });
350
340
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
351
- if (data.nextToken != null) {
352
- contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
353
- }
354
- if (data.results != null) {
355
- contents.results = de_NamedShadowList(data.results, context);
356
- }
357
- if (data.timestamp != null) {
358
- contents.timestamp = (0, smithy_client_1.expectLong)(data.timestamp);
359
- }
341
+ const doc = (0, smithy_client_1.take)(data, {
342
+ nextToken: smithy_client_1.expectString,
343
+ results: smithy_client_1._json,
344
+ timestamp: smithy_client_1.expectLong,
345
+ });
346
+ Object.assign(contents, doc);
360
347
  return contents;
361
348
  };
362
349
  exports.de_ListNamedShadowsForThingCommand = de_ListNamedShadowsForThingCommand;
@@ -390,10 +377,9 @@ const de_ListNamedShadowsForThingCommandError = async (output, context) => {
390
377
  throw await de_UnauthorizedExceptionRes(parsedOutput, context);
391
378
  default:
392
379
  const parsedBody = parsedOutput.body;
393
- (0, smithy_client_1.throwDefaultError)({
380
+ return throwDefaultError({
394
381
  output,
395
382
  parsedBody,
396
- exceptionCtor: IoTDataPlaneServiceException_1.IoTDataPlaneServiceException,
397
383
  errorCode,
398
384
  });
399
385
  }
@@ -402,16 +388,15 @@ const de_ListRetainedMessagesCommand = async (output, context) => {
402
388
  if (output.statusCode !== 200 && output.statusCode >= 300) {
403
389
  return de_ListRetainedMessagesCommandError(output, context);
404
390
  }
405
- const contents = map({
391
+ const contents = (0, smithy_client_1.map)({
406
392
  $metadata: deserializeMetadata(output),
407
393
  });
408
394
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
409
- if (data.nextToken != null) {
410
- contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
411
- }
412
- if (data.retainedTopics != null) {
413
- contents.retainedTopics = de_RetainedMessageList(data.retainedTopics, context);
414
- }
395
+ const doc = (0, smithy_client_1.take)(data, {
396
+ nextToken: smithy_client_1.expectString,
397
+ retainedTopics: smithy_client_1._json,
398
+ });
399
+ Object.assign(contents, doc);
415
400
  return contents;
416
401
  };
417
402
  exports.de_ListRetainedMessagesCommand = de_ListRetainedMessagesCommand;
@@ -442,10 +427,9 @@ const de_ListRetainedMessagesCommandError = async (output, context) => {
442
427
  throw await de_UnauthorizedExceptionRes(parsedOutput, context);
443
428
  default:
444
429
  const parsedBody = parsedOutput.body;
445
- (0, smithy_client_1.throwDefaultError)({
430
+ return throwDefaultError({
446
431
  output,
447
432
  parsedBody,
448
- exceptionCtor: IoTDataPlaneServiceException_1.IoTDataPlaneServiceException,
449
433
  errorCode,
450
434
  });
451
435
  }
@@ -454,7 +438,7 @@ const de_PublishCommand = async (output, context) => {
454
438
  if (output.statusCode !== 200 && output.statusCode >= 300) {
455
439
  return de_PublishCommandError(output, context);
456
440
  }
457
- const contents = map({
441
+ const contents = (0, smithy_client_1.map)({
458
442
  $metadata: deserializeMetadata(output),
459
443
  });
460
444
  await collectBody(output.body, context);
@@ -485,10 +469,9 @@ const de_PublishCommandError = async (output, context) => {
485
469
  throw await de_UnauthorizedExceptionRes(parsedOutput, context);
486
470
  default:
487
471
  const parsedBody = parsedOutput.body;
488
- (0, smithy_client_1.throwDefaultError)({
472
+ return throwDefaultError({
489
473
  output,
490
474
  parsedBody,
491
- exceptionCtor: IoTDataPlaneServiceException_1.IoTDataPlaneServiceException,
492
475
  errorCode,
493
476
  });
494
477
  }
@@ -497,7 +480,7 @@ const de_UpdateThingShadowCommand = async (output, context) => {
497
480
  if (output.statusCode !== 200 && output.statusCode >= 300) {
498
481
  return de_UpdateThingShadowCommandError(output, context);
499
482
  }
500
- const contents = map({
483
+ const contents = (0, smithy_client_1.map)({
501
484
  $metadata: deserializeMetadata(output),
502
485
  });
503
486
  const data = await collectBody(output.body, context);
@@ -541,21 +524,21 @@ const de_UpdateThingShadowCommandError = async (output, context) => {
541
524
  throw await de_UnsupportedDocumentEncodingExceptionRes(parsedOutput, context);
542
525
  default:
543
526
  const parsedBody = parsedOutput.body;
544
- (0, smithy_client_1.throwDefaultError)({
527
+ return throwDefaultError({
545
528
  output,
546
529
  parsedBody,
547
- exceptionCtor: IoTDataPlaneServiceException_1.IoTDataPlaneServiceException,
548
530
  errorCode,
549
531
  });
550
532
  }
551
533
  };
552
- const map = smithy_client_1.map;
534
+ const throwDefaultError = (0, smithy_client_1.withBaseException)(IoTDataPlaneServiceException_1.IoTDataPlaneServiceException);
553
535
  const de_ConflictExceptionRes = async (parsedOutput, context) => {
554
- const contents = map({});
536
+ const contents = (0, smithy_client_1.map)({});
555
537
  const data = parsedOutput.body;
556
- if (data.message != null) {
557
- contents.message = (0, smithy_client_1.expectString)(data.message);
558
- }
538
+ const doc = (0, smithy_client_1.take)(data, {
539
+ message: smithy_client_1.expectString,
540
+ });
541
+ Object.assign(contents, doc);
559
542
  const exception = new models_0_1.ConflictException({
560
543
  $metadata: deserializeMetadata(parsedOutput),
561
544
  ...contents,
@@ -563,11 +546,12 @@ const de_ConflictExceptionRes = async (parsedOutput, context) => {
563
546
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
564
547
  };
565
548
  const de_InternalFailureExceptionRes = async (parsedOutput, context) => {
566
- const contents = map({});
549
+ const contents = (0, smithy_client_1.map)({});
567
550
  const data = parsedOutput.body;
568
- if (data.message != null) {
569
- contents.message = (0, smithy_client_1.expectString)(data.message);
570
- }
551
+ const doc = (0, smithy_client_1.take)(data, {
552
+ message: smithy_client_1.expectString,
553
+ });
554
+ Object.assign(contents, doc);
571
555
  const exception = new models_0_1.InternalFailureException({
572
556
  $metadata: deserializeMetadata(parsedOutput),
573
557
  ...contents,
@@ -575,11 +559,12 @@ const de_InternalFailureExceptionRes = async (parsedOutput, context) => {
575
559
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
576
560
  };
577
561
  const de_InvalidRequestExceptionRes = async (parsedOutput, context) => {
578
- const contents = map({});
562
+ const contents = (0, smithy_client_1.map)({});
579
563
  const data = parsedOutput.body;
580
- if (data.message != null) {
581
- contents.message = (0, smithy_client_1.expectString)(data.message);
582
- }
564
+ const doc = (0, smithy_client_1.take)(data, {
565
+ message: smithy_client_1.expectString,
566
+ });
567
+ Object.assign(contents, doc);
583
568
  const exception = new models_0_1.InvalidRequestException({
584
569
  $metadata: deserializeMetadata(parsedOutput),
585
570
  ...contents,
@@ -587,11 +572,12 @@ const de_InvalidRequestExceptionRes = async (parsedOutput, context) => {
587
572
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
588
573
  };
589
574
  const de_MethodNotAllowedExceptionRes = async (parsedOutput, context) => {
590
- const contents = map({});
575
+ const contents = (0, smithy_client_1.map)({});
591
576
  const data = parsedOutput.body;
592
- if (data.message != null) {
593
- contents.message = (0, smithy_client_1.expectString)(data.message);
594
- }
577
+ const doc = (0, smithy_client_1.take)(data, {
578
+ message: smithy_client_1.expectString,
579
+ });
580
+ Object.assign(contents, doc);
595
581
  const exception = new models_0_1.MethodNotAllowedException({
596
582
  $metadata: deserializeMetadata(parsedOutput),
597
583
  ...contents,
@@ -599,11 +585,12 @@ const de_MethodNotAllowedExceptionRes = async (parsedOutput, context) => {
599
585
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
600
586
  };
601
587
  const de_RequestEntityTooLargeExceptionRes = async (parsedOutput, context) => {
602
- const contents = map({});
588
+ const contents = (0, smithy_client_1.map)({});
603
589
  const data = parsedOutput.body;
604
- if (data.message != null) {
605
- contents.message = (0, smithy_client_1.expectString)(data.message);
606
- }
590
+ const doc = (0, smithy_client_1.take)(data, {
591
+ message: smithy_client_1.expectString,
592
+ });
593
+ Object.assign(contents, doc);
607
594
  const exception = new models_0_1.RequestEntityTooLargeException({
608
595
  $metadata: deserializeMetadata(parsedOutput),
609
596
  ...contents,
@@ -611,11 +598,12 @@ const de_RequestEntityTooLargeExceptionRes = async (parsedOutput, context) => {
611
598
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
612
599
  };
613
600
  const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
614
- const contents = map({});
601
+ const contents = (0, smithy_client_1.map)({});
615
602
  const data = parsedOutput.body;
616
- if (data.message != null) {
617
- contents.message = (0, smithy_client_1.expectString)(data.message);
618
- }
603
+ const doc = (0, smithy_client_1.take)(data, {
604
+ message: smithy_client_1.expectString,
605
+ });
606
+ Object.assign(contents, doc);
619
607
  const exception = new models_0_1.ResourceNotFoundException({
620
608
  $metadata: deserializeMetadata(parsedOutput),
621
609
  ...contents,
@@ -623,11 +611,12 @@ const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
623
611
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
624
612
  };
625
613
  const de_ServiceUnavailableExceptionRes = async (parsedOutput, context) => {
626
- const contents = map({});
614
+ const contents = (0, smithy_client_1.map)({});
627
615
  const data = parsedOutput.body;
628
- if (data.message != null) {
629
- contents.message = (0, smithy_client_1.expectString)(data.message);
630
- }
616
+ const doc = (0, smithy_client_1.take)(data, {
617
+ message: smithy_client_1.expectString,
618
+ });
619
+ Object.assign(contents, doc);
631
620
  const exception = new models_0_1.ServiceUnavailableException({
632
621
  $metadata: deserializeMetadata(parsedOutput),
633
622
  ...contents,
@@ -635,11 +624,12 @@ const de_ServiceUnavailableExceptionRes = async (parsedOutput, context) => {
635
624
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
636
625
  };
637
626
  const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
638
- const contents = map({});
627
+ const contents = (0, smithy_client_1.map)({});
639
628
  const data = parsedOutput.body;
640
- if (data.message != null) {
641
- contents.message = (0, smithy_client_1.expectString)(data.message);
642
- }
629
+ const doc = (0, smithy_client_1.take)(data, {
630
+ message: smithy_client_1.expectString,
631
+ });
632
+ Object.assign(contents, doc);
643
633
  const exception = new models_0_1.ThrottlingException({
644
634
  $metadata: deserializeMetadata(parsedOutput),
645
635
  ...contents,
@@ -647,11 +637,12 @@ const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
647
637
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
648
638
  };
649
639
  const de_UnauthorizedExceptionRes = async (parsedOutput, context) => {
650
- const contents = map({});
640
+ const contents = (0, smithy_client_1.map)({});
651
641
  const data = parsedOutput.body;
652
- if (data.message != null) {
653
- contents.message = (0, smithy_client_1.expectString)(data.message);
654
- }
642
+ const doc = (0, smithy_client_1.take)(data, {
643
+ message: smithy_client_1.expectString,
644
+ });
645
+ Object.assign(contents, doc);
655
646
  const exception = new models_0_1.UnauthorizedException({
656
647
  $metadata: deserializeMetadata(parsedOutput),
657
648
  ...contents,
@@ -659,47 +650,18 @@ const de_UnauthorizedExceptionRes = async (parsedOutput, context) => {
659
650
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
660
651
  };
661
652
  const de_UnsupportedDocumentEncodingExceptionRes = async (parsedOutput, context) => {
662
- const contents = map({});
653
+ const contents = (0, smithy_client_1.map)({});
663
654
  const data = parsedOutput.body;
664
- if (data.message != null) {
665
- contents.message = (0, smithy_client_1.expectString)(data.message);
666
- }
655
+ const doc = (0, smithy_client_1.take)(data, {
656
+ message: smithy_client_1.expectString,
657
+ });
658
+ Object.assign(contents, doc);
667
659
  const exception = new models_0_1.UnsupportedDocumentEncodingException({
668
660
  $metadata: deserializeMetadata(parsedOutput),
669
661
  ...contents,
670
662
  });
671
663
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
672
664
  };
673
- const de_NamedShadowList = (output, context) => {
674
- const retVal = (output || [])
675
- .filter((e) => e != null)
676
- .map((entry) => {
677
- if (entry === null) {
678
- return null;
679
- }
680
- return (0, smithy_client_1.expectString)(entry);
681
- });
682
- return retVal;
683
- };
684
- const de_RetainedMessageList = (output, context) => {
685
- const retVal = (output || [])
686
- .filter((e) => e != null)
687
- .map((entry) => {
688
- if (entry === null) {
689
- return null;
690
- }
691
- return de_RetainedMessageSummary(entry, context);
692
- });
693
- return retVal;
694
- };
695
- const de_RetainedMessageSummary = (output, context) => {
696
- return {
697
- lastModifiedTime: (0, smithy_client_1.expectLong)(output.lastModifiedTime),
698
- payloadSize: (0, smithy_client_1.expectLong)(output.payloadSize),
699
- qos: (0, smithy_client_1.expectInt32)(output.qos),
700
- topic: (0, smithy_client_1.expectString)(output.topic),
701
- };
702
- };
703
665
  const deserializeMetadata = (output) => ({
704
666
  httpStatusCode: output.statusCode,
705
667
  requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
@@ -1,3 +1,4 @@
1
+ import { createAggregatedClient } from "@aws-sdk/smithy-client";
1
2
  import { DeleteThingShadowCommand, } from "./commands/DeleteThingShadowCommand";
2
3
  import { GetRetainedMessageCommand, } from "./commands/GetRetainedMessageCommand";
3
4
  import { GetThingShadowCommand, } from "./commands/GetThingShadowCommand";
@@ -6,103 +7,15 @@ import { ListRetainedMessagesCommand, } from "./commands/ListRetainedMessagesCom
6
7
  import { PublishCommand } from "./commands/PublishCommand";
7
8
  import { UpdateThingShadowCommand, } from "./commands/UpdateThingShadowCommand";
8
9
  import { IoTDataPlaneClient } from "./IoTDataPlaneClient";
10
+ const commands = {
11
+ DeleteThingShadowCommand,
12
+ GetRetainedMessageCommand,
13
+ GetThingShadowCommand,
14
+ ListNamedShadowsForThingCommand,
15
+ ListRetainedMessagesCommand,
16
+ PublishCommand,
17
+ UpdateThingShadowCommand,
18
+ };
9
19
  export class IoTDataPlane extends IoTDataPlaneClient {
10
- deleteThingShadow(args, optionsOrCb, cb) {
11
- const command = new DeleteThingShadowCommand(args);
12
- if (typeof optionsOrCb === "function") {
13
- this.send(command, optionsOrCb);
14
- }
15
- else if (typeof cb === "function") {
16
- if (typeof optionsOrCb !== "object")
17
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
18
- this.send(command, optionsOrCb || {}, cb);
19
- }
20
- else {
21
- return this.send(command, optionsOrCb);
22
- }
23
- }
24
- getRetainedMessage(args, optionsOrCb, cb) {
25
- const command = new GetRetainedMessageCommand(args);
26
- if (typeof optionsOrCb === "function") {
27
- this.send(command, optionsOrCb);
28
- }
29
- else if (typeof cb === "function") {
30
- if (typeof optionsOrCb !== "object")
31
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
32
- this.send(command, optionsOrCb || {}, cb);
33
- }
34
- else {
35
- return this.send(command, optionsOrCb);
36
- }
37
- }
38
- getThingShadow(args, optionsOrCb, cb) {
39
- const command = new GetThingShadowCommand(args);
40
- if (typeof optionsOrCb === "function") {
41
- this.send(command, optionsOrCb);
42
- }
43
- else if (typeof cb === "function") {
44
- if (typeof optionsOrCb !== "object")
45
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
46
- this.send(command, optionsOrCb || {}, cb);
47
- }
48
- else {
49
- return this.send(command, optionsOrCb);
50
- }
51
- }
52
- listNamedShadowsForThing(args, optionsOrCb, cb) {
53
- const command = new ListNamedShadowsForThingCommand(args);
54
- if (typeof optionsOrCb === "function") {
55
- this.send(command, optionsOrCb);
56
- }
57
- else if (typeof cb === "function") {
58
- if (typeof optionsOrCb !== "object")
59
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
60
- this.send(command, optionsOrCb || {}, cb);
61
- }
62
- else {
63
- return this.send(command, optionsOrCb);
64
- }
65
- }
66
- listRetainedMessages(args, optionsOrCb, cb) {
67
- const command = new ListRetainedMessagesCommand(args);
68
- if (typeof optionsOrCb === "function") {
69
- this.send(command, optionsOrCb);
70
- }
71
- else if (typeof cb === "function") {
72
- if (typeof optionsOrCb !== "object")
73
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
74
- this.send(command, optionsOrCb || {}, cb);
75
- }
76
- else {
77
- return this.send(command, optionsOrCb);
78
- }
79
- }
80
- publish(args, optionsOrCb, cb) {
81
- const command = new PublishCommand(args);
82
- if (typeof optionsOrCb === "function") {
83
- this.send(command, optionsOrCb);
84
- }
85
- else if (typeof cb === "function") {
86
- if (typeof optionsOrCb !== "object")
87
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
88
- this.send(command, optionsOrCb || {}, cb);
89
- }
90
- else {
91
- return this.send(command, optionsOrCb);
92
- }
93
- }
94
- updateThingShadow(args, optionsOrCb, cb) {
95
- const command = new UpdateThingShadowCommand(args);
96
- if (typeof optionsOrCb === "function") {
97
- this.send(command, optionsOrCb);
98
- }
99
- else if (typeof cb === "function") {
100
- if (typeof optionsOrCb !== "object")
101
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
102
- this.send(command, optionsOrCb || {}, cb);
103
- }
104
- else {
105
- return this.send(command, optionsOrCb);
106
- }
107
- }
108
20
  }
21
+ createAggregatedClient(commands, IoTDataPlane);
@@ -1,5 +1,5 @@
1
1
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
- import { decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectLong as __expectLong, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, LazyJsonString as __LazyJsonString, map as __map, resolvedPath as __resolvedPath, throwDefaultError, } from "@aws-sdk/smithy-client";
2
+ import { _json, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectLong as __expectLong, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, LazyJsonString as __LazyJsonString, map, resolvedPath as __resolvedPath, take, withBaseException, } from "@aws-sdk/smithy-client";
3
3
  import { IoTDataPlaneServiceException as __BaseException } from "../models/IoTDataPlaneServiceException";
4
4
  import { ConflictException, InternalFailureException, InvalidRequestException, MethodNotAllowedException, RequestEntityTooLargeException, ResourceNotFoundException, ServiceUnavailableException, ThrottlingException, UnauthorizedException, UnsupportedDocumentEncodingException, } from "../models/models_0";
5
5
  export const se_DeleteThingShadowCommand = async (input, context) => {
@@ -204,10 +204,9 @@ const de_DeleteThingShadowCommandError = async (output, context) => {
204
204
  throw await de_UnsupportedDocumentEncodingExceptionRes(parsedOutput, context);
205
205
  default:
206
206
  const parsedBody = parsedOutput.body;
207
- throwDefaultError({
207
+ return throwDefaultError({
208
208
  output,
209
209
  parsedBody,
210
- exceptionCtor: __BaseException,
211
210
  errorCode,
212
211
  });
213
212
  }
@@ -220,21 +219,14 @@ export const de_GetRetainedMessageCommand = async (output, context) => {
220
219
  $metadata: deserializeMetadata(output),
221
220
  });
222
221
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
223
- if (data.lastModifiedTime != null) {
224
- contents.lastModifiedTime = __expectLong(data.lastModifiedTime);
225
- }
226
- if (data.payload != null) {
227
- contents.payload = context.base64Decoder(data.payload);
228
- }
229
- if (data.qos != null) {
230
- contents.qos = __expectInt32(data.qos);
231
- }
232
- if (data.topic != null) {
233
- contents.topic = __expectString(data.topic);
234
- }
235
- if (data.userProperties != null) {
236
- contents.userProperties = context.base64Decoder(data.userProperties);
237
- }
222
+ const doc = take(data, {
223
+ lastModifiedTime: __expectLong,
224
+ payload: context.base64Decoder,
225
+ qos: __expectInt32,
226
+ topic: __expectString,
227
+ userProperties: context.base64Decoder,
228
+ });
229
+ Object.assign(contents, doc);
238
230
  return contents;
239
231
  };
240
232
  const de_GetRetainedMessageCommandError = async (output, context) => {
@@ -267,10 +259,9 @@ const de_GetRetainedMessageCommandError = async (output, context) => {
267
259
  throw await de_UnauthorizedExceptionRes(parsedOutput, context);
268
260
  default:
269
261
  const parsedBody = parsedOutput.body;
270
- throwDefaultError({
262
+ return throwDefaultError({
271
263
  output,
272
264
  parsedBody,
273
- exceptionCtor: __BaseException,
274
265
  errorCode,
275
266
  });
276
267
  }
@@ -319,10 +310,9 @@ const de_GetThingShadowCommandError = async (output, context) => {
319
310
  throw await de_UnsupportedDocumentEncodingExceptionRes(parsedOutput, context);
320
311
  default:
321
312
  const parsedBody = parsedOutput.body;
322
- throwDefaultError({
313
+ return throwDefaultError({
323
314
  output,
324
315
  parsedBody,
325
- exceptionCtor: __BaseException,
326
316
  errorCode,
327
317
  });
328
318
  }
@@ -335,15 +325,12 @@ export const de_ListNamedShadowsForThingCommand = async (output, context) => {
335
325
  $metadata: deserializeMetadata(output),
336
326
  });
337
327
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
338
- if (data.nextToken != null) {
339
- contents.nextToken = __expectString(data.nextToken);
340
- }
341
- if (data.results != null) {
342
- contents.results = de_NamedShadowList(data.results, context);
343
- }
344
- if (data.timestamp != null) {
345
- contents.timestamp = __expectLong(data.timestamp);
346
- }
328
+ const doc = take(data, {
329
+ nextToken: __expectString,
330
+ results: _json,
331
+ timestamp: __expectLong,
332
+ });
333
+ Object.assign(contents, doc);
347
334
  return contents;
348
335
  };
349
336
  const de_ListNamedShadowsForThingCommandError = async (output, context) => {
@@ -376,10 +363,9 @@ const de_ListNamedShadowsForThingCommandError = async (output, context) => {
376
363
  throw await de_UnauthorizedExceptionRes(parsedOutput, context);
377
364
  default:
378
365
  const parsedBody = parsedOutput.body;
379
- throwDefaultError({
366
+ return throwDefaultError({
380
367
  output,
381
368
  parsedBody,
382
- exceptionCtor: __BaseException,
383
369
  errorCode,
384
370
  });
385
371
  }
@@ -392,12 +378,11 @@ export const de_ListRetainedMessagesCommand = async (output, context) => {
392
378
  $metadata: deserializeMetadata(output),
393
379
  });
394
380
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
395
- if (data.nextToken != null) {
396
- contents.nextToken = __expectString(data.nextToken);
397
- }
398
- if (data.retainedTopics != null) {
399
- contents.retainedTopics = de_RetainedMessageList(data.retainedTopics, context);
400
- }
381
+ const doc = take(data, {
382
+ nextToken: __expectString,
383
+ retainedTopics: _json,
384
+ });
385
+ Object.assign(contents, doc);
401
386
  return contents;
402
387
  };
403
388
  const de_ListRetainedMessagesCommandError = async (output, context) => {
@@ -427,10 +412,9 @@ const de_ListRetainedMessagesCommandError = async (output, context) => {
427
412
  throw await de_UnauthorizedExceptionRes(parsedOutput, context);
428
413
  default:
429
414
  const parsedBody = parsedOutput.body;
430
- throwDefaultError({
415
+ return throwDefaultError({
431
416
  output,
432
417
  parsedBody,
433
- exceptionCtor: __BaseException,
434
418
  errorCode,
435
419
  });
436
420
  }
@@ -469,10 +453,9 @@ const de_PublishCommandError = async (output, context) => {
469
453
  throw await de_UnauthorizedExceptionRes(parsedOutput, context);
470
454
  default:
471
455
  const parsedBody = parsedOutput.body;
472
- throwDefaultError({
456
+ return throwDefaultError({
473
457
  output,
474
458
  parsedBody,
475
- exceptionCtor: __BaseException,
476
459
  errorCode,
477
460
  });
478
461
  }
@@ -524,21 +507,21 @@ const de_UpdateThingShadowCommandError = async (output, context) => {
524
507
  throw await de_UnsupportedDocumentEncodingExceptionRes(parsedOutput, context);
525
508
  default:
526
509
  const parsedBody = parsedOutput.body;
527
- throwDefaultError({
510
+ return throwDefaultError({
528
511
  output,
529
512
  parsedBody,
530
- exceptionCtor: __BaseException,
531
513
  errorCode,
532
514
  });
533
515
  }
534
516
  };
535
- const map = __map;
517
+ const throwDefaultError = withBaseException(__BaseException);
536
518
  const de_ConflictExceptionRes = async (parsedOutput, context) => {
537
519
  const contents = map({});
538
520
  const data = parsedOutput.body;
539
- if (data.message != null) {
540
- contents.message = __expectString(data.message);
541
- }
521
+ const doc = take(data, {
522
+ message: __expectString,
523
+ });
524
+ Object.assign(contents, doc);
542
525
  const exception = new ConflictException({
543
526
  $metadata: deserializeMetadata(parsedOutput),
544
527
  ...contents,
@@ -548,9 +531,10 @@ const de_ConflictExceptionRes = async (parsedOutput, context) => {
548
531
  const de_InternalFailureExceptionRes = async (parsedOutput, context) => {
549
532
  const contents = map({});
550
533
  const data = parsedOutput.body;
551
- if (data.message != null) {
552
- contents.message = __expectString(data.message);
553
- }
534
+ const doc = take(data, {
535
+ message: __expectString,
536
+ });
537
+ Object.assign(contents, doc);
554
538
  const exception = new InternalFailureException({
555
539
  $metadata: deserializeMetadata(parsedOutput),
556
540
  ...contents,
@@ -560,9 +544,10 @@ const de_InternalFailureExceptionRes = async (parsedOutput, context) => {
560
544
  const de_InvalidRequestExceptionRes = async (parsedOutput, context) => {
561
545
  const contents = map({});
562
546
  const data = parsedOutput.body;
563
- if (data.message != null) {
564
- contents.message = __expectString(data.message);
565
- }
547
+ const doc = take(data, {
548
+ message: __expectString,
549
+ });
550
+ Object.assign(contents, doc);
566
551
  const exception = new InvalidRequestException({
567
552
  $metadata: deserializeMetadata(parsedOutput),
568
553
  ...contents,
@@ -572,9 +557,10 @@ const de_InvalidRequestExceptionRes = async (parsedOutput, context) => {
572
557
  const de_MethodNotAllowedExceptionRes = async (parsedOutput, context) => {
573
558
  const contents = map({});
574
559
  const data = parsedOutput.body;
575
- if (data.message != null) {
576
- contents.message = __expectString(data.message);
577
- }
560
+ const doc = take(data, {
561
+ message: __expectString,
562
+ });
563
+ Object.assign(contents, doc);
578
564
  const exception = new MethodNotAllowedException({
579
565
  $metadata: deserializeMetadata(parsedOutput),
580
566
  ...contents,
@@ -584,9 +570,10 @@ const de_MethodNotAllowedExceptionRes = async (parsedOutput, context) => {
584
570
  const de_RequestEntityTooLargeExceptionRes = async (parsedOutput, context) => {
585
571
  const contents = map({});
586
572
  const data = parsedOutput.body;
587
- if (data.message != null) {
588
- contents.message = __expectString(data.message);
589
- }
573
+ const doc = take(data, {
574
+ message: __expectString,
575
+ });
576
+ Object.assign(contents, doc);
590
577
  const exception = new RequestEntityTooLargeException({
591
578
  $metadata: deserializeMetadata(parsedOutput),
592
579
  ...contents,
@@ -596,9 +583,10 @@ const de_RequestEntityTooLargeExceptionRes = async (parsedOutput, context) => {
596
583
  const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
597
584
  const contents = map({});
598
585
  const data = parsedOutput.body;
599
- if (data.message != null) {
600
- contents.message = __expectString(data.message);
601
- }
586
+ const doc = take(data, {
587
+ message: __expectString,
588
+ });
589
+ Object.assign(contents, doc);
602
590
  const exception = new ResourceNotFoundException({
603
591
  $metadata: deserializeMetadata(parsedOutput),
604
592
  ...contents,
@@ -608,9 +596,10 @@ const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
608
596
  const de_ServiceUnavailableExceptionRes = async (parsedOutput, context) => {
609
597
  const contents = map({});
610
598
  const data = parsedOutput.body;
611
- if (data.message != null) {
612
- contents.message = __expectString(data.message);
613
- }
599
+ const doc = take(data, {
600
+ message: __expectString,
601
+ });
602
+ Object.assign(contents, doc);
614
603
  const exception = new ServiceUnavailableException({
615
604
  $metadata: deserializeMetadata(parsedOutput),
616
605
  ...contents,
@@ -620,9 +609,10 @@ const de_ServiceUnavailableExceptionRes = async (parsedOutput, context) => {
620
609
  const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
621
610
  const contents = map({});
622
611
  const data = parsedOutput.body;
623
- if (data.message != null) {
624
- contents.message = __expectString(data.message);
625
- }
612
+ const doc = take(data, {
613
+ message: __expectString,
614
+ });
615
+ Object.assign(contents, doc);
626
616
  const exception = new ThrottlingException({
627
617
  $metadata: deserializeMetadata(parsedOutput),
628
618
  ...contents,
@@ -632,9 +622,10 @@ const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
632
622
  const de_UnauthorizedExceptionRes = async (parsedOutput, context) => {
633
623
  const contents = map({});
634
624
  const data = parsedOutput.body;
635
- if (data.message != null) {
636
- contents.message = __expectString(data.message);
637
- }
625
+ const doc = take(data, {
626
+ message: __expectString,
627
+ });
628
+ Object.assign(contents, doc);
638
629
  const exception = new UnauthorizedException({
639
630
  $metadata: deserializeMetadata(parsedOutput),
640
631
  ...contents,
@@ -644,45 +635,16 @@ const de_UnauthorizedExceptionRes = async (parsedOutput, context) => {
644
635
  const de_UnsupportedDocumentEncodingExceptionRes = async (parsedOutput, context) => {
645
636
  const contents = map({});
646
637
  const data = parsedOutput.body;
647
- if (data.message != null) {
648
- contents.message = __expectString(data.message);
649
- }
638
+ const doc = take(data, {
639
+ message: __expectString,
640
+ });
641
+ Object.assign(contents, doc);
650
642
  const exception = new UnsupportedDocumentEncodingException({
651
643
  $metadata: deserializeMetadata(parsedOutput),
652
644
  ...contents,
653
645
  });
654
646
  return __decorateServiceException(exception, parsedOutput.body);
655
647
  };
656
- const de_NamedShadowList = (output, context) => {
657
- const retVal = (output || [])
658
- .filter((e) => e != null)
659
- .map((entry) => {
660
- if (entry === null) {
661
- return null;
662
- }
663
- return __expectString(entry);
664
- });
665
- return retVal;
666
- };
667
- const de_RetainedMessageList = (output, context) => {
668
- const retVal = (output || [])
669
- .filter((e) => e != null)
670
- .map((entry) => {
671
- if (entry === null) {
672
- return null;
673
- }
674
- return de_RetainedMessageSummary(entry, context);
675
- });
676
- return retVal;
677
- };
678
- const de_RetainedMessageSummary = (output, context) => {
679
- return {
680
- lastModifiedTime: __expectLong(output.lastModifiedTime),
681
- payloadSize: __expectLong(output.payloadSize),
682
- qos: __expectInt32(output.qos),
683
- topic: __expectString(output.topic),
684
- };
685
- };
686
648
  const deserializeMetadata = (output) => ({
687
649
  httpStatusCode: output.statusCode,
688
650
  requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
@@ -7,98 +7,63 @@ import { ListRetainedMessagesCommandInput, ListRetainedMessagesCommandOutput } f
7
7
  import { PublishCommandInput, PublishCommandOutput } from "./commands/PublishCommand";
8
8
  import { UpdateThingShadowCommandInput, UpdateThingShadowCommandOutput } from "./commands/UpdateThingShadowCommand";
9
9
  import { IoTDataPlaneClient } from "./IoTDataPlaneClient";
10
- /**
11
- * @public
12
- * <fullname>IoT data</fullname>
13
- * <p>IoT data enables secure, bi-directional communication between Internet-connected things (such as sensors,
14
- * actuators, embedded devices, or smart appliances) and the Amazon Web Services cloud. It implements a broker for applications and
15
- * things to publish messages over HTTP (Publish) and retrieve, update, and delete shadows. A shadow is a
16
- * persistent representation of your things and their state in the Amazon Web Services cloud.</p>
17
- * <p>Find the endpoint address for actions in IoT data by running this CLI command:</p>
18
- * <p>
19
- * <code>aws iot describe-endpoint --endpoint-type iot:Data-ATS</code>
20
- * </p>
21
- * <p>The service name used by <a href="https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html">Amazon Web ServicesSignature Version 4</a>
22
- * to sign requests is: <i>iotdevicegateway</i>.</p>
23
- */
24
- export declare class IoTDataPlane extends IoTDataPlaneClient {
10
+ export interface IoTDataPlane {
25
11
  /**
26
- * @public
27
- * <p>Deletes the shadow for the specified thing.</p>
28
- * <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">DeleteThingShadow</a> action.</p>
29
- * <p>For more information, see <a href="http://docs.aws.amazon.com/iot/latest/developerguide/API_DeleteThingShadow.html">DeleteThingShadow</a> in the IoT Developer Guide.</p>
12
+ * @see {@link DeleteThingShadowCommand}
30
13
  */
31
14
  deleteThingShadow(args: DeleteThingShadowCommandInput, options?: __HttpHandlerOptions): Promise<DeleteThingShadowCommandOutput>;
32
15
  deleteThingShadow(args: DeleteThingShadowCommandInput, cb: (err: any, data?: DeleteThingShadowCommandOutput) => void): void;
33
16
  deleteThingShadow(args: DeleteThingShadowCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: DeleteThingShadowCommandOutput) => void): void;
34
17
  /**
35
- * @public
36
- * <p>Gets the details of a single retained message for the specified topic.</p>
37
- * <p>This action returns the message payload of the retained message, which can
38
- * incur messaging costs. To list only the topic names of the retained messages, call
39
- * <a href="https://docs.aws.amazon.com/iot/latest/apireference/API_iotdata_ListRetainedMessages.html">ListRetainedMessages</a>.</p>
40
- * <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiotfleethubfordevicemanagement.html#awsiotfleethubfordevicemanagement-actions-as-permissions">GetRetainedMessage</a> action.</p>
41
- * <p>For more information about messaging costs, see <a href="http://aws.amazon.com/iot-core/pricing/#Messaging">Amazon Web Services IoT Core
42
- * pricing - Messaging</a>.</p>
18
+ * @see {@link GetRetainedMessageCommand}
43
19
  */
44
20
  getRetainedMessage(args: GetRetainedMessageCommandInput, options?: __HttpHandlerOptions): Promise<GetRetainedMessageCommandOutput>;
45
21
  getRetainedMessage(args: GetRetainedMessageCommandInput, cb: (err: any, data?: GetRetainedMessageCommandOutput) => void): void;
46
22
  getRetainedMessage(args: GetRetainedMessageCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: GetRetainedMessageCommandOutput) => void): void;
47
23
  /**
48
- * @public
49
- * <p>Gets the shadow for the specified thing.</p>
50
- * <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">GetThingShadow</a> action.</p>
51
- * <p>For more information, see <a href="http://docs.aws.amazon.com/iot/latest/developerguide/API_GetThingShadow.html">GetThingShadow</a> in the
52
- * IoT Developer Guide.</p>
24
+ * @see {@link GetThingShadowCommand}
53
25
  */
54
26
  getThingShadow(args: GetThingShadowCommandInput, options?: __HttpHandlerOptions): Promise<GetThingShadowCommandOutput>;
55
27
  getThingShadow(args: GetThingShadowCommandInput, cb: (err: any, data?: GetThingShadowCommandOutput) => void): void;
56
28
  getThingShadow(args: GetThingShadowCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: GetThingShadowCommandOutput) => void): void;
57
29
  /**
58
- * @public
59
- * <p>Lists the shadows for the specified thing.</p>
60
- * <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">ListNamedShadowsForThing</a> action.</p>
30
+ * @see {@link ListNamedShadowsForThingCommand}
61
31
  */
62
32
  listNamedShadowsForThing(args: ListNamedShadowsForThingCommandInput, options?: __HttpHandlerOptions): Promise<ListNamedShadowsForThingCommandOutput>;
63
33
  listNamedShadowsForThing(args: ListNamedShadowsForThingCommandInput, cb: (err: any, data?: ListNamedShadowsForThingCommandOutput) => void): void;
64
34
  listNamedShadowsForThing(args: ListNamedShadowsForThingCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: ListNamedShadowsForThingCommandOutput) => void): void;
65
35
  /**
66
- * @public
67
- * <p>Lists summary information about the retained messages stored for the account.</p>
68
- * <p>This action returns only the topic names of the retained messages. It doesn't
69
- * return any message payloads. Although this action doesn't return a message payload,
70
- * it can still incur messaging costs.</p>
71
- * <p>To get the message payload of a retained message, call
72
- * <a href="https://docs.aws.amazon.com/iot/latest/apireference/API_iotdata_GetRetainedMessage.html">GetRetainedMessage</a>
73
- * with the topic name of the retained message.</p>
74
- * <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiotfleethubfordevicemanagement.html#awsiotfleethubfordevicemanagement-actions-as-permissions">ListRetainedMessages</a> action.</p>
75
- * <p>For more information about messaging costs, see <a href="http://aws.amazon.com/iot-core/pricing/#Messaging">Amazon Web Services IoT Core
76
- * pricing - Messaging</a>.</p>
36
+ * @see {@link ListRetainedMessagesCommand}
77
37
  */
78
38
  listRetainedMessages(args: ListRetainedMessagesCommandInput, options?: __HttpHandlerOptions): Promise<ListRetainedMessagesCommandOutput>;
79
39
  listRetainedMessages(args: ListRetainedMessagesCommandInput, cb: (err: any, data?: ListRetainedMessagesCommandOutput) => void): void;
80
40
  listRetainedMessages(args: ListRetainedMessagesCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: ListRetainedMessagesCommandOutput) => void): void;
81
41
  /**
82
- * @public
83
- * <p>Publishes an MQTT message.</p>
84
- * <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">Publish</a> action.</p>
85
- * <p>For more information about MQTT messages, see
86
- * <a href="http://docs.aws.amazon.com/iot/latest/developerguide/mqtt.html">MQTT Protocol</a> in the
87
- * IoT Developer Guide.</p>
88
- * <p>For more information about messaging costs, see <a href="http://aws.amazon.com/iot-core/pricing/#Messaging">Amazon Web Services IoT Core
89
- * pricing - Messaging</a>.</p>
42
+ * @see {@link PublishCommand}
90
43
  */
91
44
  publish(args: PublishCommandInput, options?: __HttpHandlerOptions): Promise<PublishCommandOutput>;
92
45
  publish(args: PublishCommandInput, cb: (err: any, data?: PublishCommandOutput) => void): void;
93
46
  publish(args: PublishCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: PublishCommandOutput) => void): void;
94
47
  /**
95
- * @public
96
- * <p>Updates the shadow for the specified thing.</p>
97
- * <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">UpdateThingShadow</a> action.</p>
98
- * <p>For more information, see <a href="http://docs.aws.amazon.com/iot/latest/developerguide/API_UpdateThingShadow.html">UpdateThingShadow</a> in the
99
- * IoT Developer Guide.</p>
48
+ * @see {@link UpdateThingShadowCommand}
100
49
  */
101
50
  updateThingShadow(args: UpdateThingShadowCommandInput, options?: __HttpHandlerOptions): Promise<UpdateThingShadowCommandOutput>;
102
51
  updateThingShadow(args: UpdateThingShadowCommandInput, cb: (err: any, data?: UpdateThingShadowCommandOutput) => void): void;
103
52
  updateThingShadow(args: UpdateThingShadowCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: UpdateThingShadowCommandOutput) => void): void;
104
53
  }
54
+ /**
55
+ * @public
56
+ * <fullname>IoT data</fullname>
57
+ * <p>IoT data enables secure, bi-directional communication between Internet-connected things (such as sensors,
58
+ * actuators, embedded devices, or smart appliances) and the Amazon Web Services cloud. It implements a broker for applications and
59
+ * things to publish messages over HTTP (Publish) and retrieve, update, and delete shadows. A shadow is a
60
+ * persistent representation of your things and their state in the Amazon Web Services cloud.</p>
61
+ * <p>Find the endpoint address for actions in IoT data by running this CLI command:</p>
62
+ * <p>
63
+ * <code>aws iot describe-endpoint --endpoint-type iot:Data-ATS</code>
64
+ * </p>
65
+ * <p>The service name used by <a href="https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html">Amazon Web ServicesSignature Version 4</a>
66
+ * to sign requests is: <i>iotdevicegateway</i>.</p>
67
+ */
68
+ export declare class IoTDataPlane extends IoTDataPlaneClient implements IoTDataPlane {
69
+ }
@@ -28,7 +28,7 @@ import {
28
28
  UpdateThingShadowCommandOutput,
29
29
  } from "./commands/UpdateThingShadowCommand";
30
30
  import { IoTDataPlaneClient } from "./IoTDataPlaneClient";
31
- export declare class IoTDataPlane extends IoTDataPlaneClient {
31
+ export interface IoTDataPlane {
32
32
  deleteThingShadow(
33
33
  args: DeleteThingShadowCommandInput,
34
34
  options?: __HttpHandlerOptions
@@ -121,3 +121,6 @@ export declare class IoTDataPlane extends IoTDataPlaneClient {
121
121
  cb: (err: any, data?: UpdateThingShadowCommandOutput) => void
122
122
  ): void;
123
123
  }
124
+ export declare class IoTDataPlane
125
+ extends IoTDataPlaneClient
126
+ implements IoTDataPlane {}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-iot-data-plane",
3
3
  "description": "AWS SDK for JavaScript Iot Data Plane Client for Node.js, Browser and React Native",
4
- "version": "3.312.0",
4
+ "version": "3.316.0",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -21,9 +21,9 @@
21
21
  "dependencies": {
22
22
  "@aws-crypto/sha256-browser": "3.0.0",
23
23
  "@aws-crypto/sha256-js": "3.0.0",
24
- "@aws-sdk/client-sts": "3.312.0",
24
+ "@aws-sdk/client-sts": "3.316.0",
25
25
  "@aws-sdk/config-resolver": "3.310.0",
26
- "@aws-sdk/credential-provider-node": "3.310.0",
26
+ "@aws-sdk/credential-provider-node": "3.316.0",
27
27
  "@aws-sdk/fetch-http-handler": "3.310.0",
28
28
  "@aws-sdk/hash-node": "3.310.0",
29
29
  "@aws-sdk/invalid-dependency": "3.310.0",
@@ -40,14 +40,14 @@
40
40
  "@aws-sdk/node-config-provider": "3.310.0",
41
41
  "@aws-sdk/node-http-handler": "3.310.0",
42
42
  "@aws-sdk/protocol-http": "3.310.0",
43
- "@aws-sdk/smithy-client": "3.310.0",
43
+ "@aws-sdk/smithy-client": "3.316.0",
44
44
  "@aws-sdk/types": "3.310.0",
45
45
  "@aws-sdk/url-parser": "3.310.0",
46
46
  "@aws-sdk/util-base64": "3.310.0",
47
47
  "@aws-sdk/util-body-length-browser": "3.310.0",
48
48
  "@aws-sdk/util-body-length-node": "3.310.0",
49
- "@aws-sdk/util-defaults-mode-browser": "3.310.0",
50
- "@aws-sdk/util-defaults-mode-node": "3.310.0",
49
+ "@aws-sdk/util-defaults-mode-browser": "3.316.0",
50
+ "@aws-sdk/util-defaults-mode-node": "3.316.0",
51
51
  "@aws-sdk/util-endpoints": "3.310.0",
52
52
  "@aws-sdk/util-retry": "3.310.0",
53
53
  "@aws-sdk/util-user-agent-browser": "3.310.0",