@aws-sdk/client-iot-data-plane 3.141.0 → 3.150.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,33 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.150.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.149.0...v3.150.0) (2022-08-15)
7
+
8
+ **Note:** Version bump only for package @aws-sdk/client-iot-data-plane
9
+
10
+
11
+
12
+
13
+
14
+ # [3.145.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.144.0...v3.145.0) (2022-08-08)
15
+
16
+ **Note:** Version bump only for package @aws-sdk/client-iot-data-plane
17
+
18
+
19
+
20
+
21
+
22
+ # [3.142.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.141.0...v3.142.0) (2022-08-02)
23
+
24
+
25
+ ### Features
26
+
27
+ * **codegen:** general data mapping function ([#3830](https://github.com/aws/aws-sdk-js-v3/issues/3830)) ([9417eae](https://github.com/aws/aws-sdk-js-v3/commit/9417eae722806799fb4c15c07921574268c1165c))
28
+
29
+
30
+
31
+
32
+
6
33
  # [3.141.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.140.0...v3.141.0) (2022-08-01)
7
34
 
8
35
 
@@ -9,19 +9,10 @@ const serializeAws_restJson1DeleteThingShadowCommand = async (input, context) =>
9
9
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
10
10
  const headers = {};
11
11
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/shadow";
12
- if (input.thingName !== undefined) {
13
- const labelValue = input.thingName;
14
- if (labelValue.length <= 0) {
15
- throw new Error("Empty value provided for input HTTP label: thingName.");
16
- }
17
- resolvedPath = resolvedPath.replace("{thingName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
18
- }
19
- else {
20
- throw new Error("No value provided for input HTTP label: thingName.");
21
- }
22
- const query = {
23
- ...(input.shadowName !== undefined && { name: input.shadowName }),
24
- };
12
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "thingName", () => input.thingName, "{thingName}", false);
13
+ const query = map({
14
+ name: [, input.shadowName],
15
+ });
25
16
  let body;
26
17
  return new protocol_http_1.HttpRequest({
27
18
  protocol,
@@ -39,16 +30,7 @@ const serializeAws_restJson1GetRetainedMessageCommand = async (input, context) =
39
30
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
40
31
  const headers = {};
41
32
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/retainedMessage/{topic}";
42
- if (input.topic !== undefined) {
43
- const labelValue = input.topic;
44
- if (labelValue.length <= 0) {
45
- throw new Error("Empty value provided for input HTTP label: topic.");
46
- }
47
- resolvedPath = resolvedPath.replace("{topic}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
48
- }
49
- else {
50
- throw new Error("No value provided for input HTTP label: topic.");
51
- }
33
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "topic", () => input.topic, "{topic}", false);
52
34
  let body;
53
35
  return new protocol_http_1.HttpRequest({
54
36
  protocol,
@@ -65,19 +47,10 @@ const serializeAws_restJson1GetThingShadowCommand = async (input, context) => {
65
47
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
66
48
  const headers = {};
67
49
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/shadow";
68
- if (input.thingName !== undefined) {
69
- const labelValue = input.thingName;
70
- if (labelValue.length <= 0) {
71
- throw new Error("Empty value provided for input HTTP label: thingName.");
72
- }
73
- resolvedPath = resolvedPath.replace("{thingName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
74
- }
75
- else {
76
- throw new Error("No value provided for input HTTP label: thingName.");
77
- }
78
- const query = {
79
- ...(input.shadowName !== undefined && { name: input.shadowName }),
80
- };
50
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "thingName", () => input.thingName, "{thingName}", false);
51
+ const query = map({
52
+ name: [, input.shadowName],
53
+ });
81
54
  let body;
82
55
  return new protocol_http_1.HttpRequest({
83
56
  protocol,
@@ -96,20 +69,11 @@ const serializeAws_restJson1ListNamedShadowsForThingCommand = async (input, cont
96
69
  const headers = {};
97
70
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
98
71
  "/api/things/shadow/ListNamedShadowsForThing/{thingName}";
99
- if (input.thingName !== undefined) {
100
- const labelValue = input.thingName;
101
- if (labelValue.length <= 0) {
102
- throw new Error("Empty value provided for input HTTP label: thingName.");
103
- }
104
- resolvedPath = resolvedPath.replace("{thingName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
105
- }
106
- else {
107
- throw new Error("No value provided for input HTTP label: thingName.");
108
- }
109
- const query = {
110
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
111
- ...(input.pageSize !== undefined && { pageSize: input.pageSize.toString() }),
112
- };
72
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "thingName", () => input.thingName, "{thingName}", false);
73
+ const query = map({
74
+ nextToken: [, input.nextToken],
75
+ pageSize: [() => input.pageSize !== void 0, () => input.pageSize.toString()],
76
+ });
113
77
  let body;
114
78
  return new protocol_http_1.HttpRequest({
115
79
  protocol,
@@ -127,10 +91,10 @@ const serializeAws_restJson1ListRetainedMessagesCommand = async (input, context)
127
91
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
128
92
  const headers = {};
129
93
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/retainedMessage";
130
- const query = {
131
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
132
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
133
- };
94
+ const query = map({
95
+ nextToken: [, input.nextToken],
96
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
97
+ });
134
98
  let body;
135
99
  return new protocol_http_1.HttpRequest({
136
100
  protocol,
@@ -150,20 +114,11 @@ const serializeAws_restJson1PublishCommand = async (input, context) => {
150
114
  "content-type": "application/octet-stream",
151
115
  };
152
116
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/topics/{topic}";
153
- if (input.topic !== undefined) {
154
- const labelValue = input.topic;
155
- if (labelValue.length <= 0) {
156
- throw new Error("Empty value provided for input HTTP label: topic.");
157
- }
158
- resolvedPath = resolvedPath.replace("{topic}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
159
- }
160
- else {
161
- throw new Error("No value provided for input HTTP label: topic.");
162
- }
163
- const query = {
164
- ...(input.qos !== undefined && { qos: input.qos.toString() }),
165
- ...(input.retain !== undefined && { retain: input.retain.toString() }),
166
- };
117
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "topic", () => input.topic, "{topic}", false);
118
+ const query = map({
119
+ qos: [() => input.qos !== void 0, () => input.qos.toString()],
120
+ retain: [() => input.retain !== void 0, () => input.retain.toString()],
121
+ });
167
122
  let body;
168
123
  if (input.payload !== undefined) {
169
124
  body = input.payload;
@@ -186,19 +141,10 @@ const serializeAws_restJson1UpdateThingShadowCommand = async (input, context) =>
186
141
  "content-type": "application/octet-stream",
187
142
  };
188
143
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/shadow";
189
- if (input.thingName !== undefined) {
190
- const labelValue = input.thingName;
191
- if (labelValue.length <= 0) {
192
- throw new Error("Empty value provided for input HTTP label: thingName.");
193
- }
194
- resolvedPath = resolvedPath.replace("{thingName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
195
- }
196
- else {
197
- throw new Error("No value provided for input HTTP label: thingName.");
198
- }
199
- const query = {
200
- ...(input.shadowName !== undefined && { name: input.shadowName }),
201
- };
144
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "thingName", () => input.thingName, "{thingName}", false);
145
+ const query = map({
146
+ name: [, input.shadowName],
147
+ });
202
148
  let body;
203
149
  if (input.payload !== undefined) {
204
150
  body = input.payload;
@@ -219,13 +165,12 @@ const deserializeAws_restJson1DeleteThingShadowCommand = async (output, context)
219
165
  if (output.statusCode !== 200 && output.statusCode >= 300) {
220
166
  return deserializeAws_restJson1DeleteThingShadowCommandError(output, context);
221
167
  }
222
- const contents = {
168
+ const contents = map({
223
169
  $metadata: deserializeMetadata(output),
224
- payload: undefined,
225
- };
170
+ });
226
171
  const data = await collectBody(output.body, context);
227
172
  contents.payload = data;
228
- return Promise.resolve(contents);
173
+ return contents;
229
174
  };
230
175
  exports.deserializeAws_restJson1DeleteThingShadowCommand = deserializeAws_restJson1DeleteThingShadowCommand;
231
176
  const deserializeAws_restJson1DeleteThingShadowCommandError = async (output, context) => {
@@ -233,7 +178,6 @@ const deserializeAws_restJson1DeleteThingShadowCommandError = async (output, con
233
178
  ...output,
234
179
  body: await parseBody(output.body, context),
235
180
  };
236
- let response;
237
181
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
238
182
  switch (errorCode) {
239
183
  case "InternalFailureException":
@@ -262,41 +206,35 @@ const deserializeAws_restJson1DeleteThingShadowCommandError = async (output, con
262
206
  throw await deserializeAws_restJson1UnsupportedDocumentEncodingExceptionResponse(parsedOutput, context);
263
207
  default:
264
208
  const parsedBody = parsedOutput.body;
265
- const $metadata = deserializeMetadata(output);
266
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
267
- response = new IoTDataPlaneServiceException_1.IoTDataPlaneServiceException({
268
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
269
- $fault: "client",
270
- $metadata,
209
+ (0, smithy_client_1.throwDefaultError)({
210
+ output,
211
+ parsedBody,
212
+ exceptionCtor: IoTDataPlaneServiceException_1.IoTDataPlaneServiceException,
213
+ errorCode,
271
214
  });
272
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
273
215
  }
274
216
  };
275
217
  const deserializeAws_restJson1GetRetainedMessageCommand = async (output, context) => {
276
218
  if (output.statusCode !== 200 && output.statusCode >= 300) {
277
219
  return deserializeAws_restJson1GetRetainedMessageCommandError(output, context);
278
220
  }
279
- const contents = {
221
+ const contents = map({
280
222
  $metadata: deserializeMetadata(output),
281
- lastModifiedTime: undefined,
282
- payload: undefined,
283
- qos: undefined,
284
- topic: undefined,
285
- };
223
+ });
286
224
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
287
- if (data.lastModifiedTime !== undefined && data.lastModifiedTime !== null) {
225
+ if (data.lastModifiedTime != null) {
288
226
  contents.lastModifiedTime = (0, smithy_client_1.expectLong)(data.lastModifiedTime);
289
227
  }
290
- if (data.payload !== undefined && data.payload !== null) {
228
+ if (data.payload != null) {
291
229
  contents.payload = context.base64Decoder(data.payload);
292
230
  }
293
- if (data.qos !== undefined && data.qos !== null) {
231
+ if (data.qos != null) {
294
232
  contents.qos = (0, smithy_client_1.expectInt32)(data.qos);
295
233
  }
296
- if (data.topic !== undefined && data.topic !== null) {
234
+ if (data.topic != null) {
297
235
  contents.topic = (0, smithy_client_1.expectString)(data.topic);
298
236
  }
299
- return Promise.resolve(contents);
237
+ return contents;
300
238
  };
301
239
  exports.deserializeAws_restJson1GetRetainedMessageCommand = deserializeAws_restJson1GetRetainedMessageCommand;
302
240
  const deserializeAws_restJson1GetRetainedMessageCommandError = async (output, context) => {
@@ -304,7 +242,6 @@ const deserializeAws_restJson1GetRetainedMessageCommandError = async (output, co
304
242
  ...output,
305
243
  body: await parseBody(output.body, context),
306
244
  };
307
- let response;
308
245
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
309
246
  switch (errorCode) {
310
247
  case "InternalFailureException":
@@ -330,27 +267,24 @@ const deserializeAws_restJson1GetRetainedMessageCommandError = async (output, co
330
267
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
331
268
  default:
332
269
  const parsedBody = parsedOutput.body;
333
- const $metadata = deserializeMetadata(output);
334
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
335
- response = new IoTDataPlaneServiceException_1.IoTDataPlaneServiceException({
336
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
337
- $fault: "client",
338
- $metadata,
270
+ (0, smithy_client_1.throwDefaultError)({
271
+ output,
272
+ parsedBody,
273
+ exceptionCtor: IoTDataPlaneServiceException_1.IoTDataPlaneServiceException,
274
+ errorCode,
339
275
  });
340
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
341
276
  }
342
277
  };
343
278
  const deserializeAws_restJson1GetThingShadowCommand = async (output, context) => {
344
279
  if (output.statusCode !== 200 && output.statusCode >= 300) {
345
280
  return deserializeAws_restJson1GetThingShadowCommandError(output, context);
346
281
  }
347
- const contents = {
282
+ const contents = map({
348
283
  $metadata: deserializeMetadata(output),
349
- payload: undefined,
350
- };
284
+ });
351
285
  const data = await collectBody(output.body, context);
352
286
  contents.payload = data;
353
- return Promise.resolve(contents);
287
+ return contents;
354
288
  };
355
289
  exports.deserializeAws_restJson1GetThingShadowCommand = deserializeAws_restJson1GetThingShadowCommand;
356
290
  const deserializeAws_restJson1GetThingShadowCommandError = async (output, context) => {
@@ -358,7 +292,6 @@ const deserializeAws_restJson1GetThingShadowCommandError = async (output, contex
358
292
  ...output,
359
293
  body: await parseBody(output.body, context),
360
294
  };
361
- let response;
362
295
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
363
296
  switch (errorCode) {
364
297
  case "InternalFailureException":
@@ -387,37 +320,32 @@ const deserializeAws_restJson1GetThingShadowCommandError = async (output, contex
387
320
  throw await deserializeAws_restJson1UnsupportedDocumentEncodingExceptionResponse(parsedOutput, context);
388
321
  default:
389
322
  const parsedBody = parsedOutput.body;
390
- const $metadata = deserializeMetadata(output);
391
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
392
- response = new IoTDataPlaneServiceException_1.IoTDataPlaneServiceException({
393
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
394
- $fault: "client",
395
- $metadata,
323
+ (0, smithy_client_1.throwDefaultError)({
324
+ output,
325
+ parsedBody,
326
+ exceptionCtor: IoTDataPlaneServiceException_1.IoTDataPlaneServiceException,
327
+ errorCode,
396
328
  });
397
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
398
329
  }
399
330
  };
400
331
  const deserializeAws_restJson1ListNamedShadowsForThingCommand = async (output, context) => {
401
332
  if (output.statusCode !== 200 && output.statusCode >= 300) {
402
333
  return deserializeAws_restJson1ListNamedShadowsForThingCommandError(output, context);
403
334
  }
404
- const contents = {
335
+ const contents = map({
405
336
  $metadata: deserializeMetadata(output),
406
- nextToken: undefined,
407
- results: undefined,
408
- timestamp: undefined,
409
- };
337
+ });
410
338
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
411
- if (data.nextToken !== undefined && data.nextToken !== null) {
339
+ if (data.nextToken != null) {
412
340
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
413
341
  }
414
- if (data.results !== undefined && data.results !== null) {
342
+ if (data.results != null) {
415
343
  contents.results = deserializeAws_restJson1NamedShadowList(data.results, context);
416
344
  }
417
- if (data.timestamp !== undefined && data.timestamp !== null) {
345
+ if (data.timestamp != null) {
418
346
  contents.timestamp = (0, smithy_client_1.expectLong)(data.timestamp);
419
347
  }
420
- return Promise.resolve(contents);
348
+ return contents;
421
349
  };
422
350
  exports.deserializeAws_restJson1ListNamedShadowsForThingCommand = deserializeAws_restJson1ListNamedShadowsForThingCommand;
423
351
  const deserializeAws_restJson1ListNamedShadowsForThingCommandError = async (output, context) => {
@@ -425,7 +353,6 @@ const deserializeAws_restJson1ListNamedShadowsForThingCommandError = async (outp
425
353
  ...output,
426
354
  body: await parseBody(output.body, context),
427
355
  };
428
- let response;
429
356
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
430
357
  switch (errorCode) {
431
358
  case "InternalFailureException":
@@ -451,33 +378,29 @@ const deserializeAws_restJson1ListNamedShadowsForThingCommandError = async (outp
451
378
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
452
379
  default:
453
380
  const parsedBody = parsedOutput.body;
454
- const $metadata = deserializeMetadata(output);
455
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
456
- response = new IoTDataPlaneServiceException_1.IoTDataPlaneServiceException({
457
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
458
- $fault: "client",
459
- $metadata,
381
+ (0, smithy_client_1.throwDefaultError)({
382
+ output,
383
+ parsedBody,
384
+ exceptionCtor: IoTDataPlaneServiceException_1.IoTDataPlaneServiceException,
385
+ errorCode,
460
386
  });
461
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
462
387
  }
463
388
  };
464
389
  const deserializeAws_restJson1ListRetainedMessagesCommand = async (output, context) => {
465
390
  if (output.statusCode !== 200 && output.statusCode >= 300) {
466
391
  return deserializeAws_restJson1ListRetainedMessagesCommandError(output, context);
467
392
  }
468
- const contents = {
393
+ const contents = map({
469
394
  $metadata: deserializeMetadata(output),
470
- nextToken: undefined,
471
- retainedTopics: undefined,
472
- };
395
+ });
473
396
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
474
- if (data.nextToken !== undefined && data.nextToken !== null) {
397
+ if (data.nextToken != null) {
475
398
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
476
399
  }
477
- if (data.retainedTopics !== undefined && data.retainedTopics !== null) {
400
+ if (data.retainedTopics != null) {
478
401
  contents.retainedTopics = deserializeAws_restJson1RetainedMessageList(data.retainedTopics, context);
479
402
  }
480
- return Promise.resolve(contents);
403
+ return contents;
481
404
  };
482
405
  exports.deserializeAws_restJson1ListRetainedMessagesCommand = deserializeAws_restJson1ListRetainedMessagesCommand;
483
406
  const deserializeAws_restJson1ListRetainedMessagesCommandError = async (output, context) => {
@@ -485,7 +408,6 @@ const deserializeAws_restJson1ListRetainedMessagesCommandError = async (output,
485
408
  ...output,
486
409
  body: await parseBody(output.body, context),
487
410
  };
488
- let response;
489
411
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
490
412
  switch (errorCode) {
491
413
  case "InternalFailureException":
@@ -508,25 +430,23 @@ const deserializeAws_restJson1ListRetainedMessagesCommandError = async (output,
508
430
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
509
431
  default:
510
432
  const parsedBody = parsedOutput.body;
511
- const $metadata = deserializeMetadata(output);
512
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
513
- response = new IoTDataPlaneServiceException_1.IoTDataPlaneServiceException({
514
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
515
- $fault: "client",
516
- $metadata,
433
+ (0, smithy_client_1.throwDefaultError)({
434
+ output,
435
+ parsedBody,
436
+ exceptionCtor: IoTDataPlaneServiceException_1.IoTDataPlaneServiceException,
437
+ errorCode,
517
438
  });
518
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
519
439
  }
520
440
  };
521
441
  const deserializeAws_restJson1PublishCommand = async (output, context) => {
522
442
  if (output.statusCode !== 200 && output.statusCode >= 300) {
523
443
  return deserializeAws_restJson1PublishCommandError(output, context);
524
444
  }
525
- const contents = {
445
+ const contents = map({
526
446
  $metadata: deserializeMetadata(output),
527
- };
447
+ });
528
448
  await collectBody(output.body, context);
529
- return Promise.resolve(contents);
449
+ return contents;
530
450
  };
531
451
  exports.deserializeAws_restJson1PublishCommand = deserializeAws_restJson1PublishCommand;
532
452
  const deserializeAws_restJson1PublishCommandError = async (output, context) => {
@@ -534,7 +454,6 @@ const deserializeAws_restJson1PublishCommandError = async (output, context) => {
534
454
  ...output,
535
455
  body: await parseBody(output.body, context),
536
456
  };
537
- let response;
538
457
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
539
458
  switch (errorCode) {
540
459
  case "InternalFailureException":
@@ -551,27 +470,24 @@ const deserializeAws_restJson1PublishCommandError = async (output, context) => {
551
470
  throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
552
471
  default:
553
472
  const parsedBody = parsedOutput.body;
554
- const $metadata = deserializeMetadata(output);
555
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
556
- response = new IoTDataPlaneServiceException_1.IoTDataPlaneServiceException({
557
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
558
- $fault: "client",
559
- $metadata,
473
+ (0, smithy_client_1.throwDefaultError)({
474
+ output,
475
+ parsedBody,
476
+ exceptionCtor: IoTDataPlaneServiceException_1.IoTDataPlaneServiceException,
477
+ errorCode,
560
478
  });
561
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
562
479
  }
563
480
  };
564
481
  const deserializeAws_restJson1UpdateThingShadowCommand = async (output, context) => {
565
482
  if (output.statusCode !== 200 && output.statusCode >= 300) {
566
483
  return deserializeAws_restJson1UpdateThingShadowCommandError(output, context);
567
484
  }
568
- const contents = {
485
+ const contents = map({
569
486
  $metadata: deserializeMetadata(output),
570
- payload: undefined,
571
- };
487
+ });
572
488
  const data = await collectBody(output.body, context);
573
489
  contents.payload = data;
574
- return Promise.resolve(contents);
490
+ return contents;
575
491
  };
576
492
  exports.deserializeAws_restJson1UpdateThingShadowCommand = deserializeAws_restJson1UpdateThingShadowCommand;
577
493
  const deserializeAws_restJson1UpdateThingShadowCommandError = async (output, context) => {
@@ -579,7 +495,6 @@ const deserializeAws_restJson1UpdateThingShadowCommandError = async (output, con
579
495
  ...output,
580
496
  body: await parseBody(output.body, context),
581
497
  };
582
- let response;
583
498
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
584
499
  switch (errorCode) {
585
500
  case "ConflictException":
@@ -611,20 +526,19 @@ const deserializeAws_restJson1UpdateThingShadowCommandError = async (output, con
611
526
  throw await deserializeAws_restJson1UnsupportedDocumentEncodingExceptionResponse(parsedOutput, context);
612
527
  default:
613
528
  const parsedBody = parsedOutput.body;
614
- const $metadata = deserializeMetadata(output);
615
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
616
- response = new IoTDataPlaneServiceException_1.IoTDataPlaneServiceException({
617
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
618
- $fault: "client",
619
- $metadata,
529
+ (0, smithy_client_1.throwDefaultError)({
530
+ output,
531
+ parsedBody,
532
+ exceptionCtor: IoTDataPlaneServiceException_1.IoTDataPlaneServiceException,
533
+ errorCode,
620
534
  });
621
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
622
535
  }
623
536
  };
537
+ const map = smithy_client_1.map;
624
538
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
625
- const contents = {};
539
+ const contents = map({});
626
540
  const data = parsedOutput.body;
627
- if (data.message !== undefined && data.message !== null) {
541
+ if (data.message != null) {
628
542
  contents.message = (0, smithy_client_1.expectString)(data.message);
629
543
  }
630
544
  const exception = new models_0_1.ConflictException({
@@ -634,9 +548,9 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
634
548
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
635
549
  };
636
550
  const deserializeAws_restJson1InternalFailureExceptionResponse = async (parsedOutput, context) => {
637
- const contents = {};
551
+ const contents = map({});
638
552
  const data = parsedOutput.body;
639
- if (data.message !== undefined && data.message !== null) {
553
+ if (data.message != null) {
640
554
  contents.message = (0, smithy_client_1.expectString)(data.message);
641
555
  }
642
556
  const exception = new models_0_1.InternalFailureException({
@@ -646,9 +560,9 @@ const deserializeAws_restJson1InternalFailureExceptionResponse = async (parsedOu
646
560
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
647
561
  };
648
562
  const deserializeAws_restJson1InvalidRequestExceptionResponse = async (parsedOutput, context) => {
649
- const contents = {};
563
+ const contents = map({});
650
564
  const data = parsedOutput.body;
651
- if (data.message !== undefined && data.message !== null) {
565
+ if (data.message != null) {
652
566
  contents.message = (0, smithy_client_1.expectString)(data.message);
653
567
  }
654
568
  const exception = new models_0_1.InvalidRequestException({
@@ -658,9 +572,9 @@ const deserializeAws_restJson1InvalidRequestExceptionResponse = async (parsedOut
658
572
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
659
573
  };
660
574
  const deserializeAws_restJson1MethodNotAllowedExceptionResponse = async (parsedOutput, context) => {
661
- const contents = {};
575
+ const contents = map({});
662
576
  const data = parsedOutput.body;
663
- if (data.message !== undefined && data.message !== null) {
577
+ if (data.message != null) {
664
578
  contents.message = (0, smithy_client_1.expectString)(data.message);
665
579
  }
666
580
  const exception = new models_0_1.MethodNotAllowedException({
@@ -670,9 +584,9 @@ const deserializeAws_restJson1MethodNotAllowedExceptionResponse = async (parsedO
670
584
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
671
585
  };
672
586
  const deserializeAws_restJson1RequestEntityTooLargeExceptionResponse = async (parsedOutput, context) => {
673
- const contents = {};
587
+ const contents = map({});
674
588
  const data = parsedOutput.body;
675
- if (data.message !== undefined && data.message !== null) {
589
+ if (data.message != null) {
676
590
  contents.message = (0, smithy_client_1.expectString)(data.message);
677
591
  }
678
592
  const exception = new models_0_1.RequestEntityTooLargeException({
@@ -682,9 +596,9 @@ const deserializeAws_restJson1RequestEntityTooLargeExceptionResponse = async (pa
682
596
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
683
597
  };
684
598
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
685
- const contents = {};
599
+ const contents = map({});
686
600
  const data = parsedOutput.body;
687
- if (data.message !== undefined && data.message !== null) {
601
+ if (data.message != null) {
688
602
  contents.message = (0, smithy_client_1.expectString)(data.message);
689
603
  }
690
604
  const exception = new models_0_1.ResourceNotFoundException({
@@ -694,9 +608,9 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
694
608
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
695
609
  };
696
610
  const deserializeAws_restJson1ServiceUnavailableExceptionResponse = async (parsedOutput, context) => {
697
- const contents = {};
611
+ const contents = map({});
698
612
  const data = parsedOutput.body;
699
- if (data.message !== undefined && data.message !== null) {
613
+ if (data.message != null) {
700
614
  contents.message = (0, smithy_client_1.expectString)(data.message);
701
615
  }
702
616
  const exception = new models_0_1.ServiceUnavailableException({
@@ -706,9 +620,9 @@ const deserializeAws_restJson1ServiceUnavailableExceptionResponse = async (parse
706
620
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
707
621
  };
708
622
  const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
709
- const contents = {};
623
+ const contents = map({});
710
624
  const data = parsedOutput.body;
711
- if (data.message !== undefined && data.message !== null) {
625
+ if (data.message != null) {
712
626
  contents.message = (0, smithy_client_1.expectString)(data.message);
713
627
  }
714
628
  const exception = new models_0_1.ThrottlingException({
@@ -718,9 +632,9 @@ const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput,
718
632
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
719
633
  };
720
634
  const deserializeAws_restJson1UnauthorizedExceptionResponse = async (parsedOutput, context) => {
721
- const contents = {};
635
+ const contents = map({});
722
636
  const data = parsedOutput.body;
723
- if (data.message !== undefined && data.message !== null) {
637
+ if (data.message != null) {
724
638
  contents.message = (0, smithy_client_1.expectString)(data.message);
725
639
  }
726
640
  const exception = new models_0_1.UnauthorizedException({
@@ -730,9 +644,9 @@ const deserializeAws_restJson1UnauthorizedExceptionResponse = async (parsedOutpu
730
644
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
731
645
  };
732
646
  const deserializeAws_restJson1UnsupportedDocumentEncodingExceptionResponse = async (parsedOutput, context) => {
733
- const contents = {};
647
+ const contents = map({});
734
648
  const data = parsedOutput.body;
735
- if (data.message !== undefined && data.message !== null) {
649
+ if (data.message != null) {
736
650
  contents.message = (0, smithy_client_1.expectString)(data.message);
737
651
  }
738
652
  const exception = new models_0_1.UnsupportedDocumentEncodingException({