@aws-sdk/client-ssm-incidents 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.
@@ -112,9 +112,9 @@ const serializeAws_restJson1DeleteReplicationSetCommand = async (input, context)
112
112
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
113
113
  const headers = {};
114
114
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/deleteReplicationSet";
115
- const query = {
116
- ...(input.arn !== undefined && { arn: input.arn }),
117
- };
115
+ const query = map({
116
+ arn: [, input.arn],
117
+ });
118
118
  let body;
119
119
  return new protocol_http_1.HttpRequest({
120
120
  protocol,
@@ -197,9 +197,9 @@ const serializeAws_restJson1GetIncidentRecordCommand = async (input, context) =>
197
197
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
198
198
  const headers = {};
199
199
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/getIncidentRecord";
200
- const query = {
201
- ...(input.arn !== undefined && { arn: input.arn }),
202
- };
200
+ const query = map({
201
+ arn: [, input.arn],
202
+ });
203
203
  let body;
204
204
  return new protocol_http_1.HttpRequest({
205
205
  protocol,
@@ -217,9 +217,9 @@ const serializeAws_restJson1GetReplicationSetCommand = async (input, context) =>
217
217
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
218
218
  const headers = {};
219
219
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/getReplicationSet";
220
- const query = {
221
- ...(input.arn !== undefined && { arn: input.arn }),
222
- };
220
+ const query = map({
221
+ arn: [, input.arn],
222
+ });
223
223
  let body;
224
224
  return new protocol_http_1.HttpRequest({
225
225
  protocol,
@@ -239,9 +239,9 @@ const serializeAws_restJson1GetResourcePoliciesCommand = async (input, context)
239
239
  "content-type": "application/json",
240
240
  };
241
241
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/getResourcePolicies";
242
- const query = {
243
- ...(input.resourceArn !== undefined && { resourceArn: input.resourceArn }),
244
- };
242
+ const query = map({
243
+ resourceArn: [, input.resourceArn],
244
+ });
245
245
  let body;
246
246
  body = JSON.stringify({
247
247
  ...(input.maxResults != null && { maxResults: input.maxResults }),
@@ -263,9 +263,9 @@ const serializeAws_restJson1GetResponsePlanCommand = async (input, context) => {
263
263
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
264
264
  const headers = {};
265
265
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/getResponsePlan";
266
- const query = {
267
- ...(input.arn !== undefined && { arn: input.arn }),
268
- };
266
+ const query = map({
267
+ arn: [, input.arn],
268
+ });
269
269
  let body;
270
270
  return new protocol_http_1.HttpRequest({
271
271
  protocol,
@@ -283,10 +283,10 @@ const serializeAws_restJson1GetTimelineEventCommand = async (input, context) =>
283
283
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
284
284
  const headers = {};
285
285
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/getTimelineEvent";
286
- const query = {
287
- ...(input.incidentRecordArn !== undefined && { incidentRecordArn: input.incidentRecordArn }),
288
- ...(input.eventId !== undefined && { eventId: input.eventId }),
289
- };
286
+ const query = map({
287
+ incidentRecordArn: [, input.incidentRecordArn],
288
+ eventId: [, input.eventId],
289
+ });
290
290
  let body;
291
291
  return new protocol_http_1.HttpRequest({
292
292
  protocol,
@@ -394,16 +394,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
394
394
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
395
395
  const headers = {};
396
396
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
397
- if (input.resourceArn !== undefined) {
398
- const labelValue = input.resourceArn;
399
- if (labelValue.length <= 0) {
400
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
401
- }
402
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
403
- }
404
- else {
405
- throw new Error("No value provided for input HTTP label: resourceArn.");
406
- }
397
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
407
398
  let body;
408
399
  return new protocol_http_1.HttpRequest({
409
400
  protocol,
@@ -501,16 +492,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
501
492
  "content-type": "application/json",
502
493
  };
503
494
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
504
- if (input.resourceArn !== undefined) {
505
- const labelValue = input.resourceArn;
506
- if (labelValue.length <= 0) {
507
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
508
- }
509
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
510
- }
511
- else {
512
- throw new Error("No value provided for input HTTP label: resourceArn.");
513
- }
495
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
514
496
  let body;
515
497
  body = JSON.stringify({
516
498
  ...(input.tags != null && { tags: serializeAws_restJson1TagMap(input.tags, context) }),
@@ -530,19 +512,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
530
512
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
531
513
  const headers = {};
532
514
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
533
- if (input.resourceArn !== undefined) {
534
- const labelValue = input.resourceArn;
535
- if (labelValue.length <= 0) {
536
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
537
- }
538
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
539
- }
540
- else {
541
- throw new Error("No value provided for input HTTP label: resourceArn.");
542
- }
543
- const query = {
544
- ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }),
545
- };
515
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
516
+ const query = map({
517
+ tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys || []).map((_entry) => _entry)],
518
+ });
546
519
  let body;
547
520
  return new protocol_http_1.HttpRequest({
548
521
  protocol,
@@ -731,15 +704,14 @@ const deserializeAws_restJson1CreateReplicationSetCommand = async (output, conte
731
704
  if (output.statusCode !== 201 && output.statusCode >= 300) {
732
705
  return deserializeAws_restJson1CreateReplicationSetCommandError(output, context);
733
706
  }
734
- const contents = {
707
+ const contents = map({
735
708
  $metadata: deserializeMetadata(output),
736
- arn: undefined,
737
- };
709
+ });
738
710
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
739
- if (data.arn !== undefined && data.arn !== null) {
711
+ if (data.arn != null) {
740
712
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
741
713
  }
742
- return Promise.resolve(contents);
714
+ return contents;
743
715
  };
744
716
  exports.deserializeAws_restJson1CreateReplicationSetCommand = deserializeAws_restJson1CreateReplicationSetCommand;
745
717
  const deserializeAws_restJson1CreateReplicationSetCommandError = async (output, context) => {
@@ -747,7 +719,6 @@ const deserializeAws_restJson1CreateReplicationSetCommandError = async (output,
747
719
  ...output,
748
720
  body: await parseBody(output.body, context),
749
721
  };
750
- let response;
751
722
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
752
723
  switch (errorCode) {
753
724
  case "AccessDeniedException":
@@ -770,29 +741,26 @@ const deserializeAws_restJson1CreateReplicationSetCommandError = async (output,
770
741
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
771
742
  default:
772
743
  const parsedBody = parsedOutput.body;
773
- const $metadata = deserializeMetadata(output);
774
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
775
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
776
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
777
- $fault: "client",
778
- $metadata,
744
+ (0, smithy_client_1.throwDefaultError)({
745
+ output,
746
+ parsedBody,
747
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
748
+ errorCode,
779
749
  });
780
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
781
750
  }
782
751
  };
783
752
  const deserializeAws_restJson1CreateResponsePlanCommand = async (output, context) => {
784
753
  if (output.statusCode !== 201 && output.statusCode >= 300) {
785
754
  return deserializeAws_restJson1CreateResponsePlanCommandError(output, context);
786
755
  }
787
- const contents = {
756
+ const contents = map({
788
757
  $metadata: deserializeMetadata(output),
789
- arn: undefined,
790
- };
758
+ });
791
759
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
792
- if (data.arn !== undefined && data.arn !== null) {
760
+ if (data.arn != null) {
793
761
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
794
762
  }
795
- return Promise.resolve(contents);
763
+ return contents;
796
764
  };
797
765
  exports.deserializeAws_restJson1CreateResponsePlanCommand = deserializeAws_restJson1CreateResponsePlanCommand;
798
766
  const deserializeAws_restJson1CreateResponsePlanCommandError = async (output, context) => {
@@ -800,7 +768,6 @@ const deserializeAws_restJson1CreateResponsePlanCommandError = async (output, co
800
768
  ...output,
801
769
  body: await parseBody(output.body, context),
802
770
  };
803
- let response;
804
771
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
805
772
  switch (errorCode) {
806
773
  case "AccessDeniedException":
@@ -823,33 +790,29 @@ const deserializeAws_restJson1CreateResponsePlanCommandError = async (output, co
823
790
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
824
791
  default:
825
792
  const parsedBody = parsedOutput.body;
826
- const $metadata = deserializeMetadata(output);
827
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
828
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
829
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
830
- $fault: "client",
831
- $metadata,
793
+ (0, smithy_client_1.throwDefaultError)({
794
+ output,
795
+ parsedBody,
796
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
797
+ errorCode,
832
798
  });
833
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
834
799
  }
835
800
  };
836
801
  const deserializeAws_restJson1CreateTimelineEventCommand = async (output, context) => {
837
802
  if (output.statusCode !== 201 && output.statusCode >= 300) {
838
803
  return deserializeAws_restJson1CreateTimelineEventCommandError(output, context);
839
804
  }
840
- const contents = {
805
+ const contents = map({
841
806
  $metadata: deserializeMetadata(output),
842
- eventId: undefined,
843
- incidentRecordArn: undefined,
844
- };
807
+ });
845
808
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
846
- if (data.eventId !== undefined && data.eventId !== null) {
809
+ if (data.eventId != null) {
847
810
  contents.eventId = (0, smithy_client_1.expectString)(data.eventId);
848
811
  }
849
- if (data.incidentRecordArn !== undefined && data.incidentRecordArn !== null) {
812
+ if (data.incidentRecordArn != null) {
850
813
  contents.incidentRecordArn = (0, smithy_client_1.expectString)(data.incidentRecordArn);
851
814
  }
852
- return Promise.resolve(contents);
815
+ return contents;
853
816
  };
854
817
  exports.deserializeAws_restJson1CreateTimelineEventCommand = deserializeAws_restJson1CreateTimelineEventCommand;
855
818
  const deserializeAws_restJson1CreateTimelineEventCommandError = async (output, context) => {
@@ -857,7 +820,6 @@ const deserializeAws_restJson1CreateTimelineEventCommandError = async (output, c
857
820
  ...output,
858
821
  body: await parseBody(output.body, context),
859
822
  };
860
- let response;
861
823
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
862
824
  switch (errorCode) {
863
825
  case "AccessDeniedException":
@@ -880,25 +842,23 @@ const deserializeAws_restJson1CreateTimelineEventCommandError = async (output, c
880
842
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
881
843
  default:
882
844
  const parsedBody = parsedOutput.body;
883
- const $metadata = deserializeMetadata(output);
884
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
885
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
886
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
887
- $fault: "client",
888
- $metadata,
845
+ (0, smithy_client_1.throwDefaultError)({
846
+ output,
847
+ parsedBody,
848
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
849
+ errorCode,
889
850
  });
890
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
891
851
  }
892
852
  };
893
853
  const deserializeAws_restJson1DeleteIncidentRecordCommand = async (output, context) => {
894
854
  if (output.statusCode !== 204 && output.statusCode >= 300) {
895
855
  return deserializeAws_restJson1DeleteIncidentRecordCommandError(output, context);
896
856
  }
897
- const contents = {
857
+ const contents = map({
898
858
  $metadata: deserializeMetadata(output),
899
- };
859
+ });
900
860
  await collectBody(output.body, context);
901
- return Promise.resolve(contents);
861
+ return contents;
902
862
  };
903
863
  exports.deserializeAws_restJson1DeleteIncidentRecordCommand = deserializeAws_restJson1DeleteIncidentRecordCommand;
904
864
  const deserializeAws_restJson1DeleteIncidentRecordCommandError = async (output, context) => {
@@ -906,7 +866,6 @@ const deserializeAws_restJson1DeleteIncidentRecordCommandError = async (output,
906
866
  ...output,
907
867
  body: await parseBody(output.body, context),
908
868
  };
909
- let response;
910
869
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
911
870
  switch (errorCode) {
912
871
  case "AccessDeniedException":
@@ -923,25 +882,23 @@ const deserializeAws_restJson1DeleteIncidentRecordCommandError = async (output,
923
882
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
924
883
  default:
925
884
  const parsedBody = parsedOutput.body;
926
- const $metadata = deserializeMetadata(output);
927
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
928
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
929
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
930
- $fault: "client",
931
- $metadata,
885
+ (0, smithy_client_1.throwDefaultError)({
886
+ output,
887
+ parsedBody,
888
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
889
+ errorCode,
932
890
  });
933
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
934
891
  }
935
892
  };
936
893
  const deserializeAws_restJson1DeleteReplicationSetCommand = async (output, context) => {
937
894
  if (output.statusCode !== 204 && output.statusCode >= 300) {
938
895
  return deserializeAws_restJson1DeleteReplicationSetCommandError(output, context);
939
896
  }
940
- const contents = {
897
+ const contents = map({
941
898
  $metadata: deserializeMetadata(output),
942
- };
899
+ });
943
900
  await collectBody(output.body, context);
944
- return Promise.resolve(contents);
901
+ return contents;
945
902
  };
946
903
  exports.deserializeAws_restJson1DeleteReplicationSetCommand = deserializeAws_restJson1DeleteReplicationSetCommand;
947
904
  const deserializeAws_restJson1DeleteReplicationSetCommandError = async (output, context) => {
@@ -949,7 +906,6 @@ const deserializeAws_restJson1DeleteReplicationSetCommandError = async (output,
949
906
  ...output,
950
907
  body: await parseBody(output.body, context),
951
908
  };
952
- let response;
953
909
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
954
910
  switch (errorCode) {
955
911
  case "AccessDeniedException":
@@ -969,25 +925,23 @@ const deserializeAws_restJson1DeleteReplicationSetCommandError = async (output,
969
925
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
970
926
  default:
971
927
  const parsedBody = parsedOutput.body;
972
- const $metadata = deserializeMetadata(output);
973
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
974
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
975
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
976
- $fault: "client",
977
- $metadata,
928
+ (0, smithy_client_1.throwDefaultError)({
929
+ output,
930
+ parsedBody,
931
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
932
+ errorCode,
978
933
  });
979
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
980
934
  }
981
935
  };
982
936
  const deserializeAws_restJson1DeleteResourcePolicyCommand = async (output, context) => {
983
937
  if (output.statusCode !== 200 && output.statusCode >= 300) {
984
938
  return deserializeAws_restJson1DeleteResourcePolicyCommandError(output, context);
985
939
  }
986
- const contents = {
940
+ const contents = map({
987
941
  $metadata: deserializeMetadata(output),
988
- };
942
+ });
989
943
  await collectBody(output.body, context);
990
- return Promise.resolve(contents);
944
+ return contents;
991
945
  };
992
946
  exports.deserializeAws_restJson1DeleteResourcePolicyCommand = deserializeAws_restJson1DeleteResourcePolicyCommand;
993
947
  const deserializeAws_restJson1DeleteResourcePolicyCommandError = async (output, context) => {
@@ -995,7 +949,6 @@ const deserializeAws_restJson1DeleteResourcePolicyCommandError = async (output,
995
949
  ...output,
996
950
  body: await parseBody(output.body, context),
997
951
  };
998
- let response;
999
952
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1000
953
  switch (errorCode) {
1001
954
  case "AccessDeniedException":
@@ -1015,25 +968,23 @@ const deserializeAws_restJson1DeleteResourcePolicyCommandError = async (output,
1015
968
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1016
969
  default:
1017
970
  const parsedBody = parsedOutput.body;
1018
- const $metadata = deserializeMetadata(output);
1019
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1020
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1021
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1022
- $fault: "client",
1023
- $metadata,
971
+ (0, smithy_client_1.throwDefaultError)({
972
+ output,
973
+ parsedBody,
974
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
975
+ errorCode,
1024
976
  });
1025
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1026
977
  }
1027
978
  };
1028
979
  const deserializeAws_restJson1DeleteResponsePlanCommand = async (output, context) => {
1029
980
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1030
981
  return deserializeAws_restJson1DeleteResponsePlanCommandError(output, context);
1031
982
  }
1032
- const contents = {
983
+ const contents = map({
1033
984
  $metadata: deserializeMetadata(output),
1034
- };
985
+ });
1035
986
  await collectBody(output.body, context);
1036
- return Promise.resolve(contents);
987
+ return contents;
1037
988
  };
1038
989
  exports.deserializeAws_restJson1DeleteResponsePlanCommand = deserializeAws_restJson1DeleteResponsePlanCommand;
1039
990
  const deserializeAws_restJson1DeleteResponsePlanCommandError = async (output, context) => {
@@ -1041,7 +992,6 @@ const deserializeAws_restJson1DeleteResponsePlanCommandError = async (output, co
1041
992
  ...output,
1042
993
  body: await parseBody(output.body, context),
1043
994
  };
1044
- let response;
1045
995
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1046
996
  switch (errorCode) {
1047
997
  case "AccessDeniedException":
@@ -1058,25 +1008,23 @@ const deserializeAws_restJson1DeleteResponsePlanCommandError = async (output, co
1058
1008
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1059
1009
  default:
1060
1010
  const parsedBody = parsedOutput.body;
1061
- const $metadata = deserializeMetadata(output);
1062
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1063
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1064
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1065
- $fault: "client",
1066
- $metadata,
1011
+ (0, smithy_client_1.throwDefaultError)({
1012
+ output,
1013
+ parsedBody,
1014
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
1015
+ errorCode,
1067
1016
  });
1068
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1069
1017
  }
1070
1018
  };
1071
1019
  const deserializeAws_restJson1DeleteTimelineEventCommand = async (output, context) => {
1072
1020
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1073
1021
  return deserializeAws_restJson1DeleteTimelineEventCommandError(output, context);
1074
1022
  }
1075
- const contents = {
1023
+ const contents = map({
1076
1024
  $metadata: deserializeMetadata(output),
1077
- };
1025
+ });
1078
1026
  await collectBody(output.body, context);
1079
- return Promise.resolve(contents);
1027
+ return contents;
1080
1028
  };
1081
1029
  exports.deserializeAws_restJson1DeleteTimelineEventCommand = deserializeAws_restJson1DeleteTimelineEventCommand;
1082
1030
  const deserializeAws_restJson1DeleteTimelineEventCommandError = async (output, context) => {
@@ -1084,7 +1032,6 @@ const deserializeAws_restJson1DeleteTimelineEventCommandError = async (output, c
1084
1032
  ...output,
1085
1033
  body: await parseBody(output.body, context),
1086
1034
  };
1087
- let response;
1088
1035
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1089
1036
  switch (errorCode) {
1090
1037
  case "AccessDeniedException":
@@ -1101,29 +1048,26 @@ const deserializeAws_restJson1DeleteTimelineEventCommandError = async (output, c
1101
1048
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1102
1049
  default:
1103
1050
  const parsedBody = parsedOutput.body;
1104
- const $metadata = deserializeMetadata(output);
1105
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1106
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1107
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1108
- $fault: "client",
1109
- $metadata,
1051
+ (0, smithy_client_1.throwDefaultError)({
1052
+ output,
1053
+ parsedBody,
1054
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
1055
+ errorCode,
1110
1056
  });
1111
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1112
1057
  }
1113
1058
  };
1114
1059
  const deserializeAws_restJson1GetIncidentRecordCommand = async (output, context) => {
1115
1060
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1116
1061
  return deserializeAws_restJson1GetIncidentRecordCommandError(output, context);
1117
1062
  }
1118
- const contents = {
1063
+ const contents = map({
1119
1064
  $metadata: deserializeMetadata(output),
1120
- incidentRecord: undefined,
1121
- };
1065
+ });
1122
1066
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1123
- if (data.incidentRecord !== undefined && data.incidentRecord !== null) {
1067
+ if (data.incidentRecord != null) {
1124
1068
  contents.incidentRecord = deserializeAws_restJson1IncidentRecord(data.incidentRecord, context);
1125
1069
  }
1126
- return Promise.resolve(contents);
1070
+ return contents;
1127
1071
  };
1128
1072
  exports.deserializeAws_restJson1GetIncidentRecordCommand = deserializeAws_restJson1GetIncidentRecordCommand;
1129
1073
  const deserializeAws_restJson1GetIncidentRecordCommandError = async (output, context) => {
@@ -1131,7 +1075,6 @@ const deserializeAws_restJson1GetIncidentRecordCommandError = async (output, con
1131
1075
  ...output,
1132
1076
  body: await parseBody(output.body, context),
1133
1077
  };
1134
- let response;
1135
1078
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1136
1079
  switch (errorCode) {
1137
1080
  case "AccessDeniedException":
@@ -1151,29 +1094,26 @@ const deserializeAws_restJson1GetIncidentRecordCommandError = async (output, con
1151
1094
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1152
1095
  default:
1153
1096
  const parsedBody = parsedOutput.body;
1154
- const $metadata = deserializeMetadata(output);
1155
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1156
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1157
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1158
- $fault: "client",
1159
- $metadata,
1097
+ (0, smithy_client_1.throwDefaultError)({
1098
+ output,
1099
+ parsedBody,
1100
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
1101
+ errorCode,
1160
1102
  });
1161
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1162
1103
  }
1163
1104
  };
1164
1105
  const deserializeAws_restJson1GetReplicationSetCommand = async (output, context) => {
1165
1106
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1166
1107
  return deserializeAws_restJson1GetReplicationSetCommandError(output, context);
1167
1108
  }
1168
- const contents = {
1109
+ const contents = map({
1169
1110
  $metadata: deserializeMetadata(output),
1170
- replicationSet: undefined,
1171
- };
1111
+ });
1172
1112
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1173
- if (data.replicationSet !== undefined && data.replicationSet !== null) {
1113
+ if (data.replicationSet != null) {
1174
1114
  contents.replicationSet = deserializeAws_restJson1ReplicationSet(data.replicationSet, context);
1175
1115
  }
1176
- return Promise.resolve(contents);
1116
+ return contents;
1177
1117
  };
1178
1118
  exports.deserializeAws_restJson1GetReplicationSetCommand = deserializeAws_restJson1GetReplicationSetCommand;
1179
1119
  const deserializeAws_restJson1GetReplicationSetCommandError = async (output, context) => {
@@ -1181,7 +1121,6 @@ const deserializeAws_restJson1GetReplicationSetCommandError = async (output, con
1181
1121
  ...output,
1182
1122
  body: await parseBody(output.body, context),
1183
1123
  };
1184
- let response;
1185
1124
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1186
1125
  switch (errorCode) {
1187
1126
  case "AccessDeniedException":
@@ -1201,33 +1140,29 @@ const deserializeAws_restJson1GetReplicationSetCommandError = async (output, con
1201
1140
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1202
1141
  default:
1203
1142
  const parsedBody = parsedOutput.body;
1204
- const $metadata = deserializeMetadata(output);
1205
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1206
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1207
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1208
- $fault: "client",
1209
- $metadata,
1143
+ (0, smithy_client_1.throwDefaultError)({
1144
+ output,
1145
+ parsedBody,
1146
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
1147
+ errorCode,
1210
1148
  });
1211
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1212
1149
  }
1213
1150
  };
1214
1151
  const deserializeAws_restJson1GetResourcePoliciesCommand = async (output, context) => {
1215
1152
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1216
1153
  return deserializeAws_restJson1GetResourcePoliciesCommandError(output, context);
1217
1154
  }
1218
- const contents = {
1155
+ const contents = map({
1219
1156
  $metadata: deserializeMetadata(output),
1220
- nextToken: undefined,
1221
- resourcePolicies: undefined,
1222
- };
1157
+ });
1223
1158
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1224
- if (data.nextToken !== undefined && data.nextToken !== null) {
1159
+ if (data.nextToken != null) {
1225
1160
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1226
1161
  }
1227
- if (data.resourcePolicies !== undefined && data.resourcePolicies !== null) {
1162
+ if (data.resourcePolicies != null) {
1228
1163
  contents.resourcePolicies = deserializeAws_restJson1ResourcePolicyList(data.resourcePolicies, context);
1229
1164
  }
1230
- return Promise.resolve(contents);
1165
+ return contents;
1231
1166
  };
1232
1167
  exports.deserializeAws_restJson1GetResourcePoliciesCommand = deserializeAws_restJson1GetResourcePoliciesCommand;
1233
1168
  const deserializeAws_restJson1GetResourcePoliciesCommandError = async (output, context) => {
@@ -1235,7 +1170,6 @@ const deserializeAws_restJson1GetResourcePoliciesCommandError = async (output, c
1235
1170
  ...output,
1236
1171
  body: await parseBody(output.body, context),
1237
1172
  };
1238
- let response;
1239
1173
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1240
1174
  switch (errorCode) {
1241
1175
  case "AccessDeniedException":
@@ -1255,53 +1189,44 @@ const deserializeAws_restJson1GetResourcePoliciesCommandError = async (output, c
1255
1189
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1256
1190
  default:
1257
1191
  const parsedBody = parsedOutput.body;
1258
- const $metadata = deserializeMetadata(output);
1259
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1260
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1261
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1262
- $fault: "client",
1263
- $metadata,
1192
+ (0, smithy_client_1.throwDefaultError)({
1193
+ output,
1194
+ parsedBody,
1195
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
1196
+ errorCode,
1264
1197
  });
1265
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1266
1198
  }
1267
1199
  };
1268
1200
  const deserializeAws_restJson1GetResponsePlanCommand = async (output, context) => {
1269
1201
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1270
1202
  return deserializeAws_restJson1GetResponsePlanCommandError(output, context);
1271
1203
  }
1272
- const contents = {
1204
+ const contents = map({
1273
1205
  $metadata: deserializeMetadata(output),
1274
- actions: undefined,
1275
- arn: undefined,
1276
- chatChannel: undefined,
1277
- displayName: undefined,
1278
- engagements: undefined,
1279
- incidentTemplate: undefined,
1280
- name: undefined,
1281
- };
1206
+ });
1282
1207
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1283
- if (data.actions !== undefined && data.actions !== null) {
1208
+ if (data.actions != null) {
1284
1209
  contents.actions = deserializeAws_restJson1ActionsList(data.actions, context);
1285
1210
  }
1286
- if (data.arn !== undefined && data.arn !== null) {
1211
+ if (data.arn != null) {
1287
1212
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
1288
1213
  }
1289
- if (data.chatChannel !== undefined && data.chatChannel !== null) {
1214
+ if (data.chatChannel != null) {
1290
1215
  contents.chatChannel = deserializeAws_restJson1ChatChannel((0, smithy_client_1.expectUnion)(data.chatChannel), context);
1291
1216
  }
1292
- if (data.displayName !== undefined && data.displayName !== null) {
1217
+ if (data.displayName != null) {
1293
1218
  contents.displayName = (0, smithy_client_1.expectString)(data.displayName);
1294
1219
  }
1295
- if (data.engagements !== undefined && data.engagements !== null) {
1220
+ if (data.engagements != null) {
1296
1221
  contents.engagements = deserializeAws_restJson1EngagementSet(data.engagements, context);
1297
1222
  }
1298
- if (data.incidentTemplate !== undefined && data.incidentTemplate !== null) {
1223
+ if (data.incidentTemplate != null) {
1299
1224
  contents.incidentTemplate = deserializeAws_restJson1IncidentTemplate(data.incidentTemplate, context);
1300
1225
  }
1301
- if (data.name !== undefined && data.name !== null) {
1226
+ if (data.name != null) {
1302
1227
  contents.name = (0, smithy_client_1.expectString)(data.name);
1303
1228
  }
1304
- return Promise.resolve(contents);
1229
+ return contents;
1305
1230
  };
1306
1231
  exports.deserializeAws_restJson1GetResponsePlanCommand = deserializeAws_restJson1GetResponsePlanCommand;
1307
1232
  const deserializeAws_restJson1GetResponsePlanCommandError = async (output, context) => {
@@ -1309,7 +1234,6 @@ const deserializeAws_restJson1GetResponsePlanCommandError = async (output, conte
1309
1234
  ...output,
1310
1235
  body: await parseBody(output.body, context),
1311
1236
  };
1312
- let response;
1313
1237
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1314
1238
  switch (errorCode) {
1315
1239
  case "AccessDeniedException":
@@ -1329,29 +1253,26 @@ const deserializeAws_restJson1GetResponsePlanCommandError = async (output, conte
1329
1253
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1330
1254
  default:
1331
1255
  const parsedBody = parsedOutput.body;
1332
- const $metadata = deserializeMetadata(output);
1333
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1334
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1335
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1336
- $fault: "client",
1337
- $metadata,
1256
+ (0, smithy_client_1.throwDefaultError)({
1257
+ output,
1258
+ parsedBody,
1259
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
1260
+ errorCode,
1338
1261
  });
1339
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1340
1262
  }
1341
1263
  };
1342
1264
  const deserializeAws_restJson1GetTimelineEventCommand = async (output, context) => {
1343
1265
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1344
1266
  return deserializeAws_restJson1GetTimelineEventCommandError(output, context);
1345
1267
  }
1346
- const contents = {
1268
+ const contents = map({
1347
1269
  $metadata: deserializeMetadata(output),
1348
- event: undefined,
1349
- };
1270
+ });
1350
1271
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1351
- if (data.event !== undefined && data.event !== null) {
1272
+ if (data.event != null) {
1352
1273
  contents.event = deserializeAws_restJson1TimelineEvent(data.event, context);
1353
1274
  }
1354
- return Promise.resolve(contents);
1275
+ return contents;
1355
1276
  };
1356
1277
  exports.deserializeAws_restJson1GetTimelineEventCommand = deserializeAws_restJson1GetTimelineEventCommand;
1357
1278
  const deserializeAws_restJson1GetTimelineEventCommandError = async (output, context) => {
@@ -1359,7 +1280,6 @@ const deserializeAws_restJson1GetTimelineEventCommandError = async (output, cont
1359
1280
  ...output,
1360
1281
  body: await parseBody(output.body, context),
1361
1282
  };
1362
- let response;
1363
1283
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1364
1284
  switch (errorCode) {
1365
1285
  case "AccessDeniedException":
@@ -1379,33 +1299,29 @@ const deserializeAws_restJson1GetTimelineEventCommandError = async (output, cont
1379
1299
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1380
1300
  default:
1381
1301
  const parsedBody = parsedOutput.body;
1382
- const $metadata = deserializeMetadata(output);
1383
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1384
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1385
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1386
- $fault: "client",
1387
- $metadata,
1302
+ (0, smithy_client_1.throwDefaultError)({
1303
+ output,
1304
+ parsedBody,
1305
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
1306
+ errorCode,
1388
1307
  });
1389
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1390
1308
  }
1391
1309
  };
1392
1310
  const deserializeAws_restJson1ListIncidentRecordsCommand = async (output, context) => {
1393
1311
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1394
1312
  return deserializeAws_restJson1ListIncidentRecordsCommandError(output, context);
1395
1313
  }
1396
- const contents = {
1314
+ const contents = map({
1397
1315
  $metadata: deserializeMetadata(output),
1398
- incidentRecordSummaries: undefined,
1399
- nextToken: undefined,
1400
- };
1316
+ });
1401
1317
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1402
- if (data.incidentRecordSummaries !== undefined && data.incidentRecordSummaries !== null) {
1318
+ if (data.incidentRecordSummaries != null) {
1403
1319
  contents.incidentRecordSummaries = deserializeAws_restJson1IncidentRecordSummaryList(data.incidentRecordSummaries, context);
1404
1320
  }
1405
- if (data.nextToken !== undefined && data.nextToken !== null) {
1321
+ if (data.nextToken != null) {
1406
1322
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1407
1323
  }
1408
- return Promise.resolve(contents);
1324
+ return contents;
1409
1325
  };
1410
1326
  exports.deserializeAws_restJson1ListIncidentRecordsCommand = deserializeAws_restJson1ListIncidentRecordsCommand;
1411
1327
  const deserializeAws_restJson1ListIncidentRecordsCommandError = async (output, context) => {
@@ -1413,7 +1329,6 @@ const deserializeAws_restJson1ListIncidentRecordsCommandError = async (output, c
1413
1329
  ...output,
1414
1330
  body: await parseBody(output.body, context),
1415
1331
  };
1416
- let response;
1417
1332
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1418
1333
  switch (errorCode) {
1419
1334
  case "AccessDeniedException":
@@ -1430,33 +1345,29 @@ const deserializeAws_restJson1ListIncidentRecordsCommandError = async (output, c
1430
1345
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1431
1346
  default:
1432
1347
  const parsedBody = parsedOutput.body;
1433
- const $metadata = deserializeMetadata(output);
1434
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1435
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1436
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1437
- $fault: "client",
1438
- $metadata,
1348
+ (0, smithy_client_1.throwDefaultError)({
1349
+ output,
1350
+ parsedBody,
1351
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
1352
+ errorCode,
1439
1353
  });
1440
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1441
1354
  }
1442
1355
  };
1443
1356
  const deserializeAws_restJson1ListRelatedItemsCommand = async (output, context) => {
1444
1357
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1445
1358
  return deserializeAws_restJson1ListRelatedItemsCommandError(output, context);
1446
1359
  }
1447
- const contents = {
1360
+ const contents = map({
1448
1361
  $metadata: deserializeMetadata(output),
1449
- nextToken: undefined,
1450
- relatedItems: undefined,
1451
- };
1362
+ });
1452
1363
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1453
- if (data.nextToken !== undefined && data.nextToken !== null) {
1364
+ if (data.nextToken != null) {
1454
1365
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1455
1366
  }
1456
- if (data.relatedItems !== undefined && data.relatedItems !== null) {
1367
+ if (data.relatedItems != null) {
1457
1368
  contents.relatedItems = deserializeAws_restJson1RelatedItemList(data.relatedItems, context);
1458
1369
  }
1459
- return Promise.resolve(contents);
1370
+ return contents;
1460
1371
  };
1461
1372
  exports.deserializeAws_restJson1ListRelatedItemsCommand = deserializeAws_restJson1ListRelatedItemsCommand;
1462
1373
  const deserializeAws_restJson1ListRelatedItemsCommandError = async (output, context) => {
@@ -1464,7 +1375,6 @@ const deserializeAws_restJson1ListRelatedItemsCommandError = async (output, cont
1464
1375
  ...output,
1465
1376
  body: await parseBody(output.body, context),
1466
1377
  };
1467
- let response;
1468
1378
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1469
1379
  switch (errorCode) {
1470
1380
  case "AccessDeniedException":
@@ -1481,33 +1391,29 @@ const deserializeAws_restJson1ListRelatedItemsCommandError = async (output, cont
1481
1391
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1482
1392
  default:
1483
1393
  const parsedBody = parsedOutput.body;
1484
- const $metadata = deserializeMetadata(output);
1485
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1486
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1487
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1488
- $fault: "client",
1489
- $metadata,
1394
+ (0, smithy_client_1.throwDefaultError)({
1395
+ output,
1396
+ parsedBody,
1397
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
1398
+ errorCode,
1490
1399
  });
1491
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1492
1400
  }
1493
1401
  };
1494
1402
  const deserializeAws_restJson1ListReplicationSetsCommand = async (output, context) => {
1495
1403
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1496
1404
  return deserializeAws_restJson1ListReplicationSetsCommandError(output, context);
1497
1405
  }
1498
- const contents = {
1406
+ const contents = map({
1499
1407
  $metadata: deserializeMetadata(output),
1500
- nextToken: undefined,
1501
- replicationSetArns: undefined,
1502
- };
1408
+ });
1503
1409
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1504
- if (data.nextToken !== undefined && data.nextToken !== null) {
1410
+ if (data.nextToken != null) {
1505
1411
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1506
1412
  }
1507
- if (data.replicationSetArns !== undefined && data.replicationSetArns !== null) {
1413
+ if (data.replicationSetArns != null) {
1508
1414
  contents.replicationSetArns = deserializeAws_restJson1ReplicationSetArnList(data.replicationSetArns, context);
1509
1415
  }
1510
- return Promise.resolve(contents);
1416
+ return contents;
1511
1417
  };
1512
1418
  exports.deserializeAws_restJson1ListReplicationSetsCommand = deserializeAws_restJson1ListReplicationSetsCommand;
1513
1419
  const deserializeAws_restJson1ListReplicationSetsCommandError = async (output, context) => {
@@ -1515,7 +1421,6 @@ const deserializeAws_restJson1ListReplicationSetsCommandError = async (output, c
1515
1421
  ...output,
1516
1422
  body: await parseBody(output.body, context),
1517
1423
  };
1518
- let response;
1519
1424
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1520
1425
  switch (errorCode) {
1521
1426
  case "AccessDeniedException":
@@ -1532,33 +1437,29 @@ const deserializeAws_restJson1ListReplicationSetsCommandError = async (output, c
1532
1437
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1533
1438
  default:
1534
1439
  const parsedBody = parsedOutput.body;
1535
- const $metadata = deserializeMetadata(output);
1536
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1537
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1538
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1539
- $fault: "client",
1540
- $metadata,
1440
+ (0, smithy_client_1.throwDefaultError)({
1441
+ output,
1442
+ parsedBody,
1443
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
1444
+ errorCode,
1541
1445
  });
1542
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1543
1446
  }
1544
1447
  };
1545
1448
  const deserializeAws_restJson1ListResponsePlansCommand = async (output, context) => {
1546
1449
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1547
1450
  return deserializeAws_restJson1ListResponsePlansCommandError(output, context);
1548
1451
  }
1549
- const contents = {
1452
+ const contents = map({
1550
1453
  $metadata: deserializeMetadata(output),
1551
- nextToken: undefined,
1552
- responsePlanSummaries: undefined,
1553
- };
1454
+ });
1554
1455
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1555
- if (data.nextToken !== undefined && data.nextToken !== null) {
1456
+ if (data.nextToken != null) {
1556
1457
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1557
1458
  }
1558
- if (data.responsePlanSummaries !== undefined && data.responsePlanSummaries !== null) {
1459
+ if (data.responsePlanSummaries != null) {
1559
1460
  contents.responsePlanSummaries = deserializeAws_restJson1ResponsePlanSummaryList(data.responsePlanSummaries, context);
1560
1461
  }
1561
- return Promise.resolve(contents);
1462
+ return contents;
1562
1463
  };
1563
1464
  exports.deserializeAws_restJson1ListResponsePlansCommand = deserializeAws_restJson1ListResponsePlansCommand;
1564
1465
  const deserializeAws_restJson1ListResponsePlansCommandError = async (output, context) => {
@@ -1566,7 +1467,6 @@ const deserializeAws_restJson1ListResponsePlansCommandError = async (output, con
1566
1467
  ...output,
1567
1468
  body: await parseBody(output.body, context),
1568
1469
  };
1569
- let response;
1570
1470
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1571
1471
  switch (errorCode) {
1572
1472
  case "AccessDeniedException":
@@ -1583,29 +1483,26 @@ const deserializeAws_restJson1ListResponsePlansCommandError = async (output, con
1583
1483
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1584
1484
  default:
1585
1485
  const parsedBody = parsedOutput.body;
1586
- const $metadata = deserializeMetadata(output);
1587
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1588
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1589
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1590
- $fault: "client",
1591
- $metadata,
1486
+ (0, smithy_client_1.throwDefaultError)({
1487
+ output,
1488
+ parsedBody,
1489
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
1490
+ errorCode,
1592
1491
  });
1593
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1594
1492
  }
1595
1493
  };
1596
1494
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
1597
1495
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1598
1496
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
1599
1497
  }
1600
- const contents = {
1498
+ const contents = map({
1601
1499
  $metadata: deserializeMetadata(output),
1602
- tags: undefined,
1603
- };
1500
+ });
1604
1501
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1605
- if (data.tags !== undefined && data.tags !== null) {
1502
+ if (data.tags != null) {
1606
1503
  contents.tags = deserializeAws_restJson1TagMap(data.tags, context);
1607
1504
  }
1608
- return Promise.resolve(contents);
1505
+ return contents;
1609
1506
  };
1610
1507
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
1611
1508
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -1613,7 +1510,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1613
1510
  ...output,
1614
1511
  body: await parseBody(output.body, context),
1615
1512
  };
1616
- let response;
1617
1513
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1618
1514
  switch (errorCode) {
1619
1515
  case "AccessDeniedException":
@@ -1633,33 +1529,29 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
1633
1529
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1634
1530
  default:
1635
1531
  const parsedBody = parsedOutput.body;
1636
- const $metadata = deserializeMetadata(output);
1637
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1638
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1639
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1640
- $fault: "client",
1641
- $metadata,
1532
+ (0, smithy_client_1.throwDefaultError)({
1533
+ output,
1534
+ parsedBody,
1535
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
1536
+ errorCode,
1642
1537
  });
1643
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1644
1538
  }
1645
1539
  };
1646
1540
  const deserializeAws_restJson1ListTimelineEventsCommand = async (output, context) => {
1647
1541
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1648
1542
  return deserializeAws_restJson1ListTimelineEventsCommandError(output, context);
1649
1543
  }
1650
- const contents = {
1544
+ const contents = map({
1651
1545
  $metadata: deserializeMetadata(output),
1652
- eventSummaries: undefined,
1653
- nextToken: undefined,
1654
- };
1546
+ });
1655
1547
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1656
- if (data.eventSummaries !== undefined && data.eventSummaries !== null) {
1548
+ if (data.eventSummaries != null) {
1657
1549
  contents.eventSummaries = deserializeAws_restJson1EventSummaryList(data.eventSummaries, context);
1658
1550
  }
1659
- if (data.nextToken !== undefined && data.nextToken !== null) {
1551
+ if (data.nextToken != null) {
1660
1552
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1661
1553
  }
1662
- return Promise.resolve(contents);
1554
+ return contents;
1663
1555
  };
1664
1556
  exports.deserializeAws_restJson1ListTimelineEventsCommand = deserializeAws_restJson1ListTimelineEventsCommand;
1665
1557
  const deserializeAws_restJson1ListTimelineEventsCommandError = async (output, context) => {
@@ -1667,7 +1559,6 @@ const deserializeAws_restJson1ListTimelineEventsCommandError = async (output, co
1667
1559
  ...output,
1668
1560
  body: await parseBody(output.body, context),
1669
1561
  };
1670
- let response;
1671
1562
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1672
1563
  switch (errorCode) {
1673
1564
  case "AccessDeniedException":
@@ -1684,29 +1575,26 @@ const deserializeAws_restJson1ListTimelineEventsCommandError = async (output, co
1684
1575
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1685
1576
  default:
1686
1577
  const parsedBody = parsedOutput.body;
1687
- const $metadata = deserializeMetadata(output);
1688
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1689
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1690
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1691
- $fault: "client",
1692
- $metadata,
1578
+ (0, smithy_client_1.throwDefaultError)({
1579
+ output,
1580
+ parsedBody,
1581
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
1582
+ errorCode,
1693
1583
  });
1694
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1695
1584
  }
1696
1585
  };
1697
1586
  const deserializeAws_restJson1PutResourcePolicyCommand = async (output, context) => {
1698
1587
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1699
1588
  return deserializeAws_restJson1PutResourcePolicyCommandError(output, context);
1700
1589
  }
1701
- const contents = {
1590
+ const contents = map({
1702
1591
  $metadata: deserializeMetadata(output),
1703
- policyId: undefined,
1704
- };
1592
+ });
1705
1593
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1706
- if (data.policyId !== undefined && data.policyId !== null) {
1594
+ if (data.policyId != null) {
1707
1595
  contents.policyId = (0, smithy_client_1.expectString)(data.policyId);
1708
1596
  }
1709
- return Promise.resolve(contents);
1597
+ return contents;
1710
1598
  };
1711
1599
  exports.deserializeAws_restJson1PutResourcePolicyCommand = deserializeAws_restJson1PutResourcePolicyCommand;
1712
1600
  const deserializeAws_restJson1PutResourcePolicyCommandError = async (output, context) => {
@@ -1714,7 +1602,6 @@ const deserializeAws_restJson1PutResourcePolicyCommandError = async (output, con
1714
1602
  ...output,
1715
1603
  body: await parseBody(output.body, context),
1716
1604
  };
1717
- let response;
1718
1605
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1719
1606
  switch (errorCode) {
1720
1607
  case "AccessDeniedException":
@@ -1734,29 +1621,26 @@ const deserializeAws_restJson1PutResourcePolicyCommandError = async (output, con
1734
1621
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1735
1622
  default:
1736
1623
  const parsedBody = parsedOutput.body;
1737
- const $metadata = deserializeMetadata(output);
1738
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1739
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1740
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1741
- $fault: "client",
1742
- $metadata,
1624
+ (0, smithy_client_1.throwDefaultError)({
1625
+ output,
1626
+ parsedBody,
1627
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
1628
+ errorCode,
1743
1629
  });
1744
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1745
1630
  }
1746
1631
  };
1747
1632
  const deserializeAws_restJson1StartIncidentCommand = async (output, context) => {
1748
1633
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1749
1634
  return deserializeAws_restJson1StartIncidentCommandError(output, context);
1750
1635
  }
1751
- const contents = {
1636
+ const contents = map({
1752
1637
  $metadata: deserializeMetadata(output),
1753
- incidentRecordArn: undefined,
1754
- };
1638
+ });
1755
1639
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1756
- if (data.incidentRecordArn !== undefined && data.incidentRecordArn !== null) {
1640
+ if (data.incidentRecordArn != null) {
1757
1641
  contents.incidentRecordArn = (0, smithy_client_1.expectString)(data.incidentRecordArn);
1758
1642
  }
1759
- return Promise.resolve(contents);
1643
+ return contents;
1760
1644
  };
1761
1645
  exports.deserializeAws_restJson1StartIncidentCommand = deserializeAws_restJson1StartIncidentCommand;
1762
1646
  const deserializeAws_restJson1StartIncidentCommandError = async (output, context) => {
@@ -1764,7 +1648,6 @@ const deserializeAws_restJson1StartIncidentCommandError = async (output, context
1764
1648
  ...output,
1765
1649
  body: await parseBody(output.body, context),
1766
1650
  };
1767
- let response;
1768
1651
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1769
1652
  switch (errorCode) {
1770
1653
  case "AccessDeniedException":
@@ -1787,25 +1670,23 @@ const deserializeAws_restJson1StartIncidentCommandError = async (output, context
1787
1670
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1788
1671
  default:
1789
1672
  const parsedBody = parsedOutput.body;
1790
- const $metadata = deserializeMetadata(output);
1791
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1792
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1793
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1794
- $fault: "client",
1795
- $metadata,
1673
+ (0, smithy_client_1.throwDefaultError)({
1674
+ output,
1675
+ parsedBody,
1676
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
1677
+ errorCode,
1796
1678
  });
1797
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1798
1679
  }
1799
1680
  };
1800
1681
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
1801
1682
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1802
1683
  return deserializeAws_restJson1TagResourceCommandError(output, context);
1803
1684
  }
1804
- const contents = {
1685
+ const contents = map({
1805
1686
  $metadata: deserializeMetadata(output),
1806
- };
1687
+ });
1807
1688
  await collectBody(output.body, context);
1808
- return Promise.resolve(contents);
1689
+ return contents;
1809
1690
  };
1810
1691
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
1811
1692
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -1813,7 +1694,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1813
1694
  ...output,
1814
1695
  body: await parseBody(output.body, context),
1815
1696
  };
1816
- let response;
1817
1697
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1818
1698
  switch (errorCode) {
1819
1699
  case "AccessDeniedException":
@@ -1839,25 +1719,23 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
1839
1719
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1840
1720
  default:
1841
1721
  const parsedBody = parsedOutput.body;
1842
- const $metadata = deserializeMetadata(output);
1843
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1844
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1845
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1846
- $fault: "client",
1847
- $metadata,
1722
+ (0, smithy_client_1.throwDefaultError)({
1723
+ output,
1724
+ parsedBody,
1725
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
1726
+ errorCode,
1848
1727
  });
1849
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1850
1728
  }
1851
1729
  };
1852
1730
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
1853
1731
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1854
1732
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
1855
1733
  }
1856
- const contents = {
1734
+ const contents = map({
1857
1735
  $metadata: deserializeMetadata(output),
1858
- };
1736
+ });
1859
1737
  await collectBody(output.body, context);
1860
- return Promise.resolve(contents);
1738
+ return contents;
1861
1739
  };
1862
1740
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
1863
1741
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -1865,7 +1743,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1865
1743
  ...output,
1866
1744
  body: await parseBody(output.body, context),
1867
1745
  };
1868
- let response;
1869
1746
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1870
1747
  switch (errorCode) {
1871
1748
  case "AccessDeniedException":
@@ -1888,25 +1765,23 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
1888
1765
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1889
1766
  default:
1890
1767
  const parsedBody = parsedOutput.body;
1891
- const $metadata = deserializeMetadata(output);
1892
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1893
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1894
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1895
- $fault: "client",
1896
- $metadata,
1768
+ (0, smithy_client_1.throwDefaultError)({
1769
+ output,
1770
+ parsedBody,
1771
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
1772
+ errorCode,
1897
1773
  });
1898
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1899
1774
  }
1900
1775
  };
1901
1776
  const deserializeAws_restJson1UpdateDeletionProtectionCommand = async (output, context) => {
1902
1777
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1903
1778
  return deserializeAws_restJson1UpdateDeletionProtectionCommandError(output, context);
1904
1779
  }
1905
- const contents = {
1780
+ const contents = map({
1906
1781
  $metadata: deserializeMetadata(output),
1907
- };
1782
+ });
1908
1783
  await collectBody(output.body, context);
1909
- return Promise.resolve(contents);
1784
+ return contents;
1910
1785
  };
1911
1786
  exports.deserializeAws_restJson1UpdateDeletionProtectionCommand = deserializeAws_restJson1UpdateDeletionProtectionCommand;
1912
1787
  const deserializeAws_restJson1UpdateDeletionProtectionCommandError = async (output, context) => {
@@ -1914,7 +1789,6 @@ const deserializeAws_restJson1UpdateDeletionProtectionCommandError = async (outp
1914
1789
  ...output,
1915
1790
  body: await parseBody(output.body, context),
1916
1791
  };
1917
- let response;
1918
1792
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1919
1793
  switch (errorCode) {
1920
1794
  case "AccessDeniedException":
@@ -1934,25 +1808,23 @@ const deserializeAws_restJson1UpdateDeletionProtectionCommandError = async (outp
1934
1808
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1935
1809
  default:
1936
1810
  const parsedBody = parsedOutput.body;
1937
- const $metadata = deserializeMetadata(output);
1938
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1939
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1940
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1941
- $fault: "client",
1942
- $metadata,
1811
+ (0, smithy_client_1.throwDefaultError)({
1812
+ output,
1813
+ parsedBody,
1814
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
1815
+ errorCode,
1943
1816
  });
1944
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1945
1817
  }
1946
1818
  };
1947
1819
  const deserializeAws_restJson1UpdateIncidentRecordCommand = async (output, context) => {
1948
1820
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1949
1821
  return deserializeAws_restJson1UpdateIncidentRecordCommandError(output, context);
1950
1822
  }
1951
- const contents = {
1823
+ const contents = map({
1952
1824
  $metadata: deserializeMetadata(output),
1953
- };
1825
+ });
1954
1826
  await collectBody(output.body, context);
1955
- return Promise.resolve(contents);
1827
+ return contents;
1956
1828
  };
1957
1829
  exports.deserializeAws_restJson1UpdateIncidentRecordCommand = deserializeAws_restJson1UpdateIncidentRecordCommand;
1958
1830
  const deserializeAws_restJson1UpdateIncidentRecordCommandError = async (output, context) => {
@@ -1960,7 +1832,6 @@ const deserializeAws_restJson1UpdateIncidentRecordCommandError = async (output,
1960
1832
  ...output,
1961
1833
  body: await parseBody(output.body, context),
1962
1834
  };
1963
- let response;
1964
1835
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1965
1836
  switch (errorCode) {
1966
1837
  case "AccessDeniedException":
@@ -1983,25 +1854,23 @@ const deserializeAws_restJson1UpdateIncidentRecordCommandError = async (output,
1983
1854
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1984
1855
  default:
1985
1856
  const parsedBody = parsedOutput.body;
1986
- const $metadata = deserializeMetadata(output);
1987
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1988
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1989
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1990
- $fault: "client",
1991
- $metadata,
1857
+ (0, smithy_client_1.throwDefaultError)({
1858
+ output,
1859
+ parsedBody,
1860
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
1861
+ errorCode,
1992
1862
  });
1993
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1994
1863
  }
1995
1864
  };
1996
1865
  const deserializeAws_restJson1UpdateRelatedItemsCommand = async (output, context) => {
1997
1866
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1998
1867
  return deserializeAws_restJson1UpdateRelatedItemsCommandError(output, context);
1999
1868
  }
2000
- const contents = {
1869
+ const contents = map({
2001
1870
  $metadata: deserializeMetadata(output),
2002
- };
1871
+ });
2003
1872
  await collectBody(output.body, context);
2004
- return Promise.resolve(contents);
1873
+ return contents;
2005
1874
  };
2006
1875
  exports.deserializeAws_restJson1UpdateRelatedItemsCommand = deserializeAws_restJson1UpdateRelatedItemsCommand;
2007
1876
  const deserializeAws_restJson1UpdateRelatedItemsCommandError = async (output, context) => {
@@ -2009,7 +1878,6 @@ const deserializeAws_restJson1UpdateRelatedItemsCommandError = async (output, co
2009
1878
  ...output,
2010
1879
  body: await parseBody(output.body, context),
2011
1880
  };
2012
- let response;
2013
1881
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2014
1882
  switch (errorCode) {
2015
1883
  case "AccessDeniedException":
@@ -2032,25 +1900,23 @@ const deserializeAws_restJson1UpdateRelatedItemsCommandError = async (output, co
2032
1900
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2033
1901
  default:
2034
1902
  const parsedBody = parsedOutput.body;
2035
- const $metadata = deserializeMetadata(output);
2036
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2037
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
2038
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2039
- $fault: "client",
2040
- $metadata,
1903
+ (0, smithy_client_1.throwDefaultError)({
1904
+ output,
1905
+ parsedBody,
1906
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
1907
+ errorCode,
2041
1908
  });
2042
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2043
1909
  }
2044
1910
  };
2045
1911
  const deserializeAws_restJson1UpdateReplicationSetCommand = async (output, context) => {
2046
1912
  if (output.statusCode !== 204 && output.statusCode >= 300) {
2047
1913
  return deserializeAws_restJson1UpdateReplicationSetCommandError(output, context);
2048
1914
  }
2049
- const contents = {
1915
+ const contents = map({
2050
1916
  $metadata: deserializeMetadata(output),
2051
- };
1917
+ });
2052
1918
  await collectBody(output.body, context);
2053
- return Promise.resolve(contents);
1919
+ return contents;
2054
1920
  };
2055
1921
  exports.deserializeAws_restJson1UpdateReplicationSetCommand = deserializeAws_restJson1UpdateReplicationSetCommand;
2056
1922
  const deserializeAws_restJson1UpdateReplicationSetCommandError = async (output, context) => {
@@ -2058,7 +1924,6 @@ const deserializeAws_restJson1UpdateReplicationSetCommandError = async (output,
2058
1924
  ...output,
2059
1925
  body: await parseBody(output.body, context),
2060
1926
  };
2061
- let response;
2062
1927
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2063
1928
  switch (errorCode) {
2064
1929
  case "AccessDeniedException":
@@ -2081,25 +1946,23 @@ const deserializeAws_restJson1UpdateReplicationSetCommandError = async (output,
2081
1946
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2082
1947
  default:
2083
1948
  const parsedBody = parsedOutput.body;
2084
- const $metadata = deserializeMetadata(output);
2085
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2086
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
2087
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2088
- $fault: "client",
2089
- $metadata,
1949
+ (0, smithy_client_1.throwDefaultError)({
1950
+ output,
1951
+ parsedBody,
1952
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
1953
+ errorCode,
2090
1954
  });
2091
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2092
1955
  }
2093
1956
  };
2094
1957
  const deserializeAws_restJson1UpdateResponsePlanCommand = async (output, context) => {
2095
1958
  if (output.statusCode !== 204 && output.statusCode >= 300) {
2096
1959
  return deserializeAws_restJson1UpdateResponsePlanCommandError(output, context);
2097
1960
  }
2098
- const contents = {
1961
+ const contents = map({
2099
1962
  $metadata: deserializeMetadata(output),
2100
- };
1963
+ });
2101
1964
  await collectBody(output.body, context);
2102
- return Promise.resolve(contents);
1965
+ return contents;
2103
1966
  };
2104
1967
  exports.deserializeAws_restJson1UpdateResponsePlanCommand = deserializeAws_restJson1UpdateResponsePlanCommand;
2105
1968
  const deserializeAws_restJson1UpdateResponsePlanCommandError = async (output, context) => {
@@ -2107,7 +1970,6 @@ const deserializeAws_restJson1UpdateResponsePlanCommandError = async (output, co
2107
1970
  ...output,
2108
1971
  body: await parseBody(output.body, context),
2109
1972
  };
2110
- let response;
2111
1973
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2112
1974
  switch (errorCode) {
2113
1975
  case "AccessDeniedException":
@@ -2130,25 +1992,23 @@ const deserializeAws_restJson1UpdateResponsePlanCommandError = async (output, co
2130
1992
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2131
1993
  default:
2132
1994
  const parsedBody = parsedOutput.body;
2133
- const $metadata = deserializeMetadata(output);
2134
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2135
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
2136
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2137
- $fault: "client",
2138
- $metadata,
1995
+ (0, smithy_client_1.throwDefaultError)({
1996
+ output,
1997
+ parsedBody,
1998
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
1999
+ errorCode,
2139
2000
  });
2140
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2141
2001
  }
2142
2002
  };
2143
2003
  const deserializeAws_restJson1UpdateTimelineEventCommand = async (output, context) => {
2144
2004
  if (output.statusCode !== 204 && output.statusCode >= 300) {
2145
2005
  return deserializeAws_restJson1UpdateTimelineEventCommandError(output, context);
2146
2006
  }
2147
- const contents = {
2007
+ const contents = map({
2148
2008
  $metadata: deserializeMetadata(output),
2149
- };
2009
+ });
2150
2010
  await collectBody(output.body, context);
2151
- return Promise.resolve(contents);
2011
+ return contents;
2152
2012
  };
2153
2013
  exports.deserializeAws_restJson1UpdateTimelineEventCommand = deserializeAws_restJson1UpdateTimelineEventCommand;
2154
2014
  const deserializeAws_restJson1UpdateTimelineEventCommandError = async (output, context) => {
@@ -2156,7 +2016,6 @@ const deserializeAws_restJson1UpdateTimelineEventCommandError = async (output, c
2156
2016
  ...output,
2157
2017
  body: await parseBody(output.body, context),
2158
2018
  };
2159
- let response;
2160
2019
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2161
2020
  switch (errorCode) {
2162
2021
  case "AccessDeniedException":
@@ -2179,20 +2038,19 @@ const deserializeAws_restJson1UpdateTimelineEventCommandError = async (output, c
2179
2038
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2180
2039
  default:
2181
2040
  const parsedBody = parsedOutput.body;
2182
- const $metadata = deserializeMetadata(output);
2183
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2184
- response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
2185
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2186
- $fault: "client",
2187
- $metadata,
2041
+ (0, smithy_client_1.throwDefaultError)({
2042
+ output,
2043
+ parsedBody,
2044
+ exceptionCtor: SSMIncidentsServiceException_1.SSMIncidentsServiceException,
2045
+ errorCode,
2188
2046
  });
2189
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2190
2047
  }
2191
2048
  };
2049
+ const map = smithy_client_1.map;
2192
2050
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
2193
- const contents = {};
2051
+ const contents = map({});
2194
2052
  const data = parsedOutput.body;
2195
- if (data.message !== undefined && data.message !== null) {
2053
+ if (data.message != null) {
2196
2054
  contents.message = (0, smithy_client_1.expectString)(data.message);
2197
2055
  }
2198
2056
  const exception = new models_0_1.AccessDeniedException({
@@ -2202,18 +2060,18 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
2202
2060
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2203
2061
  };
2204
2062
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
2205
- const contents = {};
2063
+ const contents = map({});
2206
2064
  const data = parsedOutput.body;
2207
- if (data.message !== undefined && data.message !== null) {
2065
+ if (data.message != null) {
2208
2066
  contents.message = (0, smithy_client_1.expectString)(data.message);
2209
2067
  }
2210
- if (data.resourceIdentifier !== undefined && data.resourceIdentifier !== null) {
2068
+ if (data.resourceIdentifier != null) {
2211
2069
  contents.resourceIdentifier = (0, smithy_client_1.expectString)(data.resourceIdentifier);
2212
2070
  }
2213
- if (data.resourceType !== undefined && data.resourceType !== null) {
2071
+ if (data.resourceType != null) {
2214
2072
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
2215
2073
  }
2216
- if (data.retryAfter !== undefined && data.retryAfter !== null) {
2074
+ if (data.retryAfter != null) {
2217
2075
  contents.retryAfter = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.retryAfter)));
2218
2076
  }
2219
2077
  const exception = new models_0_1.ConflictException({
@@ -2223,9 +2081,9 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
2223
2081
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2224
2082
  };
2225
2083
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
2226
- const contents = {};
2084
+ const contents = map({});
2227
2085
  const data = parsedOutput.body;
2228
- if (data.message !== undefined && data.message !== null) {
2086
+ if (data.message != null) {
2229
2087
  contents.message = (0, smithy_client_1.expectString)(data.message);
2230
2088
  }
2231
2089
  const exception = new models_0_1.InternalServerException({
@@ -2235,15 +2093,15 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
2235
2093
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2236
2094
  };
2237
2095
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
2238
- const contents = {};
2096
+ const contents = map({});
2239
2097
  const data = parsedOutput.body;
2240
- if (data.message !== undefined && data.message !== null) {
2098
+ if (data.message != null) {
2241
2099
  contents.message = (0, smithy_client_1.expectString)(data.message);
2242
2100
  }
2243
- if (data.resourceIdentifier !== undefined && data.resourceIdentifier !== null) {
2101
+ if (data.resourceIdentifier != null) {
2244
2102
  contents.resourceIdentifier = (0, smithy_client_1.expectString)(data.resourceIdentifier);
2245
2103
  }
2246
- if (data.resourceType !== undefined && data.resourceType !== null) {
2104
+ if (data.resourceType != null) {
2247
2105
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
2248
2106
  }
2249
2107
  const exception = new models_0_1.ResourceNotFoundException({
@@ -2253,21 +2111,21 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
2253
2111
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2254
2112
  };
2255
2113
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
2256
- const contents = {};
2114
+ const contents = map({});
2257
2115
  const data = parsedOutput.body;
2258
- if (data.message !== undefined && data.message !== null) {
2116
+ if (data.message != null) {
2259
2117
  contents.message = (0, smithy_client_1.expectString)(data.message);
2260
2118
  }
2261
- if (data.quotaCode !== undefined && data.quotaCode !== null) {
2119
+ if (data.quotaCode != null) {
2262
2120
  contents.quotaCode = (0, smithy_client_1.expectString)(data.quotaCode);
2263
2121
  }
2264
- if (data.resourceIdentifier !== undefined && data.resourceIdentifier !== null) {
2122
+ if (data.resourceIdentifier != null) {
2265
2123
  contents.resourceIdentifier = (0, smithy_client_1.expectString)(data.resourceIdentifier);
2266
2124
  }
2267
- if (data.resourceType !== undefined && data.resourceType !== null) {
2125
+ if (data.resourceType != null) {
2268
2126
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
2269
2127
  }
2270
- if (data.serviceCode !== undefined && data.serviceCode !== null) {
2128
+ if (data.serviceCode != null) {
2271
2129
  contents.serviceCode = (0, smithy_client_1.expectString)(data.serviceCode);
2272
2130
  }
2273
2131
  const exception = new models_0_1.ServiceQuotaExceededException({
@@ -2277,15 +2135,15 @@ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (par
2277
2135
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2278
2136
  };
2279
2137
  const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
2280
- const contents = {};
2138
+ const contents = map({});
2281
2139
  const data = parsedOutput.body;
2282
- if (data.message !== undefined && data.message !== null) {
2140
+ if (data.message != null) {
2283
2141
  contents.message = (0, smithy_client_1.expectString)(data.message);
2284
2142
  }
2285
- if (data.quotaCode !== undefined && data.quotaCode !== null) {
2143
+ if (data.quotaCode != null) {
2286
2144
  contents.quotaCode = (0, smithy_client_1.expectString)(data.quotaCode);
2287
2145
  }
2288
- if (data.serviceCode !== undefined && data.serviceCode !== null) {
2146
+ if (data.serviceCode != null) {
2289
2147
  contents.serviceCode = (0, smithy_client_1.expectString)(data.serviceCode);
2290
2148
  }
2291
2149
  const exception = new models_0_1.ThrottlingException({
@@ -2295,9 +2153,9 @@ const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput,
2295
2153
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2296
2154
  };
2297
2155
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
2298
- const contents = {};
2156
+ const contents = map({});
2299
2157
  const data = parsedOutput.body;
2300
- if (data.message !== undefined && data.message !== null) {
2158
+ if (data.message != null) {
2301
2159
  contents.message = (0, smithy_client_1.expectString)(data.message);
2302
2160
  }
2303
2161
  const exception = new models_0_1.ValidationException({
@@ -2316,9 +2174,6 @@ const serializeAws_restJson1ActionsList = (input, context) => {
2316
2174
  return input
2317
2175
  .filter((e) => e != null)
2318
2176
  .map((entry) => {
2319
- if (entry === null) {
2320
- return null;
2321
- }
2322
2177
  return serializeAws_restJson1Action(entry, context);
2323
2178
  });
2324
2179
  };
@@ -2339,9 +2194,6 @@ const serializeAws_restJson1ChatbotSnsConfigurationSet = (input, context) => {
2339
2194
  return input
2340
2195
  .filter((e) => e != null)
2341
2196
  .map((entry) => {
2342
- if (entry === null) {
2343
- return null;
2344
- }
2345
2197
  return entry;
2346
2198
  });
2347
2199
  };
@@ -2389,9 +2241,6 @@ const serializeAws_restJson1EngagementSet = (input, context) => {
2389
2241
  return input
2390
2242
  .filter((e) => e != null)
2391
2243
  .map((entry) => {
2392
- if (entry === null) {
2393
- return null;
2394
- }
2395
2244
  return entry;
2396
2245
  });
2397
2246
  };
@@ -2405,9 +2254,6 @@ const serializeAws_restJson1FilterList = (input, context) => {
2405
2254
  return input
2406
2255
  .filter((e) => e != null)
2407
2256
  .map((entry) => {
2408
- if (entry === null) {
2409
- return null;
2410
- }
2411
2257
  return serializeAws_restJson1Filter(entry, context);
2412
2258
  });
2413
2259
  };
@@ -2427,9 +2273,6 @@ const serializeAws_restJson1IntegerList = (input, context) => {
2427
2273
  return input
2428
2274
  .filter((e) => e != null)
2429
2275
  .map((entry) => {
2430
- if (entry === null) {
2431
- return null;
2432
- }
2433
2276
  return entry;
2434
2277
  });
2435
2278
  };
@@ -2457,9 +2300,6 @@ const serializeAws_restJson1NotificationTargetSet = (input, context) => {
2457
2300
  return input
2458
2301
  .filter((e) => e != null)
2459
2302
  .map((entry) => {
2460
- if (entry === null) {
2461
- return null;
2462
- }
2463
2303
  return serializeAws_restJson1NotificationTargetItem(entry, context);
2464
2304
  });
2465
2305
  };
@@ -2489,9 +2329,6 @@ const serializeAws_restJson1RelatedItemList = (input, context) => {
2489
2329
  return input
2490
2330
  .filter((e) => e != null)
2491
2331
  .map((entry) => {
2492
- if (entry === null) {
2493
- return null;
2494
- }
2495
2332
  return serializeAws_restJson1RelatedItem(entry, context);
2496
2333
  });
2497
2334
  };
@@ -2529,9 +2366,6 @@ const serializeAws_restJson1SsmParameterValues = (input, context) => {
2529
2366
  return input
2530
2367
  .filter((e) => e != null)
2531
2368
  .map((entry) => {
2532
- if (entry === null) {
2533
- return null;
2534
- }
2535
2369
  return entry;
2536
2370
  });
2537
2371
  };
@@ -2539,9 +2373,6 @@ const serializeAws_restJson1StringList = (input, context) => {
2539
2373
  return input
2540
2374
  .filter((e) => e != null)
2541
2375
  .map((entry) => {
2542
- if (entry === null) {
2543
- return null;
2544
- }
2545
2376
  return entry;
2546
2377
  });
2547
2378
  };
@@ -2579,9 +2410,6 @@ const serializeAws_restJson1UpdateActionList = (input, context) => {
2579
2410
  return input
2580
2411
  .filter((e) => e != null)
2581
2412
  .map((entry) => {
2582
- if (entry === null) {
2583
- return null;
2584
- }
2585
2413
  return serializeAws_restJson1UpdateReplicationSetAction(entry, context);
2586
2414
  });
2587
2415
  };
@@ -2593,7 +2421,7 @@ const serializeAws_restJson1UpdateReplicationSetAction = (input, context) => {
2593
2421
  });
2594
2422
  };
2595
2423
  const deserializeAws_restJson1Action = (output, context) => {
2596
- if (output.ssmAutomation !== undefined && output.ssmAutomation !== null) {
2424
+ if (output.ssmAutomation != null) {
2597
2425
  return {
2598
2426
  ssmAutomation: deserializeAws_restJson1SsmAutomation(output.ssmAutomation, context),
2599
2427
  };
@@ -2640,12 +2468,12 @@ const deserializeAws_restJson1ChatbotSnsConfigurationSet = (output, context) =>
2640
2468
  return retVal;
2641
2469
  };
2642
2470
  const deserializeAws_restJson1ChatChannel = (output, context) => {
2643
- if (output.chatbotSns !== undefined && output.chatbotSns !== null) {
2471
+ if (output.chatbotSns != null) {
2644
2472
  return {
2645
2473
  chatbotSns: deserializeAws_restJson1ChatbotSnsConfigurationSet(output.chatbotSns, context),
2646
2474
  };
2647
2475
  }
2648
- if (output.empty !== undefined && output.empty !== null) {
2476
+ if (output.empty != null) {
2649
2477
  return {
2650
2478
  empty: deserializeAws_restJson1EmptyChatChannel(output.empty, context),
2651
2479
  };