@aws-sdk/client-ssm-incidents 3.52.0 → 3.53.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.
@@ -6,6 +6,7 @@ const protocol_http_1 = require("@aws-sdk/protocol-http");
6
6
  const smithy_client_1 = require("@aws-sdk/smithy-client");
7
7
  const uuid_1 = require("uuid");
8
8
  const models_0_1 = require("../models/models_0");
9
+ const SSMIncidentsServiceException_1 = require("../models/SSMIncidentsServiceException");
9
10
  const serializeAws_restJson1CreateReplicationSetCommand = async (input, context) => {
10
11
  var _a;
11
12
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
@@ -780,67 +781,31 @@ const deserializeAws_restJson1CreateReplicationSetCommandError = async (output,
780
781
  switch (errorCode) {
781
782
  case "AccessDeniedException":
782
783
  case "com.amazonaws.ssmincidents#AccessDeniedException":
783
- response = {
784
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
785
- name: errorCode,
786
- $metadata: deserializeMetadata(output),
787
- };
788
- break;
784
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
789
785
  case "ConflictException":
790
786
  case "com.amazonaws.ssmincidents#ConflictException":
791
- response = {
792
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
793
- name: errorCode,
794
- $metadata: deserializeMetadata(output),
795
- };
796
- break;
787
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
797
788
  case "InternalServerException":
798
789
  case "com.amazonaws.ssmincidents#InternalServerException":
799
- response = {
800
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
801
- name: errorCode,
802
- $metadata: deserializeMetadata(output),
803
- };
804
- break;
790
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
805
791
  case "ServiceQuotaExceededException":
806
792
  case "com.amazonaws.ssmincidents#ServiceQuotaExceededException":
807
- response = {
808
- ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
809
- name: errorCode,
810
- $metadata: deserializeMetadata(output),
811
- };
812
- break;
793
+ throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
813
794
  case "ThrottlingException":
814
795
  case "com.amazonaws.ssmincidents#ThrottlingException":
815
- response = {
816
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
817
- name: errorCode,
818
- $metadata: deserializeMetadata(output),
819
- };
820
- break;
796
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
821
797
  case "ValidationException":
822
798
  case "com.amazonaws.ssmincidents#ValidationException":
823
- response = {
824
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
825
- name: errorCode,
826
- $metadata: deserializeMetadata(output),
827
- };
828
- break;
799
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
829
800
  default:
830
801
  const parsedBody = parsedOutput.body;
831
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
832
- response = {
833
- ...parsedBody,
834
- name: `${errorCode}`,
835
- message: parsedBody.message || parsedBody.Message || errorCode,
802
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
803
+ name: parsedBody.code || parsedBody.Code || errorCode,
836
804
  $fault: "client",
837
805
  $metadata: deserializeMetadata(output),
838
- };
806
+ });
807
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
839
808
  }
840
- const message = response.message || response.Message || errorCode;
841
- response.message = message;
842
- delete response.Message;
843
- return Promise.reject(Object.assign(new Error(message), response));
844
809
  };
845
810
  const deserializeAws_restJson1CreateResponsePlanCommand = async (output, context) => {
846
811
  if (output.statusCode !== 201 && output.statusCode >= 300) {
@@ -868,67 +833,31 @@ const deserializeAws_restJson1CreateResponsePlanCommandError = async (output, co
868
833
  switch (errorCode) {
869
834
  case "AccessDeniedException":
870
835
  case "com.amazonaws.ssmincidents#AccessDeniedException":
871
- response = {
872
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
873
- name: errorCode,
874
- $metadata: deserializeMetadata(output),
875
- };
876
- break;
836
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
877
837
  case "ConflictException":
878
838
  case "com.amazonaws.ssmincidents#ConflictException":
879
- response = {
880
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
881
- name: errorCode,
882
- $metadata: deserializeMetadata(output),
883
- };
884
- break;
839
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
885
840
  case "InternalServerException":
886
841
  case "com.amazonaws.ssmincidents#InternalServerException":
887
- response = {
888
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
889
- name: errorCode,
890
- $metadata: deserializeMetadata(output),
891
- };
892
- break;
842
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
893
843
  case "ResourceNotFoundException":
894
844
  case "com.amazonaws.ssmincidents#ResourceNotFoundException":
895
- response = {
896
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
897
- name: errorCode,
898
- $metadata: deserializeMetadata(output),
899
- };
900
- break;
845
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
901
846
  case "ThrottlingException":
902
847
  case "com.amazonaws.ssmincidents#ThrottlingException":
903
- response = {
904
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
905
- name: errorCode,
906
- $metadata: deserializeMetadata(output),
907
- };
908
- break;
848
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
909
849
  case "ValidationException":
910
850
  case "com.amazonaws.ssmincidents#ValidationException":
911
- response = {
912
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
913
- name: errorCode,
914
- $metadata: deserializeMetadata(output),
915
- };
916
- break;
851
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
917
852
  default:
918
853
  const parsedBody = parsedOutput.body;
919
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
920
- response = {
921
- ...parsedBody,
922
- name: `${errorCode}`,
923
- message: parsedBody.message || parsedBody.Message || errorCode,
854
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
855
+ name: parsedBody.code || parsedBody.Code || errorCode,
924
856
  $fault: "client",
925
857
  $metadata: deserializeMetadata(output),
926
- };
858
+ });
859
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
927
860
  }
928
- const message = response.message || response.Message || errorCode;
929
- response.message = message;
930
- delete response.Message;
931
- return Promise.reject(Object.assign(new Error(message), response));
932
861
  };
933
862
  const deserializeAws_restJson1CreateTimelineEventCommand = async (output, context) => {
934
863
  if (output.statusCode !== 201 && output.statusCode >= 300) {
@@ -960,67 +889,31 @@ const deserializeAws_restJson1CreateTimelineEventCommandError = async (output, c
960
889
  switch (errorCode) {
961
890
  case "AccessDeniedException":
962
891
  case "com.amazonaws.ssmincidents#AccessDeniedException":
963
- response = {
964
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
965
- name: errorCode,
966
- $metadata: deserializeMetadata(output),
967
- };
968
- break;
892
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
969
893
  case "ConflictException":
970
894
  case "com.amazonaws.ssmincidents#ConflictException":
971
- response = {
972
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
973
- name: errorCode,
974
- $metadata: deserializeMetadata(output),
975
- };
976
- break;
895
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
977
896
  case "InternalServerException":
978
897
  case "com.amazonaws.ssmincidents#InternalServerException":
979
- response = {
980
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
981
- name: errorCode,
982
- $metadata: deserializeMetadata(output),
983
- };
984
- break;
898
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
985
899
  case "ResourceNotFoundException":
986
900
  case "com.amazonaws.ssmincidents#ResourceNotFoundException":
987
- response = {
988
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
989
- name: errorCode,
990
- $metadata: deserializeMetadata(output),
991
- };
992
- break;
901
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
993
902
  case "ThrottlingException":
994
903
  case "com.amazonaws.ssmincidents#ThrottlingException":
995
- response = {
996
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
997
- name: errorCode,
998
- $metadata: deserializeMetadata(output),
999
- };
1000
- break;
904
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1001
905
  case "ValidationException":
1002
906
  case "com.amazonaws.ssmincidents#ValidationException":
1003
- response = {
1004
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1005
- name: errorCode,
1006
- $metadata: deserializeMetadata(output),
1007
- };
1008
- break;
907
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1009
908
  default:
1010
909
  const parsedBody = parsedOutput.body;
1011
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1012
- response = {
1013
- ...parsedBody,
1014
- name: `${errorCode}`,
1015
- message: parsedBody.message || parsedBody.Message || errorCode,
910
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
911
+ name: parsedBody.code || parsedBody.Code || errorCode,
1016
912
  $fault: "client",
1017
913
  $metadata: deserializeMetadata(output),
1018
- };
914
+ });
915
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1019
916
  }
1020
- const message = response.message || response.Message || errorCode;
1021
- response.message = message;
1022
- delete response.Message;
1023
- return Promise.reject(Object.assign(new Error(message), response));
1024
917
  };
1025
918
  const deserializeAws_restJson1DeleteIncidentRecordCommand = async (output, context) => {
1026
919
  if (output.statusCode !== 204 && output.statusCode >= 300) {
@@ -1044,51 +937,25 @@ const deserializeAws_restJson1DeleteIncidentRecordCommandError = async (output,
1044
937
  switch (errorCode) {
1045
938
  case "AccessDeniedException":
1046
939
  case "com.amazonaws.ssmincidents#AccessDeniedException":
1047
- response = {
1048
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1049
- name: errorCode,
1050
- $metadata: deserializeMetadata(output),
1051
- };
1052
- break;
940
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1053
941
  case "InternalServerException":
1054
942
  case "com.amazonaws.ssmincidents#InternalServerException":
1055
- response = {
1056
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1057
- name: errorCode,
1058
- $metadata: deserializeMetadata(output),
1059
- };
1060
- break;
943
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1061
944
  case "ThrottlingException":
1062
945
  case "com.amazonaws.ssmincidents#ThrottlingException":
1063
- response = {
1064
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1065
- name: errorCode,
1066
- $metadata: deserializeMetadata(output),
1067
- };
1068
- break;
946
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1069
947
  case "ValidationException":
1070
948
  case "com.amazonaws.ssmincidents#ValidationException":
1071
- response = {
1072
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1073
- name: errorCode,
1074
- $metadata: deserializeMetadata(output),
1075
- };
1076
- break;
949
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1077
950
  default:
1078
951
  const parsedBody = parsedOutput.body;
1079
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1080
- response = {
1081
- ...parsedBody,
1082
- name: `${errorCode}`,
1083
- message: parsedBody.message || parsedBody.Message || errorCode,
952
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
953
+ name: parsedBody.code || parsedBody.Code || errorCode,
1084
954
  $fault: "client",
1085
955
  $metadata: deserializeMetadata(output),
1086
- };
956
+ });
957
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1087
958
  }
1088
- const message = response.message || response.Message || errorCode;
1089
- response.message = message;
1090
- delete response.Message;
1091
- return Promise.reject(Object.assign(new Error(message), response));
1092
959
  };
