@aws-sdk/client-greengrassv2 3.141.0 → 3.142.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,16 +35,7 @@ const serializeAws_restJson1BatchAssociateClientDeviceWithCoreDeviceCommand = as
35
35
  };
36
36
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
37
37
  "/greengrass/v2/coreDevices/{coreDeviceThingName}/associateClientDevices";
38
- if (input.coreDeviceThingName !== undefined) {
39
- const labelValue = input.coreDeviceThingName;
40
- if (labelValue.length <= 0) {
41
- throw new Error("Empty value provided for input HTTP label: coreDeviceThingName.");
42
- }
43
- resolvedPath = resolvedPath.replace("{coreDeviceThingName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
44
- }
45
- else {
46
- throw new Error("No value provided for input HTTP label: coreDeviceThingName.");
47
- }
38
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "coreDeviceThingName", () => input.coreDeviceThingName, "{coreDeviceThingName}", false);
48
39
  let body;
49
40
  body = JSON.stringify({
50
41
  ...(input.entries != null && {
@@ -69,16 +60,7 @@ const serializeAws_restJson1BatchDisassociateClientDeviceFromCoreDeviceCommand =
69
60
  };
70
61
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
71
62
  "/greengrass/v2/coreDevices/{coreDeviceThingName}/disassociateClientDevices";
72
- if (input.coreDeviceThingName !== undefined) {
73
- const labelValue = input.coreDeviceThingName;
74
- if (labelValue.length <= 0) {
75
- throw new Error("Empty value provided for input HTTP label: coreDeviceThingName.");
76
- }
77
- resolvedPath = resolvedPath.replace("{coreDeviceThingName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
78
- }
79
- else {
80
- throw new Error("No value provided for input HTTP label: coreDeviceThingName.");
81
- }
63
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "coreDeviceThingName", () => input.coreDeviceThingName, "{coreDeviceThingName}", false);
82
64
  let body;
83
65
  body = JSON.stringify({
84
66
  ...(input.entries != null && {
@@ -101,16 +83,7 @@ const serializeAws_restJson1CancelDeploymentCommand = async (input, context) =>
101
83
  const headers = {};
102
84
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
103
85
  "/greengrass/v2/deployments/{deploymentId}/cancel";
104
- if (input.deploymentId !== undefined) {
105
- const labelValue = input.deploymentId;
106
- if (labelValue.length <= 0) {
107
- throw new Error("Empty value provided for input HTTP label: deploymentId.");
108
- }
109
- resolvedPath = resolvedPath.replace("{deploymentId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
110
- }
111
- else {
112
- throw new Error("No value provided for input HTTP label: deploymentId.");
113
- }
86
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "deploymentId", () => input.deploymentId, "{deploymentId}", false);
114
87
  let body;
115
88
  return new protocol_http_1.HttpRequest({
116
89
  protocol,
@@ -188,16 +161,7 @@ const serializeAws_restJson1DeleteComponentCommand = async (input, context) => {
188
161
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
189
162
  const headers = {};
190
163
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/v2/components/{arn}";
191
- if (input.arn !== undefined) {
192
- const labelValue = input.arn;
193
- if (labelValue.length <= 0) {
194
- throw new Error("Empty value provided for input HTTP label: arn.");
195
- }
196
- resolvedPath = resolvedPath.replace("{arn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
197
- }
198
- else {
199
- throw new Error("No value provided for input HTTP label: arn.");
200
- }
164
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "arn", () => input.arn, "{arn}", false);
201
165
  let body;
202
166
  return new protocol_http_1.HttpRequest({
203
167
  protocol,
@@ -215,16 +179,7 @@ const serializeAws_restJson1DeleteCoreDeviceCommand = async (input, context) =>
215
179
  const headers = {};
216
180
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
217
181
  "/greengrass/v2/coreDevices/{coreDeviceThingName}";
218
- if (input.coreDeviceThingName !== undefined) {
219
- const labelValue = input.coreDeviceThingName;
220
- if (labelValue.length <= 0) {
221
- throw new Error("Empty value provided for input HTTP label: coreDeviceThingName.");
222
- }
223
- resolvedPath = resolvedPath.replace("{coreDeviceThingName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
224
- }
225
- else {
226
- throw new Error("No value provided for input HTTP label: coreDeviceThingName.");
227
- }
182
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "coreDeviceThingName", () => input.coreDeviceThingName, "{coreDeviceThingName}", false);
228
183
  let body;
229
184
  return new protocol_http_1.HttpRequest({
230
185
  protocol,
@@ -241,16 +196,7 @@ const serializeAws_restJson1DeleteDeploymentCommand = async (input, context) =>
241
196
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
242
197
  const headers = {};
243
198
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/v2/deployments/{deploymentId}";
244
- if (input.deploymentId !== undefined) {
245
- const labelValue = input.deploymentId;
246
- if (labelValue.length <= 0) {
247
- throw new Error("Empty value provided for input HTTP label: deploymentId.");
248
- }
249
- resolvedPath = resolvedPath.replace("{deploymentId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
250
- }
251
- else {
252
- throw new Error("No value provided for input HTTP label: deploymentId.");
253
- }
199
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "deploymentId", () => input.deploymentId, "{deploymentId}", false);
254
200
  let body;
255
201
  return new protocol_http_1.HttpRequest({
256
202
  protocol,
@@ -267,16 +213,7 @@ const serializeAws_restJson1DescribeComponentCommand = async (input, context) =>
267
213
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
268
214
  const headers = {};
269
215
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/v2/components/{arn}/metadata";
270
- if (input.arn !== undefined) {
271
- const labelValue = input.arn;
272
- if (labelValue.length <= 0) {
273
- throw new Error("Empty value provided for input HTTP label: arn.");
274
- }
275
- resolvedPath = resolvedPath.replace("{arn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
276
- }
277
- else {
278
- throw new Error("No value provided for input HTTP label: arn.");
279
- }
216
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "arn", () => input.arn, "{arn}", false);
280
217
  let body;
281
218
  return new protocol_http_1.HttpRequest({
282
219
  protocol,
@@ -312,19 +249,10 @@ const serializeAws_restJson1GetComponentCommand = async (input, context) => {
312
249
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
313
250
  const headers = {};
314
251
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/v2/components/{arn}";
315
- if (input.arn !== undefined) {
316
- const labelValue = input.arn;
317
- if (labelValue.length <= 0) {
318
- throw new Error("Empty value provided for input HTTP label: arn.");
319
- }
320
- resolvedPath = resolvedPath.replace("{arn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
321
- }
322
- else {
323
- throw new Error("No value provided for input HTTP label: arn.");
324
- }
325
- const query = {
326
- ...(input.recipeOutputFormat !== undefined && { recipeOutputFormat: input.recipeOutputFormat }),
327
- };
252
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "arn", () => input.arn, "{arn}", false);
253
+ const query = map({
254
+ recipeOutputFormat: [, input.recipeOutputFormat],
255
+ });
328
256
  let body;
329
257
  return new protocol_http_1.HttpRequest({
330
258
  protocol,
@@ -343,29 +271,8 @@ const serializeAws_restJson1GetComponentVersionArtifactCommand = async (input, c
343
271
  const headers = {};
344
272
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
345
273
  "/greengrass/v2/components/{arn}/artifacts/{artifactName+}";
346
- if (input.arn !== undefined) {
347
- const labelValue = input.arn;
348
- if (labelValue.length <= 0) {
349
- throw new Error("Empty value provided for input HTTP label: arn.");
350
- }
351
- resolvedPath = resolvedPath.replace("{arn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
352
- }
353
- else {
354
- throw new Error("No value provided for input HTTP label: arn.");
355
- }
356
- if (input.artifactName !== undefined) {
357
- const labelValue = input.artifactName;
358
- if (labelValue.length <= 0) {
359
- throw new Error("Empty value provided for input HTTP label: artifactName.");
360
- }
361
- resolvedPath = resolvedPath.replace("{artifactName+}", labelValue
362
- .split("/")
363
- .map((segment) => (0, smithy_client_1.extendedEncodeURIComponent)(segment))
364
- .join("/"));
365
- }
366
- else {
367
- throw new Error("No value provided for input HTTP label: artifactName.");
368
- }
274
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "arn", () => input.arn, "{arn}", false);
275
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "artifactName", () => input.artifactName, "{artifactName+}", true);
369
276
  let body;
370
277
  return new protocol_http_1.HttpRequest({
371
278
  protocol,
@@ -383,16 +290,7 @@ const serializeAws_restJson1GetConnectivityInfoCommand = async (input, context)
383
290
  const headers = {};
384
291
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
385
292
  "/greengrass/things/{thingName}/connectivityInfo";
386
- if (input.thingName !== undefined) {
387
- const labelValue = input.thingName;
388
- if (labelValue.length <= 0) {
389
- throw new Error("Empty value provided for input HTTP label: thingName.");
390
- }
391
- resolvedPath = resolvedPath.replace("{thingName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
392
- }
393
- else {
394
- throw new Error("No value provided for input HTTP label: thingName.");
395
- }
293
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "thingName", () => input.thingName, "{thingName}", false);
396
294
  let body;
397
295
  return new protocol_http_1.HttpRequest({
398
296
  protocol,
@@ -410,16 +308,7 @@ const serializeAws_restJson1GetCoreDeviceCommand = async (input, context) => {
410
308
  const headers = {};
411
309
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
412
310
  "/greengrass/v2/coreDevices/{coreDeviceThingName}";
413
- if (input.coreDeviceThingName !== undefined) {
414
- const labelValue = input.coreDeviceThingName;
415
- if (labelValue.length <= 0) {
416
- throw new Error("Empty value provided for input HTTP label: coreDeviceThingName.");
417
- }
418
- resolvedPath = resolvedPath.replace("{coreDeviceThingName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
419
- }
420
- else {
421
- throw new Error("No value provided for input HTTP label: coreDeviceThingName.");
422
- }
311
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "coreDeviceThingName", () => input.coreDeviceThingName, "{coreDeviceThingName}", false);
423
312
  let body;
424
313
  return new protocol_http_1.HttpRequest({
425
314
  protocol,
@@ -436,16 +325,7 @@ const serializeAws_restJson1GetDeploymentCommand = async (input, context) => {
436
325
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
437
326
  const headers = {};
438
327
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/v2/deployments/{deploymentId}";
439
- if (input.deploymentId !== undefined) {
440
- const labelValue = input.deploymentId;
441
- if (labelValue.length <= 0) {
442
- throw new Error("Empty value provided for input HTTP label: deploymentId.");
443
- }
444
- resolvedPath = resolvedPath.replace("{deploymentId}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
445
- }
446
- else {
447
- throw new Error("No value provided for input HTTP label: deploymentId.");
448
- }
328
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "deploymentId", () => input.deploymentId, "{deploymentId}", false);
449
329
  let body;
450
330
  return new protocol_http_1.HttpRequest({
451
331
  protocol,
@@ -482,20 +362,11 @@ const serializeAws_restJson1ListClientDevicesAssociatedWithCoreDeviceCommand = a
482
362
  const headers = {};
483
363
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
484
364
  "/greengrass/v2/coreDevices/{coreDeviceThingName}/associatedClientDevices";
485
- if (input.coreDeviceThingName !== undefined) {
486
- const labelValue = input.coreDeviceThingName;
487
- if (labelValue.length <= 0) {
488
- throw new Error("Empty value provided for input HTTP label: coreDeviceThingName.");
489
- }
490
- resolvedPath = resolvedPath.replace("{coreDeviceThingName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
491
- }
492
- else {
493
- throw new Error("No value provided for input HTTP label: coreDeviceThingName.");
494
- }
495
- const query = {
496
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
497
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
498
- };
365
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "coreDeviceThingName", () => input.coreDeviceThingName, "{coreDeviceThingName}", false);
366
+ const query = map({
367
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
368
+ nextToken: [, input.nextToken],
369
+ });
499
370
  let body;
500
371
  return new protocol_http_1.HttpRequest({
501
372
  protocol,
@@ -513,11 +384,11 @@ const serializeAws_restJson1ListComponentsCommand = async (input, context) => {
513
384
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
514
385
  const headers = {};
515
386
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/v2/components";
516
- const query = {
517
- ...(input.scope !== undefined && { scope: input.scope }),
518
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
519
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
520
- };
387
+ const query = map({
388
+ scope: [, input.scope],
389
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
390
+ nextToken: [, input.nextToken],
391
+ });
521
392
  let body;
522
393
  return new protocol_http_1.HttpRequest({
523
394
  protocol,
@@ -535,20 +406,11 @@ const serializeAws_restJson1ListComponentVersionsCommand = async (input, context
535
406
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
536
407
  const headers = {};
537
408
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/v2/components/{arn}/versions";
538
- if (input.arn !== undefined) {
539
- const labelValue = input.arn;
540
- if (labelValue.length <= 0) {
541
- throw new Error("Empty value provided for input HTTP label: arn.");
542
- }
543
- resolvedPath = resolvedPath.replace("{arn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
544
- }
545
- else {
546
- throw new Error("No value provided for input HTTP label: arn.");
547
- }
548
- const query = {
549
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
550
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
551
- };
409
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "arn", () => input.arn, "{arn}", false);
410
+ const query = map({
411
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
412
+ nextToken: [, input.nextToken],
413
+ });
552
414
  let body;
553
415
  return new protocol_http_1.HttpRequest({
554
416
  protocol,
@@ -566,12 +428,12 @@ const serializeAws_restJson1ListCoreDevicesCommand = async (input, context) => {
566
428
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
567
429
  const headers = {};
568
430
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/v2/coreDevices";
569
- const query = {
570
- ...(input.thingGroupArn !== undefined && { thingGroupArn: input.thingGroupArn }),
571
- ...(input.status !== undefined && { status: input.status }),
572
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
573
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
574
- };
431
+ const query = map({
432
+ thingGroupArn: [, input.thingGroupArn],
433
+ status: [, input.status],
434
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
435
+ nextToken: [, input.nextToken],
436
+ });
575
437
  let body;
576
438
  return new protocol_http_1.HttpRequest({
577
439
  protocol,
@@ -589,12 +451,12 @@ const serializeAws_restJson1ListDeploymentsCommand = async (input, context) => {
589
451
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
590
452
  const headers = {};
591
453
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/greengrass/v2/deployments";
592
- const query = {
593
- ...(input.targetArn !== undefined && { targetArn: input.targetArn }),
594
- ...(input.historyFilter !== undefined && { historyFilter: input.historyFilter }),
595
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
596
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
597
- };
454
+ const query = map({
455
+ targetArn: [, input.targetArn],
456
+ historyFilter: [, input.historyFilter],
457
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
458
+ nextToken: [, input.nextToken],
459
+ });
598
460
  let body;
599
461
  return new protocol_http_1.HttpRequest({
600
462
  protocol,
@@ -613,20 +475,11 @@ const serializeAws_restJson1ListEffectiveDeploymentsCommand = async (input, cont
613
475
  const headers = {};
614
476
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
615
477
  "/greengrass/v2/coreDevices/{coreDeviceThingName}/effectiveDeployments";
616
- if (input.coreDeviceThingName !== undefined) {
617
- const labelValue = input.coreDeviceThingName;
618
- if (labelValue.length <= 0) {
619
- throw new Error("Empty value provided for input HTTP label: coreDeviceThingName.");
620
- }
621
- resolvedPath = resolvedPath.replace("{coreDeviceThingName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
622
- }
623
- else {
624
- throw new Error("No value provided for input HTTP label: coreDeviceThingName.");
625
- }
626
- const query = {
627
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
628
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
629
- };
478
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "coreDeviceThingName", () => input.coreDeviceThingName, "{coreDeviceThingName}", false);
479
+ const query = map({
480
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
481
+ nextToken: [, input.nextToken],
482
+ });
630
483
  let body;
631
484
  return new protocol_http_1.HttpRequest({
632
485
  protocol,
@@ -645,20 +498,11 @@ const serializeAws_restJson1ListInstalledComponentsCommand = async (input, conte
645
498
  const headers = {};
646
499
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
647
500
  "/greengrass/v2/coreDevices/{coreDeviceThingName}/installedComponents";
648
- if (input.coreDeviceThingName !== undefined) {
649
- const labelValue = input.coreDeviceThingName;
650
- if (labelValue.length <= 0) {
651
- throw new Error("Empty value provided for input HTTP label: coreDeviceThingName.");
652
- }
653
- resolvedPath = resolvedPath.replace("{coreDeviceThingName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
654
- }
655
- else {
656
- throw new Error("No value provided for input HTTP label: coreDeviceThingName.");
657
- }
658
- const query = {
659
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
660
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
661
- };
501
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "coreDeviceThingName", () => input.coreDeviceThingName, "{coreDeviceThingName}", false);
502
+ const query = map({
503
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
504
+ nextToken: [, input.nextToken],
505
+ });
662
506
  let body;
663
507
  return new protocol_http_1.HttpRequest({
664
508
  protocol,
@@ -676,16 +520,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
676
520
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
677
521
  const headers = {};
678
522
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
679
- if (input.resourceArn !== undefined) {
680
- const labelValue = input.resourceArn;
681
- if (labelValue.length <= 0) {
682
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
683
- }
684
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
685
- }
686
- else {
687
- throw new Error("No value provided for input HTTP label: resourceArn.");
688
- }
523
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
689
524
  let body;
690
525
  return new protocol_http_1.HttpRequest({
691
526
  protocol,
@@ -728,16 +563,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
728
563
  "content-type": "application/json",
729
564
  };
730
565
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
731
- if (input.resourceArn !== undefined) {
732
- const labelValue = input.resourceArn;
733
- if (labelValue.length <= 0) {
734
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
735
- }
736
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
737
- }
738
- else {
739
- throw new Error("No value provided for input HTTP label: resourceArn.");
740
- }
566
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
741
567
  let body;
742
568
  body = JSON.stringify({
743
569
  ...(input.tags != null && { tags: serializeAws_restJson1TagMap(input.tags, context) }),
@@ -757,19 +583,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
757
583
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
758
584
  const headers = {};
759
585
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
760
- if (input.resourceArn !== undefined) {
761
- const labelValue = input.resourceArn;
762
- if (labelValue.length <= 0) {
763
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
764
- }
765
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
766
- }
767
- else {
768
- throw new Error("No value provided for input HTTP label: resourceArn.");
769
- }
770
- const query = {
771
- ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }),
772
- };
586
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
587
+ const query = map({
588
+ tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys || []).map((_entry) => _entry)],
589
+ });
773
590
  let body;
774
591
  return new protocol_http_1.HttpRequest({
775
592
  protocol,
@@ -790,16 +607,7 @@ const serializeAws_restJson1UpdateConnectivityInfoCommand = async (input, contex
790
607
  };
791
608
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
792
609
  "/greengrass/things/{thingName}/connectivityInfo";
793
- if (input.thingName !== undefined) {
794
- const labelValue = input.thingName;
795
- if (labelValue.length <= 0) {
796
- throw new Error("Empty value provided for input HTTP label: thingName.");
797
- }
798
- resolvedPath = resolvedPath.replace("{thingName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
799
- }
800
- else {
801
- throw new Error("No value provided for input HTTP label: thingName.");
802
- }
610
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "thingName", () => input.thingName, "{thingName}", false);
803
611
  let body;
804
612
  body = JSON.stringify({
805
613
  ...(input.connectivityInfo != null && {
@@ -821,15 +629,14 @@ const deserializeAws_restJson1AssociateServiceRoleToAccountCommand = async (outp
821
629
  if (output.statusCode !== 200 && output.statusCode >= 300) {
822
630
  return deserializeAws_restJson1AssociateServiceRoleToAccountCommandError(output, context);
823
631
  }
824
- const contents = {
632
+ const contents = map({
825
633
  $metadata: deserializeMetadata(output),
826
- associatedAt: undefined,
827
- };
634
+ });
828
635
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
829
- if (data.AssociatedAt !== undefined && data.AssociatedAt !== null) {
636
+ if (data.AssociatedAt != null) {
830
637
  contents.associatedAt = (0, smithy_client_1.expectString)(data.AssociatedAt);
831
638
  }
832
- return Promise.resolve(contents);
639
+ return contents;
833
640
  };
834
641
  exports.deserializeAws_restJson1AssociateServiceRoleToAccountCommand = deserializeAws_restJson1AssociateServiceRoleToAccountCommand;
835
642
  const deserializeAws_restJson1AssociateServiceRoleToAccountCommandError = async (output, context) => {
@@ -837,7 +644,6 @@ const deserializeAws_restJson1AssociateServiceRoleToAccountCommandError = async
837
644
  ...output,
838
645
  body: await parseBody(output.body, context),
839
646
  };
840
- let response;
841
647
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
842
648
  switch (errorCode) {
843
649
  case "InternalServerException":
@@ -848,29 +654,26 @@ const deserializeAws_restJson1AssociateServiceRoleToAccountCommandError = async
848
654
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
849
655
  default:
850
656
  const parsedBody = parsedOutput.body;
851
- const $metadata = deserializeMetadata(output);
852
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
853
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
854
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
855
- $fault: "client",
856
- $metadata,
657
+ (0, smithy_client_1.throwDefaultError)({
658
+ output,
659
+ parsedBody,
660
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
661
+ errorCode,
857
662
  });
858
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
859
663
  }
860
664
  };
861
665
  const deserializeAws_restJson1BatchAssociateClientDeviceWithCoreDeviceCommand = async (output, context) => {
862
666
  if (output.statusCode !== 200 && output.statusCode >= 300) {
863
667
  return deserializeAws_restJson1BatchAssociateClientDeviceWithCoreDeviceCommandError(output, context);
864
668
  }
865
- const contents = {
669
+ const contents = map({
866
670
  $metadata: deserializeMetadata(output),
867
- errorEntries: undefined,
868
- };
671
+ });
869
672
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
870
- if (data.errorEntries !== undefined && data.errorEntries !== null) {
673
+ if (data.errorEntries != null) {
871
674
  contents.errorEntries = deserializeAws_restJson1AssociateClientDeviceWithCoreDeviceErrorList(data.errorEntries, context);
872
675
  }
873
- return Promise.resolve(contents);
676
+ return contents;
874
677
  };
875
678
  exports.deserializeAws_restJson1BatchAssociateClientDeviceWithCoreDeviceCommand = deserializeAws_restJson1BatchAssociateClientDeviceWithCoreDeviceCommand;
876
679
  const deserializeAws_restJson1BatchAssociateClientDeviceWithCoreDeviceCommandError = async (output, context) => {
@@ -878,7 +681,6 @@ const deserializeAws_restJson1BatchAssociateClientDeviceWithCoreDeviceCommandErr
878
681
  ...output,
879
682
  body: await parseBody(output.body, context),
880
683
  };
881
- let response;
882
684
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
883
685
  switch (errorCode) {
884
686
  case "AccessDeniedException":
@@ -898,29 +700,26 @@ const deserializeAws_restJson1BatchAssociateClientDeviceWithCoreDeviceCommandErr
898
700
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
899
701
  default:
900
702
  const parsedBody = parsedOutput.body;
901
- const $metadata = deserializeMetadata(output);
902
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
903
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
904
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
905
- $fault: "client",
906
- $metadata,
703
+ (0, smithy_client_1.throwDefaultError)({
704
+ output,
705
+ parsedBody,
706
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
707
+ errorCode,
907
708
  });
908
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
909
709
  }
910
710
  };
911
711
  const deserializeAws_restJson1BatchDisassociateClientDeviceFromCoreDeviceCommand = async (output, context) => {
912
712
  if (output.statusCode !== 200 && output.statusCode >= 300) {
913
713
  return deserializeAws_restJson1BatchDisassociateClientDeviceFromCoreDeviceCommandError(output, context);
914
714
  }
915
- const contents = {
715
+ const contents = map({
916
716
  $metadata: deserializeMetadata(output),
917
- errorEntries: undefined,
918
- };
717
+ });
919
718
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
920
- if (data.errorEntries !== undefined && data.errorEntries !== null) {
719
+ if (data.errorEntries != null) {
921
720
  contents.errorEntries = deserializeAws_restJson1DisassociateClientDeviceFromCoreDeviceErrorList(data.errorEntries, context);
922
721
  }
923
- return Promise.resolve(contents);
722
+ return contents;
924
723
  };
925
724
  exports.deserializeAws_restJson1BatchDisassociateClientDeviceFromCoreDeviceCommand = deserializeAws_restJson1BatchDisassociateClientDeviceFromCoreDeviceCommand;
926
725
  const deserializeAws_restJson1BatchDisassociateClientDeviceFromCoreDeviceCommandError = async (output, context) => {
@@ -928,7 +727,6 @@ const deserializeAws_restJson1BatchDisassociateClientDeviceFromCoreDeviceCommand
928
727
  ...output,
929
728
  body: await parseBody(output.body, context),
930
729
  };
931
- let response;
932
730
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
933
731
  switch (errorCode) {
934
732
  case "AccessDeniedException":
@@ -948,29 +746,26 @@ const deserializeAws_restJson1BatchDisassociateClientDeviceFromCoreDeviceCommand
948
746
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
949
747
  default:
950
748
  const parsedBody = parsedOutput.body;
951
- const $metadata = deserializeMetadata(output);
952
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
953
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
954
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
955
- $fault: "client",
956
- $metadata,
749
+ (0, smithy_client_1.throwDefaultError)({
750
+ output,
751
+ parsedBody,
752
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
753
+ errorCode,
957
754
  });
958
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
959
755
  }
960
756
  };
961
757
  const deserializeAws_restJson1CancelDeploymentCommand = async (output, context) => {
962
758
  if (output.statusCode !== 200 && output.statusCode >= 300) {
963
759
  return deserializeAws_restJson1CancelDeploymentCommandError(output, context);
964
760
  }
965
- const contents = {
761
+ const contents = map({
966
762
  $metadata: deserializeMetadata(output),
967
- message: undefined,
968
- };
763
+ });
969
764
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
970
- if (data.message !== undefined && data.message !== null) {
765
+ if (data.message != null) {
971
766
  contents.message = (0, smithy_client_1.expectString)(data.message);
972
767
  }
973
- return Promise.resolve(contents);
768
+ return contents;
974
769
  };
975
770
  exports.deserializeAws_restJson1CancelDeploymentCommand = deserializeAws_restJson1CancelDeploymentCommand;
976
771
  const deserializeAws_restJson1CancelDeploymentCommandError = async (output, context) => {
@@ -978,7 +773,6 @@ const deserializeAws_restJson1CancelDeploymentCommandError = async (output, cont
978
773
  ...output,
979
774
  body: await parseBody(output.body, context),
980
775
  };
981
- let response;
982
776
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
983
777
  switch (errorCode) {
984
778
  case "AccessDeniedException":
@@ -1001,45 +795,38 @@ const deserializeAws_restJson1CancelDeploymentCommandError = async (output, cont
1001
795
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1002
796
  default:
1003
797
  const parsedBody = parsedOutput.body;
1004
- const $metadata = deserializeMetadata(output);
1005
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1006
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1007
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1008
- $fault: "client",
1009
- $metadata,
798
+ (0, smithy_client_1.throwDefaultError)({
799
+ output,
800
+ parsedBody,
801
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
802
+ errorCode,
1010
803
  });
1011
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1012
804
  }
1013
805
  };
1014
806
  const deserializeAws_restJson1CreateComponentVersionCommand = async (output, context) => {
1015
807
  if (output.statusCode !== 201 && output.statusCode >= 300) {
1016
808
  return deserializeAws_restJson1CreateComponentVersionCommandError(output, context);
1017
809
  }
1018
- const contents = {
810
+ const contents = map({
1019
811
  $metadata: deserializeMetadata(output),
1020
- arn: undefined,
1021
- componentName: undefined,
1022
- componentVersion: undefined,
1023
- creationTimestamp: undefined,
1024
- status: undefined,
1025
- };
812
+ });
1026
813
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1027
- if (data.arn !== undefined && data.arn !== null) {
814
+ if (data.arn != null) {
1028
815
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
1029
816
  }
1030
- if (data.componentName !== undefined && data.componentName !== null) {
817
+ if (data.componentName != null) {
1031
818
  contents.componentName = (0, smithy_client_1.expectString)(data.componentName);
1032
819
  }
1033
- if (data.componentVersion !== undefined && data.componentVersion !== null) {
820
+ if (data.componentVersion != null) {
1034
821
  contents.componentVersion = (0, smithy_client_1.expectString)(data.componentVersion);
1035
822
  }
1036
- if (data.creationTimestamp !== undefined && data.creationTimestamp !== null) {
823
+ if (data.creationTimestamp != null) {
1037
824
  contents.creationTimestamp = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.creationTimestamp)));
1038
825
  }
1039
- if (data.status !== undefined && data.status !== null) {
826
+ if (data.status != null) {
1040
827
  contents.status = deserializeAws_restJson1CloudComponentStatus(data.status, context);
1041
828
  }
1042
- return Promise.resolve(contents);
829
+ return contents;
1043
830
  };
1044
831
  exports.deserializeAws_restJson1CreateComponentVersionCommand = deserializeAws_restJson1CreateComponentVersionCommand;
1045
832
  const deserializeAws_restJson1CreateComponentVersionCommandError = async (output, context) => {
@@ -1047,7 +834,6 @@ const deserializeAws_restJson1CreateComponentVersionCommandError = async (output
1047
834
  ...output,
1048
835
  body: await parseBody(output.body, context),
1049
836
  };
1050
- let response;
1051
837
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1052
838
  switch (errorCode) {
1053
839
  case "AccessDeniedException":
@@ -1073,37 +859,32 @@ const deserializeAws_restJson1CreateComponentVersionCommandError = async (output
1073
859
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1074
860
  default:
1075
861
  const parsedBody = parsedOutput.body;
1076
- const $metadata = deserializeMetadata(output);
1077
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1078
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1079
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1080
- $fault: "client",
1081
- $metadata,
862
+ (0, smithy_client_1.throwDefaultError)({
863
+ output,
864
+ parsedBody,
865
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
866
+ errorCode,
1082
867
  });
1083
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1084
868
  }
1085
869
  };
1086
870
  const deserializeAws_restJson1CreateDeploymentCommand = async (output, context) => {
1087
871
  if (output.statusCode !== 201 && output.statusCode >= 300) {
1088
872
  return deserializeAws_restJson1CreateDeploymentCommandError(output, context);
1089
873
  }
1090
- const contents = {
874
+ const contents = map({
1091
875
  $metadata: deserializeMetadata(output),
1092
- deploymentId: undefined,
1093
- iotJobArn: undefined,
1094
- iotJobId: undefined,
1095
- };
876
+ });
1096
877
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1097
- if (data.deploymentId !== undefined && data.deploymentId !== null) {
878
+ if (data.deploymentId != null) {
1098
879
  contents.deploymentId = (0, smithy_client_1.expectString)(data.deploymentId);
1099
880
  }
1100
- if (data.iotJobArn !== undefined && data.iotJobArn !== null) {
881
+ if (data.iotJobArn != null) {
1101
882
  contents.iotJobArn = (0, smithy_client_1.expectString)(data.iotJobArn);
1102
883
  }
1103
- if (data.iotJobId !== undefined && data.iotJobId !== null) {
884
+ if (data.iotJobId != null) {
1104
885
  contents.iotJobId = (0, smithy_client_1.expectString)(data.iotJobId);
1105
886
  }
1106
- return Promise.resolve(contents);
887
+ return contents;
1107
888
  };
1108
889
  exports.deserializeAws_restJson1CreateDeploymentCommand = deserializeAws_restJson1CreateDeploymentCommand;
1109
890
  const deserializeAws_restJson1CreateDeploymentCommandError = async (output, context) => {
@@ -1111,7 +892,6 @@ const deserializeAws_restJson1CreateDeploymentCommandError = async (output, cont
1111
892
  ...output,
1112
893
  body: await parseBody(output.body, context),
1113
894
  };
1114
- let response;
1115
895
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1116
896
  switch (errorCode) {
1117
897
  case "AccessDeniedException":
@@ -1137,25 +917,23 @@ const deserializeAws_restJson1CreateDeploymentCommandError = async (output, cont
1137
917
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1138
918
  default:
1139
919
  const parsedBody = parsedOutput.body;
1140
- const $metadata = deserializeMetadata(output);
1141
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1142
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1143
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1144
- $fault: "client",
1145
- $metadata,
920
+ (0, smithy_client_1.throwDefaultError)({
921
+ output,
922
+ parsedBody,
923
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
924
+ errorCode,
1146
925
  });
1147
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1148
926
  }
1149
927
  };
1150
928
  const deserializeAws_restJson1DeleteComponentCommand = async (output, context) => {
1151
929
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1152
930
  return deserializeAws_restJson1DeleteComponentCommandError(output, context);
1153
931
  }
1154
- const contents = {
932
+ const contents = map({
1155
933
  $metadata: deserializeMetadata(output),
1156
- };
934
+ });
1157
935
  await collectBody(output.body, context);
1158
- return Promise.resolve(contents);
936
+ return contents;
1159
937
  };
1160
938
  exports.deserializeAws_restJson1DeleteComponentCommand = deserializeAws_restJson1DeleteComponentCommand;
1161
939
  const deserializeAws_restJson1DeleteComponentCommandError = async (output, context) => {
@@ -1163,7 +941,6 @@ const deserializeAws_restJson1DeleteComponentCommandError = async (output, conte
1163
941
  ...output,
1164
942
  body: await parseBody(output.body, context),
1165
943
  };
1166
- let response;
1167
944
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1168
945
  switch (errorCode) {
1169
946
  case "AccessDeniedException":
@@ -1186,25 +963,23 @@ const deserializeAws_restJson1DeleteComponentCommandError = async (output, conte
1186
963
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1187
964
  default:
1188
965
  const parsedBody = parsedOutput.body;
1189
- const $metadata = deserializeMetadata(output);
1190
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1191
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1192
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1193
- $fault: "client",
1194
- $metadata,
966
+ (0, smithy_client_1.throwDefaultError)({
967
+ output,
968
+ parsedBody,
969
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
970
+ errorCode,
1195
971
  });
1196
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1197
972
  }
1198
973
  };
1199
974
  const deserializeAws_restJson1DeleteCoreDeviceCommand = async (output, context) => {
1200
975
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1201
976
  return deserializeAws_restJson1DeleteCoreDeviceCommandError(output, context);
1202
977
  }
1203
- const contents = {
978
+ const contents = map({
1204
979
  $metadata: deserializeMetadata(output),
1205
- };
980
+ });
1206
981
  await collectBody(output.body, context);
1207
- return Promise.resolve(contents);
982
+ return contents;
1208
983
  };
1209
984
  exports.deserializeAws_restJson1DeleteCoreDeviceCommand = deserializeAws_restJson1DeleteCoreDeviceCommand;
1210
985
  const deserializeAws_restJson1DeleteCoreDeviceCommandError = async (output, context) => {
@@ -1212,7 +987,6 @@ const deserializeAws_restJson1DeleteCoreDeviceCommandError = async (output, cont
1212
987
  ...output,
1213
988
  body: await parseBody(output.body, context),
1214
989
  };
1215
- let response;
1216
990
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1217
991
  switch (errorCode) {
1218
992
  case "AccessDeniedException":
@@ -1235,25 +1009,23 @@ const deserializeAws_restJson1DeleteCoreDeviceCommandError = async (output, cont
1235
1009
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1236
1010
  default:
1237
1011
  const parsedBody = parsedOutput.body;
1238
- const $metadata = deserializeMetadata(output);
1239
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1240
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1241
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1242
- $fault: "client",
1243
- $metadata,
1012
+ (0, smithy_client_1.throwDefaultError)({
1013
+ output,
1014
+ parsedBody,
1015
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
1016
+ errorCode,
1244
1017
  });
1245
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1246
1018
  }
1247
1019
  };
1248
1020
  const deserializeAws_restJson1DeleteDeploymentCommand = async (output, context) => {
1249
1021
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1250
1022
  return deserializeAws_restJson1DeleteDeploymentCommandError(output, context);
1251
1023
  }
1252
- const contents = {
1024
+ const contents = map({
1253
1025
  $metadata: deserializeMetadata(output),
1254
- };
1026
+ });
1255
1027
  await collectBody(output.body, context);
1256
- return Promise.resolve(contents);
1028
+ return contents;
1257
1029
  };
1258
1030
  exports.deserializeAws_restJson1DeleteDeploymentCommand = deserializeAws_restJson1DeleteDeploymentCommand;
1259
1031
  const deserializeAws_restJson1DeleteDeploymentCommandError = async (output, context) => {
@@ -1261,7 +1033,6 @@ const deserializeAws_restJson1DeleteDeploymentCommandError = async (output, cont
1261
1033
  ...output,
1262
1034
  body: await parseBody(output.body, context),
1263
1035
  };
1264
- let response;
1265
1036
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1266
1037
  switch (errorCode) {
1267
1038
  case "AccessDeniedException":
@@ -1284,61 +1055,50 @@ const deserializeAws_restJson1DeleteDeploymentCommandError = async (output, cont
1284
1055
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1285
1056
  default:
1286
1057
  const parsedBody = parsedOutput.body;
1287
- const $metadata = deserializeMetadata(output);
1288
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1289
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1290
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1291
- $fault: "client",
1292
- $metadata,
1058
+ (0, smithy_client_1.throwDefaultError)({
1059
+ output,
1060
+ parsedBody,
1061
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
1062
+ errorCode,
1293
1063
  });
1294
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1295
1064
  }
1296
1065
  };
1297
1066
  const deserializeAws_restJson1DescribeComponentCommand = async (output, context) => {
1298
1067
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1299
1068
  return deserializeAws_restJson1DescribeComponentCommandError(output, context);
1300
1069
  }
1301
- const contents = {
1070
+ const contents = map({
1302
1071
  $metadata: deserializeMetadata(output),
1303
- arn: undefined,
1304
- componentName: undefined,
1305
- componentVersion: undefined,
1306
- creationTimestamp: undefined,
1307
- description: undefined,
1308
- platforms: undefined,
1309
- publisher: undefined,
1310
- status: undefined,
1311
- tags: undefined,
1312
- };
1072
+ });
1313
1073
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1314
- if (data.arn !== undefined && data.arn !== null) {
1074
+ if (data.arn != null) {
1315
1075
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
1316
1076
  }
1317
- if (data.componentName !== undefined && data.componentName !== null) {
1077
+ if (data.componentName != null) {
1318
1078
  contents.componentName = (0, smithy_client_1.expectString)(data.componentName);
1319
1079
  }
1320
- if (data.componentVersion !== undefined && data.componentVersion !== null) {
1080
+ if (data.componentVersion != null) {
1321
1081
  contents.componentVersion = (0, smithy_client_1.expectString)(data.componentVersion);
1322
1082
  }
1323
- if (data.creationTimestamp !== undefined && data.creationTimestamp !== null) {
1083
+ if (data.creationTimestamp != null) {
1324
1084
  contents.creationTimestamp = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.creationTimestamp)));
1325
1085
  }
1326
- if (data.description !== undefined && data.description !== null) {
1086
+ if (data.description != null) {
1327
1087
  contents.description = (0, smithy_client_1.expectString)(data.description);
1328
1088
  }
1329
- if (data.platforms !== undefined && data.platforms !== null) {
1089
+ if (data.platforms != null) {
1330
1090
  contents.platforms = deserializeAws_restJson1ComponentPlatformList(data.platforms, context);
1331
1091
  }
1332
- if (data.publisher !== undefined && data.publisher !== null) {
1092
+ if (data.publisher != null) {
1333
1093
  contents.publisher = (0, smithy_client_1.expectString)(data.publisher);
1334
1094
  }
1335
- if (data.status !== undefined && data.status !== null) {
1095
+ if (data.status != null) {
1336
1096
  contents.status = deserializeAws_restJson1CloudComponentStatus(data.status, context);
1337
1097
  }
1338
- if (data.tags !== undefined && data.tags !== null) {
1098
+ if (data.tags != null) {
1339
1099
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
1340
1100
  }
1341
- return Promise.resolve(contents);
1101
+ return contents;
1342
1102
  };
1343
1103
  exports.deserializeAws_restJson1DescribeComponentCommand = deserializeAws_restJson1DescribeComponentCommand;
1344
1104
  const deserializeAws_restJson1DescribeComponentCommandError = async (output, context) => {
@@ -1346,7 +1106,6 @@ const deserializeAws_restJson1DescribeComponentCommandError = async (output, con
1346
1106
  ...output,
1347
1107
  body: await parseBody(output.body, context),
1348
1108
  };
1349
- let response;
1350
1109
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1351
1110
  switch (errorCode) {
1352
1111
  case "AccessDeniedException":
@@ -1366,29 +1125,26 @@ const deserializeAws_restJson1DescribeComponentCommandError = async (output, con
1366
1125
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1367
1126
  default:
1368
1127
  const parsedBody = parsedOutput.body;
1369
- const $metadata = deserializeMetadata(output);
1370
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1371
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1372
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1373
- $fault: "client",
1374
- $metadata,
1128
+ (0, smithy_client_1.throwDefaultError)({
1129
+ output,
1130
+ parsedBody,
1131
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
1132
+ errorCode,
1375
1133
  });
1376
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1377
1134
  }
1378
1135
  };
1379
1136
  const deserializeAws_restJson1DisassociateServiceRoleFromAccountCommand = async (output, context) => {
1380
1137
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1381
1138
  return deserializeAws_restJson1DisassociateServiceRoleFromAccountCommandError(output, context);
1382
1139
  }
1383
- const contents = {
1140
+ const contents = map({
1384
1141
  $metadata: deserializeMetadata(output),
1385
- disassociatedAt: undefined,
1386
- };
1142
+ });
1387
1143
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1388
- if (data.DisassociatedAt !== undefined && data.DisassociatedAt !== null) {
1144
+ if (data.DisassociatedAt != null) {
1389
1145
  contents.disassociatedAt = (0, smithy_client_1.expectString)(data.DisassociatedAt);
1390
1146
  }
1391
- return Promise.resolve(contents);
1147
+ return contents;
1392
1148
  };
1393
1149
  exports.deserializeAws_restJson1DisassociateServiceRoleFromAccountCommand = deserializeAws_restJson1DisassociateServiceRoleFromAccountCommand;
1394
1150
  const deserializeAws_restJson1DisassociateServiceRoleFromAccountCommandError = async (output, context) => {
@@ -1396,7 +1152,6 @@ const deserializeAws_restJson1DisassociateServiceRoleFromAccountCommandError = a
1396
1152
  ...output,
1397
1153
  body: await parseBody(output.body, context),
1398
1154
  };
1399
- let response;
1400
1155
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1401
1156
  switch (errorCode) {
1402
1157
  case "InternalServerException":
@@ -1404,37 +1159,32 @@ const deserializeAws_restJson1DisassociateServiceRoleFromAccountCommandError = a
1404
1159
  throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1405
1160
  default:
1406
1161
  const parsedBody = parsedOutput.body;
1407
- const $metadata = deserializeMetadata(output);
1408
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1409
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1410
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1411
- $fault: "client",
1412
- $metadata,
1162
+ (0, smithy_client_1.throwDefaultError)({
1163
+ output,
1164
+ parsedBody,
1165
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
1166
+ errorCode,
1413
1167
  });
1414
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1415
1168
  }
1416
1169
  };
1417
1170
  const deserializeAws_restJson1GetComponentCommand = async (output, context) => {
1418
1171
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1419
1172
  return deserializeAws_restJson1GetComponentCommandError(output, context);
1420
1173
  }
1421
- const contents = {
1174
+ const contents = map({
1422
1175
  $metadata: deserializeMetadata(output),
1423
- recipe: undefined,
1424
- recipeOutputFormat: undefined,
1425
- tags: undefined,
1426
- };
1176
+ });
1427
1177
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1428
- if (data.recipe !== undefined && data.recipe !== null) {
1178
+ if (data.recipe != null) {
1429
1179
  contents.recipe = context.base64Decoder(data.recipe);
1430
1180
  }
1431
- if (data.recipeOutputFormat !== undefined && data.recipeOutputFormat !== null) {
1181
+ if (data.recipeOutputFormat != null) {
1432
1182
  contents.recipeOutputFormat = (0, smithy_client_1.expectString)(data.recipeOutputFormat);
1433
1183
  }
1434
- if (data.tags !== undefined && data.tags !== null) {
1184
+ if (data.tags != null) {
1435
1185
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
1436
1186
  }
1437
- return Promise.resolve(contents);
1187
+ return contents;
1438
1188
  };
1439
1189
  exports.deserializeAws_restJson1GetComponentCommand = deserializeAws_restJson1GetComponentCommand;
1440
1190
  const deserializeAws_restJson1GetComponentCommandError = async (output, context) => {
@@ -1442,7 +1192,6 @@ const deserializeAws_restJson1GetComponentCommandError = async (output, context)
1442
1192
  ...output,
1443
1193
  body: await parseBody(output.body, context),
1444
1194
  };
1445
- let response;
1446
1195
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1447
1196
  switch (errorCode) {
1448
1197
  case "AccessDeniedException":
@@ -1462,29 +1211,26 @@ const deserializeAws_restJson1GetComponentCommandError = async (output, context)
1462
1211
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1463
1212
  default:
1464
1213
  const parsedBody = parsedOutput.body;
1465
- const $metadata = deserializeMetadata(output);
1466
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1467
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1468
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1469
- $fault: "client",
1470
- $metadata,
1214
+ (0, smithy_client_1.throwDefaultError)({
1215
+ output,
1216
+ parsedBody,
1217
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
1218
+ errorCode,
1471
1219
  });
1472
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1473
1220
  }
1474
1221
  };
1475
1222
  const deserializeAws_restJson1GetComponentVersionArtifactCommand = async (output, context) => {
1476
1223
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1477
1224
  return deserializeAws_restJson1GetComponentVersionArtifactCommandError(output, context);
1478
1225
  }
1479
- const contents = {
1226
+ const contents = map({
1480
1227
  $metadata: deserializeMetadata(output),
1481
- preSignedUrl: undefined,
1482
- };
1228
+ });
1483
1229
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1484
- if (data.preSignedUrl !== undefined && data.preSignedUrl !== null) {
1230
+ if (data.preSignedUrl != null) {
1485
1231
  contents.preSignedUrl = (0, smithy_client_1.expectString)(data.preSignedUrl);
1486
1232
  }
1487
- return Promise.resolve(contents);
1233
+ return contents;
1488
1234
  };
1489
1235
  exports.deserializeAws_restJson1GetComponentVersionArtifactCommand = deserializeAws_restJson1GetComponentVersionArtifactCommand;
1490
1236
  const deserializeAws_restJson1GetComponentVersionArtifactCommandError = async (output, context) => {
@@ -1492,7 +1238,6 @@ const deserializeAws_restJson1GetComponentVersionArtifactCommandError = async (o
1492
1238
  ...output,
1493
1239
  body: await parseBody(output.body, context),
1494
1240
  };
1495
- let response;
1496
1241
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1497
1242
  switch (errorCode) {
1498
1243
  case "AccessDeniedException":
@@ -1512,33 +1257,29 @@ const deserializeAws_restJson1GetComponentVersionArtifactCommandError = async (o
1512
1257
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1513
1258
  default:
1514
1259
  const parsedBody = parsedOutput.body;
1515
- const $metadata = deserializeMetadata(output);
1516
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1517
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1518
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1519
- $fault: "client",
1520
- $metadata,
1260
+ (0, smithy_client_1.throwDefaultError)({
1261
+ output,
1262
+ parsedBody,
1263
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
1264
+ errorCode,
1521
1265
  });
1522
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1523
1266
  }
1524
1267
  };
1525
1268
  const deserializeAws_restJson1GetConnectivityInfoCommand = async (output, context) => {
1526
1269
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1527
1270
  return deserializeAws_restJson1GetConnectivityInfoCommandError(output, context);
1528
1271
  }
1529
- const contents = {
1272
+ const contents = map({
1530
1273
  $metadata: deserializeMetadata(output),
1531
- connectivityInfo: undefined,
1532
- message: undefined,
1533
- };
1274
+ });
1534
1275
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1535
- if (data.ConnectivityInfo !== undefined && data.ConnectivityInfo !== null) {
1276
+ if (data.ConnectivityInfo != null) {
1536
1277
  contents.connectivityInfo = deserializeAws_restJson1connectivityInfoList(data.ConnectivityInfo, context);
1537
1278
  }
1538
- if (data.Message !== undefined && data.Message !== null) {
1279
+ if (data.Message != null) {
1539
1280
  contents.message = (0, smithy_client_1.expectString)(data.Message);
1540
1281
  }
1541
- return Promise.resolve(contents);
1282
+ return contents;
1542
1283
  };
1543
1284
  exports.deserializeAws_restJson1GetConnectivityInfoCommand = deserializeAws_restJson1GetConnectivityInfoCommand;
1544
1285
  const deserializeAws_restJson1GetConnectivityInfoCommandError = async (output, context) => {
@@ -1546,7 +1287,6 @@ const deserializeAws_restJson1GetConnectivityInfoCommandError = async (output, c
1546
1287
  ...output,
1547
1288
  body: await parseBody(output.body, context),
1548
1289
  };
1549
- let response;
1550
1290
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1551
1291
  switch (errorCode) {
1552
1292
  case "InternalServerException":
@@ -1557,53 +1297,44 @@ const deserializeAws_restJson1GetConnectivityInfoCommandError = async (output, c
1557
1297
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1558
1298
  default:
1559
1299
  const parsedBody = parsedOutput.body;
1560
- const $metadata = deserializeMetadata(output);
1561
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1562
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1563
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1564
- $fault: "client",
1565
- $metadata,
1300
+ (0, smithy_client_1.throwDefaultError)({
1301
+ output,
1302
+ parsedBody,
1303
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
1304
+ errorCode,
1566
1305
  });
1567
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1568
1306
  }
1569
1307
  };
1570
1308
  const deserializeAws_restJson1GetCoreDeviceCommand = async (output, context) => {
1571
1309
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1572
1310
  return deserializeAws_restJson1GetCoreDeviceCommandError(output, context);
1573
1311
  }
1574
- const contents = {
1312
+ const contents = map({
1575
1313
  $metadata: deserializeMetadata(output),
1576
- architecture: undefined,
1577
- coreDeviceThingName: undefined,
1578
- coreVersion: undefined,
1579
- lastStatusUpdateTimestamp: undefined,
1580
- platform: undefined,
1581
- status: undefined,
1582
- tags: undefined,
1583
- };
1314
+ });
1584
1315
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1585
- if (data.architecture !== undefined && data.architecture !== null) {
1316
+ if (data.architecture != null) {
1586
1317
  contents.architecture = (0, smithy_client_1.expectString)(data.architecture);
1587
1318
  }
1588
- if (data.coreDeviceThingName !== undefined && data.coreDeviceThingName !== null) {
1319
+ if (data.coreDeviceThingName != null) {
1589
1320
  contents.coreDeviceThingName = (0, smithy_client_1.expectString)(data.coreDeviceThingName);
1590
1321
  }
1591
- if (data.coreVersion !== undefined && data.coreVersion !== null) {
1322
+ if (data.coreVersion != null) {
1592
1323
  contents.coreVersion = (0, smithy_client_1.expectString)(data.coreVersion);
1593
1324
  }
1594
- if (data.lastStatusUpdateTimestamp !== undefined && data.lastStatusUpdateTimestamp !== null) {
1325
+ if (data.lastStatusUpdateTimestamp != null) {
1595
1326
  contents.lastStatusUpdateTimestamp = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.lastStatusUpdateTimestamp)));
1596
1327
  }
1597
- if (data.platform !== undefined && data.platform !== null) {
1328
+ if (data.platform != null) {
1598
1329
  contents.platform = (0, smithy_client_1.expectString)(data.platform);
1599
1330
  }
1600
- if (data.status !== undefined && data.status !== null) {
1331
+ if (data.status != null) {
1601
1332
  contents.status = (0, smithy_client_1.expectString)(data.status);
1602
1333
  }
1603
- if (data.tags !== undefined && data.tags !== null) {
1334
+ if (data.tags != null) {
1604
1335
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
1605
1336
  }
1606
- return Promise.resolve(contents);
1337
+ return contents;
1607
1338
  };
1608
1339
  exports.deserializeAws_restJson1GetCoreDeviceCommand = deserializeAws_restJson1GetCoreDeviceCommand;
1609
1340
  const deserializeAws_restJson1GetCoreDeviceCommandError = async (output, context) => {
@@ -1611,7 +1342,6 @@ const deserializeAws_restJson1GetCoreDeviceCommandError = async (output, context
1611
1342
  ...output,
1612
1343
  body: await parseBody(output.body, context),
1613
1344
  };
1614
- let response;
1615
1345
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1616
1346
  switch (errorCode) {
1617
1347
  case "AccessDeniedException":
@@ -1631,77 +1361,62 @@ const deserializeAws_restJson1GetCoreDeviceCommandError = async (output, context
1631
1361
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1632
1362
  default:
1633
1363
  const parsedBody = parsedOutput.body;
1634
- const $metadata = deserializeMetadata(output);
1635
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1636
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1637
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1638
- $fault: "client",
1639
- $metadata,
1364
+ (0, smithy_client_1.throwDefaultError)({
1365
+ output,
1366
+ parsedBody,
1367
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
1368
+ errorCode,
1640
1369
  });
1641
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1642
1370
  }
1643
1371
  };
1644
1372
  const deserializeAws_restJson1GetDeploymentCommand = async (output, context) => {
1645
1373
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1646
1374
  return deserializeAws_restJson1GetDeploymentCommandError(output, context);
1647
1375
  }
1648
- const contents = {
1376
+ const contents = map({
1649
1377
  $metadata: deserializeMetadata(output),
1650
- components: undefined,
1651
- creationTimestamp: undefined,
1652
- deploymentId: undefined,
1653
- deploymentName: undefined,
1654
- deploymentPolicies: undefined,
1655
- deploymentStatus: undefined,
1656
- iotJobArn: undefined,
1657
- iotJobConfiguration: undefined,
1658
- iotJobId: undefined,
1659
- isLatestForTarget: undefined,
1660
- revisionId: undefined,
1661
- tags: undefined,
1662
- targetArn: undefined,
1663
- };
1378
+ });
1664
1379
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1665
- if (data.components !== undefined && data.components !== null) {
1380
+ if (data.components != null) {
1666
1381
  contents.components = deserializeAws_restJson1ComponentDeploymentSpecifications(data.components, context);
1667
1382
  }
1668
- if (data.creationTimestamp !== undefined && data.creationTimestamp !== null) {
1383
+ if (data.creationTimestamp != null) {
1669
1384
  contents.creationTimestamp = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.creationTimestamp)));
1670
1385
  }
1671
- if (data.deploymentId !== undefined && data.deploymentId !== null) {
1386
+ if (data.deploymentId != null) {
1672
1387
  contents.deploymentId = (0, smithy_client_1.expectString)(data.deploymentId);
1673
1388
  }
1674
- if (data.deploymentName !== undefined && data.deploymentName !== null) {
1389
+ if (data.deploymentName != null) {
1675
1390
  contents.deploymentName = (0, smithy_client_1.expectString)(data.deploymentName);
1676
1391
  }
1677
- if (data.deploymentPolicies !== undefined && data.deploymentPolicies !== null) {
1392
+ if (data.deploymentPolicies != null) {
1678
1393
  contents.deploymentPolicies = deserializeAws_restJson1DeploymentPolicies(data.deploymentPolicies, context);
1679
1394
  }
1680
- if (data.deploymentStatus !== undefined && data.deploymentStatus !== null) {
1395
+ if (data.deploymentStatus != null) {
1681
1396
  contents.deploymentStatus = (0, smithy_client_1.expectString)(data.deploymentStatus);
1682
1397
  }
1683
- if (data.iotJobArn !== undefined && data.iotJobArn !== null) {
1398
+ if (data.iotJobArn != null) {
1684
1399
  contents.iotJobArn = (0, smithy_client_1.expectString)(data.iotJobArn);
1685
1400
  }
1686
- if (data.iotJobConfiguration !== undefined && data.iotJobConfiguration !== null) {
1401
+ if (data.iotJobConfiguration != null) {
1687
1402
  contents.iotJobConfiguration = deserializeAws_restJson1DeploymentIoTJobConfiguration(data.iotJobConfiguration, context);
1688
1403
  }
1689
- if (data.iotJobId !== undefined && data.iotJobId !== null) {
1404
+ if (data.iotJobId != null) {
1690
1405
  contents.iotJobId = (0, smithy_client_1.expectString)(data.iotJobId);
1691
1406
  }
1692
- if (data.isLatestForTarget !== undefined && data.isLatestForTarget !== null) {
1407
+ if (data.isLatestForTarget != null) {
1693
1408
  contents.isLatestForTarget = (0, smithy_client_1.expectBoolean)(data.isLatestForTarget);
1694
1409
  }
1695
- if (data.revisionId !== undefined && data.revisionId !== null) {
1410
+ if (data.revisionId != null) {
1696
1411
  contents.revisionId = (0, smithy_client_1.expectString)(data.revisionId);
1697
1412
  }
1698
- if (data.tags !== undefined && data.tags !== null) {
1413
+ if (data.tags != null) {
1699
1414
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
1700
1415
  }
1701
- if (data.targetArn !== undefined && data.targetArn !== null) {
1416
+ if (data.targetArn != null) {
1702
1417
  contents.targetArn = (0, smithy_client_1.expectString)(data.targetArn);
1703
1418
  }
1704
- return Promise.resolve(contents);
1419
+ return contents;
1705
1420
  };
1706
1421
  exports.deserializeAws_restJson1GetDeploymentCommand = deserializeAws_restJson1GetDeploymentCommand;
1707
1422
  const deserializeAws_restJson1GetDeploymentCommandError = async (output, context) => {
@@ -1709,7 +1424,6 @@ const deserializeAws_restJson1GetDeploymentCommandError = async (output, context
1709
1424
  ...output,
1710
1425
  body: await parseBody(output.body, context),
1711
1426
  };
1712
- let response;
1713
1427
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1714
1428
  switch (errorCode) {
1715
1429
  case "AccessDeniedException":
@@ -1729,33 +1443,29 @@ const deserializeAws_restJson1GetDeploymentCommandError = async (output, context
1729
1443
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1730
1444
  default:
1731
1445
  const parsedBody = parsedOutput.body;
1732
- const $metadata = deserializeMetadata(output);
1733
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1734
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1735
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1736
- $fault: "client",
1737
- $metadata,
1446
+ (0, smithy_client_1.throwDefaultError)({
1447
+ output,
1448
+ parsedBody,
1449
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
1450
+ errorCode,
1738
1451
  });
1739
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1740
1452
  }
1741
1453
  };
1742
1454
  const deserializeAws_restJson1GetServiceRoleForAccountCommand = async (output, context) => {
1743
1455
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1744
1456
  return deserializeAws_restJson1GetServiceRoleForAccountCommandError(output, context);
1745
1457
  }
1746
- const contents = {
1458
+ const contents = map({
1747
1459
  $metadata: deserializeMetadata(output),
1748
- associatedAt: undefined,
1749
- roleArn: undefined,
1750
- };
1460
+ });
1751
1461
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1752
- if (data.AssociatedAt !== undefined && data.AssociatedAt !== null) {
1462
+ if (data.AssociatedAt != null) {
1753
1463
  contents.associatedAt = (0, smithy_client_1.expectString)(data.AssociatedAt);
1754
1464
  }
1755
- if (data.RoleArn !== undefined && data.RoleArn !== null) {
1465
+ if (data.RoleArn != null) {
1756
1466
  contents.roleArn = (0, smithy_client_1.expectString)(data.RoleArn);
1757
1467
  }
1758
- return Promise.resolve(contents);
1468
+ return contents;
1759
1469
  };
1760
1470
  exports.deserializeAws_restJson1GetServiceRoleForAccountCommand = deserializeAws_restJson1GetServiceRoleForAccountCommand;
1761
1471
  const deserializeAws_restJson1GetServiceRoleForAccountCommandError = async (output, context) => {
@@ -1763,7 +1473,6 @@ const deserializeAws_restJson1GetServiceRoleForAccountCommandError = async (outp
1763
1473
  ...output,
1764
1474
  body: await parseBody(output.body, context),
1765
1475
  };
1766
- let response;
1767
1476
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1768
1477
  switch (errorCode) {
1769
1478
  case "InternalServerException":
@@ -1771,33 +1480,29 @@ const deserializeAws_restJson1GetServiceRoleForAccountCommandError = async (outp
1771
1480
  throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1772
1481
  default:
1773
1482
  const parsedBody = parsedOutput.body;
1774
- const $metadata = deserializeMetadata(output);
1775
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1776
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1777
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1778
- $fault: "client",
1779
- $metadata,
1483
+ (0, smithy_client_1.throwDefaultError)({
1484
+ output,
1485
+ parsedBody,
1486
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
1487
+ errorCode,
1780
1488
  });
1781
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1782
1489
  }
1783
1490
  };
1784
1491
  const deserializeAws_restJson1ListClientDevicesAssociatedWithCoreDeviceCommand = async (output, context) => {
1785
1492
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1786
1493
  return deserializeAws_restJson1ListClientDevicesAssociatedWithCoreDeviceCommandError(output, context);
1787
1494
  }
1788
- const contents = {
1495
+ const contents = map({
1789
1496
  $metadata: deserializeMetadata(output),
1790
- associatedClientDevices: undefined,
1791
- nextToken: undefined,
1792
- };
1497
+ });
1793
1498
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1794
- if (data.associatedClientDevices !== undefined && data.associatedClientDevices !== null) {
1499
+ if (data.associatedClientDevices != null) {
1795
1500
  contents.associatedClientDevices = deserializeAws_restJson1AssociatedClientDeviceList(data.associatedClientDevices, context);
1796
1501
  }
1797
- if (data.nextToken !== undefined && data.nextToken !== null) {
1502
+ if (data.nextToken != null) {
1798
1503
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1799
1504
  }
1800
- return Promise.resolve(contents);
1505
+ return contents;
1801
1506
  };
1802
1507
  exports.deserializeAws_restJson1ListClientDevicesAssociatedWithCoreDeviceCommand = deserializeAws_restJson1ListClientDevicesAssociatedWithCoreDeviceCommand;
1803
1508
  const deserializeAws_restJson1ListClientDevicesAssociatedWithCoreDeviceCommandError = async (output, context) => {
@@ -1805,7 +1510,6 @@ const deserializeAws_restJson1ListClientDevicesAssociatedWithCoreDeviceCommandEr
1805
1510
  ...output,
1806
1511
  body: await parseBody(output.body, context),
1807
1512
  };
1808
- let response;
1809
1513
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1810
1514
  switch (errorCode) {
1811
1515
  case "AccessDeniedException":
@@ -1825,33 +1529,29 @@ const deserializeAws_restJson1ListClientDevicesAssociatedWithCoreDeviceCommandEr
1825
1529
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1826
1530
  default:
1827
1531
  const parsedBody = parsedOutput.body;
1828
- const $metadata = deserializeMetadata(output);
1829
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1830
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1831
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1832
- $fault: "client",
1833
- $metadata,
1532
+ (0, smithy_client_1.throwDefaultError)({
1533
+ output,
1534
+ parsedBody,
1535
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
1536
+ errorCode,
1834
1537
  });
1835
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1836
1538
  }
1837
1539
  };
1838
1540
  const deserializeAws_restJson1ListComponentsCommand = async (output, context) => {
1839
1541
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1840
1542
  return deserializeAws_restJson1ListComponentsCommandError(output, context);
1841
1543
  }
1842
- const contents = {
1544
+ const contents = map({
1843
1545
  $metadata: deserializeMetadata(output),
1844
- components: undefined,
1845
- nextToken: undefined,
1846
- };
1546
+ });
1847
1547
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1848
- if (data.components !== undefined && data.components !== null) {
1548
+ if (data.components != null) {
1849
1549
  contents.components = deserializeAws_restJson1ComponentList(data.components, context);
1850
1550
  }
1851
- if (data.nextToken !== undefined && data.nextToken !== null) {
1551
+ if (data.nextToken != null) {
1852
1552
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1853
1553
  }
1854
- return Promise.resolve(contents);
1554
+ return contents;
1855
1555
  };
1856
1556
  exports.deserializeAws_restJson1ListComponentsCommand = deserializeAws_restJson1ListComponentsCommand;
1857
1557
  const deserializeAws_restJson1ListComponentsCommandError = async (output, context) => {
@@ -1859,7 +1559,6 @@ const deserializeAws_restJson1ListComponentsCommandError = async (output, contex
1859
1559
  ...output,
1860
1560
  body: await parseBody(output.body, context),
1861
1561
  };
1862
- let response;
1863
1562
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1864
1563
  switch (errorCode) {
1865
1564
  case "AccessDeniedException":
@@ -1879,33 +1578,29 @@ const deserializeAws_restJson1ListComponentsCommandError = async (output, contex
1879
1578
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1880
1579
  default:
1881
1580
  const parsedBody = parsedOutput.body;
1882
- const $metadata = deserializeMetadata(output);
1883
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1884
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1885
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1886
- $fault: "client",
1887
- $metadata,
1581
+ (0, smithy_client_1.throwDefaultError)({
1582
+ output,
1583
+ parsedBody,
1584
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
1585
+ errorCode,
1888
1586
  });
1889
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1890
1587
  }
1891
1588
  };
1892
1589
  const deserializeAws_restJson1ListComponentVersionsCommand = async (output, context) => {
1893
1590
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1894
1591
  return deserializeAws_restJson1ListComponentVersionsCommandError(output, context);
1895
1592
  }
1896
- const contents = {
1593
+ const contents = map({
1897
1594
  $metadata: deserializeMetadata(output),
1898
- componentVersions: undefined,
1899
- nextToken: undefined,
1900
- };
1595
+ });
1901
1596
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1902
- if (data.componentVersions !== undefined && data.componentVersions !== null) {
1597
+ if (data.componentVersions != null) {
1903
1598
  contents.componentVersions = deserializeAws_restJson1ComponentVersionList(data.componentVersions, context);
1904
1599
  }
1905
- if (data.nextToken !== undefined && data.nextToken !== null) {
1600
+ if (data.nextToken != null) {
1906
1601
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1907
1602
  }
1908
- return Promise.resolve(contents);
1603
+ return contents;
1909
1604
  };
1910
1605
  exports.deserializeAws_restJson1ListComponentVersionsCommand = deserializeAws_restJson1ListComponentVersionsCommand;
1911
1606
  const deserializeAws_restJson1ListComponentVersionsCommandError = async (output, context) => {
@@ -1913,7 +1608,6 @@ const deserializeAws_restJson1ListComponentVersionsCommandError = async (output,
1913
1608
  ...output,
1914
1609
  body: await parseBody(output.body, context),
1915
1610
  };
1916
- let response;
1917
1611
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1918
1612
  switch (errorCode) {
1919
1613
  case "AccessDeniedException":
@@ -1933,33 +1627,29 @@ const deserializeAws_restJson1ListComponentVersionsCommandError = async (output,
1933
1627
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1934
1628
  default:
1935
1629
  const parsedBody = parsedOutput.body;
1936
- const $metadata = deserializeMetadata(output);
1937
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1938
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1939
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1940
- $fault: "client",
1941
- $metadata,
1630
+ (0, smithy_client_1.throwDefaultError)({
1631
+ output,
1632
+ parsedBody,
1633
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
1634
+ errorCode,
1942
1635
  });
1943
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1944
1636
  }
1945
1637
  };
1946
1638
  const deserializeAws_restJson1ListCoreDevicesCommand = async (output, context) => {
1947
1639
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1948
1640
  return deserializeAws_restJson1ListCoreDevicesCommandError(output, context);
1949
1641
  }
1950
- const contents = {
1642
+ const contents = map({
1951
1643
  $metadata: deserializeMetadata(output),
1952
- coreDevices: undefined,
1953
- nextToken: undefined,
1954
- };
1644
+ });
1955
1645
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1956
- if (data.coreDevices !== undefined && data.coreDevices !== null) {
1646
+ if (data.coreDevices != null) {
1957
1647
  contents.coreDevices = deserializeAws_restJson1CoreDevicesList(data.coreDevices, context);
1958
1648
  }
1959
- if (data.nextToken !== undefined && data.nextToken !== null) {
1649
+ if (data.nextToken != null) {
1960
1650
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1961
1651
  }
1962
- return Promise.resolve(contents);
1652
+ return contents;
1963
1653
  };
1964
1654
  exports.deserializeAws_restJson1ListCoreDevicesCommand = deserializeAws_restJson1ListCoreDevicesCommand;
1965
1655
  const deserializeAws_restJson1ListCoreDevicesCommandError = async (output, context) => {
@@ -1967,7 +1657,6 @@ const deserializeAws_restJson1ListCoreDevicesCommandError = async (output, conte
1967
1657
  ...output,
1968
1658
  body: await parseBody(output.body, context),
1969
1659
  };
1970
- let response;
1971
1660
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1972
1661
  switch (errorCode) {
1973
1662
  case "AccessDeniedException":
@@ -1984,33 +1673,29 @@ const deserializeAws_restJson1ListCoreDevicesCommandError = async (output, conte
1984
1673
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1985
1674
  default:
1986
1675
  const parsedBody = parsedOutput.body;
1987
- const $metadata = deserializeMetadata(output);
1988
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1989
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
1990
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1991
- $fault: "client",
1992
- $metadata,
1676
+ (0, smithy_client_1.throwDefaultError)({
1677
+ output,
1678
+ parsedBody,
1679
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
1680
+ errorCode,
1993
1681
  });
1994
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1995
1682
  }
1996
1683
  };
1997
1684
  const deserializeAws_restJson1ListDeploymentsCommand = async (output, context) => {
1998
1685
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1999
1686
  return deserializeAws_restJson1ListDeploymentsCommandError(output, context);
2000
1687
  }
2001
- const contents = {
1688
+ const contents = map({
2002
1689
  $metadata: deserializeMetadata(output),
2003
- deployments: undefined,
2004
- nextToken: undefined,
2005
- };
1690
+ });
2006
1691
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2007
- if (data.deployments !== undefined && data.deployments !== null) {
1692
+ if (data.deployments != null) {
2008
1693
  contents.deployments = deserializeAws_restJson1DeploymentList(data.deployments, context);
2009
1694
  }
2010
- if (data.nextToken !== undefined && data.nextToken !== null) {
1695
+ if (data.nextToken != null) {
2011
1696
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2012
1697
  }
2013
- return Promise.resolve(contents);
1698
+ return contents;
2014
1699
  };
2015
1700
  exports.deserializeAws_restJson1ListDeploymentsCommand = deserializeAws_restJson1ListDeploymentsCommand;
2016
1701
  const deserializeAws_restJson1ListDeploymentsCommandError = async (output, context) => {
@@ -2018,7 +1703,6 @@ const deserializeAws_restJson1ListDeploymentsCommandError = async (output, conte
2018
1703
  ...output,
2019
1704
  body: await parseBody(output.body, context),
2020
1705
  };
2021
- let response;
2022
1706
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2023
1707
  switch (errorCode) {
2024
1708
  case "AccessDeniedException":
@@ -2035,33 +1719,29 @@ const deserializeAws_restJson1ListDeploymentsCommandError = async (output, conte
2035
1719
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2036
1720
  default:
2037
1721
  const parsedBody = parsedOutput.body;
2038
- const $metadata = deserializeMetadata(output);
2039
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2040
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
2041
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2042
- $fault: "client",
2043
- $metadata,
1722
+ (0, smithy_client_1.throwDefaultError)({
1723
+ output,
1724
+ parsedBody,
1725
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
1726
+ errorCode,
2044
1727
  });
2045
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2046
1728
  }
2047
1729
  };
2048
1730
  const deserializeAws_restJson1ListEffectiveDeploymentsCommand = async (output, context) => {
2049
1731
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2050
1732
  return deserializeAws_restJson1ListEffectiveDeploymentsCommandError(output, context);
2051
1733
  }
2052
- const contents = {
1734
+ const contents = map({
2053
1735
  $metadata: deserializeMetadata(output),
2054
- effectiveDeployments: undefined,
2055
- nextToken: undefined,
2056
- };
1736
+ });
2057
1737
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2058
- if (data.effectiveDeployments !== undefined && data.effectiveDeployments !== null) {
1738
+ if (data.effectiveDeployments != null) {
2059
1739
  contents.effectiveDeployments = deserializeAws_restJson1EffectiveDeploymentsList(data.effectiveDeployments, context);
2060
1740
  }
2061
- if (data.nextToken !== undefined && data.nextToken !== null) {
1741
+ if (data.nextToken != null) {
2062
1742
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2063
1743
  }
2064
- return Promise.resolve(contents);
1744
+ return contents;
2065
1745
  };
2066
1746
  exports.deserializeAws_restJson1ListEffectiveDeploymentsCommand = deserializeAws_restJson1ListEffectiveDeploymentsCommand;
2067
1747
  const deserializeAws_restJson1ListEffectiveDeploymentsCommandError = async (output, context) => {
@@ -2069,7 +1749,6 @@ const deserializeAws_restJson1ListEffectiveDeploymentsCommandError = async (outp
2069
1749
  ...output,
2070
1750
  body: await parseBody(output.body, context),
2071
1751
  };
2072
- let response;
2073
1752
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2074
1753
  switch (errorCode) {
2075
1754
  case "AccessDeniedException":
@@ -2089,33 +1768,29 @@ const deserializeAws_restJson1ListEffectiveDeploymentsCommandError = async (outp
2089
1768
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2090
1769
  default:
2091
1770
  const parsedBody = parsedOutput.body;
2092
- const $metadata = deserializeMetadata(output);
2093
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2094
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
2095
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2096
- $fault: "client",
2097
- $metadata,
1771
+ (0, smithy_client_1.throwDefaultError)({
1772
+ output,
1773
+ parsedBody,
1774
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
1775
+ errorCode,
2098
1776
  });
2099
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2100
1777
  }
2101
1778
  };
2102
1779
  const deserializeAws_restJson1ListInstalledComponentsCommand = async (output, context) => {
2103
1780
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2104
1781
  return deserializeAws_restJson1ListInstalledComponentsCommandError(output, context);
2105
1782
  }
2106
- const contents = {
1783
+ const contents = map({
2107
1784
  $metadata: deserializeMetadata(output),
2108
- installedComponents: undefined,
2109
- nextToken: undefined,
2110
- };
1785
+ });
2111
1786
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2112
- if (data.installedComponents !== undefined && data.installedComponents !== null) {
1787
+ if (data.installedComponents != null) {
2113
1788
  contents.installedComponents = deserializeAws_restJson1InstalledComponentList(data.installedComponents, context);
2114
1789
  }
2115
- if (data.nextToken !== undefined && data.nextToken !== null) {
1790
+ if (data.nextToken != null) {
2116
1791
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
2117
1792
  }
2118
- return Promise.resolve(contents);
1793
+ return contents;
2119
1794
  };
2120
1795
  exports.deserializeAws_restJson1ListInstalledComponentsCommand = deserializeAws_restJson1ListInstalledComponentsCommand;
2121
1796
  const deserializeAws_restJson1ListInstalledComponentsCommandError = async (output, context) => {
@@ -2123,7 +1798,6 @@ const deserializeAws_restJson1ListInstalledComponentsCommandError = async (outpu
2123
1798
  ...output,
2124
1799
  body: await parseBody(output.body, context),
2125
1800
  };
2126
- let response;
2127
1801
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2128
1802
  switch (errorCode) {
2129
1803
  case "AccessDeniedException":
@@ -2143,29 +1817,26 @@ const deserializeAws_restJson1ListInstalledComponentsCommandError = async (outpu
2143
1817
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2144
1818
  default:
2145
1819
  const parsedBody = parsedOutput.body;
2146
- const $metadata = deserializeMetadata(output);
2147
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2148
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
2149
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2150
- $fault: "client",
2151
- $metadata,
1820
+ (0, smithy_client_1.throwDefaultError)({
1821
+ output,
1822
+ parsedBody,
1823
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
1824
+ errorCode,
2152
1825
  });
2153
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2154
1826
  }
2155
1827
  };
2156
1828
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
2157
1829
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2158
1830
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
2159
1831
  }
2160
- const contents = {
1832
+ const contents = map({
2161
1833
  $metadata: deserializeMetadata(output),
2162
- tags: undefined,
2163
- };
1834
+ });
2164
1835
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2165
- if (data.tags !== undefined && data.tags !== null) {
1836
+ if (data.tags != null) {
2166
1837
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
2167
1838
  }
2168
- return Promise.resolve(contents);
1839
+ return contents;
2169
1840
  };
2170
1841
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
2171
1842
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -2173,7 +1844,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
2173
1844
  ...output,
2174
1845
  body: await parseBody(output.body, context),
2175
1846
  };
2176
- let response;
2177
1847
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2178
1848
  switch (errorCode) {
2179
1849
  case "InternalServerException":
@@ -2187,29 +1857,26 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
2187
1857
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2188
1858
  default:
2189
1859
  const parsedBody = parsedOutput.body;
2190
- const $metadata = deserializeMetadata(output);
2191
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2192
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
2193
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2194
- $fault: "client",
2195
- $metadata,
1860
+ (0, smithy_client_1.throwDefaultError)({
1861
+ output,
1862
+ parsedBody,
1863
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
1864
+ errorCode,
2196
1865
  });
2197
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2198
1866
  }
2199
1867
  };
2200
1868
  const deserializeAws_restJson1ResolveComponentCandidatesCommand = async (output, context) => {
2201
1869
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2202
1870
  return deserializeAws_restJson1ResolveComponentCandidatesCommandError(output, context);
2203
1871
  }
2204
- const contents = {
1872
+ const contents = map({
2205
1873
  $metadata: deserializeMetadata(output),
2206
- resolvedComponentVersions: undefined,
2207
- };
1874
+ });
2208
1875
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2209
- if (data.resolvedComponentVersions !== undefined && data.resolvedComponentVersions !== null) {
1876
+ if (data.resolvedComponentVersions != null) {
2210
1877
  contents.resolvedComponentVersions = deserializeAws_restJson1ResolvedComponentVersionsList(data.resolvedComponentVersions, context);
2211
1878
  }
2212
- return Promise.resolve(contents);
1879
+ return contents;
2213
1880
  };
2214
1881
  exports.deserializeAws_restJson1ResolveComponentCandidatesCommand = deserializeAws_restJson1ResolveComponentCandidatesCommand;
2215
1882
  const deserializeAws_restJson1ResolveComponentCandidatesCommandError = async (output, context) => {
@@ -2217,7 +1884,6 @@ const deserializeAws_restJson1ResolveComponentCandidatesCommandError = async (ou
2217
1884
  ...output,
2218
1885
  body: await parseBody(output.body, context),
2219
1886
  };
2220
- let response;
2221
1887
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2222
1888
  switch (errorCode) {
2223
1889
  case "AccessDeniedException":
@@ -2240,25 +1906,23 @@ const deserializeAws_restJson1ResolveComponentCandidatesCommandError = async (ou
2240
1906
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2241
1907
  default:
2242
1908
  const parsedBody = parsedOutput.body;
2243
- const $metadata = deserializeMetadata(output);
2244
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2245
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
2246
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2247
- $fault: "client",
2248
- $metadata,
1909
+ (0, smithy_client_1.throwDefaultError)({
1910
+ output,
1911
+ parsedBody,
1912
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
1913
+ errorCode,
2249
1914
  });
2250
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2251
1915
  }
2252
1916
  };
2253
1917
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
2254
1918
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2255
1919
  return deserializeAws_restJson1TagResourceCommandError(output, context);
2256
1920
  }
2257
- const contents = {
1921
+ const contents = map({
2258
1922
  $metadata: deserializeMetadata(output),
2259
- };
1923
+ });
2260
1924
  await collectBody(output.body, context);
2261
- return Promise.resolve(contents);
1925
+ return contents;
2262
1926
  };
2263
1927
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
2264
1928
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -2266,7 +1930,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
2266
1930
  ...output,
2267
1931
  body: await parseBody(output.body, context),
2268
1932
  };
2269
- let response;
2270
1933
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2271
1934
  switch (errorCode) {
2272
1935
  case "InternalServerException":
@@ -2280,25 +1943,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
2280
1943
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2281
1944
  default:
2282
1945
  const parsedBody = parsedOutput.body;
2283
- const $metadata = deserializeMetadata(output);
2284
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2285
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
2286
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2287
- $fault: "client",
2288
- $metadata,
1946
+ (0, smithy_client_1.throwDefaultError)({
1947
+ output,
1948
+ parsedBody,
1949
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
1950
+ errorCode,
2289
1951
  });
2290
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2291
1952
  }
2292
1953
  };
2293
1954
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
2294
1955
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2295
1956
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
2296
1957
  }
2297
- const contents = {
1958
+ const contents = map({
2298
1959
  $metadata: deserializeMetadata(output),
2299
- };
1960
+ });
2300
1961
  await collectBody(output.body, context);
2301
- return Promise.resolve(contents);
1962
+ return contents;
2302
1963
  };
2303
1964
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
2304
1965
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -2306,7 +1967,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
2306
1967
  ...output,
2307
1968
  body: await parseBody(output.body, context),
2308
1969
  };
2309
- let response;
2310
1970
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2311
1971
  switch (errorCode) {
2312
1972
  case "InternalServerException":
@@ -2320,33 +1980,29 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
2320
1980
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2321
1981
  default:
2322
1982
  const parsedBody = parsedOutput.body;
2323
- const $metadata = deserializeMetadata(output);
2324
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2325
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
2326
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2327
- $fault: "client",
2328
- $metadata,
1983
+ (0, smithy_client_1.throwDefaultError)({
1984
+ output,
1985
+ parsedBody,
1986
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
1987
+ errorCode,
2329
1988
  });
2330
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2331
1989
  }
2332
1990
  };
2333
1991
  const deserializeAws_restJson1UpdateConnectivityInfoCommand = async (output, context) => {
2334
1992
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2335
1993
  return deserializeAws_restJson1UpdateConnectivityInfoCommandError(output, context);
2336
1994
  }
2337
- const contents = {
1995
+ const contents = map({
2338
1996
  $metadata: deserializeMetadata(output),
2339
- message: undefined,
2340
- version: undefined,
2341
- };
1997
+ });
2342
1998
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2343
- if (data.Message !== undefined && data.Message !== null) {
1999
+ if (data.Message != null) {
2344
2000
  contents.message = (0, smithy_client_1.expectString)(data.Message);
2345
2001
  }
2346
- if (data.Version !== undefined && data.Version !== null) {
2002
+ if (data.Version != null) {
2347
2003
  contents.version = (0, smithy_client_1.expectString)(data.Version);
2348
2004
  }
2349
- return Promise.resolve(contents);
2005
+ return contents;
2350
2006
  };
2351
2007
  exports.deserializeAws_restJson1UpdateConnectivityInfoCommand = deserializeAws_restJson1UpdateConnectivityInfoCommand;
2352
2008
  const deserializeAws_restJson1UpdateConnectivityInfoCommandError = async (output, context) => {
@@ -2354,7 +2010,6 @@ const deserializeAws_restJson1UpdateConnectivityInfoCommandError = async (output
2354
2010
  ...output,
2355
2011
  body: await parseBody(output.body, context),
2356
2012
  };
2357
- let response;
2358
2013
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2359
2014
  switch (errorCode) {
2360
2015
  case "InternalServerException":
@@ -2365,20 +2020,19 @@ const deserializeAws_restJson1UpdateConnectivityInfoCommandError = async (output
2365
2020
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2366
2021
  default:
2367
2022
  const parsedBody = parsedOutput.body;
2368
- const $metadata = deserializeMetadata(output);
2369
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2370
- response = new GreengrassV2ServiceException_1.GreengrassV2ServiceException({
2371
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2372
- $fault: "client",
2373
- $metadata,
2023
+ (0, smithy_client_1.throwDefaultError)({
2024
+ output,
2025
+ parsedBody,
2026
+ exceptionCtor: GreengrassV2ServiceException_1.GreengrassV2ServiceException,
2027
+ errorCode,
2374
2028
  });
2375
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2376
2029
  }
2377
2030
  };
2031
+ const map = smithy_client_1.map;
2378
2032
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
2379
- const contents = {};
2033
+ const contents = map({});
2380
2034
  const data = parsedOutput.body;
2381
- if (data.message !== undefined && data.message !== null) {
2035
+ if (data.message != null) {
2382
2036
  contents.message = (0, smithy_client_1.expectString)(data.message);
2383
2037
  }
2384
2038
  const exception = new models_0_1.AccessDeniedException({
@@ -2388,15 +2042,15 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
2388
2042
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2389
2043
  };
2390
2044
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
2391
- const contents = {};
2045
+ const contents = map({});
2392
2046
  const data = parsedOutput.body;
2393
- if (data.message !== undefined && data.message !== null) {
2047
+ if (data.message != null) {
2394
2048
  contents.message = (0, smithy_client_1.expectString)(data.message);
2395
2049
  }
2396
- if (data.resourceId !== undefined && data.resourceId !== null) {
2050
+ if (data.resourceId != null) {
2397
2051
  contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
2398
2052
  }
2399
- if (data.resourceType !== undefined && data.resourceType !== null) {
2053
+ if (data.resourceType != null) {
2400
2054
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
2401
2055
  }
2402
2056
  const exception = new models_0_1.ConflictException({
@@ -2406,12 +2060,14 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
2406
2060
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2407
2061
  };
2408
2062
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
2409
- const contents = {};
2410
- if (parsedOutput.headers["retry-after"] !== undefined) {
2411
- contents.retryAfterSeconds = (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]);
2412
- }
2063
+ const contents = map({
2064
+ retryAfterSeconds: [
2065
+ () => void 0 !== parsedOutput.headers["retry-after"],
2066
+ () => (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]),
2067
+ ],
2068
+ });
2413
2069
  const data = parsedOutput.body;
2414
- if (data.message !== undefined && data.message !== null) {
2070
+ if (data.message != null) {
2415
2071
  contents.message = (0, smithy_client_1.expectString)(data.message);
2416
2072
  }
2417
2073
  const exception = new models_0_1.InternalServerException({
@@ -2421,9 +2077,9 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
2421
2077
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2422
2078
  };
2423
2079
  const deserializeAws_restJson1RequestAlreadyInProgressExceptionResponse = async (parsedOutput, context) => {
2424
- const contents = {};
2080
+ const contents = map({});
2425
2081
  const data = parsedOutput.body;
2426
- if (data.message !== undefined && data.message !== null) {
2082
+ if (data.message != null) {
2427
2083
  contents.message = (0, smithy_client_1.expectString)(data.message);
2428
2084
  }
2429
2085
  const exception = new models_0_1.RequestAlreadyInProgressException({
@@ -2433,15 +2089,15 @@ const deserializeAws_restJson1RequestAlreadyInProgressExceptionResponse = async
2433
2089
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2434
2090
  };
2435
2091
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
2436
- const contents = {};
2092
+ const contents = map({});
2437
2093
  const data = parsedOutput.body;
2438
- if (data.message !== undefined && data.message !== null) {
2094
+ if (data.message != null) {
2439
2095
  contents.message = (0, smithy_client_1.expectString)(data.message);
2440
2096
  }
2441
- if (data.resourceId !== undefined && data.resourceId !== null) {
2097
+ if (data.resourceId != null) {
2442
2098
  contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
2443
2099
  }
2444
- if (data.resourceType !== undefined && data.resourceType !== null) {
2100
+ if (data.resourceType != null) {
2445
2101
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
2446
2102
  }
2447
2103
  const exception = new models_0_1.ResourceNotFoundException({
@@ -2451,21 +2107,21 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
2451
2107
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2452
2108
  };
2453
2109
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
2454
- const contents = {};
2110
+ const contents = map({});
2455
2111
  const data = parsedOutput.body;
2456
- if (data.message !== undefined && data.message !== null) {
2112
+ if (data.message != null) {
2457
2113
  contents.message = (0, smithy_client_1.expectString)(data.message);
2458
2114
  }
2459
- if (data.quotaCode !== undefined && data.quotaCode !== null) {
2115
+ if (data.quotaCode != null) {
2460
2116
  contents.quotaCode = (0, smithy_client_1.expectString)(data.quotaCode);
2461
2117
  }
2462
- if (data.resourceId !== undefined && data.resourceId !== null) {
2118
+ if (data.resourceId != null) {
2463
2119
  contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
2464
2120
  }
2465
- if (data.resourceType !== undefined && data.resourceType !== null) {
2121
+ if (data.resourceType != null) {
2466
2122
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
2467
2123
  }
2468
- if (data.serviceCode !== undefined && data.serviceCode !== null) {
2124
+ if (data.serviceCode != null) {
2469
2125
  contents.serviceCode = (0, smithy_client_1.expectString)(data.serviceCode);
2470
2126
  }
2471
2127
  const exception = new models_0_1.ServiceQuotaExceededException({
@@ -2475,18 +2131,20 @@ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (par
2475
2131
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2476
2132
  };
2477
2133
  const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
2478
- const contents = {};
2479
- if (parsedOutput.headers["retry-after"] !== undefined) {
2480
- contents.retryAfterSeconds = (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]);
2481
- }
2134
+ const contents = map({
2135
+ retryAfterSeconds: [
2136
+ () => void 0 !== parsedOutput.headers["retry-after"],
2137
+ () => (0, smithy_client_1.strictParseInt32)(parsedOutput.headers["retry-after"]),
2138
+ ],
2139
+ });
2482
2140
  const data = parsedOutput.body;
2483
- if (data.message !== undefined && data.message !== null) {
2141
+ if (data.message != null) {
2484
2142
  contents.message = (0, smithy_client_1.expectString)(data.message);
2485
2143
  }
2486
- if (data.quotaCode !== undefined && data.quotaCode !== null) {
2144
+ if (data.quotaCode != null) {
2487
2145
  contents.quotaCode = (0, smithy_client_1.expectString)(data.quotaCode);
2488
2146
  }
2489
- if (data.serviceCode !== undefined && data.serviceCode !== null) {
2147
+ if (data.serviceCode != null) {
2490
2148
  contents.serviceCode = (0, smithy_client_1.expectString)(data.serviceCode);
2491
2149
  }
2492
2150
  const exception = new models_0_1.ThrottlingException({
@@ -2496,15 +2154,15 @@ const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput,
2496
2154
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2497
2155
  };
2498
2156
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
2499
- const contents = {};
2157
+ const contents = map({});
2500
2158
  const data = parsedOutput.body;
2501
- if (data.fields !== undefined && data.fields !== null) {
2159
+ if (data.fields != null) {
2502
2160
  contents.fields = deserializeAws_restJson1ValidationExceptionFieldList(data.fields, context);
2503
2161
  }
2504
- if (data.message !== undefined && data.message !== null) {
2162
+ if (data.message != null) {
2505
2163
  contents.message = (0, smithy_client_1.expectString)(data.message);
2506
2164
  }
2507
- if (data.reason !== undefined && data.reason !== null) {
2165
+ if (data.reason != null) {
2508
2166
  contents.reason = (0, smithy_client_1.expectString)(data.reason);
2509
2167
  }
2510
2168
  const exception = new models_0_1.ValidationException({
@@ -2522,9 +2180,6 @@ const serializeAws_restJson1AssociateClientDeviceWithCoreDeviceEntryList = (inpu
2522
2180
  return input
2523
2181
  .filter((e) => e != null)
2524
2182
  .map((entry) => {
2525
- if (entry === null) {
2526
- return null;
2527
- }
2528
2183
  return serializeAws_restJson1AssociateClientDeviceWithCoreDeviceEntry(entry, context);
2529
2184
  });
2530
2185
  };
@@ -2541,9 +2196,6 @@ const serializeAws_restJson1ComponentCandidateList = (input, context) => {
2541
2196
  return input
2542
2197
  .filter((e) => e != null)
2543
2198
  .map((entry) => {
2544
- if (entry === null) {
2545
- return null;
2546
- }
2547
2199
  return serializeAws_restJson1ComponentCandidate(entry, context);
2548
2200
  });
2549
2201
  };
@@ -2551,9 +2203,6 @@ const serializeAws_restJson1ComponentConfigurationPathList = (input, context) =>
2551
2203
  return input
2552
2204
  .filter((e) => e != null)
2553
2205
  .map((entry) => {
2554
- if (entry === null) {
2555
- return null;
2556
- }
2557
2206
  return entry;
2558
2207
  });
2559
2208
  };
@@ -2612,9 +2261,6 @@ const serializeAws_restJson1ComponentPlatformList = (input, context) => {
2612
2261
  return input
2613
2262
  .filter((e) => e != null)
2614
2263
  .map((entry) => {
2615
- if (entry === null) {
2616
- return null;
2617
- }
2618
2264
  return serializeAws_restJson1ComponentPlatform(entry, context);
2619
2265
  });
2620
2266
  };
@@ -2650,9 +2296,6 @@ const serializeAws_restJson1connectivityInfoList = (input, context) => {
2650
2296
  return input
2651
2297
  .filter((e) => e != null)
2652
2298
  .map((entry) => {
2653
- if (entry === null) {
2654
- return null;
2655
- }
2656
2299
  return serializeAws_restJson1ConnectivityInfo(entry, context);
2657
2300
  });
2658
2301
  };
@@ -2700,9 +2343,6 @@ const serializeAws_restJson1DisassociateClientDeviceFromCoreDeviceEntryList = (i
2700
2343
  return input
2701
2344
  .filter((e) => e != null)
2702
2345
  .map((entry) => {
2703
- if (entry === null) {
2704
- return null;
2705
- }
2706
2346
  return serializeAws_restJson1DisassociateClientDeviceFromCoreDeviceEntry(entry, context);
2707
2347
  });
2708
2348
  };
@@ -2725,9 +2365,6 @@ const serializeAws_restJson1IoTJobAbortCriteriaList = (input, context) => {
2725
2365
  return input
2726
2366
  .filter((e) => e != null)
2727
2367
  .map((entry) => {
2728
- if (entry === null) {
2729
- return null;
2730
- }
2731
2368
  return serializeAws_restJson1IoTJobAbortCriteria(entry, context);
2732
2369
  });
2733
2370
  };
@@ -2771,9 +2408,6 @@ const serializeAws_restJson1LambdaDeviceList = (input, context) => {
2771
2408
  return input
2772
2409
  .filter((e) => e != null)
2773
2410
  .map((entry) => {
2774
- if (entry === null) {
2775
- return null;
2776
- }
2777
2411
  return serializeAws_restJson1LambdaDeviceMount(entry, context);
2778
2412
  });
2779
2413
  };
@@ -2805,9 +2439,6 @@ const serializeAws_restJson1LambdaEventSourceList = (input, context) => {
2805
2439
  return input
2806
2440
  .filter((e) => e != null)
2807
2441
  .map((entry) => {
2808
- if (entry === null) {
2809
- return null;
2810
- }
2811
2442
  return serializeAws_restJson1LambdaEventSource(entry, context);
2812
2443
  });
2813
2444
  };
@@ -2815,9 +2446,6 @@ const serializeAws_restJson1LambdaExecArgsList = (input, context) => {
2815
2446
  return input
2816
2447
  .filter((e) => e != null)
2817
2448
  .map((entry) => {
2818
- if (entry === null) {
2819
- return null;
2820
- }
2821
2449
  return entry;
2822
2450
  });
2823
2451
  };
@@ -2870,9 +2498,6 @@ const serializeAws_restJson1LambdaVolumeList = (input, context) => {
2870
2498
  return input
2871
2499
  .filter((e) => e != null)
2872
2500
  .map((entry) => {
2873
- if (entry === null) {
2874
- return null;
2875
- }
2876
2501
  return serializeAws_restJson1LambdaVolumeMount(entry, context);
2877
2502
  });
2878
2503
  };