@aws-sdk/client-mwaa 3.141.0 → 3.150.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,16 +9,7 @@ const serializeAws_restJson1CreateCliTokenCommand = async (input, context) => {
9
9
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
10
10
  const headers = {};
11
11
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/clitoken/{Name}";
12
- if (input.Name !== undefined) {
13
- const labelValue = input.Name;
14
- if (labelValue.length <= 0) {
15
- throw new Error("Empty value provided for input HTTP label: Name.");
16
- }
17
- resolvedPath = resolvedPath.replace("{Name}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
18
- }
19
- else {
20
- throw new Error("No value provided for input HTTP label: Name.");
21
- }
12
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Name", () => input.Name, "{Name}", false);
22
13
  let body;
23
14
  let { hostname: resolvedHostname } = await context.endpoint();
24
15
  if (context.disableHostPrefix !== true) {
@@ -44,16 +35,7 @@ const serializeAws_restJson1CreateEnvironmentCommand = async (input, context) =>
44
35
  "content-type": "application/json",
45
36
  };
46
37
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/environments/{Name}";
47
- if (input.Name !== undefined) {
48
- const labelValue = input.Name;
49
- if (labelValue.length <= 0) {
50
- throw new Error("Empty value provided for input HTTP label: Name.");
51
- }
52
- resolvedPath = resolvedPath.replace("{Name}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
53
- }
54
- else {
55
- throw new Error("No value provided for input HTTP label: Name.");
56
- }
38
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Name", () => input.Name, "{Name}", false);
57
39
  let body;
58
40
  body = JSON.stringify({
59
41
  ...(input.AirflowConfigurationOptions != null && {
@@ -108,16 +90,7 @@ const serializeAws_restJson1CreateWebLoginTokenCommand = async (input, context)
108
90
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
109
91
  const headers = {};
110
92
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/webtoken/{Name}";
111
- if (input.Name !== undefined) {
112
- const labelValue = input.Name;
113
- if (labelValue.length <= 0) {
114
- throw new Error("Empty value provided for input HTTP label: Name.");
115
- }
116
- resolvedPath = resolvedPath.replace("{Name}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
117
- }
118
- else {
119
- throw new Error("No value provided for input HTTP label: Name.");
120
- }
93
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Name", () => input.Name, "{Name}", false);
121
94
  let body;
122
95
  let { hostname: resolvedHostname } = await context.endpoint();
123
96
  if (context.disableHostPrefix !== true) {
@@ -141,16 +114,7 @@ const serializeAws_restJson1DeleteEnvironmentCommand = async (input, context) =>
141
114
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
142
115
  const headers = {};
143
116
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/environments/{Name}";
144
- if (input.Name !== undefined) {
145
- const labelValue = input.Name;
146
- if (labelValue.length <= 0) {
147
- throw new Error("Empty value provided for input HTTP label: Name.");
148
- }
149
- resolvedPath = resolvedPath.replace("{Name}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
150
- }
151
- else {
152
- throw new Error("No value provided for input HTTP label: Name.");
153
- }
117
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Name", () => input.Name, "{Name}", false);
154
118
  let body;
155
119
  let { hostname: resolvedHostname } = await context.endpoint();
156
120
  if (context.disableHostPrefix !== true) {
@@ -174,16 +138,7 @@ const serializeAws_restJson1GetEnvironmentCommand = async (input, context) => {
174
138
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
175
139
  const headers = {};
176
140
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/environments/{Name}";
177
- if (input.Name !== undefined) {
178
- const labelValue = input.Name;
179
- if (labelValue.length <= 0) {
180
- throw new Error("Empty value provided for input HTTP label: Name.");
181
- }
182
- resolvedPath = resolvedPath.replace("{Name}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
183
- }
184
- else {
185
- throw new Error("No value provided for input HTTP label: Name.");
186
- }
141
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Name", () => input.Name, "{Name}", false);
187
142
  let body;
188
143
  let { hostname: resolvedHostname } = await context.endpoint();
189
144
  if (context.disableHostPrefix !== true) {
@@ -207,10 +162,10 @@ const serializeAws_restJson1ListEnvironmentsCommand = async (input, context) =>
207
162
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
208
163
  const headers = {};
209
164
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/environments";
210
- const query = {
211
- ...(input.NextToken !== undefined && { NextToken: input.NextToken }),
212
- ...(input.MaxResults !== undefined && { MaxResults: input.MaxResults.toString() }),
213
- };
165
+ const query = map({
166
+ NextToken: [, input.NextToken],
167
+ MaxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
168
+ });
214
169
  let body;
215
170
  let { hostname: resolvedHostname } = await context.endpoint();
216
171
  if (context.disableHostPrefix !== true) {
@@ -235,16 +190,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
235
190
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
236
191
  const headers = {};
237
192
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
238
- if (input.ResourceArn !== undefined) {
239
- const labelValue = input.ResourceArn;
240
- if (labelValue.length <= 0) {
241
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
242
- }
243
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
244
- }
245
- else {
246
- throw new Error("No value provided for input HTTP label: ResourceArn.");
247
- }
193
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
248
194
  let body;
249
195
  let { hostname: resolvedHostname } = await context.endpoint();
250
196
  if (context.disableHostPrefix !== true) {
@@ -270,16 +216,7 @@ const serializeAws_restJson1PublishMetricsCommand = async (input, context) => {
270
216
  "content-type": "application/json",
271
217
  };
272
218
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/metrics/environments/{EnvironmentName}";
273
- if (input.EnvironmentName !== undefined) {
274
- const labelValue = input.EnvironmentName;
275
- if (labelValue.length <= 0) {
276
- throw new Error("Empty value provided for input HTTP label: EnvironmentName.");
277
- }
278
- resolvedPath = resolvedPath.replace("{EnvironmentName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
279
- }
280
- else {
281
- throw new Error("No value provided for input HTTP label: EnvironmentName.");
282
- }
219
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "EnvironmentName", () => input.EnvironmentName, "{EnvironmentName}", false);
283
220
  let body;
284
221
  body = JSON.stringify({
285
222
  ...(input.MetricData != null && { MetricData: serializeAws_restJson1MetricData(input.MetricData, context) }),
@@ -308,16 +245,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
308
245
  "content-type": "application/json",
309
246
  };
310
247
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
311
- if (input.ResourceArn !== undefined) {
312
- const labelValue = input.ResourceArn;
313
- if (labelValue.length <= 0) {
314
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
315
- }
316
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
317
- }
318
- else {
319
- throw new Error("No value provided for input HTTP label: ResourceArn.");
320
- }
248
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
321
249
  let body;
322
250
  body = JSON.stringify({
323
251
  ...(input.Tags != null && { Tags: serializeAws_restJson1TagMap(input.Tags, context) }),
@@ -344,19 +272,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
344
272
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
345
273
  const headers = {};
346
274
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
347
- if (input.ResourceArn !== undefined) {
348
- const labelValue = input.ResourceArn;
349
- if (labelValue.length <= 0) {
350
- throw new Error("Empty value provided for input HTTP label: ResourceArn.");
351
- }
352
- resolvedPath = resolvedPath.replace("{ResourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
353
- }
354
- else {
355
- throw new Error("No value provided for input HTTP label: ResourceArn.");
356
- }
357
- const query = {
358
- ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }),
359
- };
275
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
276
+ const query = map({
277
+ tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys || []).map((_entry) => _entry)],
278
+ });
360
279
  let body;
361
280
  let { hostname: resolvedHostname } = await context.endpoint();
362
281
  if (context.disableHostPrefix !== true) {
@@ -383,16 +302,7 @@ const serializeAws_restJson1UpdateEnvironmentCommand = async (input, context) =>
383
302
  "content-type": "application/json",
384
303
  };
385
304
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/environments/{Name}";
386
- if (input.Name !== undefined) {
387
- const labelValue = input.Name;
388
- if (labelValue.length <= 0) {
389
- throw new Error("Empty value provided for input HTTP label: Name.");
390
- }
391
- resolvedPath = resolvedPath.replace("{Name}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
392
- }
393
- else {
394
- throw new Error("No value provided for input HTTP label: Name.");
395
- }
305
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "Name", () => input.Name, "{Name}", false);
396
306
  let body;
397
307
  body = JSON.stringify({
398
308
  ...(input.AirflowConfigurationOptions != null && {
@@ -445,19 +355,17 @@ const deserializeAws_restJson1CreateCliTokenCommand = async (output, context) =>
445
355
  if (output.statusCode !== 200 && output.statusCode >= 300) {
446
356
  return deserializeAws_restJson1CreateCliTokenCommandError(output, context);
447
357
  }
448
- const contents = {
358
+ const contents = map({
449
359
  $metadata: deserializeMetadata(output),
450
- CliToken: undefined,
451
- WebServerHostname: undefined,
452
- };
360
+ });
453
361
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
454
- if (data.CliToken !== undefined && data.CliToken !== null) {
362
+ if (data.CliToken != null) {
455
363
  contents.CliToken = (0, smithy_client_1.expectString)(data.CliToken);
456
364
  }
457
- if (data.WebServerHostname !== undefined && data.WebServerHostname !== null) {
365
+ if (data.WebServerHostname != null) {
458
366
  contents.WebServerHostname = (0, smithy_client_1.expectString)(data.WebServerHostname);
459
367
  }
460
- return Promise.resolve(contents);
368
+ return contents;
461
369
  };
462
370
  exports.deserializeAws_restJson1CreateCliTokenCommand = deserializeAws_restJson1CreateCliTokenCommand;
463
371
  const deserializeAws_restJson1CreateCliTokenCommandError = async (output, context) => {
@@ -465,7 +373,6 @@ const deserializeAws_restJson1CreateCliTokenCommandError = async (output, contex
465
373
  ...output,
466
374
  body: await parseBody(output.body, context),
467
375
  };
468
- let response;
469
376
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
470
377
  switch (errorCode) {
471
378
  case "ResourceNotFoundException":
@@ -473,29 +380,26 @@ const deserializeAws_restJson1CreateCliTokenCommandError = async (output, contex
473
380
  throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
474
381
  default:
475
382
  const parsedBody = parsedOutput.body;
476
- const $metadata = deserializeMetadata(output);
477
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
478
- response = new MWAAServiceException_1.MWAAServiceException({
479
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
480
- $fault: "client",
481
- $metadata,
383
+ (0, smithy_client_1.throwDefaultError)({
384
+ output,
385
+ parsedBody,
386
+ exceptionCtor: MWAAServiceException_1.MWAAServiceException,
387
+ errorCode,
482
388
  });
483
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
484
389
  }
485
390
  };
486
391
  const deserializeAws_restJson1CreateEnvironmentCommand = async (output, context) => {
487
392
  if (output.statusCode !== 200 && output.statusCode >= 300) {
488
393
  return deserializeAws_restJson1CreateEnvironmentCommandError(output, context);
489
394
  }
490
- const contents = {
395
+ const contents = map({
491
396
  $metadata: deserializeMetadata(output),
492
- Arn: undefined,
493
- };
397
+ });
494
398
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
495
- if (data.Arn !== undefined && data.Arn !== null) {
399
+ if (data.Arn != null) {
496
400
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
497
401
  }
498
- return Promise.resolve(contents);
402
+ return contents;
499
403
  };
500
404
  exports.deserializeAws_restJson1CreateEnvironmentCommand = deserializeAws_restJson1CreateEnvironmentCommand;
501
405
  const deserializeAws_restJson1CreateEnvironmentCommandError = async (output, context) => {
@@ -503,7 +407,6 @@ const deserializeAws_restJson1CreateEnvironmentCommandError = async (output, con
503
407
  ...output,
504
408
  body: await parseBody(output.body, context),
505
409
  };
506
- let response;
507
410
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
508
411
  switch (errorCode) {
509
412
  case "InternalServerException":
@@ -514,33 +417,29 @@ const deserializeAws_restJson1CreateEnvironmentCommandError = async (output, con
514
417
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
515
418
  default:
516
419
  const parsedBody = parsedOutput.body;
517
- const $metadata = deserializeMetadata(output);
518
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
519
- response = new MWAAServiceException_1.MWAAServiceException({
520
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
521
- $fault: "client",
522
- $metadata,
420
+ (0, smithy_client_1.throwDefaultError)({
421
+ output,
422
+ parsedBody,
423
+ exceptionCtor: MWAAServiceException_1.MWAAServiceException,
424
+ errorCode,
523
425
  });
524
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
525
426
  }
526
427
  };
527
428
  const deserializeAws_restJson1CreateWebLoginTokenCommand = async (output, context) => {
528
429
  if (output.statusCode !== 200 && output.statusCode >= 300) {
529
430
  return deserializeAws_restJson1CreateWebLoginTokenCommandError(output, context);
530
431
  }
531
- const contents = {
432
+ const contents = map({
532
433
  $metadata: deserializeMetadata(output),
533
- WebServerHostname: undefined,
534
- WebToken: undefined,
535
- };
434
+ });
536
435
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
537
- if (data.WebServerHostname !== undefined && data.WebServerHostname !== null) {
436
+ if (data.WebServerHostname != null) {
538
437
  contents.WebServerHostname = (0, smithy_client_1.expectString)(data.WebServerHostname);
539
438
  }
540
- if (data.WebToken !== undefined && data.WebToken !== null) {
439
+ if (data.WebToken != null) {
541
440
  contents.WebToken = (0, smithy_client_1.expectString)(data.WebToken);
542
441
  }
543
- return Promise.resolve(contents);
442
+ return contents;
544
443
  };
545
444
  exports.deserializeAws_restJson1CreateWebLoginTokenCommand = deserializeAws_restJson1CreateWebLoginTokenCommand;
546
445
  const deserializeAws_restJson1CreateWebLoginTokenCommandError = async (output, context) => {
@@ -548,7 +447,6 @@ const deserializeAws_restJson1CreateWebLoginTokenCommandError = async (output, c
548
447
  ...output,
549
448
  body: await parseBody(output.body, context),
550
449
  };
551
- let response;
552
450
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
553
451
  switch (errorCode) {
554
452
  case "AccessDeniedException":
@@ -565,25 +463,23 @@ const deserializeAws_restJson1CreateWebLoginTokenCommandError = async (output, c
565
463
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
566
464
  default:
567
465
  const parsedBody = parsedOutput.body;
568
- const $metadata = deserializeMetadata(output);
569
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
570
- response = new MWAAServiceException_1.MWAAServiceException({
571
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
572
- $fault: "client",
573
- $metadata,
466
+ (0, smithy_client_1.throwDefaultError)({
467
+ output,
468
+ parsedBody,
469
+ exceptionCtor: MWAAServiceException_1.MWAAServiceException,
470
+ errorCode,
574
471
  });
575
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
576
472
  }
577
473
  };
578
474
  const deserializeAws_restJson1DeleteEnvironmentCommand = async (output, context) => {
579
475
  if (output.statusCode !== 200 && output.statusCode >= 300) {
580
476
  return deserializeAws_restJson1DeleteEnvironmentCommandError(output, context);
581
477
  }
582
- const contents = {
478
+ const contents = map({
583
479
  $metadata: deserializeMetadata(output),
584
- };
480
+ });
585
481
  await collectBody(output.body, context);
586
- return Promise.resolve(contents);
482
+ return contents;
587
483
  };
588
484
  exports.deserializeAws_restJson1DeleteEnvironmentCommand = deserializeAws_restJson1DeleteEnvironmentCommand;
589
485
  const deserializeAws_restJson1DeleteEnvironmentCommandError = async (output, context) => {
@@ -591,7 +487,6 @@ const deserializeAws_restJson1DeleteEnvironmentCommandError = async (output, con
591
487
  ...output,
592
488
  body: await parseBody(output.body, context),
593
489
  };
594
- let response;
595
490
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
596
491
  switch (errorCode) {
597
492
  case "InternalServerException":
@@ -605,29 +500,26 @@ const deserializeAws_restJson1DeleteEnvironmentCommandError = async (output, con
605
500
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
606
501
  default:
607
502
  const parsedBody = parsedOutput.body;
608
- const $metadata = deserializeMetadata(output);
609
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
610
- response = new MWAAServiceException_1.MWAAServiceException({
611
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
612
- $fault: "client",
613
- $metadata,
503
+ (0, smithy_client_1.throwDefaultError)({
504
+ output,
505
+ parsedBody,
506
+ exceptionCtor: MWAAServiceException_1.MWAAServiceException,
507
+ errorCode,
614
508
  });
615
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
616
509
  }
617
510
  };
618
511
  const deserializeAws_restJson1GetEnvironmentCommand = async (output, context) => {
619
512
  if (output.statusCode !== 200 && output.statusCode >= 300) {
620
513
  return deserializeAws_restJson1GetEnvironmentCommandError(output, context);
621
514
  }
622
- const contents = {
515
+ const contents = map({
623
516
  $metadata: deserializeMetadata(output),
624
- Environment: undefined,
625
- };
517
+ });
626
518
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
627
- if (data.Environment !== undefined && data.Environment !== null) {
519
+ if (data.Environment != null) {
628
520
  contents.Environment = deserializeAws_restJson1Environment(data.Environment, context);
629
521
  }
630
- return Promise.resolve(contents);
522
+ return contents;
631
523
  };
632
524
  exports.deserializeAws_restJson1GetEnvironmentCommand = deserializeAws_restJson1GetEnvironmentCommand;
633
525
  const deserializeAws_restJson1GetEnvironmentCommandError = async (output, context) => {
@@ -635,7 +527,6 @@ const deserializeAws_restJson1GetEnvironmentCommandError = async (output, contex
635
527
  ...output,
636
528
  body: await parseBody(output.body, context),
637
529
  };
638
- let response;
639
530
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
640
531
  switch (errorCode) {
641
532
  case "InternalServerException":
@@ -649,33 +540,29 @@ const deserializeAws_restJson1GetEnvironmentCommandError = async (output, contex
649
540
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
650
541
  default:
651
542
  const parsedBody = parsedOutput.body;
652
- const $metadata = deserializeMetadata(output);
653
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
654
- response = new MWAAServiceException_1.MWAAServiceException({
655
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
656
- $fault: "client",
657
- $metadata,
543
+ (0, smithy_client_1.throwDefaultError)({
544
+ output,
545
+ parsedBody,
546
+ exceptionCtor: MWAAServiceException_1.MWAAServiceException,
547
+ errorCode,
658
548
  });
659
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
660
549
  }
661
550
  };
662
551
  const deserializeAws_restJson1ListEnvironmentsCommand = async (output, context) => {
663
552
  if (output.statusCode !== 200 && output.statusCode >= 300) {
664
553
  return deserializeAws_restJson1ListEnvironmentsCommandError(output, context);
665
554
  }
666
- const contents = {
555
+ const contents = map({
667
556
  $metadata: deserializeMetadata(output),
668
- Environments: undefined,
669
- NextToken: undefined,
670
- };
557
+ });
671
558
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
672
- if (data.Environments !== undefined && data.Environments !== null) {
559
+ if (data.Environments != null) {
673
560
  contents.Environments = deserializeAws_restJson1EnvironmentList(data.Environments, context);
674
561
  }
675
- if (data.NextToken !== undefined && data.NextToken !== null) {
562
+ if (data.NextToken != null) {
676
563
  contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
677
564
  }
678
- return Promise.resolve(contents);
565
+ return contents;
679
566
  };
680
567
  exports.deserializeAws_restJson1ListEnvironmentsCommand = deserializeAws_restJson1ListEnvironmentsCommand;
681
568
  const deserializeAws_restJson1ListEnvironmentsCommandError = async (output, context) => {
@@ -683,7 +570,6 @@ const deserializeAws_restJson1ListEnvironmentsCommandError = async (output, cont
683
570
  ...output,
684
571
  body: await parseBody(output.body, context),
685
572
  };
686
- let response;
687
573
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
688
574
  switch (errorCode) {
689
575
  case "InternalServerException":
@@ -694,29 +580,26 @@ const deserializeAws_restJson1ListEnvironmentsCommandError = async (output, cont
694
580
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
695
581
  default:
696
582
  const parsedBody = parsedOutput.body;
697
- const $metadata = deserializeMetadata(output);
698
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
699
- response = new MWAAServiceException_1.MWAAServiceException({
700
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
701
- $fault: "client",
702
- $metadata,
583
+ (0, smithy_client_1.throwDefaultError)({
584
+ output,
585
+ parsedBody,
586
+ exceptionCtor: MWAAServiceException_1.MWAAServiceException,
587
+ errorCode,
703
588
  });
704
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
705
589
  }
706
590
  };
707
591
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
708
592
  if (output.statusCode !== 200 && output.statusCode >= 300) {
709
593
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
710
594
  }
711
- const contents = {
595
+ const contents = map({
712
596
  $metadata: deserializeMetadata(output),
713
- Tags: undefined,
714
- };
597
+ });
715
598
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
716
- if (data.Tags !== undefined && data.Tags !== null) {
599
+ if (data.Tags != null) {
717
600
  contents.Tags = deserializeAws_restJson1TagMap(data.Tags, context);
718
601
  }
719
- return Promise.resolve(contents);
602
+ return contents;
720
603
  };
721
604
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
722
605
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -724,7 +607,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
724
607
  ...output,
725
608
  body: await parseBody(output.body, context),
726
609
  };
727
- let response;
728
610
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
729
611
  switch (errorCode) {
730
612
  case "InternalServerException":
@@ -738,25 +620,23 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
738
620
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
739
621
  default:
740
622
  const parsedBody = parsedOutput.body;
741
- const $metadata = deserializeMetadata(output);
742
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
743
- response = new MWAAServiceException_1.MWAAServiceException({
744
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
745
- $fault: "client",
746
- $metadata,
623
+ (0, smithy_client_1.throwDefaultError)({
624
+ output,
625
+ parsedBody,
626
+ exceptionCtor: MWAAServiceException_1.MWAAServiceException,
627
+ errorCode,
747
628
  });
748
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
749
629
  }
750
630
  };
751
631
  const deserializeAws_restJson1PublishMetricsCommand = async (output, context) => {
752
632
  if (output.statusCode !== 200 && output.statusCode >= 300) {
753
633
  return deserializeAws_restJson1PublishMetricsCommandError(output, context);
754
634
  }
755
- const contents = {
635
+ const contents = map({
756
636
  $metadata: deserializeMetadata(output),
757
- };
637
+ });
758
638
  await collectBody(output.body, context);
759
- return Promise.resolve(contents);
639
+ return contents;
760
640
  };
761
641
  exports.deserializeAws_restJson1PublishMetricsCommand = deserializeAws_restJson1PublishMetricsCommand;
762
642
  const deserializeAws_restJson1PublishMetricsCommandError = async (output, context) => {
@@ -764,7 +644,6 @@ const deserializeAws_restJson1PublishMetricsCommandError = async (output, contex
764
644
  ...output,
765
645
  body: await parseBody(output.body, context),
766
646
  };
767
- let response;
768
647
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
769
648
  switch (errorCode) {
770
649
  case "InternalServerException":
@@ -775,25 +654,23 @@ const deserializeAws_restJson1PublishMetricsCommandError = async (output, contex
775
654
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
776
655
  default:
777
656
  const parsedBody = parsedOutput.body;
778
- const $metadata = deserializeMetadata(output);
779
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
780
- response = new MWAAServiceException_1.MWAAServiceException({
781
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
782
- $fault: "client",
783
- $metadata,
657
+ (0, smithy_client_1.throwDefaultError)({
658
+ output,
659
+ parsedBody,
660
+ exceptionCtor: MWAAServiceException_1.MWAAServiceException,
661
+ errorCode,
784
662
  });
785
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
786
663
  }
787
664
  };
788
665
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
789
666
  if (output.statusCode !== 200 && output.statusCode >= 300) {
790
667
  return deserializeAws_restJson1TagResourceCommandError(output, context);
791
668
  }
792
- const contents = {
669
+ const contents = map({
793
670
  $metadata: deserializeMetadata(output),
794
- };
671
+ });
795
672
  await collectBody(output.body, context);
796
- return Promise.resolve(contents);
673
+ return contents;
797
674
  };
798
675
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
799
676
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -801,7 +678,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
801
678
  ...output,
802
679
  body: await parseBody(output.body, context),
803
680
  };
804
- let response;
805
681
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
806
682
  switch (errorCode) {
807
683
  case "InternalServerException":
@@ -815,25 +691,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
815
691
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
816
692
  default:
817
693
  const parsedBody = parsedOutput.body;
818
- const $metadata = deserializeMetadata(output);
819
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
820
- response = new MWAAServiceException_1.MWAAServiceException({
821
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
822
- $fault: "client",
823
- $metadata,
694
+ (0, smithy_client_1.throwDefaultError)({
695
+ output,
696
+ parsedBody,
697
+ exceptionCtor: MWAAServiceException_1.MWAAServiceException,
698
+ errorCode,
824
699
  });
825
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
826
700
  }
827
701
  };
828
702
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
829
703
  if (output.statusCode !== 200 && output.statusCode >= 300) {
830
704
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
831
705
  }
832
- const contents = {
706
+ const contents = map({
833
707
  $metadata: deserializeMetadata(output),
834
- };
708
+ });
835
709
  await collectBody(output.body, context);
836
- return Promise.resolve(contents);
710
+ return contents;
837
711
  };
838
712
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
839
713
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -841,7 +715,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
841
715
  ...output,
842
716
  body: await parseBody(output.body, context),
843
717
  };
844
- let response;
845
718
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
846
719
  switch (errorCode) {
847
720
  case "InternalServerException":
@@ -855,29 +728,26 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
855
728
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
856
729
  default:
857
730
  const parsedBody = parsedOutput.body;
858
- const $metadata = deserializeMetadata(output);
859
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
860
- response = new MWAAServiceException_1.MWAAServiceException({
861
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
862
- $fault: "client",
863
- $metadata,
731
+ (0, smithy_client_1.throwDefaultError)({
732
+ output,
733
+ parsedBody,
734
+ exceptionCtor: MWAAServiceException_1.MWAAServiceException,
735
+ errorCode,
864
736
  });
865
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
866
737
  }
867
738
  };
868
739
  const deserializeAws_restJson1UpdateEnvironmentCommand = async (output, context) => {
869
740
  if (output.statusCode !== 200 && output.statusCode >= 300) {
870
741
  return deserializeAws_restJson1UpdateEnvironmentCommandError(output, context);
871
742
  }
872
- const contents = {
743
+ const contents = map({
873
744
  $metadata: deserializeMetadata(output),
874
- Arn: undefined,
875
- };
745
+ });
876
746
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
877
- if (data.Arn !== undefined && data.Arn !== null) {
747
+ if (data.Arn != null) {
878
748
  contents.Arn = (0, smithy_client_1.expectString)(data.Arn);
879
749
  }
880
- return Promise.resolve(contents);
750
+ return contents;
881
751
  };
882
752
  exports.deserializeAws_restJson1UpdateEnvironmentCommand = deserializeAws_restJson1UpdateEnvironmentCommand;
883
753
  const deserializeAws_restJson1UpdateEnvironmentCommandError = async (output, context) => {
@@ -885,7 +755,6 @@ const deserializeAws_restJson1UpdateEnvironmentCommandError = async (output, con
885
755
  ...output,
886
756
  body: await parseBody(output.body, context),
887
757
  };
888
- let response;
889
758
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
890
759
  switch (errorCode) {
891
760
  case "InternalServerException":
@@ -899,20 +768,19 @@ const deserializeAws_restJson1UpdateEnvironmentCommandError = async (output, con
899
768
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
900
769
  default:
901
770
  const parsedBody = parsedOutput.body;
902
- const $metadata = deserializeMetadata(output);
903
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
904
- response = new MWAAServiceException_1.MWAAServiceException({
905
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
906
- $fault: "client",
907
- $metadata,
771
+ (0, smithy_client_1.throwDefaultError)({
772
+ output,
773
+ parsedBody,
774
+ exceptionCtor: MWAAServiceException_1.MWAAServiceException,
775
+ errorCode,
908
776
  });
909
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
910
777
  }
911
778
  };
779
+ const map = smithy_client_1.map;
912
780
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
913
- const contents = {};
781
+ const contents = map({});
914
782
  const data = parsedOutput.body;
915
- if (data.Message !== undefined && data.Message !== null) {
783
+ if (data.Message != null) {
916
784
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
917
785
  }
918
786
  const exception = new models_0_1.AccessDeniedException({
@@ -922,9 +790,9 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
922
790
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
923
791
  };
924
792
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
925
- const contents = {};
793
+ const contents = map({});
926
794
  const data = parsedOutput.body;
927
- if (data.message !== undefined && data.message !== null) {
795
+ if (data.message != null) {
928
796
  contents.message = (0, smithy_client_1.expectString)(data.message);
929
797
  }
930
798
  const exception = new models_0_1.InternalServerException({
@@ -934,9 +802,9 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
934
802
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
935
803
  };
936
804
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
937
- const contents = {};
805
+ const contents = map({});
938
806
  const data = parsedOutput.body;
939
- if (data.message !== undefined && data.message !== null) {
807
+ if (data.message != null) {
940
808
  contents.message = (0, smithy_client_1.expectString)(data.message);
941
809
  }
942
810
  const exception = new models_0_1.ResourceNotFoundException({
@@ -946,9 +814,9 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
946
814
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
947
815
  };
948
816
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
949
- const contents = {};
817
+ const contents = map({});
950
818
  const data = parsedOutput.body;
951
- if (data.message !== undefined && data.message !== null) {
819
+ if (data.message != null) {
952
820
  contents.message = (0, smithy_client_1.expectString)(data.message);
953
821
  }
954
822
  const exception = new models_0_1.ValidationException({
@@ -978,9 +846,6 @@ const serializeAws_restJson1Dimensions = (input, context) => {
978
846
  return input
979
847
  .filter((e) => e != null)
980
848
  .map((entry) => {
981
- if (entry === null) {
982
- return null;
983
- }
984
849
  return serializeAws_restJson1Dimension(entry, context);
985
850
  });
986
851
  };
@@ -1007,9 +872,6 @@ const serializeAws_restJson1MetricData = (input, context) => {
1007
872
  return input
1008
873
  .filter((e) => e != null)
1009
874
  .map((entry) => {
1010
- if (entry === null) {
1011
- return null;
1012
- }
1013
875
  return serializeAws_restJson1MetricDatum(entry, context);
1014
876
  });
1015
877
  };
@@ -1043,9 +905,6 @@ const serializeAws_restJson1SecurityGroupList = (input, context) => {
1043
905
  return input
1044
906
  .filter((e) => e != null)
1045
907
  .map((entry) => {
1046
- if (entry === null) {
1047
- return null;
1048
- }
1049
908
  return entry;
1050
909
  });
1051
910
  };
@@ -1061,9 +920,6 @@ const serializeAws_restJson1SubnetList = (input, context) => {
1061
920
  return input
1062
921
  .filter((e) => e != null)
1063
922
  .map((entry) => {
1064
- if (entry === null) {
1065
- return null;
1066
- }
1067
923
  return entry;
1068
924
  });
1069
925
  };