1093
960
  const deserializeAws_restJson1DeleteReplicationSetCommand = async (output, context) => {
1094
961
  if (output.statusCode !== 204 && output.statusCode >= 300) {
@@ -1112,59 +979,28 @@ const deserializeAws_restJson1DeleteReplicationSetCommandError = async (output,
1112
979
  switch (errorCode) {
1113
980
  case "AccessDeniedException":
1114
981
  case "com.amazonaws.ssmincidents#AccessDeniedException":
1115
- response = {
1116
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1117
- name: errorCode,
1118
- $metadata: deserializeMetadata(output),
1119
- };
1120
- break;
982
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1121
983
  case "InternalServerException":
1122
984
  case "com.amazonaws.ssmincidents#InternalServerException":
1123
- response = {
1124
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1125
- name: errorCode,
1126
- $metadata: deserializeMetadata(output),
1127
- };
1128
- break;
985
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1129
986
  case "ResourceNotFoundException":
1130
987
  case "com.amazonaws.ssmincidents#ResourceNotFoundException":
1131
- response = {
1132
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1133
- name: errorCode,
1134
- $metadata: deserializeMetadata(output),
1135
- };
1136
- break;
988
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1137
989
  case "ThrottlingException":
1138
990
  case "com.amazonaws.ssmincidents#ThrottlingException":
1139
- response = {
1140
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1141
- name: errorCode,
1142
- $metadata: deserializeMetadata(output),
1143
- };
1144
- break;
991
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1145
992
  case "ValidationException":
1146
993
  case "com.amazonaws.ssmincidents#ValidationException":
1147
- response = {
1148
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1149
- name: errorCode,
1150
- $metadata: deserializeMetadata(output),
1151
- };
1152
- break;
994
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1153
995
  default:
1154
996
  const parsedBody = parsedOutput.body;
1155
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1156
- response = {
1157
- ...parsedBody,
1158
- name: `${errorCode}`,
1159
- message: parsedBody.message || parsedBody.Message || errorCode,
997
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
998
+ name: parsedBody.code || parsedBody.Code || errorCode,
1160
999
  $fault: "client",
1161
1000
  $metadata: deserializeMetadata(output),
1162
- };
1001
+ });
1002
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1163
1003
  }
1164
- const message = response.message || response.Message || errorCode;
1165
- response.message = message;
1166
- delete response.Message;
1167
- return Promise.reject(Object.assign(new Error(message), response));
1168
1004
  };
1169
1005
  const deserializeAws_restJson1DeleteResourcePolicyCommand = async (output, context) => {
1170
1006
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1188,59 +1024,28 @@ const deserializeAws_restJson1DeleteResourcePolicyCommandError = async (output,
1188
1024
  switch (errorCode) {
1189
1025
  case "AccessDeniedException":
1190
1026
  case "com.amazonaws.ssmincidents#AccessDeniedException":
1191
- response = {
1192
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1193
- name: errorCode,
1194
- $metadata: deserializeMetadata(output),
1195
- };
1196
- break;
1027
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1197
1028
  case "InternalServerException":
1198
1029
  case "com.amazonaws.ssmincidents#InternalServerException":
1199
- response = {
1200
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1201
- name: errorCode,
1202
- $metadata: deserializeMetadata(output),
1203
- };
1204
- break;
1030
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1205
1031
  case "ResourceNotFoundException":
1206
1032
  case "com.amazonaws.ssmincidents#ResourceNotFoundException":
1207
- response = {
1208
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1209
- name: errorCode,
1210
- $metadata: deserializeMetadata(output),
1211
- };
1212
- break;
1033
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1213
1034
  case "ThrottlingException":
1214
1035
  case "com.amazonaws.ssmincidents#ThrottlingException":
1215
- response = {
1216
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1217
- name: errorCode,
1218
- $metadata: deserializeMetadata(output),
1219
- };
1220
- break;
1036
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1221
1037
  case "ValidationException":
1222
1038
  case "com.amazonaws.ssmincidents#ValidationException":
1223
- response = {
1224
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1225
- name: errorCode,
1226
- $metadata: deserializeMetadata(output),
1227
- };
1228
- break;
1039
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1229
1040
  default:
1230
1041
  const parsedBody = parsedOutput.body;
1231
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1232
- response = {
1233
- ...parsedBody,
1234
- name: `${errorCode}`,
1235
- message: parsedBody.message || parsedBody.Message || errorCode,
1042
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1043
+ name: parsedBody.code || parsedBody.Code || errorCode,
1236
1044
  $fault: "client",
1237
1045
  $metadata: deserializeMetadata(output),
1238
- };
1046
+ });
1047
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1239
1048
  }
1240
- const message = response.message || response.Message || errorCode;
1241
- response.message = message;
1242
- delete response.Message;
1243
- return Promise.reject(Object.assign(new Error(message), response));
1244
1049
  };
1245
1050
  const deserializeAws_restJson1DeleteResponsePlanCommand = async (output, context) => {
1246
1051
  if (output.statusCode !== 204 && output.statusCode >= 300) {
@@ -1264,51 +1069,25 @@ const deserializeAws_restJson1DeleteResponsePlanCommandError = async (output, co
1264
1069
  switch (errorCode) {
1265
1070
  case "AccessDeniedException":
1266
1071
  case "com.amazonaws.ssmincidents#AccessDeniedException":
1267
- response = {
1268
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1269
- name: errorCode,
1270
- $metadata: deserializeMetadata(output),
1271
- };
1272
- break;
1072
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1273
1073
  case "InternalServerException":
1274
1074
  case "com.amazonaws.ssmincidents#InternalServerException":
1275
- response = {
1276
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1277
- name: errorCode,
1278
- $metadata: deserializeMetadata(output),
1279
- };
1280
- break;
1075
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1281
1076
  case "ThrottlingException":
1282
1077
  case "com.amazonaws.ssmincidents#ThrottlingException":
1283
- response = {
1284
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1285
- name: errorCode,
1286
- $metadata: deserializeMetadata(output),
1287
- };
1288
- break;
1078
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1289
1079
  case "ValidationException":
1290
1080
  case "com.amazonaws.ssmincidents#ValidationException":
1291
- response = {
1292
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1293
- name: errorCode,
1294
- $metadata: deserializeMetadata(output),
1295
- };
1296
- break;
1081
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1297
1082
  default:
1298
1083
  const parsedBody = parsedOutput.body;
1299
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1300
- response = {
1301
- ...parsedBody,
1302
- name: `${errorCode}`,
1303
- message: parsedBody.message || parsedBody.Message || errorCode,
1084
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1085
+ name: parsedBody.code || parsedBody.Code || errorCode,
1304
1086
  $fault: "client",
1305
1087
  $metadata: deserializeMetadata(output),
1306
- };
1088
+ });
1089
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1307
1090
  }
1308
- const message = response.message || response.Message || errorCode;
1309
- response.message = message;
1310
- delete response.Message;
1311
- return Promise.reject(Object.assign(new Error(message), response));
1312
1091
  };
1313
1092
  const deserializeAws_restJson1DeleteTimelineEventCommand = async (output, context) => {
1314
1093
  if (output.statusCode !== 204 && output.statusCode >= 300) {
@@ -1332,51 +1111,25 @@ const deserializeAws_restJson1DeleteTimelineEventCommandError = async (output, c
1332
1111
  switch (errorCode) {
1333
1112
  case "AccessDeniedException":
1334
1113
  case "com.amazonaws.ssmincidents#AccessDeniedException":
1335
- response = {
1336
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1337
- name: errorCode,
1338
- $metadata: deserializeMetadata(output),
1339
- };
1340
- break;
1114
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1341
1115
  case "InternalServerException":
1342
1116
  case "com.amazonaws.ssmincidents#InternalServerException":
1343
- response = {
1344
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1345
- name: errorCode,
1346
- $metadata: deserializeMetadata(output),
1347
- };
1348
- break;
1117
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1349
1118
  case "ThrottlingException":
1350
1119
  case "com.amazonaws.ssmincidents#ThrottlingException":
1351
- response = {
1352
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1353
- name: errorCode,
1354
- $metadata: deserializeMetadata(output),
1355
- };
1356
- break;
1120
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1357
1121
  case "ValidationException":
1358
1122
  case "com.amazonaws.ssmincidents#ValidationException":
1359
- response = {
1360
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1361
- name: errorCode,
1362
- $metadata: deserializeMetadata(output),
1363
- };
1364
- break;
1123
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1365
1124
  default:
1366
1125
  const parsedBody = parsedOutput.body;
1367
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1368
- response = {
1369
- ...parsedBody,
1370
- name: `${errorCode}`,
1371
- message: parsedBody.message || parsedBody.Message || errorCode,
1126
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1127
+ name: parsedBody.code || parsedBody.Code || errorCode,
1372
1128
  $fault: "client",
1373
1129
  $metadata: deserializeMetadata(output),
1374
- };
1130
+ });
1131
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1375
1132
  }
1376
- const message = response.message || response.Message || errorCode;
1377
- response.message = message;
1378
- delete response.Message;
1379
- return Promise.reject(Object.assign(new Error(message), response));
1380
1133
  };
1381
1134
  const deserializeAws_restJson1GetIncidentRecordCommand = async (output, context) => {
1382
1135
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1404,59 +1157,28 @@ const deserializeAws_restJson1GetIncidentRecordCommandError = async (output, con
1404
1157
  switch (errorCode) {
1405
1158
  case "AccessDeniedException":
1406
1159
  case "com.amazonaws.ssmincidents#AccessDeniedException":
1407
- response = {
1408
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1409
- name: errorCode,
1410
- $metadata: deserializeMetadata(output),
1411
- };
1412
- break;
1160
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1413
1161
  case "InternalServerException":
1414
1162
  case "com.amazonaws.ssmincidents#InternalServerException":
1415
- response = {
1416
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1417
- name: errorCode,
1418
- $metadata: deserializeMetadata(output),
1419
- };
1420
- break;
1163
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1421
1164
  case "ResourceNotFoundException":
1422
1165
  case "com.amazonaws.ssmincidents#ResourceNotFoundException":
1423
- response = {
1424
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1425
- name: errorCode,
1426
- $metadata: deserializeMetadata(output),
1427
- };
1428
- break;
1166
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1429
1167
  case "ThrottlingException":
1430
1168
  case "com.amazonaws.ssmincidents#ThrottlingException":
1431
- response = {
1432
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1433
- name: errorCode,
1434
- $metadata: deserializeMetadata(output),
1435
- };
1436
- break;
1169
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1437
1170
  case "ValidationException":
1438
1171
  case "com.amazonaws.ssmincidents#ValidationException":
1439
- response = {
1440
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1441
- name: errorCode,
1442
- $metadata: deserializeMetadata(output),
1443
- };
1444
- break;
1172
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1445
1173
  default:
1446
1174
  const parsedBody = parsedOutput.body;
1447
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1448
- response = {
1449
- ...parsedBody,
1450
- name: `${errorCode}`,
1451
- message: parsedBody.message || parsedBody.Message || errorCode,
1175
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1176
+ name: parsedBody.code || parsedBody.Code || errorCode,
1452
1177
  $fault: "client",
1453
1178
  $metadata: deserializeMetadata(output),
1454
- };
1179
+ });
1180
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1455
1181
  }
1456
- const message = response.message || response.Message || errorCode;
1457
- response.message = message;
1458
- delete response.Message;
1459
- return Promise.reject(Object.assign(new Error(message), response));
1460
1182
  };
