@aws-sdk/client-amp 3.310.0 → 3.315.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
- import { decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, map as __map, parseEpochTimestamp as __parseEpochTimestamp, resolvedPath as __resolvedPath, strictParseInt32 as __strictParseInt32, throwDefaultError, } from "@aws-sdk/smithy-client";
2
+ import { _json, decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, map, parseEpochTimestamp as __parseEpochTimestamp, resolvedPath as __resolvedPath, strictParseInt32 as __strictParseInt32, take, withBaseException, } from "@aws-sdk/smithy-client";
3
3
  import { v4 as generateIdempotencyToken } from "uuid";
4
4
  import { AmpServiceException as __BaseException } from "../models/AmpServiceException";
5
5
  import { AccessDeniedException, ConflictException, InternalServerException, ResourceNotFoundException, ServiceQuotaExceededException, ThrottlingException, ValidationException, } from "../models/models_0";
@@ -12,10 +12,10 @@ export const se_CreateAlertManagerDefinitionCommand = async (input, context) =>
12
12
  "/workspaces/{workspaceId}/alertmanager/definition";
13
13
  resolvedPath = __resolvedPath(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
14
14
  let body;
15
- body = JSON.stringify({
16
- clientToken: input.clientToken ?? generateIdempotencyToken(),
17
- ...(input.data != null && { data: context.base64Encoder(input.data) }),
18
- });
15
+ body = JSON.stringify(take(input, {
16
+ clientToken: (_) => _ ?? generateIdempotencyToken(),
17
+ data: (_) => context.base64Encoder(_),
18
+ }));
19
19
  return new __HttpRequest({
20
20
  protocol,
21
21
  hostname,
@@ -34,10 +34,10 @@ export const se_CreateLoggingConfigurationCommand = async (input, context) => {
34
34
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces/{workspaceId}/logging";
35
35
  resolvedPath = __resolvedPath(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
36
36
  let body;
37
- body = JSON.stringify({
38
- clientToken: input.clientToken ?? generateIdempotencyToken(),
39
- ...(input.logGroupArn != null && { logGroupArn: input.logGroupArn }),
40
- });
37
+ body = JSON.stringify(take(input, {
38
+ clientToken: (_) => _ ?? generateIdempotencyToken(),
39
+ logGroupArn: [],
40
+ }));
41
41
  return new __HttpRequest({
42
42
  protocol,
43
43
  hostname,
@@ -57,12 +57,12 @@ export const se_CreateRuleGroupsNamespaceCommand = async (input, context) => {
57
57
  "/workspaces/{workspaceId}/rulegroupsnamespaces";
58
58
  resolvedPath = __resolvedPath(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
59
59
  let body;
60
- body = JSON.stringify({
61
- clientToken: input.clientToken ?? generateIdempotencyToken(),
62
- ...(input.data != null && { data: context.base64Encoder(input.data) }),
63
- ...(input.name != null && { name: input.name }),
64
- ...(input.tags != null && { tags: se_TagMap(input.tags, context) }),
65
- });
60
+ body = JSON.stringify(take(input, {
61
+ clientToken: (_) => _ ?? generateIdempotencyToken(),
62
+ data: (_) => context.base64Encoder(_),
63
+ name: [],
64
+ tags: (_) => _json(_),
65
+ }));
66
66
  return new __HttpRequest({
67
67
  protocol,
68
68
  hostname,
@@ -80,11 +80,11 @@ export const se_CreateWorkspaceCommand = async (input, context) => {
80
80
  };
81
81
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces";
82
82
  let body;
83
- body = JSON.stringify({
84
- ...(input.alias != null && { alias: input.alias }),
85
- clientToken: input.clientToken ?? generateIdempotencyToken(),
86
- ...(input.tags != null && { tags: se_TagMap(input.tags, context) }),
87
- });
83
+ body = JSON.stringify(take(input, {
84
+ alias: [],
85
+ clientToken: (_) => _ ?? generateIdempotencyToken(),
86
+ tags: (_) => _json(_),
87
+ }));
88
88
  return new __HttpRequest({
89
89
  protocol,
90
90
  hostname,
@@ -314,10 +314,10 @@ export const se_PutAlertManagerDefinitionCommand = async (input, context) => {
314
314
  "/workspaces/{workspaceId}/alertmanager/definition";
315
315
  resolvedPath = __resolvedPath(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
316
316
  let body;
317
- body = JSON.stringify({
318
- clientToken: input.clientToken ?? generateIdempotencyToken(),
319
- ...(input.data != null && { data: context.base64Encoder(input.data) }),
320
- });
317
+ body = JSON.stringify(take(input, {
318
+ clientToken: (_) => _ ?? generateIdempotencyToken(),
319
+ data: (_) => context.base64Encoder(_),
320
+ }));
321
321
  return new __HttpRequest({
322
322
  protocol,
323
323
  hostname,
@@ -338,10 +338,10 @@ export const se_PutRuleGroupsNamespaceCommand = async (input, context) => {
338
338
  resolvedPath = __resolvedPath(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
339
339
  resolvedPath = __resolvedPath(resolvedPath, input, "name", () => input.name, "{name}", false);
340
340
  let body;
341
- body = JSON.stringify({
342
- clientToken: input.clientToken ?? generateIdempotencyToken(),
343
- ...(input.data != null && { data: context.base64Encoder(input.data) }),
344
- });
341
+ body = JSON.stringify(take(input, {
342
+ clientToken: (_) => _ ?? generateIdempotencyToken(),
343
+ data: (_) => context.base64Encoder(_),
344
+ }));
345
345
  return new __HttpRequest({
346
346
  protocol,
347
347
  hostname,
@@ -360,9 +360,9 @@ export const se_TagResourceCommand = async (input, context) => {
360
360
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
361
361
  resolvedPath = __resolvedPath(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
362
362
  let body;
363
- body = JSON.stringify({
364
- ...(input.tags != null && { tags: se_TagMap(input.tags, context) }),
365
- });
363
+ body = JSON.stringify(take(input, {
364
+ tags: (_) => _json(_),
365
+ }));
366
366
  return new __HttpRequest({
367
367
  protocol,
368
368
  hostname,
@@ -404,10 +404,10 @@ export const se_UpdateLoggingConfigurationCommand = async (input, context) => {
404
404
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces/{workspaceId}/logging";
405
405
  resolvedPath = __resolvedPath(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
406
406
  let body;
407
- body = JSON.stringify({
408
- clientToken: input.clientToken ?? generateIdempotencyToken(),
409
- ...(input.logGroupArn != null && { logGroupArn: input.logGroupArn }),
410
- });
407
+ body = JSON.stringify(take(input, {
408
+ clientToken: (_) => _ ?? generateIdempotencyToken(),
409
+ logGroupArn: [],
410
+ }));
411
411
  return new __HttpRequest({
412
412
  protocol,
413
413
  hostname,
@@ -426,10 +426,10 @@ export const se_UpdateWorkspaceAliasCommand = async (input, context) => {
426
426
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/workspaces/{workspaceId}/alias";
427
427
  resolvedPath = __resolvedPath(resolvedPath, input, "workspaceId", () => input.workspaceId, "{workspaceId}", false);
428
428
  let body;
429
- body = JSON.stringify({
430
- ...(input.alias != null && { alias: input.alias }),
431
- clientToken: input.clientToken ?? generateIdempotencyToken(),
432
- });
429
+ body = JSON.stringify(take(input, {
430
+ alias: [],
431
+ clientToken: (_) => _ ?? generateIdempotencyToken(),
432
+ }));
433
433
  return new __HttpRequest({
434
434
  protocol,
435
435
  hostname,
@@ -448,9 +448,10 @@ export const de_CreateAlertManagerDefinitionCommand = async (output, context) =>
448
448
  $metadata: deserializeMetadata(output),
449
449
  });
450
450
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
451
- if (data.status != null) {
452
- contents.status = de_AlertManagerDefinitionStatus(data.status, context);
453
- }
451
+ const doc = take(data, {
452
+ status: _json,
453
+ });
454
+ Object.assign(contents, doc);
454
455
  return contents;
455
456
  };
456
457
  const de_CreateAlertManagerDefinitionCommandError = async (output, context) => {
@@ -483,10 +484,9 @@ const de_CreateAlertManagerDefinitionCommandError = async (output, context) => {
483
484
  throw await de_ValidationExceptionRes(parsedOutput, context);
484
485
  default:
485
486
  const parsedBody = parsedOutput.body;
486
- throwDefaultError({
487
+ return throwDefaultError({
487
488
  output,
488
489
  parsedBody,
489
- exceptionCtor: __BaseException,
490
490
  errorCode,
491
491
  });
492
492
  }
@@ -499,9 +499,10 @@ export const de_CreateLoggingConfigurationCommand = async (output, context) => {
499
499
  $metadata: deserializeMetadata(output),
500
500
  });
501
501
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
502
- if (data.status != null) {
503
- contents.status = de_LoggingConfigurationStatus(data.status, context);
504
- }
502
+ const doc = take(data, {
503
+ status: _json,
504
+ });
505
+ Object.assign(contents, doc);
505
506
  return contents;
506
507
  };
507
508
  const de_CreateLoggingConfigurationCommandError = async (output, context) => {
@@ -525,10 +526,9 @@ const de_CreateLoggingConfigurationCommandError = async (output, context) => {
525
526
  throw await de_ValidationExceptionRes(parsedOutput, context);
526
527
  default:
527
528
  const parsedBody = parsedOutput.body;
528
- throwDefaultError({
529
+ return throwDefaultError({
529
530
  output,
530
531
  parsedBody,
531
- exceptionCtor: __BaseException,
532
532
  errorCode,
533
533
  });
534
534
  }
@@ -541,18 +541,13 @@ export const de_CreateRuleGroupsNamespaceCommand = async (output, context) => {
541
541
  $metadata: deserializeMetadata(output),
542
542
  });
543
543
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
544
- if (data.arn != null) {
545
- contents.arn = __expectString(data.arn);
546
- }
547
- if (data.name != null) {
548
- contents.name = __expectString(data.name);
549
- }
550
- if (data.status != null) {
551
- contents.status = de_RuleGroupsNamespaceStatus(data.status, context);
552
- }
553
- if (data.tags != null) {
554
- contents.tags = de_TagMap(data.tags, context);
555
- }
544
+ const doc = take(data, {
545
+ arn: __expectString,
546
+ name: __expectString,
547
+ status: _json,
548
+ tags: _json,
549
+ });
550
+ Object.assign(contents, doc);
556
551
  return contents;
557
552
  };
558
553
  const de_CreateRuleGroupsNamespaceCommandError = async (output, context) => {
@@ -585,10 +580,9 @@ const de_CreateRuleGroupsNamespaceCommandError = async (output, context) => {
585
580
  throw await de_ValidationExceptionRes(parsedOutput, context);
586
581
  default:
587
582
  const parsedBody = parsedOutput.body;
588
- throwDefaultError({
583
+ return throwDefaultError({
589
584
  output,
590
585
  parsedBody,
591
- exceptionCtor: __BaseException,
592
586
  errorCode,
593
587
  });
594
588
  }
@@ -601,18 +595,13 @@ export const de_CreateWorkspaceCommand = async (output, context) => {
601
595
  $metadata: deserializeMetadata(output),
602
596
  });
603
597
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
604
- if (data.arn != null) {
605
- contents.arn = __expectString(data.arn);
606
- }
607
- if (data.status != null) {
608
- contents.status = de_WorkspaceStatus(data.status, context);
609
- }
610
- if (data.tags != null) {
611
- contents.tags = de_TagMap(data.tags, context);
612
- }
613
- if (data.workspaceId != null) {
614
- contents.workspaceId = __expectString(data.workspaceId);
615
- }
598
+ const doc = take(data, {
599
+ arn: __expectString,
600
+ status: _json,
601
+ tags: _json,
602
+ workspaceId: __expectString,
603
+ });
604
+ Object.assign(contents, doc);
616
605
  return contents;
617
606
  };
618
607
  const de_CreateWorkspaceCommandError = async (output, context) => {
@@ -642,10 +631,9 @@ const de_CreateWorkspaceCommandError = async (output, context) => {
642
631
  throw await de_ValidationExceptionRes(parsedOutput, context);
643
632
  default:
644
633
  const parsedBody = parsedOutput.body;
645
- throwDefaultError({
634
+ return throwDefaultError({
646
635
  output,
647
636
  parsedBody,
648
- exceptionCtor: __BaseException,
649
637
  errorCode,
650
638
  });
651
639
  }
@@ -687,10 +675,9 @@ const de_DeleteAlertManagerDefinitionCommandError = async (output, context) => {
687
675
  throw await de_ValidationExceptionRes(parsedOutput, context);
688
676
  default:
689
677
  const parsedBody = parsedOutput.body;
690
- throwDefaultError({
678
+ return throwDefaultError({
691
679
  output,
692
680
  parsedBody,
693
- exceptionCtor: __BaseException,
694
681
  errorCode,
695
682
  });
696
683
  }
@@ -729,10 +716,9 @@ const de_DeleteLoggingConfigurationCommandError = async (output, context) => {
729
716
  throw await de_ValidationExceptionRes(parsedOutput, context);
730
717
  default:
731
718
  const parsedBody = parsedOutput.body;
732
- throwDefaultError({
719
+ return throwDefaultError({
733
720
  output,
734
721
  parsedBody,
735
- exceptionCtor: __BaseException,
736
722
  errorCode,
737
723
  });
738
724
  }
@@ -774,10 +760,9 @@ const de_DeleteRuleGroupsNamespaceCommandError = async (output, context) => {
774
760
  throw await de_ValidationExceptionRes(parsedOutput, context);
775
761
  default:
776
762
  const parsedBody = parsedOutput.body;
777
- throwDefaultError({
763
+ return throwDefaultError({
778
764
  output,
779
765
  parsedBody,
780
- exceptionCtor: __BaseException,
781
766
  errorCode,
782
767
  });
783
768
  }
@@ -819,10 +804,9 @@ const de_DeleteWorkspaceCommandError = async (output, context) => {
819
804
  throw await de_ValidationExceptionRes(parsedOutput, context);
820
805
  default:
821
806
  const parsedBody = parsedOutput.body;
822
- throwDefaultError({
807
+ return throwDefaultError({
823
808
  output,
824
809
  parsedBody,
825
- exceptionCtor: __BaseException,
826
810
  errorCode,
827
811
  });
828
812
  }
@@ -835,9 +819,10 @@ export const de_DescribeAlertManagerDefinitionCommand = async (output, context)
835
819
  $metadata: deserializeMetadata(output),
836
820
  });
837
821
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
838
- if (data.alertManagerDefinition != null) {
839
- contents.alertManagerDefinition = de_AlertManagerDefinitionDescription(data.alertManagerDefinition, context);
840
- }
822
+ const doc = take(data, {
823
+ alertManagerDefinition: (_) => de_AlertManagerDefinitionDescription(_, context),
824
+ });
825
+ Object.assign(contents, doc);
841
826
  return contents;
842
827
  };
843
828
  const de_DescribeAlertManagerDefinitionCommandError = async (output, context) => {
@@ -864,10 +849,9 @@ const de_DescribeAlertManagerDefinitionCommandError = async (output, context) =>
864
849
  throw await de_ValidationExceptionRes(parsedOutput, context);
865
850
  default:
866
851
  const parsedBody = parsedOutput.body;
867
- throwDefaultError({
852
+ return throwDefaultError({
868
853
  output,
869
854
  parsedBody,
870
- exceptionCtor: __BaseException,
871
855
  errorCode,
872
856
  });
873
857
  }
@@ -880,9 +864,10 @@ export const de_DescribeLoggingConfigurationCommand = async (output, context) =>
880
864
  $metadata: deserializeMetadata(output),
881
865
  });
882
866
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
883
- if (data.loggingConfiguration != null) {
884
- contents.loggingConfiguration = de_LoggingConfigurationMetadata(data.loggingConfiguration, context);
885
- }
867
+ const doc = take(data, {
868
+ loggingConfiguration: (_) => de_LoggingConfigurationMetadata(_, context),
869
+ });
870
+ Object.assign(contents, doc);
886
871
  return contents;
887
872
  };
888
873
  const de_DescribeLoggingConfigurationCommandError = async (output, context) => {
@@ -906,10 +891,9 @@ const de_DescribeLoggingConfigurationCommandError = async (output, context) => {
906
891
  throw await de_ValidationExceptionRes(parsedOutput, context);
907
892
  default:
908
893
  const parsedBody = parsedOutput.body;
909
- throwDefaultError({
894
+ return throwDefaultError({
910
895
  output,
911
896
  parsedBody,
912
- exceptionCtor: __BaseException,
913
897
  errorCode,
914
898
  });
915
899
  }
@@ -922,9 +906,10 @@ export const de_DescribeRuleGroupsNamespaceCommand = async (output, context) =>
922
906
  $metadata: deserializeMetadata(output),
923
907
  });
924
908
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
925
- if (data.ruleGroupsNamespace != null) {
926
- contents.ruleGroupsNamespace = de_RuleGroupsNamespaceDescription(data.ruleGroupsNamespace, context);
927
- }
909
+ const doc = take(data, {
910
+ ruleGroupsNamespace: (_) => de_RuleGroupsNamespaceDescription(_, context),
911
+ });
912
+ Object.assign(contents, doc);
928
913
  return contents;
929
914
  };
930
915
  const de_DescribeRuleGroupsNamespaceCommandError = async (output, context) => {
@@ -951,10 +936,9 @@ const de_DescribeRuleGroupsNamespaceCommandError = async (output, context) => {
951
936
  throw await de_ValidationExceptionRes(parsedOutput, context);
952
937
  default:
953
938
  const parsedBody = parsedOutput.body;
954
- throwDefaultError({
939
+ return throwDefaultError({
955
940
  output,
956
941
  parsedBody,
957
- exceptionCtor: __BaseException,
958
942
  errorCode,
959
943
  });
960
944
  }
@@ -967,9 +951,10 @@ export const de_DescribeWorkspaceCommand = async (output, context) => {
967
951
  $metadata: deserializeMetadata(output),
968
952
  });
969
953
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
970
- if (data.workspace != null) {
971
- contents.workspace = de_WorkspaceDescription(data.workspace, context);
972
- }
954
+ const doc = take(data, {
955
+ workspace: (_) => de_WorkspaceDescription(_, context),
956
+ });
957
+ Object.assign(contents, doc);
973
958
  return contents;
974
959
  };
975
960
  const de_DescribeWorkspaceCommandError = async (output, context) => {
@@ -996,10 +981,9 @@ const de_DescribeWorkspaceCommandError = async (output, context) => {
996
981
  throw await de_ValidationExceptionRes(parsedOutput, context);
997
982
  default:
998
983
  const parsedBody = parsedOutput.body;
999
- throwDefaultError({
984
+ return throwDefaultError({
1000
985
  output,
1001
986
  parsedBody,
1002
- exceptionCtor: __BaseException,
1003
987
  errorCode,
1004
988
  });
1005
989
  }
@@ -1012,12 +996,11 @@ export const de_ListRuleGroupsNamespacesCommand = async (output, context) => {
1012
996
  $metadata: deserializeMetadata(output),
1013
997
  });
1014
998
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1015
- if (data.nextToken != null) {
1016
- contents.nextToken = __expectString(data.nextToken);
1017
- }
1018
- if (data.ruleGroupsNamespaces != null) {
1019
- contents.ruleGroupsNamespaces = de_RuleGroupsNamespaceSummaryList(data.ruleGroupsNamespaces, context);
1020
- }
999
+ const doc = take(data, {
1000
+ nextToken: __expectString,
1001
+ ruleGroupsNamespaces: (_) => de_RuleGroupsNamespaceSummaryList(_, context),
1002
+ });
1003
+ Object.assign(contents, doc);
1021
1004
  return contents;
1022
1005
  };
1023
1006
  const de_ListRuleGroupsNamespacesCommandError = async (output, context) => {
@@ -1044,10 +1027,9 @@ const de_ListRuleGroupsNamespacesCommandError = async (output, context) => {
1044
1027
  throw await de_ValidationExceptionRes(parsedOutput, context);
1045
1028
  default:
1046
1029
  const parsedBody = parsedOutput.body;
1047
- throwDefaultError({
1030
+ return throwDefaultError({
1048
1031
  output,
1049
1032
  parsedBody,
1050
- exceptionCtor: __BaseException,
1051
1033
  errorCode,
1052
1034
  });
1053
1035
  }
@@ -1060,9 +1042,10 @@ export const de_ListTagsForResourceCommand = async (output, context) => {
1060
1042
  $metadata: deserializeMetadata(output),
1061
1043
  });
1062
1044
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1063
- if (data.tags != null) {
1064
- contents.tags = de_TagMap(data.tags, context);
1065
- }
1045
+ const doc = take(data, {
1046
+ tags: _json,
1047
+ });
1048
+ Object.assign(contents, doc);
1066
1049
  return contents;
1067
1050
  };
1068
1051
  const de_ListTagsForResourceCommandError = async (output, context) => {
@@ -1089,10 +1072,9 @@ const de_ListTagsForResourceCommandError = async (output, context) => {
1089
1072
  throw await de_ValidationExceptionRes(parsedOutput, context);
1090
1073
  default:
1091
1074
  const parsedBody = parsedOutput.body;
1092
- throwDefaultError({
1075
+ return throwDefaultError({
1093
1076
  output,
1094
1077
  parsedBody,
1095
- exceptionCtor: __BaseException,
1096
1078
  errorCode,
1097
1079
  });
1098
1080
  }
@@ -1105,12 +1087,11 @@ export const de_ListWorkspacesCommand = async (output, context) => {
1105
1087
  $metadata: deserializeMetadata(output),
1106
1088
  });
1107
1089
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1108
- if (data.nextToken != null) {
1109
- contents.nextToken = __expectString(data.nextToken);
1110
- }
1111
- if (data.workspaces != null) {
1112
- contents.workspaces = de_WorkspaceSummaryList(data.workspaces, context);
1113
- }
1090
+ const doc = take(data, {
1091
+ nextToken: __expectString,
1092
+ workspaces: (_) => de_WorkspaceSummaryList(_, context),
1093
+ });
1094
+ Object.assign(contents, doc);
1114
1095
  return contents;
1115
1096
  };
1116
1097
  const de_ListWorkspacesCommandError = async (output, context) => {
@@ -1134,10 +1115,9 @@ const de_ListWorkspacesCommandError = async (output, context) => {
1134
1115
  throw await de_ValidationExceptionRes(parsedOutput, context);
1135
1116
  default:
1136
1117
  const parsedBody = parsedOutput.body;
1137
- throwDefaultError({
1118
+ return throwDefaultError({
1138
1119
  output,
1139
1120
  parsedBody,
1140
- exceptionCtor: __BaseException,
1141
1121
  errorCode,
1142
1122
  });
1143
1123
  }
@@ -1150,9 +1130,10 @@ export const de_PutAlertManagerDefinitionCommand = async (output, context) => {
1150
1130
  $metadata: deserializeMetadata(output),
1151
1131
  });
1152
1132
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1153
- if (data.status != null) {
1154
- contents.status = de_AlertManagerDefinitionStatus(data.status, context);
1155
- }
1133
+ const doc = take(data, {
1134
+ status: _json,
1135
+ });
1136
+ Object.assign(contents, doc);
1156
1137
  return contents;
1157
1138
  };
1158
1139
  const de_PutAlertManagerDefinitionCommandError = async (output, context) => {
@@ -1185,10 +1166,9 @@ const de_PutAlertManagerDefinitionCommandError = async (output, context) => {
1185
1166
  throw await de_ValidationExceptionRes(parsedOutput, context);
1186
1167
  default:
1187
1168
  const parsedBody = parsedOutput.body;
1188
- throwDefaultError({
1169
+ return throwDefaultError({
1189
1170
  output,
1190
1171
  parsedBody,
1191
- exceptionCtor: __BaseException,
1192
1172
  errorCode,
1193
1173
  });
1194
1174
  }
@@ -1201,18 +1181,13 @@ export const de_PutRuleGroupsNamespaceCommand = async (output, context) => {
1201
1181
  $metadata: deserializeMetadata(output),
1202
1182
  });
1203
1183
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1204
- if (data.arn != null) {
1205
- contents.arn = __expectString(data.arn);
1206
- }
1207
- if (data.name != null) {
1208
- contents.name = __expectString(data.name);
1209
- }
1210
- if (data.status != null) {
1211
- contents.status = de_RuleGroupsNamespaceStatus(data.status, context);
1212
- }
1213
- if (data.tags != null) {
1214
- contents.tags = de_TagMap(data.tags, context);
1215
- }
1184
+ const doc = take(data, {
1185
+ arn: __expectString,
1186
+ name: __expectString,
1187
+ status: _json,
1188
+ tags: _json,
1189
+ });
1190
+ Object.assign(contents, doc);
1216
1191
  return contents;
1217
1192
  };
1218
1193
  const de_PutRuleGroupsNamespaceCommandError = async (output, context) => {
@@ -1245,10 +1220,9 @@ const de_PutRuleGroupsNamespaceCommandError = async (output, context) => {
1245
1220
  throw await de_ValidationExceptionRes(parsedOutput, context);
1246
1221
  default:
1247
1222
  const parsedBody = parsedOutput.body;
1248
- throwDefaultError({
1223
+ return throwDefaultError({
1249
1224
  output,
1250
1225
  parsedBody,
1251
- exceptionCtor: __BaseException,
1252
1226
  errorCode,
1253
1227
  });
1254
1228
  }
@@ -1287,10 +1261,9 @@ const de_TagResourceCommandError = async (output, context) => {
1287
1261
  throw await de_ValidationExceptionRes(parsedOutput, context);
1288
1262
  default:
1289
1263
  const parsedBody = parsedOutput.body;
1290
- throwDefaultError({
1264
+ return throwDefaultError({
1291
1265
  output,
1292
1266
  parsedBody,
1293
- exceptionCtor: __BaseException,
1294
1267
  errorCode,
1295
1268
  });
1296
1269
  }
@@ -1329,10 +1302,9 @@ const de_UntagResourceCommandError = async (output, context) => {
1329
1302
  throw await de_ValidationExceptionRes(parsedOutput, context);
1330
1303
  default:
1331
1304
  const parsedBody = parsedOutput.body;
1332
- throwDefaultError({
1305
+ return throwDefaultError({
1333
1306
  output,
1334
1307
  parsedBody,
1335
- exceptionCtor: __BaseException,
1336
1308
  errorCode,
1337
1309
  });
1338
1310
  }
@@ -1345,9 +1317,10 @@ export const de_UpdateLoggingConfigurationCommand = async (output, context) => {
1345
1317
  $metadata: deserializeMetadata(output),
1346
1318
  });
1347
1319
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
1348
- if (data.status != null) {
1349
- contents.status = de_LoggingConfigurationStatus(data.status, context);
1350
- }
1320
+ const doc = take(data, {
1321
+ status: _json,
1322
+ });
1323
+ Object.assign(contents, doc);
1351
1324
  return contents;
1352
1325
  };
1353
1326
  const de_UpdateLoggingConfigurationCommandError = async (output, context) => {
@@ -1374,10 +1347,9 @@ const de_UpdateLoggingConfigurationCommandError = async (output, context) => {
1374
1347
  throw await de_ValidationExceptionRes(parsedOutput, context);
1375
1348
  default:
1376
1349
  const parsedBody = parsedOutput.body;
1377
- throwDefaultError({
1350
+ return throwDefaultError({
1378
1351
  output,
1379
1352
  parsedBody,
1380
- exceptionCtor: __BaseException,
1381
1353
  errorCode,
1382
1354
  });
1383
1355
  }
@@ -1422,21 +1394,21 @@ const de_UpdateWorkspaceAliasCommandError = async (output, context) => {
1422
1394
  throw await de_ValidationExceptionRes(parsedOutput, context);
1423
1395
  default:
1424
1396
  const parsedBody = parsedOutput.body;
1425
- throwDefaultError({
1397
+ return throwDefaultError({
1426
1398
  output,
1427
1399
  parsedBody,
1428
- exceptionCtor: __BaseException,
1429
1400
  errorCode,
1430
1401
  });
1431
1402
  }
1432
1403
  };
1433
- const map = __map;
1404
+ const throwDefaultError = withBaseException(__BaseException);
1434
1405
  const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
1435
1406
  const contents = map({});
1436
1407
  const data = parsedOutput.body;
1437
- if (data.message != null) {
1438
- contents.message = __expectString(data.message);
1439
- }
1408
+ const doc = take(data, {
1409
+ message: __expectString,
1410
+ });
1411
+ Object.assign(contents, doc);
1440
1412
  const exception = new AccessDeniedException({
1441
1413
  $metadata: deserializeMetadata(parsedOutput),
1442
1414
  ...contents,
@@ -1446,15 +1418,12 @@ const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
1446
1418
  const de_ConflictExceptionRes = async (parsedOutput, context) => {
1447
1419
  const contents = map({});
1448
1420
  const data = parsedOutput.body;
1449
- if (data.message != null) {
1450
- contents.message = __expectString(data.message);
1451
- }
1452
- if (data.resourceId != null) {
1453
- contents.resourceId = __expectString(data.resourceId);
1454
- }
1455
- if (data.resourceType != null) {
1456
- contents.resourceType = __expectString(data.resourceType);
1457
- }
1421
+ const doc = take(data, {
1422
+ message: __expectString,
1423
+ resourceId: __expectString,
1424
+ resourceType: __expectString,
1425
+ });
1426
+ Object.assign(contents, doc);
1458
1427
  const exception = new ConflictException({
1459
1428
  $metadata: deserializeMetadata(parsedOutput),
1460
1429
  ...contents,
@@ -1469,9 +1438,10 @@ const de_InternalServerExceptionRes = async (parsedOutput, context) => {
1469
1438
  ],
1470
1439
  });
1471
1440
  const data = parsedOutput.body;
1472
- if (data.message != null) {
1473
- contents.message = __expectString(data.message);
1474
- }
1441
+ const doc = take(data, {
1442
+ message: __expectString,
1443
+ });
1444
+ Object.assign(contents, doc);
1475
1445
  const exception = new InternalServerException({
1476
1446
  $metadata: deserializeMetadata(parsedOutput),
1477
1447
  ...contents,
@@ -1481,15 +1451,12 @@ const de_InternalServerExceptionRes = async (parsedOutput, context) => {
1481
1451
  const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
1482
1452
  const contents = map({});
1483
1453
  const data = parsedOutput.body;
1484
- if (data.message != null) {
1485
- contents.message = __expectString(data.message);
1486
- }
1487
- if (data.resourceId != null) {
1488
- contents.resourceId = __expectString(data.resourceId);
1489
- }
1490
- if (data.resourceType != null) {
1491
- contents.resourceType = __expectString(data.resourceType);
1492
- }
1454
+ const doc = take(data, {
1455
+ message: __expectString,
1456
+ resourceId: __expectString,
1457
+ resourceType: __expectString,
1458
+ });
1459
+ Object.assign(contents, doc);
1493
1460
  const exception = new ResourceNotFoundException({
1494
1461
  $metadata: deserializeMetadata(parsedOutput),
1495
1462
  ...contents,
@@ -1499,21 +1466,14 @@ const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
1499
1466
  const de_ServiceQuotaExceededExceptionRes = async (parsedOutput, context) => {
1500
1467
  const contents = map({});
1501
1468
  const data = parsedOutput.body;
1502
- if (data.message != null) {
1503
- contents.message = __expectString(data.message);
1504
- }
1505
- if (data.quotaCode != null) {
1506
- contents.quotaCode = __expectString(data.quotaCode);
1507
- }
1508
- if (data.resourceId != null) {
1509
- contents.resourceId = __expectString(data.resourceId);
1510
- }
1511
- if (data.resourceType != null) {
1512
- contents.resourceType = __expectString(data.resourceType);
1513
- }
1514
- if (data.serviceCode != null) {
1515
- contents.serviceCode = __expectString(data.serviceCode);
1516
- }
1469
+ const doc = take(data, {
1470
+ message: __expectString,
1471
+ quotaCode: __expectString,
1472
+ resourceId: __expectString,
1473
+ resourceType: __expectString,
1474
+ serviceCode: __expectString,
1475
+ });
1476
+ Object.assign(contents, doc);
1517
1477
  const exception = new ServiceQuotaExceededException({
1518
1478
  $metadata: deserializeMetadata(parsedOutput),
1519
1479
  ...contents,
@@ -1528,15 +1488,12 @@ const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
1528
1488
  ],
1529
1489
  });
1530
1490
  const data = parsedOutput.body;
1531
- if (data.message != null) {
1532
- contents.message = __expectString(data.message);
1533
- }
1534
- if (data.quotaCode != null) {
1535
- contents.quotaCode = __expectString(data.quotaCode);
1536
- }
1537
- if (data.serviceCode != null) {
1538
- contents.serviceCode = __expectString(data.serviceCode);
1539
- }
1491
+ const doc = take(data, {
1492
+ message: __expectString,
1493
+ quotaCode: __expectString,
1494
+ serviceCode: __expectString,
1495
+ });
1496
+ Object.assign(contents, doc);
1540
1497
  const exception = new ThrottlingException({
1541
1498
  $metadata: deserializeMetadata(parsedOutput),
1542
1499
  ...contents,
@@ -1546,156 +1503,89 @@ const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
1546
1503
  const de_ValidationExceptionRes = async (parsedOutput, context) => {
1547
1504
  const contents = map({});
1548
1505
  const data = parsedOutput.body;
1549
- if (data.fieldList != null) {
1550
- contents.fieldList = de_ValidationExceptionFieldList(data.fieldList, context);
1551
- }
1552
- if (data.message != null) {
1553
- contents.message = __expectString(data.message);
1554
- }
1555
- if (data.reason != null) {
1556
- contents.reason = __expectString(data.reason);
1557
- }
1506
+ const doc = take(data, {
1507
+ fieldList: _json,
1508
+ message: __expectString,
1509
+ reason: __expectString,
1510
+ });
1511
+ Object.assign(contents, doc);
1558
1512
  const exception = new ValidationException({
1559
1513
  $metadata: deserializeMetadata(parsedOutput),
1560
1514
  ...contents,
1561
1515
  });
1562
1516
  return __decorateServiceException(exception, parsedOutput.body);
1563
1517
  };
1564
- const se_TagMap = (input, context) => {
1565
- return Object.entries(input).reduce((acc, [key, value]) => {
1566
- if (value === null) {
1567
- return acc;
1568
- }
1569
- acc[key] = value;
1570
- return acc;
1571
- }, {});
1572
- };
1573
1518
  const de_AlertManagerDefinitionDescription = (output, context) => {
1574
- return {
1575
- createdAt: output.createdAt != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt))) : undefined,
1576
- data: output.data != null ? context.base64Decoder(output.data) : undefined,
1577
- modifiedAt: output.modifiedAt != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.modifiedAt))) : undefined,
1578
- status: output.status != null ? de_AlertManagerDefinitionStatus(output.status, context) : undefined,
1579
- };
1580
- };
1581
- const de_AlertManagerDefinitionStatus = (output, context) => {
1582
- return {
1583
- statusCode: __expectString(output.statusCode),
1584
- statusReason: __expectString(output.statusReason),
1585
- };
1519
+ return take(output, {
1520
+ createdAt: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
1521
+ data: context.base64Decoder,
1522
+ modifiedAt: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
1523
+ status: _json,
1524
+ });
1586
1525
  };
1587
1526
  const de_LoggingConfigurationMetadata = (output, context) => {
1588
- return {
1589
- createdAt: output.createdAt != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt))) : undefined,
1590
- logGroupArn: __expectString(output.logGroupArn),
1591
- modifiedAt: output.modifiedAt != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.modifiedAt))) : undefined,
1592
- status: output.status != null ? de_LoggingConfigurationStatus(output.status, context) : undefined,
1593
- workspace: __expectString(output.workspace),
1594
- };
1595
- };
1596
- const de_LoggingConfigurationStatus = (output, context) => {
1597
- return {
1598
- statusCode: __expectString(output.statusCode),
1599
- statusReason: __expectString(output.statusReason),
1600
- };
1527
+ return take(output, {
1528
+ createdAt: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
1529
+ logGroupArn: __expectString,
1530
+ modifiedAt: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
1531
+ status: _json,
1532
+ workspace: __expectString,
1533
+ });
1601
1534
  };
1602
1535
  const de_RuleGroupsNamespaceDescription = (output, context) => {
1603
- return {
1604
- arn: __expectString(output.arn),
1605
- createdAt: output.createdAt != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt))) : undefined,
1606
- data: output.data != null ? context.base64Decoder(output.data) : undefined,
1607
- modifiedAt: output.modifiedAt != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.modifiedAt))) : undefined,
1608
- name: __expectString(output.name),
1609
- status: output.status != null ? de_RuleGroupsNamespaceStatus(output.status, context) : undefined,
1610
- tags: output.tags != null ? de_TagMap(output.tags, context) : undefined,
1611
- };
1612
- };
1613
- const de_RuleGroupsNamespaceStatus = (output, context) => {
1614
- return {
1615
- statusCode: __expectString(output.statusCode),
1616
- statusReason: __expectString(output.statusReason),
1617
- };
1536
+ return take(output, {
1537
+ arn: __expectString,
1538
+ createdAt: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
1539
+ data: context.base64Decoder,
1540
+ modifiedAt: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
1541
+ name: __expectString,
1542
+ status: _json,
1543
+ tags: _json,
1544
+ });
1618
1545
  };
1619
1546
  const de_RuleGroupsNamespaceSummary = (output, context) => {
1620
- return {
1621
- arn: __expectString(output.arn),
1622
- createdAt: output.createdAt != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt))) : undefined,
1623
- modifiedAt: output.modifiedAt != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.modifiedAt))) : undefined,
1624
- name: __expectString(output.name),
1625
- status: output.status != null ? de_RuleGroupsNamespaceStatus(output.status, context) : undefined,
1626
- tags: output.tags != null ? de_TagMap(output.tags, context) : undefined,
1627
- };
1547
+ return take(output, {
1548
+ arn: __expectString,
1549
+ createdAt: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
1550
+ modifiedAt: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
1551
+ name: __expectString,
1552
+ status: _json,
1553
+ tags: _json,
1554
+ });
1628
1555
  };
1629
1556
  const de_RuleGroupsNamespaceSummaryList = (output, context) => {
1630
1557
  const retVal = (output || [])
1631
1558
  .filter((e) => e != null)
1632
1559
  .map((entry) => {
1633
- if (entry === null) {
1634
- return null;
1635
- }
1636
1560
  return de_RuleGroupsNamespaceSummary(entry, context);
1637
1561
  });
1638
1562
  return retVal;
1639
1563
  };
1640
- const de_TagMap = (output, context) => {
1641
- return Object.entries(output).reduce((acc, [key, value]) => {
1642
- if (value === null) {
1643
- return acc;
1644
- }
1645
- acc[key] = __expectString(value);
1646
- return acc;
1647
- }, {});
1648
- };
1649
- const de_ValidationExceptionField = (output, context) => {
1650
- return {
1651
- message: __expectString(output.message),
1652
- name: __expectString(output.name),
1653
- };
1654
- };
1655
- const de_ValidationExceptionFieldList = (output, context) => {
1656
- const retVal = (output || [])
1657
- .filter((e) => e != null)
1658
- .map((entry) => {
1659
- if (entry === null) {
1660
- return null;
1661
- }
1662
- return de_ValidationExceptionField(entry, context);
1663
- });
1664
- return retVal;
1665
- };
1666
1564
  const de_WorkspaceDescription = (output, context) => {
1667
- return {
1668
- alias: __expectString(output.alias),
1669
- arn: __expectString(output.arn),
1670
- createdAt: output.createdAt != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt))) : undefined,
1671
- prometheusEndpoint: __expectString(output.prometheusEndpoint),
1672
- status: output.status != null ? de_WorkspaceStatus(output.status, context) : undefined,
1673
- tags: output.tags != null ? de_TagMap(output.tags, context) : undefined,
1674
- workspaceId: __expectString(output.workspaceId),
1675
- };
1676
- };
1677
- const de_WorkspaceStatus = (output, context) => {
1678
- return {
1679
- statusCode: __expectString(output.statusCode),
1680
- };
1565
+ return take(output, {
1566
+ alias: __expectString,
1567
+ arn: __expectString,
1568
+ createdAt: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
1569
+ prometheusEndpoint: __expectString,
1570
+ status: _json,
1571
+ tags: _json,
1572
+ workspaceId: __expectString,
1573
+ });
1681
1574
  };
1682
1575
  const de_WorkspaceSummary = (output, context) => {
1683
- return {
1684
- alias: __expectString(output.alias),
1685
- arn: __expectString(output.arn),
1686
- createdAt: output.createdAt != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt))) : undefined,
1687
- status: output.status != null ? de_WorkspaceStatus(output.status, context) : undefined,
1688
- tags: output.tags != null ? de_TagMap(output.tags, context) : undefined,
1689
- workspaceId: __expectString(output.workspaceId),
1690
- };
1576
+ return take(output, {
1577
+ alias: __expectString,
1578
+ arn: __expectString,
1579
+ createdAt: (_) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))),
1580
+ status: _json,
1581
+ tags: _json,
1582
+ workspaceId: __expectString,
1583
+ });
1691
1584
  };
1692
1585
  const de_WorkspaceSummaryList = (output, context) => {
1693
1586
  const retVal = (output || [])
1694
1587
  .filter((e) => e != null)
1695
1588
  .map((entry) => {
1696
- if (entry === null) {
1697
- return null;
1698
- }
1699
1589
  return de_WorkspaceSummary(entry, context);
1700
1590
  });
1701
1591
  return retVal;