1461
1183
  const deserializeAws_restJson1GetReplicationSetCommand = async (output, context) => {
1462
1184
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1484,59 +1206,28 @@ const deserializeAws_restJson1GetReplicationSetCommandError = async (output, con
1484
1206
  switch (errorCode) {
1485
1207
  case "AccessDeniedException":
1486
1208
  case "com.amazonaws.ssmincidents#AccessDeniedException":
1487
- response = {
1488
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1489
- name: errorCode,
1490
- $metadata: deserializeMetadata(output),
1491
- };
1492
- break;
1209
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1493
1210
  case "InternalServerException":
1494
1211
  case "com.amazonaws.ssmincidents#InternalServerException":
1495
- response = {
1496
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1497
- name: errorCode,
1498
- $metadata: deserializeMetadata(output),
1499
- };
1500
- break;
1212
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1501
1213
  case "ResourceNotFoundException":
1502
1214
  case "com.amazonaws.ssmincidents#ResourceNotFoundException":
1503
- response = {
1504
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1505
- name: errorCode,
1506
- $metadata: deserializeMetadata(output),
1507
- };
1508
- break;
1215
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1509
1216
  case "ThrottlingException":
1510
1217
  case "com.amazonaws.ssmincidents#ThrottlingException":
1511
- response = {
1512
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1513
- name: errorCode,
1514
- $metadata: deserializeMetadata(output),
1515
- };
1516
- break;
1218
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1517
1219
  case "ValidationException":
1518
1220
  case "com.amazonaws.ssmincidents#ValidationException":
1519
- response = {
1520
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1521
- name: errorCode,
1522
- $metadata: deserializeMetadata(output),
1523
- };
1524
- break;
1221
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1525
1222
  default:
1526
1223
  const parsedBody = parsedOutput.body;
1527
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1528
- response = {
1529
- ...parsedBody,
1530
- name: `${errorCode}`,
1531
- message: parsedBody.message || parsedBody.Message || errorCode,
1224
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1225
+ name: parsedBody.code || parsedBody.Code || errorCode,
1532
1226
  $fault: "client",
1533
1227
  $metadata: deserializeMetadata(output),
1534
- };
1228
+ });
1229
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1535
1230
  }
1536
- const message = response.message || response.Message || errorCode;
1537
- response.message = message;
1538
- delete response.Message;
1539
- return Promise.reject(Object.assign(new Error(message), response));
1540
1231
  };
1541
1232
  const deserializeAws_restJson1GetResourcePoliciesCommand = async (output, context) => {
1542
1233
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1568,59 +1259,28 @@ const deserializeAws_restJson1GetResourcePoliciesCommandError = async (output, c
1568
1259
  switch (errorCode) {
1569
1260
  case "AccessDeniedException":
1570
1261
  case "com.amazonaws.ssmincidents#AccessDeniedException":
1571
- response = {
1572
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1573
- name: errorCode,
1574
- $metadata: deserializeMetadata(output),
1575
- };
1576
- break;
1262
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1577
1263
  case "InternalServerException":
1578
1264
  case "com.amazonaws.ssmincidents#InternalServerException":
1579
- response = {
1580
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1581
- name: errorCode,
1582
- $metadata: deserializeMetadata(output),
1583
- };
1584
- break;
1265
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1585
1266
  case "ResourceNotFoundException":
1586
1267
  case "com.amazonaws.ssmincidents#ResourceNotFoundException":
1587
- response = {
1588
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1589
- name: errorCode,
1590
- $metadata: deserializeMetadata(output),
1591
- };
1592
- break;
1268
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1593
1269
  case "ThrottlingException":
1594
1270
  case "com.amazonaws.ssmincidents#ThrottlingException":
1595
- response = {
1596
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1597
- name: errorCode,
1598
- $metadata: deserializeMetadata(output),
1599
- };
1600
- break;
1271
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1601
1272
  case "ValidationException":
1602
1273
  case "com.amazonaws.ssmincidents#ValidationException":
1603
- response = {
1604
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1605
- name: errorCode,
1606
- $metadata: deserializeMetadata(output),
1607
- };
1608
- break;
1274
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1609
1275
  default:
1610
1276
  const parsedBody = parsedOutput.body;
1611
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1612
- response = {
1613
- ...parsedBody,
1614
- name: `${errorCode}`,
1615
- message: parsedBody.message || parsedBody.Message || errorCode,
1277
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1278
+ name: parsedBody.code || parsedBody.Code || errorCode,
1616
1279
  $fault: "client",
1617
1280
  $metadata: deserializeMetadata(output),
1618
- };
1281
+ });
1282
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1619
1283
  }
1620
- const message = response.message || response.Message || errorCode;
1621
- response.message = message;
1622
- delete response.Message;
1623
- return Promise.reject(Object.assign(new Error(message), response));
1624
1284
  };
1625
1285
  const deserializeAws_restJson1GetResponsePlanCommand = async (output, context) => {
1626
1286
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1672,59 +1332,28 @@ const deserializeAws_restJson1GetResponsePlanCommandError = async (output, conte
1672
1332
  switch (errorCode) {
1673
1333
  case "AccessDeniedException":
1674
1334
  case "com.amazonaws.ssmincidents#AccessDeniedException":
1675
- response = {
1676
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1677
- name: errorCode,
1678
- $metadata: deserializeMetadata(output),
1679
- };
1680
- break;
1335
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1681
1336
  case "InternalServerException":
1682
1337
  case "com.amazonaws.ssmincidents#InternalServerException":
1683
- response = {
1684
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1685
- name: errorCode,
1686
- $metadata: deserializeMetadata(output),
1687
- };
1688
- break;
1338
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1689
1339
  case "ResourceNotFoundException":
1690
1340
  case "com.amazonaws.ssmincidents#ResourceNotFoundException":
1691
- response = {
1692
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1693
- name: errorCode,
1694
- $metadata: deserializeMetadata(output),
1695
- };
1696
- break;
1341
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1697
1342
  case "ThrottlingException":
1698
1343
  case "com.amazonaws.ssmincidents#ThrottlingException":
1699
- response = {
1700
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1701
- name: errorCode,
1702
- $metadata: deserializeMetadata(output),
1703
- };
1704
- break;
1344
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1705
1345
  case "ValidationException":
1706
1346
  case "com.amazonaws.ssmincidents#ValidationException":
1707
- response = {
1708
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1709
- name: errorCode,
1710
- $metadata: deserializeMetadata(output),
1711
- };
1712
- break;
1347
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1713
1348
  default:
1714
1349
  const parsedBody = parsedOutput.body;
1715
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1716
- response = {
1717
- ...parsedBody,
1718
- name: `${errorCode}`,
1719
- message: parsedBody.message || parsedBody.Message || errorCode,
1350
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1351
+ name: parsedBody.code || parsedBody.Code || errorCode,
1720
1352
  $fault: "client",
1721
1353
  $metadata: deserializeMetadata(output),
1722
- };
1354
+ });
1355
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1723
1356
  }
1724
- const message = response.message || response.Message || errorCode;
1725
- response.message = message;
1726
- delete response.Message;
1727
- return Promise.reject(Object.assign(new Error(message), response));
1728
1357
  };
1729
1358
  const deserializeAws_restJson1GetTimelineEventCommand = async (output, context) => {
1730
1359
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1752,59 +1381,28 @@ const deserializeAws_restJson1GetTimelineEventCommandError = async (output, cont
1752
1381
  switch (errorCode) {
1753
1382
  case "AccessDeniedException":
1754
1383
  case "com.amazonaws.ssmincidents#AccessDeniedException":
1755
- response = {
1756
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1757
- name: errorCode,
1758
- $metadata: deserializeMetadata(output),
1759
- };
1760
- break;
1384
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1761
1385
  case "InternalServerException":
1762
1386
  case "com.amazonaws.ssmincidents#InternalServerException":
1763
- response = {
1764
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1765
- name: errorCode,
1766
- $metadata: deserializeMetadata(output),
1767
- };
1768
- break;
1387
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1769
1388
  case "ResourceNotFoundException":
1770
1389
  case "com.amazonaws.ssmincidents#ResourceNotFoundException":
1771
- response = {
1772
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
1773
- name: errorCode,
1774
- $metadata: deserializeMetadata(output),
1775
- };
1776
- break;
1390
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
1777
1391
  case "ThrottlingException":
1778
1392
  case "com.amazonaws.ssmincidents#ThrottlingException":
1779
- response = {
1780
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1781
- name: errorCode,
1782
- $metadata: deserializeMetadata(output),
1783
- };
1784
- break;
1393
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1785
1394
  case "ValidationException":
1786
1395
  case "com.amazonaws.ssmincidents#ValidationException":
1787
- response = {
1788
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1789
- name: errorCode,
1790
- $metadata: deserializeMetadata(output),
1791
- };
1792
- break;
1396
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1793
1397
  default:
1794
1398
  const parsedBody = parsedOutput.body;
1795
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1796
- response = {
1797
- ...parsedBody,
1798
- name: `${errorCode}`,
1799
- message: parsedBody.message || parsedBody.Message || errorCode,
1399
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1400
+ name: parsedBody.code || parsedBody.Code || errorCode,
1800
1401
  $fault: "client",
1801
1402
  $metadata: deserializeMetadata(output),
1802
- };
1403
+ });
1404
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1803
1405
  }
1804
- const message = response.message || response.Message || errorCode;
1805
- response.message = message;
1806
- delete response.Message;
1807
- return Promise.reject(Object.assign(new Error(message), response));
1808
1406
  };
1809
1407
  const deserializeAws_restJson1ListIncidentRecordsCommand = async (output, context) => {
1810
1408
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1836,51 +1434,25 @@ const deserializeAws_restJson1ListIncidentRecordsCommandError = async (output, c
1836
1434
  switch (errorCode) {
1837
1435
  case "AccessDeniedException":
1838
1436
  case "com.amazonaws.ssmincidents#AccessDeniedException":
1839
- response = {
1840
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1841
- name: errorCode,
1842
- $metadata: deserializeMetadata(output),
1843
- };
1844
- break;
1437
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1845
1438
  case "InternalServerException":
1846
1439
  case "com.amazonaws.ssmincidents#InternalServerException":
1847
- response = {
1848
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1849
- name: errorCode,
1850
- $metadata: deserializeMetadata(output),
1851
- };
1852
- break;
1440
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1853
1441
  case "ThrottlingException":
1854
1442
  case "com.amazonaws.ssmincidents#ThrottlingException":
1855
- response = {
1856
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1857
- name: errorCode,
1858
- $metadata: deserializeMetadata(output),
1859
- };
1860
- break;
1443
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1861
1444
  case "ValidationException":
1862
1445
  case "com.amazonaws.ssmincidents#ValidationException":
1863
- response = {
1864
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1865
- name: errorCode,
1866
- $metadata: deserializeMetadata(output),
1867
- };
1868
- break;
1446
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1869
1447
  default:
1870
1448
  const parsedBody = parsedOutput.body;
1871
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1872
- response = {
1873
- ...parsedBody,
1874
- name: `${errorCode}`,
1875
- message: parsedBody.message || parsedBody.Message || errorCode,
1449
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1450
+ name: parsedBody.code || parsedBody.Code || errorCode,
1876
1451
  $fault: "client",
1877
1452
  $metadata: deserializeMetadata(output),
1878
- };
1453
+ });
1454
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1879
1455
  }
1880
- const message = response.message || response.Message || errorCode;
1881
- response.message = message;
1882
- delete response.Message;
1883
- return Promise.reject(Object.assign(new Error(message), response));
1884
1456
  };
1885
1457
  const deserializeAws_restJson1ListRelatedItemsCommand = async (output, context) => {
1886
1458
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1912,51 +1484,25 @@ const deserializeAws_restJson1ListRelatedItemsCommandError = async (output, cont
1912
1484
  switch (errorCode) {
1913
1485
  case "AccessDeniedException":
1914
1486
  case "com.amazonaws.ssmincidents#AccessDeniedException":
1915
- response = {
1916
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1917
- name: errorCode,
1918
- $metadata: deserializeMetadata(output),
1919
- };
1920
- break;
1487
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1921
1488
  case "InternalServerException":
1922
1489
  case "com.amazonaws.ssmincidents#InternalServerException":
1923
- response = {
1924
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
1925
- name: errorCode,
1926
- $metadata: deserializeMetadata(output),
1927
- };
1928
- break;
1490
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
1929
1491
  case "ThrottlingException":
1930
1492
  case "com.amazonaws.ssmincidents#ThrottlingException":
1931
- response = {
1932
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
1933
- name: errorCode,
1934
- $metadata: deserializeMetadata(output),
1935
- };
1936
- break;
1493
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
1937
1494
  case "ValidationException":
1938
1495
  case "com.amazonaws.ssmincidents#ValidationException":
1939
- response = {
1940
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
1941
- name: errorCode,
1942
- $metadata: deserializeMetadata(output),
1943
- };
1944
- break;
1496
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1945
1497
  default:
1946
1498
  const parsedBody = parsedOutput.body;
1947
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
1948
- response = {
1949
- ...parsedBody,
1950
- name: `${errorCode}`,
1951
- message: parsedBody.message || parsedBody.Message || errorCode,
1499
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1500
+ name: parsedBody.code || parsedBody.Code || errorCode,
1952
1501
  $fault: "client",
1953
1502
  $metadata: deserializeMetadata(output),
1954
- };
1503
+ });
1504
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
1955
1505
  }
1956
- const message = response.message || response.Message || errorCode;
1957
- response.message = message;
1958
- delete response.Message;
1959
- return Promise.reject(Object.assign(new Error(message), response));
1960
1506
  };
1961
1507
  const deserializeAws_restJson1ListReplicationSetsCommand = async (output, context) => {
1962
1508
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -1988,51 +1534,25 @@ const deserializeAws_restJson1ListReplicationSetsCommandError = async (output, c
1988
1534
  switch (errorCode) {
1989
1535
  case "AccessDeniedException":
1990
1536
  case "com.amazonaws.ssmincidents#AccessDeniedException":
1991
- response = {
1992
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
1993
- name: errorCode,
1994
- $metadata: deserializeMetadata(output),
1995
- };
1996
- break;
1537
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
1997
1538
  case "InternalServerException":
1998
1539
  case "com.amazonaws.ssmincidents#InternalServerException":
1999
- response = {
2000
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2001
- name: errorCode,
2002
- $metadata: deserializeMetadata(output),
2003
- };
2004
- break;
1540
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2005
1541
  case "ThrottlingException":
2006
1542
  case "com.amazonaws.ssmincidents#ThrottlingException":
2007
- response = {
2008
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
2009
- name: errorCode,
2010
- $metadata: deserializeMetadata(output),
2011
- };
2012
- break;
1543
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2013
1544
  case "ValidationException":
2014
1545
  case "com.amazonaws.ssmincidents#ValidationException":
2015
- response = {
2016
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2017
- name: errorCode,
2018
- $metadata: deserializeMetadata(output),
2019
- };
2020
- break;
1546
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2021
1547
  default:
2022
1548
  const parsedBody = parsedOutput.body;
2023
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2024
- response = {
2025
- ...parsedBody,
2026
- name: `${errorCode}`,
2027
- message: parsedBody.message || parsedBody.Message || errorCode,
1549
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1550
+ name: parsedBody.code || parsedBody.Code || errorCode,
2028
1551
  $fault: "client",
2029
1552
  $metadata: deserializeMetadata(output),
2030
- };
1553
+ });
1554
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2031
1555
  }
2032
- const message = response.message || response.Message || errorCode;
2033
- response.message = message;
2034
- delete response.Message;
2035
- return Promise.reject(Object.assign(new Error(message), response));
2036
1556
  };
2037
1557
  const deserializeAws_restJson1ListResponsePlansCommand = async (output, context) => {
2038
1558
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2064,51 +1584,25 @@ const deserializeAws_restJson1ListResponsePlansCommandError = async (output, con
2064
1584
  switch (errorCode) {
2065
1585
  case "AccessDeniedException":
2066
1586
  case "com.amazonaws.ssmincidents#AccessDeniedException":
2067
- response = {
2068
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2069
- name: errorCode,
2070
- $metadata: deserializeMetadata(output),
2071
- };
2072
- break;
1587
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2073
1588
  case "InternalServerException":
2074
1589
  case "com.amazonaws.ssmincidents#InternalServerException":
2075
- response = {
2076
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2077
- name: errorCode,
2078
- $metadata: deserializeMetadata(output),
2079
- };
2080
- break;
1590
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2081
1591
  case "ThrottlingException":
2082
1592
  case "com.amazonaws.ssmincidents#ThrottlingException":
2083
- response = {
2084
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
2085
- name: errorCode,
2086
- $metadata: deserializeMetadata(output),
2087
- };
2088
- break;
1593
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2089
1594
  case "ValidationException":
2090
1595
  case "com.amazonaws.ssmincidents#ValidationException":
2091
- response = {
2092
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2093
- name: errorCode,
2094
- $metadata: deserializeMetadata(output),
2095
- };
2096
- break;
1596
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2097
1597
  default:
2098
1598
  const parsedBody = parsedOutput.body;
2099
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2100
- response = {
2101
- ...parsedBody,
2102
- name: `${errorCode}`,
2103
- message: parsedBody.message || parsedBody.Message || errorCode,
1599
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1600
+ name: parsedBody.code || parsedBody.Code || errorCode,
2104
1601
  $fault: "client",
2105
1602
  $metadata: deserializeMetadata(output),
2106
- };
1603
+ });
1604
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2107
1605
  }
2108
- const message = response.message || response.Message || errorCode;
2109
- response.message = message;
2110
- delete response.Message;
2111
- return Promise.reject(Object.assign(new Error(message), response));
2112
1606
  };
2113
1607
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
2114
1608
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2136,59 +1630,28 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
2136
1630
  switch (errorCode) {
2137
1631
  case "AccessDeniedException":
2138
1632
  case "com.amazonaws.ssmincidents#AccessDeniedException":
2139
- response = {
2140
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2141
- name: errorCode,
2142
- $metadata: deserializeMetadata(output),
2143
- };
2144
- break;
1633
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2145
1634
  case "InternalServerException":
2146
1635
  case "com.amazonaws.ssmincidents#InternalServerException":
2147
- response = {
2148
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2149
- name: errorCode,
2150
- $metadata: deserializeMetadata(output),
2151
- };
2152
- break;
1636
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2153
1637
  case "ResourceNotFoundException":
2154
1638
  case "com.amazonaws.ssmincidents#ResourceNotFoundException":
2155
- response = {
2156
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2157
- name: errorCode,
2158
- $metadata: deserializeMetadata(output),
2159
- };
2160
- break;
1639
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2161
1640
  case "ThrottlingException":
2162
1641
  case "com.amazonaws.ssmincidents#ThrottlingException":
2163
- response = {
2164
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
2165
- name: errorCode,
2166
- $metadata: deserializeMetadata(output),
2167
- };
2168
- break;
1642
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2169
1643
  case "ValidationException":
2170
1644
  case "com.amazonaws.ssmincidents#ValidationException":
2171
- response = {
2172
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2173
- name: errorCode,
2174
- $metadata: deserializeMetadata(output),
2175
- };
2176
- break;
1645
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2177
1646
  default:
2178
1647
  const parsedBody = parsedOutput.body;
2179
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2180
- response = {
2181
- ...parsedBody,
2182
- name: `${errorCode}`,
2183
- message: parsedBody.message || parsedBody.Message || errorCode,
1648
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1649
+ name: parsedBody.code || parsedBody.Code || errorCode,
2184
1650
  $fault: "client",
2185
1651
  $metadata: deserializeMetadata(output),
2186
- };
1652
+ });
1653
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2187
1654
  }
2188
- const message = response.message || response.Message || errorCode;
2189
- response.message = message;
2190
- delete response.Message;
2191
- return Promise.reject(Object.assign(new Error(message), response));
2192
1655
  };
2193
1656
  const deserializeAws_restJson1ListTimelineEventsCommand = async (output, context) => {
2194
1657
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2220,51 +1683,25 @@ const deserializeAws_restJson1ListTimelineEventsCommandError = async (output, co
2220
1683
  switch (errorCode) {
2221
1684
  case "AccessDeniedException":
2222
1685
  case "com.amazonaws.ssmincidents#AccessDeniedException":
2223
- response = {
2224
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2225
- name: errorCode,
2226
- $metadata: deserializeMetadata(output),
2227
- };
2228
- break;
1686
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2229
1687
  case "InternalServerException":
2230
1688
  case "com.amazonaws.ssmincidents#InternalServerException":
2231
- response = {
2232
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2233
- name: errorCode,
2234
- $metadata: deserializeMetadata(output),
2235
- };
2236
- break;
1689
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2237
1690
  case "ThrottlingException":
2238
1691
  case "com.amazonaws.ssmincidents#ThrottlingException":
2239
- response = {
2240
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
2241
- name: errorCode,
2242
- $metadata: deserializeMetadata(output),
2243
- };
2244
- break;
1692
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2245
1693
  case "ValidationException":
2246
1694
  case "com.amazonaws.ssmincidents#ValidationException":
2247
- response = {
2248
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2249
- name: errorCode,
2250
- $metadata: deserializeMetadata(output),
2251
- };
2252
- break;
1695
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2253
1696
  default:
2254
1697
  const parsedBody = parsedOutput.body;
2255
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2256
- response = {
2257
- ...parsedBody,
2258
- name: `${errorCode}`,
2259
- message: parsedBody.message || parsedBody.Message || errorCode,
1698
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1699
+ name: parsedBody.code || parsedBody.Code || errorCode,
2260
1700
  $fault: "client",
2261
1701
  $metadata: deserializeMetadata(output),
2262
- };
1702
+ });
1703
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2263
1704
  }
2264
- const message = response.message || response.Message || errorCode;
2265
- response.message = message;
2266
- delete response.Message;
2267
- return Promise.reject(Object.assign(new Error(message), response));
2268
1705
  };
2269
1706
  const deserializeAws_restJson1PutResourcePolicyCommand = async (output, context) => {
2270
1707
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2292,59 +1729,28 @@ const deserializeAws_restJson1PutResourcePolicyCommandError = async (output, con
2292
1729
  switch (errorCode) {
2293
1730
  case "AccessDeniedException":
2294
1731
  case "com.amazonaws.ssmincidents#AccessDeniedException":
2295
- response = {
2296
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2297
- name: errorCode,
2298
- $metadata: deserializeMetadata(output),
2299
- };
2300
- break;
1732
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2301
1733
  case "InternalServerException":
2302
1734
  case "com.amazonaws.ssmincidents#InternalServerException":
2303
- response = {
2304
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2305
- name: errorCode,
2306
- $metadata: deserializeMetadata(output),
2307
- };
2308
- break;
1735
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2309
1736
  case "ResourceNotFoundException":
2310
1737
  case "com.amazonaws.ssmincidents#ResourceNotFoundException":
2311
- response = {
2312
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2313
- name: errorCode,
2314
- $metadata: deserializeMetadata(output),
2315
- };
2316
- break;
1738
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2317
1739
  case "ThrottlingException":
2318
1740
  case "com.amazonaws.ssmincidents#ThrottlingException":
2319
- response = {
2320
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
2321
- name: errorCode,
2322
- $metadata: deserializeMetadata(output),
2323
- };
2324
- break;
1741
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2325
1742
  case "ValidationException":
2326
1743
  case "com.amazonaws.ssmincidents#ValidationException":
2327
- response = {
2328
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2329
- name: errorCode,
2330
- $metadata: deserializeMetadata(output),
2331
- };
2332
- break;
1744
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2333
1745
  default:
2334
1746
  const parsedBody = parsedOutput.body;
2335
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2336
- response = {
2337
- ...parsedBody,
2338
- name: `${errorCode}`,
2339
- message: parsedBody.message || parsedBody.Message || errorCode,
1747
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1748
+ name: parsedBody.code || parsedBody.Code || errorCode,
2340
1749
  $fault: "client",
2341
1750
  $metadata: deserializeMetadata(output),
2342
- };
1751
+ });
1752
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2343
1753
  }
2344
- const message = response.message || response.Message || errorCode;
2345
- response.message = message;
2346
- delete response.Message;
2347
- return Promise.reject(Object.assign(new Error(message), response));
2348
1754
  };
2349
1755
  const deserializeAws_restJson1StartIncidentCommand = async (output, context) => {
2350
1756
  if (output.statusCode !== 200 && output.statusCode >= 300) {
@@ -2372,67 +1778,31 @@ const deserializeAws_restJson1StartIncidentCommandError = async (output, context
2372
1778
  switch (errorCode) {
2373
1779
  case "AccessDeniedException":
2374
1780
  case "com.amazonaws.ssmincidents#AccessDeniedException":
2375
- response = {
2376
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2377
- name: errorCode,
2378
- $metadata: deserializeMetadata(output),
2379
- };
2380
- break;
1781
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2381
1782
  case "ConflictException":
2382
1783
  case "com.amazonaws.ssmincidents#ConflictException":
2383
- response = {
2384
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
2385
- name: errorCode,
2386
- $metadata: deserializeMetadata(output),
2387
- };
2388
- break;
1784
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
2389
1785
  case "InternalServerException":
2390
1786
  case "com.amazonaws.ssmincidents#InternalServerException":
2391
- response = {
2392
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2393
- name: errorCode,
2394
- $metadata: deserializeMetadata(output),
2395
- };
2396
- break;
1787
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2397
1788
  case "ResourceNotFoundException":
2398
1789
  case "com.amazonaws.ssmincidents#ResourceNotFoundException":
2399
- response = {
2400
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2401
- name: errorCode,
2402
- $metadata: deserializeMetadata(output),
2403
- };
2404
- break;
1790
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2405
1791
  case "ThrottlingException":
2406
1792
  case "com.amazonaws.ssmincidents#ThrottlingException":
2407
- response = {
2408
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
2409
- name: errorCode,
2410
- $metadata: deserializeMetadata(output),
2411
- };
2412
- break;
1793
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2413
1794
  case "ValidationException":
2414
1795
  case "com.amazonaws.ssmincidents#ValidationException":
2415
- response = {
2416
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2417
- name: errorCode,
2418
- $metadata: deserializeMetadata(output),
2419
- };
2420
- break;
1796
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2421
1797
  default:
2422
1798
  const parsedBody = parsedOutput.body;
2423
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2424
- response = {
2425
- ...parsedBody,
2426
- name: `${errorCode}`,
2427
- message: parsedBody.message || parsedBody.Message || errorCode,
1799
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1800
+ name: parsedBody.code || parsedBody.Code || errorCode,
2428
1801
  $fault: "client",
2429
1802
  $metadata: deserializeMetadata(output),
2430
- };
1803
+ });
1804
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2431
1805
  }
2432
- const message = response.message || response.Message || errorCode;
2433
- response.message = message;
2434
- delete response.Message;
2435
- return Promise.reject(Object.assign(new Error(message), response));
2436
1806
  };
2437
1807
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
2438
1808
  if (output.statusCode !== 204 && output.statusCode >= 300) {
@@ -2456,75 +1826,34 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
2456
1826
  switch (errorCode) {
2457
1827
  case "AccessDeniedException":
2458
1828
  case "com.amazonaws.ssmincidents#AccessDeniedException":
2459
- response = {
2460
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2461
- name: errorCode,
2462
- $metadata: deserializeMetadata(output),
2463
- };
2464
- break;
1829
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2465
1830
  case "ConflictException":
2466
1831
  case "com.amazonaws.ssmincidents#ConflictException":
2467
- response = {
2468
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
2469
- name: errorCode,
2470
- $metadata: deserializeMetadata(output),
2471
- };
2472
- break;
1832
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
2473
1833
  case "InternalServerException":
2474
1834
  case "com.amazonaws.ssmincidents#InternalServerException":
2475
- response = {
2476
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2477
- name: errorCode,
2478
- $metadata: deserializeMetadata(output),
2479
- };
2480
- break;
1835
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2481
1836
  case "ResourceNotFoundException":
2482
1837
  case "com.amazonaws.ssmincidents#ResourceNotFoundException":
2483
- response = {
2484
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2485
- name: errorCode,
2486
- $metadata: deserializeMetadata(output),
2487
- };
2488
- break;
1838
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2489
1839
  case "ServiceQuotaExceededException":
2490
1840
  case "com.amazonaws.ssmincidents#ServiceQuotaExceededException":
2491
- response = {
2492
- ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
2493
- name: errorCode,
2494
- $metadata: deserializeMetadata(output),
2495
- };
2496
- break;
1841
+ throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
2497
1842
  case "ThrottlingException":
2498
1843
  case "com.amazonaws.ssmincidents#ThrottlingException":
2499
- response = {
2500
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
2501
- name: errorCode,
2502
- $metadata: deserializeMetadata(output),
2503
- };
2504
- break;
1844
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2505
1845
  case "ValidationException":
2506
1846
  case "com.amazonaws.ssmincidents#ValidationException":
2507
- response = {
2508
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2509
- name: errorCode,
2510
- $metadata: deserializeMetadata(output),
2511
- };
2512
- break;
1847
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2513
1848
  default:
2514
1849
  const parsedBody = parsedOutput.body;
2515
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2516
- response = {
2517
- ...parsedBody,
2518
- name: `${errorCode}`,
2519
- message: parsedBody.message || parsedBody.Message || errorCode,
1850
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1851
+ name: parsedBody.code || parsedBody.Code || errorCode,
2520
1852
  $fault: "client",
2521
1853
  $metadata: deserializeMetadata(output),
2522
- };
1854
+ });
1855
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2523
1856
  }
2524
- const message = response.message || response.Message || errorCode;
2525
- response.message = message;
2526
- delete response.Message;
2527
- return Promise.reject(Object.assign(new Error(message), response));
2528
1857
  };
2529
1858
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
2530
1859
  if (output.statusCode !== 204 && output.statusCode >= 300) {
@@ -2548,67 +1877,31 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
2548
1877
  switch (errorCode) {
2549
1878
  case "AccessDeniedException":
2550
1879
  case "com.amazonaws.ssmincidents#AccessDeniedException":
2551
- response = {
2552
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2553
- name: errorCode,
2554
- $metadata: deserializeMetadata(output),
2555
- };
2556
- break;
1880
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2557
1881
  case "ConflictException":
2558
1882
  case "com.amazonaws.ssmincidents#ConflictException":
2559
- response = {
2560
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
2561
- name: errorCode,
2562
- $metadata: deserializeMetadata(output),
2563
- };
2564
- break;
1883
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
2565
1884
  case "InternalServerException":
2566
1885
  case "com.amazonaws.ssmincidents#InternalServerException":
2567
- response = {
2568
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2569
- name: errorCode,
2570
- $metadata: deserializeMetadata(output),
2571
- };
2572
- break;
1886
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2573
1887
  case "ResourceNotFoundException":
2574
1888
  case "com.amazonaws.ssmincidents#ResourceNotFoundException":
2575
- response = {
2576
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2577
- name: errorCode,
2578
- $metadata: deserializeMetadata(output),
2579
- };
2580
- break;
1889
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2581
1890
  case "ThrottlingException":
2582
1891
  case "com.amazonaws.ssmincidents#ThrottlingException":
2583
- response = {
2584
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
2585
- name: errorCode,
2586
- $metadata: deserializeMetadata(output),
2587
- };
2588
- break;
1892
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2589
1893
  case "ValidationException":
2590
1894
  case "com.amazonaws.ssmincidents#ValidationException":
2591
- response = {
2592
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2593
- name: errorCode,
2594
- $metadata: deserializeMetadata(output),
2595
- };
2596
- break;
1895
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2597
1896
  default:
2598
1897
  const parsedBody = parsedOutput.body;
2599
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2600
- response = {
2601
- ...parsedBody,
2602
- name: `${errorCode}`,
2603
- message: parsedBody.message || parsedBody.Message || errorCode,
1898
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1899
+ name: parsedBody.code || parsedBody.Code || errorCode,
2604
1900
  $fault: "client",
2605
1901
  $metadata: deserializeMetadata(output),
2606
- };
1902
+ });
1903
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2607
1904
  }
2608
- const message = response.message || response.Message || errorCode;
2609
- response.message = message;
2610
- delete response.Message;
2611
- return Promise.reject(Object.assign(new Error(message), response));
2612
1905
  };
2613
1906
  const deserializeAws_restJson1UpdateDeletionProtectionCommand = async (output, context) => {
2614
1907
  if (output.statusCode !== 204 && output.statusCode >= 300) {
@@ -2632,59 +1925,28 @@ const deserializeAws_restJson1UpdateDeletionProtectionCommandError = async (outp
2632
1925
  switch (errorCode) {
2633
1926
  case "AccessDeniedException":
2634
1927
  case "com.amazonaws.ssmincidents#AccessDeniedException":
2635
- response = {
2636
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2637
- name: errorCode,
2638
- $metadata: deserializeMetadata(output),
2639
- };
2640
- break;
1928
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2641
1929
  case "InternalServerException":
2642
1930
  case "com.amazonaws.ssmincidents#InternalServerException":
2643
- response = {
2644
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2645
- name: errorCode,
2646
- $metadata: deserializeMetadata(output),
2647
- };
2648
- break;
1931
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2649
1932
  case "ResourceNotFoundException":
2650
1933
  case "com.amazonaws.ssmincidents#ResourceNotFoundException":
2651
- response = {
2652
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2653
- name: errorCode,
2654
- $metadata: deserializeMetadata(output),
2655
- };
2656
- break;
1934
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2657
1935
  case "ThrottlingException":
2658
1936
  case "com.amazonaws.ssmincidents#ThrottlingException":
2659
- response = {
2660
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
2661
- name: errorCode,
2662
- $metadata: deserializeMetadata(output),
2663
- };
2664
- break;
1937
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2665
1938
  case "ValidationException":
2666
1939
  case "com.amazonaws.ssmincidents#ValidationException":
2667
- response = {
2668
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2669
- name: errorCode,
2670
- $metadata: deserializeMetadata(output),
2671
- };
2672
- break;
1940
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2673
1941
  default:
2674
1942
  const parsedBody = parsedOutput.body;
2675
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2676
- response = {
2677
- ...parsedBody,
2678
- name: `${errorCode}`,
2679
- message: parsedBody.message || parsedBody.Message || errorCode,
1943
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1944
+ name: parsedBody.code || parsedBody.Code || errorCode,
2680
1945
  $fault: "client",
2681
1946
  $metadata: deserializeMetadata(output),
2682
- };
1947
+ });
1948
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2683
1949
  }
2684
- const message = response.message || response.Message || errorCode;
2685
- response.message = message;
2686
- delete response.Message;
2687
- return Promise.reject(Object.assign(new Error(message), response));
2688
1950
  };
2689
1951
  const deserializeAws_restJson1UpdateIncidentRecordCommand = async (output, context) => {
2690
1952
  if (output.statusCode !== 204 && output.statusCode >= 300) {
@@ -2708,67 +1970,31 @@ const deserializeAws_restJson1UpdateIncidentRecordCommandError = async (output,
2708
1970
  switch (errorCode) {
2709
1971
  case "AccessDeniedException":
2710
1972
  case "com.amazonaws.ssmincidents#AccessDeniedException":
2711
- response = {
2712
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2713
- name: errorCode,
2714
- $metadata: deserializeMetadata(output),
2715
- };
2716
- break;
1973
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2717
1974
  case "ConflictException":
2718
1975
  case "com.amazonaws.ssmincidents#ConflictException":
2719
- response = {
2720
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
2721
- name: errorCode,
2722
- $metadata: deserializeMetadata(output),
2723
- };
2724
- break;
1976
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
2725
1977
  case "InternalServerException":
2726
1978
  case "com.amazonaws.ssmincidents#InternalServerException":
2727
- response = {
2728
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2729
- name: errorCode,
2730
- $metadata: deserializeMetadata(output),
2731
- };
2732
- break;
1979
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2733
1980
  case "ResourceNotFoundException":
2734
1981
  case "com.amazonaws.ssmincidents#ResourceNotFoundException":
2735
- response = {
2736
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2737
- name: errorCode,
2738
- $metadata: deserializeMetadata(output),
2739
- };
2740
- break;
1982
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2741
1983
  case "ThrottlingException":
2742
1984
  case "com.amazonaws.ssmincidents#ThrottlingException":
2743
- response = {
2744
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
2745
- name: errorCode,
2746
- $metadata: deserializeMetadata(output),
2747
- };
2748
- break;
1985
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2749
1986
  case "ValidationException":
2750
1987
  case "com.amazonaws.ssmincidents#ValidationException":
2751
- response = {
2752
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2753
- name: errorCode,
2754
- $metadata: deserializeMetadata(output),
2755
- };
2756
- break;
1988
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2757
1989
  default:
2758
1990
  const parsedBody = parsedOutput.body;
2759
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2760
- response = {
2761
- ...parsedBody,
2762
- name: `${errorCode}`,
2763
- message: parsedBody.message || parsedBody.Message || errorCode,
1991
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
1992
+ name: parsedBody.code || parsedBody.Code || errorCode,
2764
1993
  $fault: "client",
2765
1994
  $metadata: deserializeMetadata(output),
2766
- };
1995
+ });
1996
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2767
1997
  }
2768
- const message = response.message || response.Message || errorCode;
2769
- response.message = message;
2770
- delete response.Message;
2771
- return Promise.reject(Object.assign(new Error(message), response));
2772
1998
  };
2773
1999
  const deserializeAws_restJson1UpdateRelatedItemsCommand = async (output, context) => {
2774
2000
  if (output.statusCode !== 204 && output.statusCode >= 300) {
@@ -2792,67 +2018,31 @@ const deserializeAws_restJson1UpdateRelatedItemsCommandError = async (output, co
2792
2018
  switch (errorCode) {
2793
2019
  case "AccessDeniedException":
2794
2020
  case "com.amazonaws.ssmincidents#AccessDeniedException":
2795
- response = {
2796
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2797
- name: errorCode,
2798
- $metadata: deserializeMetadata(output),
2799
- };
2800
- break;
2021
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2801
2022
  case "ConflictException":
2802
2023
  case "com.amazonaws.ssmincidents#ConflictException":
2803
- response = {
2804
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
2805
- name: errorCode,
2806
- $metadata: deserializeMetadata(output),
2807
- };
2808
- break;
2024
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
2809
2025
  case "InternalServerException":
2810
2026
  case "com.amazonaws.ssmincidents#InternalServerException":
2811
- response = {
2812
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2813
- name: errorCode,
2814
- $metadata: deserializeMetadata(output),
2815
- };
2816
- break;
2027
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2817
2028
  case "ResourceNotFoundException":
2818
2029
  case "com.amazonaws.ssmincidents#ResourceNotFoundException":
2819
- response = {
2820
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2821
- name: errorCode,
2822
- $metadata: deserializeMetadata(output),
2823
- };
2824
- break;
2030
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2825
2031
  case "ThrottlingException":
2826
2032
  case "com.amazonaws.ssmincidents#ThrottlingException":
2827
- response = {
2828
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
2829
- name: errorCode,
2830
- $metadata: deserializeMetadata(output),
2831
- };
2832
- break;
2033
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2833
2034
  case "ValidationException":
2834
2035
  case "com.amazonaws.ssmincidents#ValidationException":
2835
- response = {
2836
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2837
- name: errorCode,
2838
- $metadata: deserializeMetadata(output),
2839
- };
2840
- break;
2036
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2841
2037
  default:
2842
2038
  const parsedBody = parsedOutput.body;
2843
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2844
- response = {
2845
- ...parsedBody,
2846
- name: `${errorCode}`,
2847
- message: parsedBody.message || parsedBody.Message || errorCode,
2039
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
2040
+ name: parsedBody.code || parsedBody.Code || errorCode,
2848
2041
  $fault: "client",
2849
2042
  $metadata: deserializeMetadata(output),
2850
- };
2043
+ });
2044
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2851
2045
  }
2852
- const message = response.message || response.Message || errorCode;
2853
- response.message = message;
2854
- delete response.Message;
2855
- return Promise.reject(Object.assign(new Error(message), response));
2856
2046
  };
2857
2047
  const deserializeAws_restJson1UpdateReplicationSetCommand = async (output, context) => {
2858
2048
  if (output.statusCode !== 204 && output.statusCode >= 300) {
@@ -2876,59 +2066,28 @@ const deserializeAws_restJson1UpdateReplicationSetCommandError = async (output,
2876
2066
  switch (errorCode) {
2877
2067
  case "AccessDeniedException":
2878
2068
  case "com.amazonaws.ssmincidents#AccessDeniedException":
2879
- response = {
2880
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2881
- name: errorCode,
2882
- $metadata: deserializeMetadata(output),
2883
- };
2884
- break;
2069
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2885
2070
  case "InternalServerException":
2886
2071
  case "com.amazonaws.ssmincidents#InternalServerException":
2887
- response = {
2888
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2889
- name: errorCode,
2890
- $metadata: deserializeMetadata(output),
2891
- };
2892
- break;
2072
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2893
2073
  case "ResourceNotFoundException":
2894
2074
  case "com.amazonaws.ssmincidents#ResourceNotFoundException":
2895
- response = {
2896
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2897
- name: errorCode,
2898
- $metadata: deserializeMetadata(output),
2899
- };
2900
- break;
2075
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2901
2076
  case "ThrottlingException":
2902
2077
  case "com.amazonaws.ssmincidents#ThrottlingException":
2903
- response = {
2904
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
2905
- name: errorCode,
2906
- $metadata: deserializeMetadata(output),
2907
- };
2908
- break;
2078
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2909
2079
  case "ValidationException":
2910
2080
  case "com.amazonaws.ssmincidents#ValidationException":
2911
- response = {
2912
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2913
- name: errorCode,
2914
- $metadata: deserializeMetadata(output),
2915
- };
2916
- break;
2081
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2917
2082
  default:
2918
2083
  const parsedBody = parsedOutput.body;
2919
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
2920
- response = {
2921
- ...parsedBody,
2922
- name: `${errorCode}`,
2923
- message: parsedBody.message || parsedBody.Message || errorCode,
2084
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
2085
+ name: parsedBody.code || parsedBody.Code || errorCode,
2924
2086
  $fault: "client",
2925
2087
  $metadata: deserializeMetadata(output),
2926
- };
2088
+ });
2089
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
2927
2090
  }
2928
- const message = response.message || response.Message || errorCode;
2929
- response.message = message;
2930
- delete response.Message;
2931
- return Promise.reject(Object.assign(new Error(message), response));
2932
2091
  };
2933
2092
  const deserializeAws_restJson1UpdateResponsePlanCommand = async (output, context) => {
2934
2093
  if (output.statusCode !== 204 && output.statusCode >= 300) {
@@ -2952,67 +2111,31 @@ const deserializeAws_restJson1UpdateResponsePlanCommandError = async (output, co
2952
2111
  switch (errorCode) {
2953
2112
  case "AccessDeniedException":
2954
2113
  case "com.amazonaws.ssmincidents#AccessDeniedException":
2955
- response = {
2956
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
2957
- name: errorCode,
2958
- $metadata: deserializeMetadata(output),
2959
- };
2960
- break;
2114
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
2961
2115
  case "ConflictException":
2962
2116
  case "com.amazonaws.ssmincidents#ConflictException":
2963
- response = {
2964
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
2965
- name: errorCode,
2966
- $metadata: deserializeMetadata(output),
2967
- };
2968
- break;
2117
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
2969
2118
  case "InternalServerException":
2970
2119
  case "com.amazonaws.ssmincidents#InternalServerException":
2971
- response = {
2972
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
2973
- name: errorCode,
2974
- $metadata: deserializeMetadata(output),
2975
- };
2976
- break;
2120
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
2977
2121
  case "ResourceNotFoundException":
2978
2122
  case "com.amazonaws.ssmincidents#ResourceNotFoundException":
2979
- response = {
2980
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
2981
- name: errorCode,
2982
- $metadata: deserializeMetadata(output),
2983
- };
2984
- break;
2123
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
2985
2124
  case "ThrottlingException":
2986
2125
  case "com.amazonaws.ssmincidents#ThrottlingException":
2987
- response = {
2988
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
2989
- name: errorCode,
2990
- $metadata: deserializeMetadata(output),
2991
- };
2992
- break;
2126
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
2993
2127
  case "ValidationException":
2994
2128
  case "com.amazonaws.ssmincidents#ValidationException":
2995
- response = {
2996
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
2997
- name: errorCode,
2998
- $metadata: deserializeMetadata(output),
2999
- };
3000
- break;
2129
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3001
2130
  default:
3002
2131
  const parsedBody = parsedOutput.body;
3003
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3004
- response = {
3005
- ...parsedBody,
3006
- name: `${errorCode}`,
3007
- message: parsedBody.message || parsedBody.Message || errorCode,
2132
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
2133
+ name: parsedBody.code || parsedBody.Code || errorCode,
3008
2134
  $fault: "client",
3009
2135
  $metadata: deserializeMetadata(output),
3010
- };
2136
+ });
2137
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3011
2138
  }
3012
- const message = response.message || response.Message || errorCode;
3013
- response.message = message;
3014
- delete response.Message;
3015
- return Promise.reject(Object.assign(new Error(message), response));
3016
2139
  };
3017
2140
  const deserializeAws_restJson1UpdateTimelineEventCommand = async (output, context) => {
3018
2141
  if (output.statusCode !== 204 && output.statusCode >= 300) {
@@ -3036,91 +2159,46 @@ const deserializeAws_restJson1UpdateTimelineEventCommandError = async (output, c
3036
2159
  switch (errorCode) {
3037
2160
  case "AccessDeniedException":
3038
2161
  case "com.amazonaws.ssmincidents#AccessDeniedException":
3039
- response = {
3040
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
3041
- name: errorCode,
3042
- $metadata: deserializeMetadata(output),
3043
- };
3044
- break;
2162
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
3045
2163
  case "ConflictException":
3046
2164
  case "com.amazonaws.ssmincidents#ConflictException":
3047
- response = {
3048
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
3049
- name: errorCode,
3050
- $metadata: deserializeMetadata(output),
3051
- };
3052
- break;
2165
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
3053
2166
  case "InternalServerException":
3054
2167
  case "com.amazonaws.ssmincidents#InternalServerException":
3055
- response = {
3056
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
3057
- name: errorCode,
3058
- $metadata: deserializeMetadata(output),
3059
- };
3060
- break;
2168
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
3061
2169
  case "ResourceNotFoundException":
3062
2170
  case "com.amazonaws.ssmincidents#ResourceNotFoundException":
3063
- response = {
3064
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
3065
- name: errorCode,
3066
- $metadata: deserializeMetadata(output),
3067
- };
3068
- break;
2171
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
3069
2172
  case "ThrottlingException":
3070
2173
  case "com.amazonaws.ssmincidents#ThrottlingException":
3071
- response = {
3072
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
3073
- name: errorCode,
3074
- $metadata: deserializeMetadata(output),
3075
- };
3076
- break;
2174
+ throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
3077
2175
  case "ValidationException":
3078
2176
  case "com.amazonaws.ssmincidents#ValidationException":
3079
- response = {
3080
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
3081
- name: errorCode,
3082
- $metadata: deserializeMetadata(output),
3083
- };
3084
- break;
2177
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
3085
2178
  default:
3086
2179
  const parsedBody = parsedOutput.body;
3087
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
3088
- response = {
3089
- ...parsedBody,
3090
- name: `${errorCode}`,
3091
- message: parsedBody.message || parsedBody.Message || errorCode,
2180
+ response = new SSMIncidentsServiceException_1.SSMIncidentsServiceException({
2181
+ name: parsedBody.code || parsedBody.Code || errorCode,
3092
2182
  $fault: "client",
3093
2183
  $metadata: deserializeMetadata(output),
3094
- };
2184
+ });
2185
+ throw smithy_client_1.decorateServiceException(response, parsedBody);
3095
2186
  }
3096
- const message = response.message || response.Message || errorCode;
3097
- response.message = message;
3098
- delete response.Message;
3099
- return Promise.reject(Object.assign(new Error(message), response));
3100
2187
  };
3101
2188
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
3102
- const contents = {
3103
- name: "AccessDeniedException",
3104
- $fault: "client",
3105
- $metadata: deserializeMetadata(parsedOutput),
3106
- message: undefined,
3107
- };
2189
+ const contents = {};
3108
2190
  const data = parsedOutput.body;
3109
2191
  if (data.message !== undefined && data.message !== null) {
3110
2192
  contents.message = smithy_client_1.expectString(data.message);
3111
2193
  }
3112
- return contents;
2194
+ const exception = new models_0_1.AccessDeniedException({
2195
+ $metadata: deserializeMetadata(parsedOutput),
2196
+ ...contents,
2197
+ });
2198
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
3113
2199
  };
3114
2200
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
3115
- const contents = {
3116
- name: "ConflictException",
3117
- $fault: "client",
3118
- $metadata: deserializeMetadata(parsedOutput),
3119
- message: undefined,
3120
- resourceIdentifier: undefined,
3121
- resourceType: undefined,
3122
- retryAfter: undefined,
3123
- };
2201
+ const contents = {};
3124
2202
  const data = parsedOutput.body;
3125
2203
  if (data.message !== undefined && data.message !== null) {
3126
2204
  contents.message = smithy_client_1.expectString(data.message);
@@ -3134,30 +2212,26 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
3134
2212
  if (data.retryAfter !== undefined && data.retryAfter !== null) {
3135
2213
  contents.retryAfter = smithy_client_1.expectNonNull(smithy_client_1.parseEpochTimestamp(smithy_client_1.expectNumber(data.retryAfter)));
3136
2214
  }
3137
- return contents;
2215
+ const exception = new models_0_1.ConflictException({
2216
+ $metadata: deserializeMetadata(parsedOutput),
2217
+ ...contents,
2218
+ });
2219
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
3138
2220
  };
3139
2221
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
3140
- const contents = {
3141
- name: "InternalServerException",
3142
- $fault: "server",
3143
- $metadata: deserializeMetadata(parsedOutput),
3144
- message: undefined,
3145
- };
2222
+ const contents = {};
3146
2223
  const data = parsedOutput.body;
3147
2224
  if (data.message !== undefined && data.message !== null) {
3148
2225
  contents.message = smithy_client_1.expectString(data.message);
3149
2226
  }
3150
- return contents;
2227
+ const exception = new models_0_1.InternalServerException({
2228
+ $metadata: deserializeMetadata(parsedOutput),
2229
+ ...contents,
2230
+ });
2231
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
3151
2232
  };
3152
2233
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
3153
- const contents = {
3154
- name: "ResourceNotFoundException",
3155
- $fault: "client",
3156
- $metadata: deserializeMetadata(parsedOutput),
3157
- message: undefined,
3158
- resourceIdentifier: undefined,
3159
- resourceType: undefined,
3160
- };
2234
+ const contents = {};
3161
2235
  const data = parsedOutput.body;
3162
2236
  if (data.message !== undefined && data.message !== null) {
3163
2237
  contents.message = smithy_client_1.expectString(data.message);
@@ -3168,19 +2242,14 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
3168
2242
  if (data.resourceType !== undefined && data.resourceType !== null) {
3169
2243
  contents.resourceType = smithy_client_1.expectString(data.resourceType);
3170
2244
  }
3171
- return contents;
2245
+ const exception = new models_0_1.ResourceNotFoundException({
2246
+ $metadata: deserializeMetadata(parsedOutput),
2247
+ ...contents,
2248
+ });
2249
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
3172
2250
  };
3173
2251
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
3174
- const contents = {
3175
- name: "ServiceQuotaExceededException",
3176
- $fault: "client",
3177
- $metadata: deserializeMetadata(parsedOutput),
3178
- message: undefined,
3179
- quotaCode: undefined,
3180
- resourceIdentifier: undefined,
3181
- resourceType: undefined,
3182
- serviceCode: undefined,
3183
- };
2252
+ const contents = {};
3184
2253
  const data = parsedOutput.body;
3185
2254
  if (data.message !== undefined && data.message !== null) {
3186
2255
  contents.message = smithy_client_1.expectString(data.message);
@@ -3197,17 +2266,14 @@ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (par
3197
2266
  if (data.serviceCode !== undefined && data.serviceCode !== null) {
3198
2267
  contents.serviceCode = smithy_client_1.expectString(data.serviceCode);
3199
2268
  }
3200
- return contents;
2269
+ const exception = new models_0_1.ServiceQuotaExceededException({
2270
+ $metadata: deserializeMetadata(parsedOutput),
2271
+ ...contents,
2272
+ });
2273
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
3201
2274
  };
3202
2275
  const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
3203
- const contents = {
3204
- name: "ThrottlingException",
3205
- $fault: "client",
3206
- $metadata: deserializeMetadata(parsedOutput),
3207
- message: undefined,
3208
- quotaCode: undefined,
3209
- serviceCode: undefined,
3210
- };
2276
+ const contents = {};
3211
2277
  const data = parsedOutput.body;
3212
2278
  if (data.message !== undefined && data.message !== null) {
3213
2279
  contents.message = smithy_client_1.expectString(data.message);
@@ -3218,20 +2284,23 @@ const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput,
3218
2284
  if (data.serviceCode !== undefined && data.serviceCode !== null) {
3219
2285
  contents.serviceCode = smithy_client_1.expectString(data.serviceCode);
3220
2286
  }
3221
- return contents;
2287
+ const exception = new models_0_1.ThrottlingException({
2288
+ $metadata: deserializeMetadata(parsedOutput),
2289
+ ...contents,
2290
+ });
2291
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
3222
2292
  };
3223
2293
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
3224
- const contents = {
3225
- name: "ValidationException",
3226
- $fault: "client",
3227
- $metadata: deserializeMetadata(parsedOutput),
3228
- message: undefined,
3229
- };
2294
+ const contents = {};
3230
2295
  const data = parsedOutput.body;
3231
2296
  if (data.message !== undefined && data.message !== null) {
3232
2297
  contents.message = smithy_client_1.expectString(data.message);
3233
2298
  }
3234
- return contents;
2299
+ const exception = new models_0_1.ValidationException({
2300
+ $metadata: deserializeMetadata(parsedOutput),
2301
+ ...contents,
2302
+ });
2303
+ return smithy_client_1.decorateServiceException(exception, parsedOutput.body);
3235
2304
  };
3236
2305
  const serializeAws_restJson1Action = (input, context) => {
3237
2306
  return models_0_1.Action.visit(input, {
@@ -3503,7 +2572,7 @@ const deserializeAws_restJson1Action = (output, context) => {
3503
2572
  return { $unknown: Object.entries(output)[0] };
3504
2573
  };
3505
2574
  const deserializeAws_restJson1ActionsList = (output, context) => {
3506
- return (output || [])
2575
+ const retVal = (output || [])
3507
2576
  .filter((e) => e != null)
3508
2577
  .map((entry) => {
3509
2578
  if (entry === null) {
@@ -3511,6 +2580,7 @@ const deserializeAws_restJson1ActionsList = (output, context) => {
3511
2580
  }
3512
2581
  return deserializeAws_restJson1Action(smithy_client_1.expectUnion(entry), context);
3513
2582
  });
2583
+ return retVal;
3514
2584
  };
3515
2585
  const deserializeAws_restJson1AutomationExecution = (output, context) => {
3516
2586
  if (smithy_client_1.expectString(output.ssmExecutionArn) !== undefined) {
@@ -3519,40 +2589,26 @@ const deserializeAws_restJson1AutomationExecution = (output, context) => {
3519
2589
  return { $unknown: Object.entries(output)[0] };
3520
2590
  };
3521
2591
  const deserializeAws_restJson1AutomationExecutionSet = (output, context) => {
3522
- const uniqueValues = new Set();
3523
- return (output || [])
2592
+ const retVal = (output || [])
3524
2593
  .filter((e) => e != null)
3525
2594
  .map((entry) => {
3526
2595
  if (entry === null) {
3527
2596
  return null;
3528
2597
  }
3529
- const parsedEntry = deserializeAws_restJson1AutomationExecution(smithy_client_1.expectUnion(entry), context);
3530
- if (uniqueValues.has(parsedEntry)) {
3531
- throw new TypeError('All elements of the set "com.amazonaws.ssmincidents#AutomationExecutionSet" must be unique.');
3532
- }
3533
- else {
3534
- uniqueValues.add(parsedEntry);
3535
- return parsedEntry;
3536
- }
2598
+ return deserializeAws_restJson1AutomationExecution(smithy_client_1.expectUnion(entry), context);
3537
2599
  });
2600
+ return retVal;
3538
2601
  };
3539
2602
  const deserializeAws_restJson1ChatbotSnsConfigurationSet = (output, context) => {
3540
- const uniqueValues = new Set();
3541
- return (output || [])
2603
+ const retVal = (output || [])
3542
2604
  .filter((e) => e != null)
3543
2605
  .map((entry) => {
3544
2606
  if (entry === null) {
3545
2607
  return null;
3546
2608
  }
3547
- const parsedEntry = smithy_client_1.expectString(entry);
3548
- if (uniqueValues.has(parsedEntry)) {
3549
- throw new TypeError('All elements of the set "com.amazonaws.ssmincidents#ChatbotSnsConfigurationSet" must be unique.');
3550
- }
3551
- else {
3552
- uniqueValues.add(parsedEntry);
3553
- return parsedEntry;
3554
- }
2609
+ return smithy_client_1.expectString(entry);
3555
2610
  });
2611
+ return retVal;
3556
2612
  };
3557
2613
  const deserializeAws_restJson1ChatChannel = (output, context) => {
3558
2614
  if (output.chatbotSns !== undefined && output.chatbotSns !== null) {
@@ -3571,22 +2627,15 @@ const deserializeAws_restJson1EmptyChatChannel = (output, context) => {
3571
2627
  return {};
3572
2628
  };
3573
2629
  const deserializeAws_restJson1EngagementSet = (output, context) => {
3574
- const uniqueValues = new Set();
3575
- return (output || [])
2630
+ const retVal = (output || [])
3576
2631
  .filter((e) => e != null)
3577
2632
  .map((entry) => {
3578
2633
  if (entry === null) {
3579
2634
  return null;
3580
2635
  }
3581
- const parsedEntry = smithy_client_1.expectString(entry);
3582
- if (uniqueValues.has(parsedEntry)) {
3583
- throw new TypeError('All elements of the set "com.amazonaws.ssmincidents#EngagementSet" must be unique.');
3584
- }
3585
- else {
3586
- uniqueValues.add(parsedEntry);
3587
- return parsedEntry;
3588
- }
2636
+ return smithy_client_1.expectString(entry);
3589
2637
  });
2638
+ return retVal;
3590
2639
  };
3591
2640
  const deserializeAws_restJson1EventSummary = (output, context) => {
3592
2641
  return {
@@ -3602,7 +2651,7 @@ const deserializeAws_restJson1EventSummary = (output, context) => {
3602
2651
  };
3603
2652
  };
3604
2653
  const deserializeAws_restJson1EventSummaryList = (output, context) => {
3605
- return (output || [])
2654
+ const retVal = (output || [])
3606
2655
  .filter((e) => e != null)
3607
2656
  .map((entry) => {
3608
2657
  if (entry === null) {
@@ -3610,6 +2659,7 @@ const deserializeAws_restJson1EventSummaryList = (output, context) => {
3610
2659
  }
3611
2660
  return deserializeAws_restJson1EventSummary(entry, context);
3612
2661
  });
2662
+ return retVal;
3613
2663
  };
3614
2664
  const deserializeAws_restJson1IncidentRecord = (output, context) => {
3615
2665
  return {
@@ -3669,7 +2719,7 @@ const deserializeAws_restJson1IncidentRecordSummary = (output, context) => {
3669
2719
  };
3670
2720
  };
3671
2721
  const deserializeAws_restJson1IncidentRecordSummaryList = (output, context) => {
3672
- return (output || [])
2722
+ const retVal = (output || [])
3673
2723
  .filter((e) => e != null)
3674
2724
  .map((entry) => {
3675
2725
  if (entry === null) {
@@ -3677,6 +2727,7 @@ const deserializeAws_restJson1IncidentRecordSummaryList = (output, context) => {
3677
2727
  }
3678
2728
  return deserializeAws_restJson1IncidentRecordSummary(entry, context);
3679
2729
  });
2730
+ return retVal;
3680
2731
  };
3681
2732
  const deserializeAws_restJson1IncidentTemplate = (output, context) => {
3682
2733
  return {
@@ -3716,22 +2767,15 @@ const deserializeAws_restJson1NotificationTargetItem = (output, context) => {
3716
2767
  return { $unknown: Object.entries(output)[0] };
3717
2768
  };
3718
2769
  const deserializeAws_restJson1NotificationTargetSet = (output, context) => {
3719
- const uniqueValues = new Set();
3720
- return (output || [])
2770
+ const retVal = (output || [])
3721
2771
  .filter((e) => e != null)
3722
2772
  .map((entry) => {
3723
2773
  if (entry === null) {
3724
2774
  return null;
3725
2775
  }
3726
- const parsedEntry = deserializeAws_restJson1NotificationTargetItem(smithy_client_1.expectUnion(entry), context);
3727
- if (uniqueValues.has(parsedEntry)) {
3728
- throw new TypeError('All elements of the set "com.amazonaws.ssmincidents#NotificationTargetSet" must be unique.');
3729
- }
3730
- else {
3731
- uniqueValues.add(parsedEntry);
3732
- return parsedEntry;
3733
- }
2776
+ return deserializeAws_restJson1NotificationTargetItem(smithy_client_1.expectUnion(entry), context);
3734
2777
  });
2778
+ return retVal;
3735
2779
  };
3736
2780
  const deserializeAws_restJson1RegionInfo = (output, context) => {
3737
2781
  return {
@@ -3763,7 +2807,7 @@ const deserializeAws_restJson1RelatedItem = (output, context) => {
3763
2807
  };
3764
2808
  };
3765
2809
  const deserializeAws_restJson1RelatedItemList = (output, context) => {
3766
- return (output || [])
2810
+ const retVal = (output || [])
3767
2811
  .filter((e) => e != null)
3768
2812
  .map((entry) => {
3769
2813
  if (entry === null) {
@@ -3771,6 +2815,7 @@ const deserializeAws_restJson1RelatedItemList = (output, context) => {
3771
2815
  }
3772
2816
  return deserializeAws_restJson1RelatedItem(entry, context);
3773
2817
  });
2818
+ return retVal;
3774
2819
  };
3775
2820
  const deserializeAws_restJson1ReplicationSet = (output, context) => {
3776
2821
  return {
@@ -3791,7 +2836,7 @@ const deserializeAws_restJson1ReplicationSet = (output, context) => {
3791
2836
  };
3792
2837
  };
3793
2838
  const deserializeAws_restJson1ReplicationSetArnList = (output, context) => {
3794
- return (output || [])
2839
+ const retVal = (output || [])
3795
2840
  .filter((e) => e != null)
3796
2841
  .map((entry) => {
3797
2842
  if (entry === null) {
@@ -3799,6 +2844,7 @@ const deserializeAws_restJson1ReplicationSetArnList = (output, context) => {
3799
2844
  }
3800
2845
  return smithy_client_1.expectString(entry);
3801
2846
  });
2847
+ return retVal;
3802
2848
  };
3803
2849
  const deserializeAws_restJson1ResourcePolicy = (output, context) => {
3804
2850
  return {
@@ -3808,7 +2854,7 @@ const deserializeAws_restJson1ResourcePolicy = (output, context) => {
3808
2854
  };
3809
2855
  };
3810
2856
  const deserializeAws_restJson1ResourcePolicyList = (output, context) => {
3811
- return (output || [])
2857
+ const retVal = (output || [])
3812
2858
  .filter((e) => e != null)
3813
2859
  .map((entry) => {
3814
2860
  if (entry === null) {
@@ -3816,6 +2862,7 @@ const deserializeAws_restJson1ResourcePolicyList = (output, context) => {
3816
2862
  }
3817
2863
  return deserializeAws_restJson1ResourcePolicy(entry, context);
3818
2864
  });
2865
+ return retVal;
3819
2866
  };
3820
2867
  const deserializeAws_restJson1ResponsePlanSummary = (output, context) => {
3821
2868
  return {
@@ -3825,7 +2872,7 @@ const deserializeAws_restJson1ResponsePlanSummary = (output, context) => {
3825
2872
  };
3826
2873
  };
3827
2874
  const deserializeAws_restJson1ResponsePlanSummaryList = (output, context) => {
3828
- return (output || [])
2875
+ const retVal = (output || [])
3829
2876
  .filter((e) => e != null)
3830
2877
  .map((entry) => {
3831
2878
  if (entry === null) {
@@ -3833,6 +2880,7 @@ const deserializeAws_restJson1ResponsePlanSummaryList = (output, context) => {
3833
2880
  }
3834
2881
  return deserializeAws_restJson1ResponsePlanSummary(entry, context);
3835
2882
  });
2883
+ return retVal;
3836
2884
  };
3837
2885
  const deserializeAws_restJson1SsmAutomation = (output, context) => {
3838
2886
  return {
@@ -3857,7 +2905,7 @@ const deserializeAws_restJson1SsmParameters = (output, context) => {
3857
2905
  }, {});
3858
2906
  };
3859
2907
  const deserializeAws_restJson1SsmParameterValues = (output, context) => {
3860
- return (output || [])
2908
+ const retVal = (output || [])
3861
2909
  .filter((e) => e != null)
3862
2910
  .map((entry) => {
3863
2911
  if (entry === null) {
@@ -3865,6 +2913,7 @@ const deserializeAws_restJson1SsmParameterValues = (output, context) => {
3865
2913
  }
3866
2914
  return smithy_client_1.expectString(entry);
3867
2915
  });
2916
+ return retVal;
3868
2917
  };
3869
2918
  const deserializeAws_restJson1TagMap = (output, context) => {
3870
2919
  return Object.entries(output).reduce((acc, [key, value]) => {