@aws-sdk/client-drs 3.141.0 → 3.142.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -460,10 +460,10 @@ const serializeAws_restJson1ListStagingAccountsCommand = async (input, context)
460
460
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
461
461
  const headers = {};
462
462
  const resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/ListStagingAccounts";
463
- const query = {
464
- ...(input.maxResults !== undefined && { maxResults: input.maxResults.toString() }),
465
- ...(input.nextToken !== undefined && { nextToken: input.nextToken }),
466
- };
463
+ const query = map({
464
+ maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
465
+ nextToken: [, input.nextToken],
466
+ });
467
467
  let body;
468
468
  return new protocol_http_1.HttpRequest({
469
469
  protocol,
@@ -481,16 +481,7 @@ const serializeAws_restJson1ListTagsForResourceCommand = async (input, context)
481
481
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
482
482
  const headers = {};
483
483
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
484
- if (input.resourceArn !== undefined) {
485
- const labelValue = input.resourceArn;
486
- if (labelValue.length <= 0) {
487
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
488
- }
489
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
490
- }
491
- else {
492
- throw new Error("No value provided for input HTTP label: resourceArn.");
493
- }
484
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
494
485
  let body;
495
486
  return new protocol_http_1.HttpRequest({
496
487
  protocol,
@@ -600,16 +591,7 @@ const serializeAws_restJson1TagResourceCommand = async (input, context) => {
600
591
  "content-type": "application/json",
601
592
  };
602
593
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
603
- if (input.resourceArn !== undefined) {
604
- const labelValue = input.resourceArn;
605
- if (labelValue.length <= 0) {
606
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
607
- }
608
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
609
- }
610
- else {
611
- throw new Error("No value provided for input HTTP label: resourceArn.");
612
- }
594
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
613
595
  let body;
614
596
  body = JSON.stringify({
615
597
  ...(input.tags != null && { tags: serializeAws_restJson1TagsMap(input.tags, context) }),
@@ -652,19 +634,10 @@ const serializeAws_restJson1UntagResourceCommand = async (input, context) => {
652
634
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
653
635
  const headers = {};
654
636
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
655
- if (input.resourceArn !== undefined) {
656
- const labelValue = input.resourceArn;
657
- if (labelValue.length <= 0) {
658
- throw new Error("Empty value provided for input HTTP label: resourceArn.");
659
- }
660
- resolvedPath = resolvedPath.replace("{resourceArn}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
661
- }
662
- else {
663
- throw new Error("No value provided for input HTTP label: resourceArn.");
664
- }
665
- const query = {
666
- ...(input.tagKeys !== undefined && { tagKeys: (input.tagKeys || []).map((_entry) => _entry) }),
667
- };
637
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "resourceArn", () => input.resourceArn, "{resourceArn}", false);
638
+ const query = map({
639
+ tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys || []).map((_entry) => _entry)],
640
+ });
668
641
  let body;
669
642
  return new protocol_http_1.HttpRequest({
670
643
  protocol,
@@ -834,15 +807,14 @@ const deserializeAws_restJson1CreateExtendedSourceServerCommand = async (output,
834
807
  if (output.statusCode !== 201 && output.statusCode >= 300) {
835
808
  return deserializeAws_restJson1CreateExtendedSourceServerCommandError(output, context);
836
809
  }
837
- const contents = {
810
+ const contents = map({
838
811
  $metadata: deserializeMetadata(output),
839
- sourceServer: undefined,
840
- };
812
+ });
841
813
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
842
- if (data.sourceServer !== undefined && data.sourceServer !== null) {
814
+ if (data.sourceServer != null) {
843
815
  contents.sourceServer = deserializeAws_restJson1SourceServer(data.sourceServer, context);
844
816
  }
845
- return Promise.resolve(contents);
817
+ return contents;
846
818
  };
847
819
  exports.deserializeAws_restJson1CreateExtendedSourceServerCommand = deserializeAws_restJson1CreateExtendedSourceServerCommand;
848
820
  const deserializeAws_restJson1CreateExtendedSourceServerCommandError = async (output, context) => {
@@ -850,7 +822,6 @@ const deserializeAws_restJson1CreateExtendedSourceServerCommandError = async (ou
850
822
  ...output,
851
823
  body: await parseBody(output.body, context),
852
824
  };
853
- let response;
854
825
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
855
826
  switch (errorCode) {
856
827
  case "AccessDeniedException":
@@ -876,89 +847,71 @@ const deserializeAws_restJson1CreateExtendedSourceServerCommandError = async (ou
876
847
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
877
848
  default:
878
849
  const parsedBody = parsedOutput.body;
879
- const $metadata = deserializeMetadata(output);
880
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
881
- response = new DrsServiceException_1.DrsServiceException({
882
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
883
- $fault: "client",
884
- $metadata,
850
+ (0, smithy_client_1.throwDefaultError)({
851
+ output,
852
+ parsedBody,
853
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
854
+ errorCode,
885
855
  });
886
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
887
856
  }
888
857
  };
889
858
  const deserializeAws_restJson1CreateReplicationConfigurationTemplateCommand = async (output, context) => {
890
859
  if (output.statusCode !== 201 && output.statusCode >= 300) {
891
860
  return deserializeAws_restJson1CreateReplicationConfigurationTemplateCommandError(output, context);
892
861
  }
893
- const contents = {
862
+ const contents = map({
894
863
  $metadata: deserializeMetadata(output),
895
- arn: undefined,
896
- associateDefaultSecurityGroup: undefined,
897
- bandwidthThrottling: undefined,
898
- createPublicIP: undefined,
899
- dataPlaneRouting: undefined,
900
- defaultLargeStagingDiskType: undefined,
901
- ebsEncryption: undefined,
902
- ebsEncryptionKeyArn: undefined,
903
- pitPolicy: undefined,
904
- replicationConfigurationTemplateID: undefined,
905
- replicationServerInstanceType: undefined,
906
- replicationServersSecurityGroupsIDs: undefined,
907
- stagingAreaSubnetId: undefined,
908
- stagingAreaTags: undefined,
909
- tags: undefined,
910
- useDedicatedReplicationServer: undefined,
911
- };
864
+ });
912
865
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
913
- if (data.arn !== undefined && data.arn !== null) {
866
+ if (data.arn != null) {
914
867
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
915
868
  }
916
- if (data.associateDefaultSecurityGroup !== undefined && data.associateDefaultSecurityGroup !== null) {
869
+ if (data.associateDefaultSecurityGroup != null) {
917
870
  contents.associateDefaultSecurityGroup = (0, smithy_client_1.expectBoolean)(data.associateDefaultSecurityGroup);
918
871
  }
919
- if (data.bandwidthThrottling !== undefined && data.bandwidthThrottling !== null) {
872
+ if (data.bandwidthThrottling != null) {
920
873
  contents.bandwidthThrottling = (0, smithy_client_1.expectLong)(data.bandwidthThrottling);
921
874
  }
922
- if (data.createPublicIP !== undefined && data.createPublicIP !== null) {
875
+ if (data.createPublicIP != null) {
923
876
  contents.createPublicIP = (0, smithy_client_1.expectBoolean)(data.createPublicIP);
924
877
  }
925
- if (data.dataPlaneRouting !== undefined && data.dataPlaneRouting !== null) {
878
+ if (data.dataPlaneRouting != null) {
926
879
  contents.dataPlaneRouting = (0, smithy_client_1.expectString)(data.dataPlaneRouting);
927
880
  }
928
- if (data.defaultLargeStagingDiskType !== undefined && data.defaultLargeStagingDiskType !== null) {
881
+ if (data.defaultLargeStagingDiskType != null) {
929
882
  contents.defaultLargeStagingDiskType = (0, smithy_client_1.expectString)(data.defaultLargeStagingDiskType);
930
883
  }
931
- if (data.ebsEncryption !== undefined && data.ebsEncryption !== null) {
884
+ if (data.ebsEncryption != null) {
932
885
  contents.ebsEncryption = (0, smithy_client_1.expectString)(data.ebsEncryption);
933
886
  }
934
- if (data.ebsEncryptionKeyArn !== undefined && data.ebsEncryptionKeyArn !== null) {
887
+ if (data.ebsEncryptionKeyArn != null) {
935
888
  contents.ebsEncryptionKeyArn = (0, smithy_client_1.expectString)(data.ebsEncryptionKeyArn);
936
889
  }
937
- if (data.pitPolicy !== undefined && data.pitPolicy !== null) {
890
+ if (data.pitPolicy != null) {
938
891
  contents.pitPolicy = deserializeAws_restJson1PITPolicy(data.pitPolicy, context);
939
892
  }
940
- if (data.replicationConfigurationTemplateID !== undefined && data.replicationConfigurationTemplateID !== null) {
893
+ if (data.replicationConfigurationTemplateID != null) {
941
894
  contents.replicationConfigurationTemplateID = (0, smithy_client_1.expectString)(data.replicationConfigurationTemplateID);
942
895
  }
943
- if (data.replicationServerInstanceType !== undefined && data.replicationServerInstanceType !== null) {
896
+ if (data.replicationServerInstanceType != null) {
944
897
  contents.replicationServerInstanceType = (0, smithy_client_1.expectString)(data.replicationServerInstanceType);
945
898
  }
946
- if (data.replicationServersSecurityGroupsIDs !== undefined && data.replicationServersSecurityGroupsIDs !== null) {
899
+ if (data.replicationServersSecurityGroupsIDs != null) {
947
900
  contents.replicationServersSecurityGroupsIDs = deserializeAws_restJson1ReplicationServersSecurityGroupsIDs(data.replicationServersSecurityGroupsIDs, context);
948
901
  }
949
- if (data.stagingAreaSubnetId !== undefined && data.stagingAreaSubnetId !== null) {
902
+ if (data.stagingAreaSubnetId != null) {
950
903
  contents.stagingAreaSubnetId = (0, smithy_client_1.expectString)(data.stagingAreaSubnetId);
951
904
  }
952
- if (data.stagingAreaTags !== undefined && data.stagingAreaTags !== null) {
905
+ if (data.stagingAreaTags != null) {
953
906
  contents.stagingAreaTags = deserializeAws_restJson1TagsMap(data.stagingAreaTags, context);
954
907
  }
955
- if (data.tags !== undefined && data.tags !== null) {
908
+ if (data.tags != null) {
956
909
  contents.tags = deserializeAws_restJson1TagsMap(data.tags, context);
957
910
  }
958
- if (data.useDedicatedReplicationServer !== undefined && data.useDedicatedReplicationServer !== null) {
911
+ if (data.useDedicatedReplicationServer != null) {
959
912
  contents.useDedicatedReplicationServer = (0, smithy_client_1.expectBoolean)(data.useDedicatedReplicationServer);
960
913
  }
961
- return Promise.resolve(contents);
914
+ return contents;
962
915
  };
963
916
  exports.deserializeAws_restJson1CreateReplicationConfigurationTemplateCommand = deserializeAws_restJson1CreateReplicationConfigurationTemplateCommand;
964
917
  const deserializeAws_restJson1CreateReplicationConfigurationTemplateCommandError = async (output, context) => {
@@ -966,7 +919,6 @@ const deserializeAws_restJson1CreateReplicationConfigurationTemplateCommandError
966
919
  ...output,
967
920
  body: await parseBody(output.body, context),
968
921
  };
969
- let response;
970
922
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
971
923
  switch (errorCode) {
972
924
  case "AccessDeniedException":
@@ -989,25 +941,23 @@ const deserializeAws_restJson1CreateReplicationConfigurationTemplateCommandError
989
941
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
990
942
  default:
991
943
  const parsedBody = parsedOutput.body;
992
- const $metadata = deserializeMetadata(output);
993
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
994
- response = new DrsServiceException_1.DrsServiceException({
995
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
996
- $fault: "client",
997
- $metadata,
944
+ (0, smithy_client_1.throwDefaultError)({
945
+ output,
946
+ parsedBody,
947
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
948
+ errorCode,
998
949
  });
999
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1000
950
  }
1001
951
  };
1002
952
  const deserializeAws_restJson1DeleteJobCommand = async (output, context) => {
1003
953
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1004
954
  return deserializeAws_restJson1DeleteJobCommandError(output, context);
1005
955
  }
1006
- const contents = {
956
+ const contents = map({
1007
957
  $metadata: deserializeMetadata(output),
1008
- };
958
+ });
1009
959
  await collectBody(output.body, context);
1010
- return Promise.resolve(contents);
960
+ return contents;
1011
961
  };
1012
962
  exports.deserializeAws_restJson1DeleteJobCommand = deserializeAws_restJson1DeleteJobCommand;
1013
963
  const deserializeAws_restJson1DeleteJobCommandError = async (output, context) => {
@@ -1015,7 +965,6 @@ const deserializeAws_restJson1DeleteJobCommandError = async (output, context) =>
1015
965
  ...output,
1016
966
  body: await parseBody(output.body, context),
1017
967
  };
1018
- let response;
1019
968
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1020
969
  switch (errorCode) {
1021
970
  case "ConflictException":
@@ -1035,25 +984,23 @@ const deserializeAws_restJson1DeleteJobCommandError = async (output, context) =>
1035
984
  throw await deserializeAws_restJson1UninitializedAccountExceptionResponse(parsedOutput, context);
1036
985
  default:
1037
986
  const parsedBody = parsedOutput.body;
1038
- const $metadata = deserializeMetadata(output);
1039
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1040
- response = new DrsServiceException_1.DrsServiceException({
1041
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1042
- $fault: "client",
1043
- $metadata,
987
+ (0, smithy_client_1.throwDefaultError)({
988
+ output,
989
+ parsedBody,
990
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
991
+ errorCode,
1044
992
  });
1045
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1046
993
  }
1047
994
  };
1048
995
  const deserializeAws_restJson1DeleteRecoveryInstanceCommand = async (output, context) => {
1049
996
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1050
997
  return deserializeAws_restJson1DeleteRecoveryInstanceCommandError(output, context);
1051
998
  }
1052
- const contents = {
999
+ const contents = map({
1053
1000
  $metadata: deserializeMetadata(output),
1054
- };
1001
+ });
1055
1002
  await collectBody(output.body, context);
1056
- return Promise.resolve(contents);
1003
+ return contents;
1057
1004
  };
1058
1005
  exports.deserializeAws_restJson1DeleteRecoveryInstanceCommand = deserializeAws_restJson1DeleteRecoveryInstanceCommand;
1059
1006
  const deserializeAws_restJson1DeleteRecoveryInstanceCommandError = async (output, context) => {
@@ -1061,7 +1008,6 @@ const deserializeAws_restJson1DeleteRecoveryInstanceCommandError = async (output
1061
1008
  ...output,
1062
1009
  body: await parseBody(output.body, context),
1063
1010
  };
1064
- let response;
1065
1011
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1066
1012
  switch (errorCode) {
1067
1013
  case "AccessDeniedException":
@@ -1081,25 +1027,23 @@ const deserializeAws_restJson1DeleteRecoveryInstanceCommandError = async (output
1081
1027
  throw await deserializeAws_restJson1UninitializedAccountExceptionResponse(parsedOutput, context);
1082
1028
  default:
1083
1029
  const parsedBody = parsedOutput.body;
1084
- const $metadata = deserializeMetadata(output);
1085
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1086
- response = new DrsServiceException_1.DrsServiceException({
1087
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1088
- $fault: "client",
1089
- $metadata,
1030
+ (0, smithy_client_1.throwDefaultError)({
1031
+ output,
1032
+ parsedBody,
1033
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
1034
+ errorCode,
1090
1035
  });
1091
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1092
1036
  }
1093
1037
  };
1094
1038
  const deserializeAws_restJson1DeleteReplicationConfigurationTemplateCommand = async (output, context) => {
1095
1039
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1096
1040
  return deserializeAws_restJson1DeleteReplicationConfigurationTemplateCommandError(output, context);
1097
1041
  }
1098
- const contents = {
1042
+ const contents = map({
1099
1043
  $metadata: deserializeMetadata(output),
1100
- };
1044
+ });
1101
1045
  await collectBody(output.body, context);
1102
- return Promise.resolve(contents);
1046
+ return contents;
1103
1047
  };
1104
1048
  exports.deserializeAws_restJson1DeleteReplicationConfigurationTemplateCommand = deserializeAws_restJson1DeleteReplicationConfigurationTemplateCommand;
1105
1049
  const deserializeAws_restJson1DeleteReplicationConfigurationTemplateCommandError = async (output, context) => {
@@ -1107,7 +1051,6 @@ const deserializeAws_restJson1DeleteReplicationConfigurationTemplateCommandError
1107
1051
  ...output,
1108
1052
  body: await parseBody(output.body, context),
1109
1053
  };
1110
- let response;
1111
1054
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1112
1055
  switch (errorCode) {
1113
1056
  case "ConflictException":
@@ -1127,25 +1070,23 @@ const deserializeAws_restJson1DeleteReplicationConfigurationTemplateCommandError
1127
1070
  throw await deserializeAws_restJson1UninitializedAccountExceptionResponse(parsedOutput, context);
1128
1071
  default:
1129
1072
  const parsedBody = parsedOutput.body;
1130
- const $metadata = deserializeMetadata(output);
1131
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1132
- response = new DrsServiceException_1.DrsServiceException({
1133
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1134
- $fault: "client",
1135
- $metadata,
1073
+ (0, smithy_client_1.throwDefaultError)({
1074
+ output,
1075
+ parsedBody,
1076
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
1077
+ errorCode,
1136
1078
  });
1137
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1138
1079
  }
1139
1080
  };
1140
1081
  const deserializeAws_restJson1DeleteSourceServerCommand = async (output, context) => {
1141
1082
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1142
1083
  return deserializeAws_restJson1DeleteSourceServerCommandError(output, context);
1143
1084
  }
1144
- const contents = {
1085
+ const contents = map({
1145
1086
  $metadata: deserializeMetadata(output),
1146
- };
1087
+ });
1147
1088
  await collectBody(output.body, context);
1148
- return Promise.resolve(contents);
1089
+ return contents;
1149
1090
  };
1150
1091
  exports.deserializeAws_restJson1DeleteSourceServerCommand = deserializeAws_restJson1DeleteSourceServerCommand;
1151
1092
  const deserializeAws_restJson1DeleteSourceServerCommandError = async (output, context) => {
@@ -1153,7 +1094,6 @@ const deserializeAws_restJson1DeleteSourceServerCommandError = async (output, co
1153
1094
  ...output,
1154
1095
  body: await parseBody(output.body, context),
1155
1096
  };
1156
- let response;
1157
1097
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1158
1098
  switch (errorCode) {
1159
1099
  case "ConflictException":
@@ -1173,33 +1113,29 @@ const deserializeAws_restJson1DeleteSourceServerCommandError = async (output, co
1173
1113
  throw await deserializeAws_restJson1UninitializedAccountExceptionResponse(parsedOutput, context);
1174
1114
  default:
1175
1115
  const parsedBody = parsedOutput.body;
1176
- const $metadata = deserializeMetadata(output);
1177
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1178
- response = new DrsServiceException_1.DrsServiceException({
1179
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1180
- $fault: "client",
1181
- $metadata,
1116
+ (0, smithy_client_1.throwDefaultError)({
1117
+ output,
1118
+ parsedBody,
1119
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
1120
+ errorCode,
1182
1121
  });
1183
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1184
1122
  }
1185
1123
  };
1186
1124
  const deserializeAws_restJson1DescribeJobLogItemsCommand = async (output, context) => {
1187
1125
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1188
1126
  return deserializeAws_restJson1DescribeJobLogItemsCommandError(output, context);
1189
1127
  }
1190
- const contents = {
1128
+ const contents = map({
1191
1129
  $metadata: deserializeMetadata(output),
1192
- items: undefined,
1193
- nextToken: undefined,
1194
- };
1130
+ });
1195
1131
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1196
- if (data.items !== undefined && data.items !== null) {
1132
+ if (data.items != null) {
1197
1133
  contents.items = deserializeAws_restJson1JobLogs(data.items, context);
1198
1134
  }
1199
- if (data.nextToken !== undefined && data.nextToken !== null) {
1135
+ if (data.nextToken != null) {
1200
1136
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1201
1137
  }
1202
- return Promise.resolve(contents);
1138
+ return contents;
1203
1139
  };
1204
1140
  exports.deserializeAws_restJson1DescribeJobLogItemsCommand = deserializeAws_restJson1DescribeJobLogItemsCommand;
1205
1141
  const deserializeAws_restJson1DescribeJobLogItemsCommandError = async (output, context) => {
@@ -1207,7 +1143,6 @@ const deserializeAws_restJson1DescribeJobLogItemsCommandError = async (output, c
1207
1143
  ...output,
1208
1144
  body: await parseBody(output.body, context),
1209
1145
  };
1210
- let response;
1211
1146
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1212
1147
  switch (errorCode) {
1213
1148
  case "InternalServerException":
@@ -1224,33 +1159,29 @@ const deserializeAws_restJson1DescribeJobLogItemsCommandError = async (output, c
1224
1159
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1225
1160
  default:
1226
1161
  const parsedBody = parsedOutput.body;
1227
- const $metadata = deserializeMetadata(output);
1228
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1229
- response = new DrsServiceException_1.DrsServiceException({
1230
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1231
- $fault: "client",
1232
- $metadata,
1162
+ (0, smithy_client_1.throwDefaultError)({
1163
+ output,
1164
+ parsedBody,
1165
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
1166
+ errorCode,
1233
1167
  });
1234
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1235
1168
  }
1236
1169
  };
1237
1170
  const deserializeAws_restJson1DescribeJobsCommand = async (output, context) => {
1238
1171
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1239
1172
  return deserializeAws_restJson1DescribeJobsCommandError(output, context);
1240
1173
  }
1241
- const contents = {
1174
+ const contents = map({
1242
1175
  $metadata: deserializeMetadata(output),
1243
- items: undefined,
1244
- nextToken: undefined,
1245
- };
1176
+ });
1246
1177
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1247
- if (data.items !== undefined && data.items !== null) {
1178
+ if (data.items != null) {
1248
1179
  contents.items = deserializeAws_restJson1JobsList(data.items, context);
1249
1180
  }
1250
- if (data.nextToken !== undefined && data.nextToken !== null) {
1181
+ if (data.nextToken != null) {
1251
1182
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1252
1183
  }
1253
- return Promise.resolve(contents);
1184
+ return contents;
1254
1185
  };
1255
1186
  exports.deserializeAws_restJson1DescribeJobsCommand = deserializeAws_restJson1DescribeJobsCommand;
1256
1187
  const deserializeAws_restJson1DescribeJobsCommandError = async (output, context) => {
@@ -1258,7 +1189,6 @@ const deserializeAws_restJson1DescribeJobsCommandError = async (output, context)
1258
1189
  ...output,
1259
1190
  body: await parseBody(output.body, context),
1260
1191
  };
1261
- let response;
1262
1192
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1263
1193
  switch (errorCode) {
1264
1194
  case "InternalServerException":
@@ -1275,33 +1205,29 @@ const deserializeAws_restJson1DescribeJobsCommandError = async (output, context)
1275
1205
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1276
1206
  default:
1277
1207
  const parsedBody = parsedOutput.body;
1278
- const $metadata = deserializeMetadata(output);
1279
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1280
- response = new DrsServiceException_1.DrsServiceException({
1281
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1282
- $fault: "client",
1283
- $metadata,
1208
+ (0, smithy_client_1.throwDefaultError)({
1209
+ output,
1210
+ parsedBody,
1211
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
1212
+ errorCode,
1284
1213
  });
1285
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1286
1214
  }
1287
1215
  };
1288
1216
  const deserializeAws_restJson1DescribeRecoveryInstancesCommand = async (output, context) => {
1289
1217
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1290
1218
  return deserializeAws_restJson1DescribeRecoveryInstancesCommandError(output, context);
1291
1219
  }
1292
- const contents = {
1220
+ const contents = map({
1293
1221
  $metadata: deserializeMetadata(output),
1294
- items: undefined,
1295
- nextToken: undefined,
1296
- };
1222
+ });
1297
1223
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1298
- if (data.items !== undefined && data.items !== null) {
1224
+ if (data.items != null) {
1299
1225
  contents.items = deserializeAws_restJson1DescribeRecoveryInstancesItems(data.items, context);
1300
1226
  }
1301
- if (data.nextToken !== undefined && data.nextToken !== null) {
1227
+ if (data.nextToken != null) {
1302
1228
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1303
1229
  }
1304
- return Promise.resolve(contents);
1230
+ return contents;
1305
1231
  };
1306
1232
  exports.deserializeAws_restJson1DescribeRecoveryInstancesCommand = deserializeAws_restJson1DescribeRecoveryInstancesCommand;
1307
1233
  const deserializeAws_restJson1DescribeRecoveryInstancesCommandError = async (output, context) => {
@@ -1309,7 +1235,6 @@ const deserializeAws_restJson1DescribeRecoveryInstancesCommandError = async (out
1309
1235
  ...output,
1310
1236
  body: await parseBody(output.body, context),
1311
1237
  };
1312
- let response;
1313
1238
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1314
1239
  switch (errorCode) {
1315
1240
  case "AccessDeniedException":
@@ -1326,33 +1251,29 @@ const deserializeAws_restJson1DescribeRecoveryInstancesCommandError = async (out
1326
1251
  throw await deserializeAws_restJson1UninitializedAccountExceptionResponse(parsedOutput, context);
1327
1252
  default:
1328
1253
  const parsedBody = parsedOutput.body;
1329
- const $metadata = deserializeMetadata(output);
1330
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1331
- response = new DrsServiceException_1.DrsServiceException({
1332
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1333
- $fault: "client",
1334
- $metadata,
1254
+ (0, smithy_client_1.throwDefaultError)({
1255
+ output,
1256
+ parsedBody,
1257
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
1258
+ errorCode,
1335
1259
  });
1336
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1337
1260
  }
1338
1261
  };
1339
1262
  const deserializeAws_restJson1DescribeRecoverySnapshotsCommand = async (output, context) => {
1340
1263
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1341
1264
  return deserializeAws_restJson1DescribeRecoverySnapshotsCommandError(output, context);
1342
1265
  }
1343
- const contents = {
1266
+ const contents = map({
1344
1267
  $metadata: deserializeMetadata(output),
1345
- items: undefined,
1346
- nextToken: undefined,
1347
- };
1268
+ });
1348
1269
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1349
- if (data.items !== undefined && data.items !== null) {
1270
+ if (data.items != null) {
1350
1271
  contents.items = deserializeAws_restJson1RecoverySnapshotsList(data.items, context);
1351
1272
  }
1352
- if (data.nextToken !== undefined && data.nextToken !== null) {
1273
+ if (data.nextToken != null) {
1353
1274
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1354
1275
  }
1355
- return Promise.resolve(contents);
1276
+ return contents;
1356
1277
  };
1357
1278
  exports.deserializeAws_restJson1DescribeRecoverySnapshotsCommand = deserializeAws_restJson1DescribeRecoverySnapshotsCommand;
1358
1279
  const deserializeAws_restJson1DescribeRecoverySnapshotsCommandError = async (output, context) => {
@@ -1360,7 +1281,6 @@ const deserializeAws_restJson1DescribeRecoverySnapshotsCommandError = async (out
1360
1281
  ...output,
1361
1282
  body: await parseBody(output.body, context),
1362
1283
  };
1363
- let response;
1364
1284
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1365
1285
  switch (errorCode) {
1366
1286
  case "AccessDeniedException":
@@ -1380,33 +1300,29 @@ const deserializeAws_restJson1DescribeRecoverySnapshotsCommandError = async (out
1380
1300
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1381
1301
  default:
1382
1302
  const parsedBody = parsedOutput.body;
1383
- const $metadata = deserializeMetadata(output);
1384
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1385
- response = new DrsServiceException_1.DrsServiceException({
1386
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1387
- $fault: "client",
1388
- $metadata,
1303
+ (0, smithy_client_1.throwDefaultError)({
1304
+ output,
1305
+ parsedBody,
1306
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
1307
+ errorCode,
1389
1308
  });
1390
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1391
1309
  }
1392
1310
  };
1393
1311
  const deserializeAws_restJson1DescribeReplicationConfigurationTemplatesCommand = async (output, context) => {
1394
1312
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1395
1313
  return deserializeAws_restJson1DescribeReplicationConfigurationTemplatesCommandError(output, context);
1396
1314
  }
1397
- const contents = {
1315
+ const contents = map({
1398
1316
  $metadata: deserializeMetadata(output),
1399
- items: undefined,
1400
- nextToken: undefined,
1401
- };
1317
+ });
1402
1318
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1403
- if (data.items !== undefined && data.items !== null) {
1319
+ if (data.items != null) {
1404
1320
  contents.items = deserializeAws_restJson1ReplicationConfigurationTemplates(data.items, context);
1405
1321
  }
1406
- if (data.nextToken !== undefined && data.nextToken !== null) {
1322
+ if (data.nextToken != null) {
1407
1323
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1408
1324
  }
1409
- return Promise.resolve(contents);
1325
+ return contents;
1410
1326
  };
1411
1327
  exports.deserializeAws_restJson1DescribeReplicationConfigurationTemplatesCommand = deserializeAws_restJson1DescribeReplicationConfigurationTemplatesCommand;
1412
1328
  const deserializeAws_restJson1DescribeReplicationConfigurationTemplatesCommandError = async (output, context) => {
@@ -1414,7 +1330,6 @@ const deserializeAws_restJson1DescribeReplicationConfigurationTemplatesCommandEr
1414
1330
  ...output,
1415
1331
  body: await parseBody(output.body, context),
1416
1332
  };
1417
- let response;
1418
1333
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1419
1334
  switch (errorCode) {
1420
1335
  case "InternalServerException":
@@ -1434,33 +1349,29 @@ const deserializeAws_restJson1DescribeReplicationConfigurationTemplatesCommandEr
1434
1349
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1435
1350
  default:
1436
1351
  const parsedBody = parsedOutput.body;
1437
- const $metadata = deserializeMetadata(output);
1438
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1439
- response = new DrsServiceException_1.DrsServiceException({
1440
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1441
- $fault: "client",
1442
- $metadata,
1352
+ (0, smithy_client_1.throwDefaultError)({
1353
+ output,
1354
+ parsedBody,
1355
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
1356
+ errorCode,
1443
1357
  });
1444
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1445
1358
  }
1446
1359
  };
1447
1360
  const deserializeAws_restJson1DescribeSourceServersCommand = async (output, context) => {
1448
1361
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1449
1362
  return deserializeAws_restJson1DescribeSourceServersCommandError(output, context);
1450
1363
  }
1451
- const contents = {
1364
+ const contents = map({
1452
1365
  $metadata: deserializeMetadata(output),
1453
- items: undefined,
1454
- nextToken: undefined,
1455
- };
1366
+ });
1456
1367
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1457
- if (data.items !== undefined && data.items !== null) {
1368
+ if (data.items != null) {
1458
1369
  contents.items = deserializeAws_restJson1SourceServersList(data.items, context);
1459
1370
  }
1460
- if (data.nextToken !== undefined && data.nextToken !== null) {
1371
+ if (data.nextToken != null) {
1461
1372
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1462
1373
  }
1463
- return Promise.resolve(contents);
1374
+ return contents;
1464
1375
  };
1465
1376
  exports.deserializeAws_restJson1DescribeSourceServersCommand = deserializeAws_restJson1DescribeSourceServersCommand;
1466
1377
  const deserializeAws_restJson1DescribeSourceServersCommandError = async (output, context) => {
@@ -1468,7 +1379,6 @@ const deserializeAws_restJson1DescribeSourceServersCommandError = async (output,
1468
1379
  ...output,
1469
1380
  body: await parseBody(output.body, context),
1470
1381
  };
1471
- let response;
1472
1382
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1473
1383
  switch (errorCode) {
1474
1384
  case "InternalServerException":
@@ -1485,25 +1395,23 @@ const deserializeAws_restJson1DescribeSourceServersCommandError = async (output,
1485
1395
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1486
1396
  default:
1487
1397
  const parsedBody = parsedOutput.body;
1488
- const $metadata = deserializeMetadata(output);
1489
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1490
- response = new DrsServiceException_1.DrsServiceException({
1491
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1492
- $fault: "client",
1493
- $metadata,
1398
+ (0, smithy_client_1.throwDefaultError)({
1399
+ output,
1400
+ parsedBody,
1401
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
1402
+ errorCode,
1494
1403
  });
1495
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1496
1404
  }
1497
1405
  };
1498
1406
  const deserializeAws_restJson1DisconnectRecoveryInstanceCommand = async (output, context) => {
1499
1407
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1500
1408
  return deserializeAws_restJson1DisconnectRecoveryInstanceCommandError(output, context);
1501
1409
  }
1502
- const contents = {
1410
+ const contents = map({
1503
1411
  $metadata: deserializeMetadata(output),
1504
- };
1412
+ });
1505
1413
  await collectBody(output.body, context);
1506
- return Promise.resolve(contents);
1414
+ return contents;
1507
1415
  };
1508
1416
  exports.deserializeAws_restJson1DisconnectRecoveryInstanceCommand = deserializeAws_restJson1DisconnectRecoveryInstanceCommand;
1509
1417
  const deserializeAws_restJson1DisconnectRecoveryInstanceCommandError = async (output, context) => {
@@ -1511,7 +1419,6 @@ const deserializeAws_restJson1DisconnectRecoveryInstanceCommandError = async (ou
1511
1419
  ...output,
1512
1420
  body: await parseBody(output.body, context),
1513
1421
  };
1514
- let response;
1515
1422
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1516
1423
  switch (errorCode) {
1517
1424
  case "AccessDeniedException":
@@ -1534,61 +1441,50 @@ const deserializeAws_restJson1DisconnectRecoveryInstanceCommandError = async (ou
1534
1441
  throw await deserializeAws_restJson1UninitializedAccountExceptionResponse(parsedOutput, context);
1535
1442
  default:
1536
1443
  const parsedBody = parsedOutput.body;
1537
- const $metadata = deserializeMetadata(output);
1538
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1539
- response = new DrsServiceException_1.DrsServiceException({
1540
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1541
- $fault: "client",
1542
- $metadata,
1444
+ (0, smithy_client_1.throwDefaultError)({
1445
+ output,
1446
+ parsedBody,
1447
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
1448
+ errorCode,
1543
1449
  });
1544
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1545
1450
  }
1546
1451
  };
1547
1452
  const deserializeAws_restJson1DisconnectSourceServerCommand = async (output, context) => {
1548
1453
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1549
1454
  return deserializeAws_restJson1DisconnectSourceServerCommandError(output, context);
1550
1455
  }
1551
- const contents = {
1456
+ const contents = map({
1552
1457
  $metadata: deserializeMetadata(output),
1553
- arn: undefined,
1554
- dataReplicationInfo: undefined,
1555
- lastLaunchResult: undefined,
1556
- lifeCycle: undefined,
1557
- recoveryInstanceId: undefined,
1558
- sourceProperties: undefined,
1559
- sourceServerID: undefined,
1560
- stagingArea: undefined,
1561
- tags: undefined,
1562
- };
1458
+ });
1563
1459
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1564
- if (data.arn !== undefined && data.arn !== null) {
1460
+ if (data.arn != null) {
1565
1461
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
1566
1462
  }
1567
- if (data.dataReplicationInfo !== undefined && data.dataReplicationInfo !== null) {
1463
+ if (data.dataReplicationInfo != null) {
1568
1464
  contents.dataReplicationInfo = deserializeAws_restJson1DataReplicationInfo(data.dataReplicationInfo, context);
1569
1465
  }
1570
- if (data.lastLaunchResult !== undefined && data.lastLaunchResult !== null) {
1466
+ if (data.lastLaunchResult != null) {
1571
1467
  contents.lastLaunchResult = (0, smithy_client_1.expectString)(data.lastLaunchResult);
1572
1468
  }
1573
- if (data.lifeCycle !== undefined && data.lifeCycle !== null) {
1469
+ if (data.lifeCycle != null) {
1574
1470
  contents.lifeCycle = deserializeAws_restJson1LifeCycle(data.lifeCycle, context);
1575
1471
  }
1576
- if (data.recoveryInstanceId !== undefined && data.recoveryInstanceId !== null) {
1472
+ if (data.recoveryInstanceId != null) {
1577
1473
  contents.recoveryInstanceId = (0, smithy_client_1.expectString)(data.recoveryInstanceId);
1578
1474
  }
1579
- if (data.sourceProperties !== undefined && data.sourceProperties !== null) {
1475
+ if (data.sourceProperties != null) {
1580
1476
  contents.sourceProperties = deserializeAws_restJson1SourceProperties(data.sourceProperties, context);
1581
1477
  }
1582
- if (data.sourceServerID !== undefined && data.sourceServerID !== null) {
1478
+ if (data.sourceServerID != null) {
1583
1479
  contents.sourceServerID = (0, smithy_client_1.expectString)(data.sourceServerID);
1584
1480
  }
1585
- if (data.stagingArea !== undefined && data.stagingArea !== null) {
1481
+ if (data.stagingArea != null) {
1586
1482
  contents.stagingArea = deserializeAws_restJson1StagingArea(data.stagingArea, context);
1587
1483
  }
1588
- if (data.tags !== undefined && data.tags !== null) {
1484
+ if (data.tags != null) {
1589
1485
  contents.tags = deserializeAws_restJson1TagsMap(data.tags, context);
1590
1486
  }
1591
- return Promise.resolve(contents);
1487
+ return contents;
1592
1488
  };
1593
1489
  exports.deserializeAws_restJson1DisconnectSourceServerCommand = deserializeAws_restJson1DisconnectSourceServerCommand;
1594
1490
  const deserializeAws_restJson1DisconnectSourceServerCommandError = async (output, context) => {
@@ -1596,7 +1492,6 @@ const deserializeAws_restJson1DisconnectSourceServerCommandError = async (output
1596
1492
  ...output,
1597
1493
  body: await parseBody(output.body, context),
1598
1494
  };
1599
- let response;
1600
1495
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1601
1496
  switch (errorCode) {
1602
1497
  case "ConflictException":
@@ -1616,41 +1511,35 @@ const deserializeAws_restJson1DisconnectSourceServerCommandError = async (output
1616
1511
  throw await deserializeAws_restJson1UninitializedAccountExceptionResponse(parsedOutput, context);
1617
1512
  default:
1618
1513
  const parsedBody = parsedOutput.body;
1619
- const $metadata = deserializeMetadata(output);
1620
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1621
- response = new DrsServiceException_1.DrsServiceException({
1622
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1623
- $fault: "client",
1624
- $metadata,
1514
+ (0, smithy_client_1.throwDefaultError)({
1515
+ output,
1516
+ parsedBody,
1517
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
1518
+ errorCode,
1625
1519
  });
1626
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1627
1520
  }
1628
1521
  };
1629
1522
  const deserializeAws_restJson1GetFailbackReplicationConfigurationCommand = async (output, context) => {
1630
1523
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1631
1524
  return deserializeAws_restJson1GetFailbackReplicationConfigurationCommandError(output, context);
1632
1525
  }
1633
- const contents = {
1526
+ const contents = map({
1634
1527
  $metadata: deserializeMetadata(output),
1635
- bandwidthThrottling: undefined,
1636
- name: undefined,
1637
- recoveryInstanceID: undefined,
1638
- usePrivateIP: undefined,
1639
- };
1528
+ });
1640
1529
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1641
- if (data.bandwidthThrottling !== undefined && data.bandwidthThrottling !== null) {
1530
+ if (data.bandwidthThrottling != null) {
1642
1531
  contents.bandwidthThrottling = (0, smithy_client_1.expectLong)(data.bandwidthThrottling);
1643
1532
  }
1644
- if (data.name !== undefined && data.name !== null) {
1533
+ if (data.name != null) {
1645
1534
  contents.name = (0, smithy_client_1.expectString)(data.name);
1646
1535
  }
1647
- if (data.recoveryInstanceID !== undefined && data.recoveryInstanceID !== null) {
1536
+ if (data.recoveryInstanceID != null) {
1648
1537
  contents.recoveryInstanceID = (0, smithy_client_1.expectString)(data.recoveryInstanceID);
1649
1538
  }
1650
- if (data.usePrivateIP !== undefined && data.usePrivateIP !== null) {
1539
+ if (data.usePrivateIP != null) {
1651
1540
  contents.usePrivateIP = (0, smithy_client_1.expectBoolean)(data.usePrivateIP);
1652
1541
  }
1653
- return Promise.resolve(contents);
1542
+ return contents;
1654
1543
  };
1655
1544
  exports.deserializeAws_restJson1GetFailbackReplicationConfigurationCommand = deserializeAws_restJson1GetFailbackReplicationConfigurationCommand;
1656
1545
  const deserializeAws_restJson1GetFailbackReplicationConfigurationCommandError = async (output, context) => {
@@ -1658,7 +1547,6 @@ const deserializeAws_restJson1GetFailbackReplicationConfigurationCommandError =
1658
1547
  ...output,
1659
1548
  body: await parseBody(output.body, context),
1660
1549
  };
1661
- let response;
1662
1550
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1663
1551
  switch (errorCode) {
1664
1552
  case "InternalServerException":
@@ -1675,57 +1563,47 @@ const deserializeAws_restJson1GetFailbackReplicationConfigurationCommandError =
1675
1563
  throw await deserializeAws_restJson1UninitializedAccountExceptionResponse(parsedOutput, context);
1676
1564
  default:
1677
1565
  const parsedBody = parsedOutput.body;
1678
- const $metadata = deserializeMetadata(output);
1679
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1680
- response = new DrsServiceException_1.DrsServiceException({
1681
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1682
- $fault: "client",
1683
- $metadata,
1566
+ (0, smithy_client_1.throwDefaultError)({
1567
+ output,
1568
+ parsedBody,
1569
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
1570
+ errorCode,
1684
1571
  });
1685
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1686
1572
  }
1687
1573
  };
1688
1574
  const deserializeAws_restJson1GetLaunchConfigurationCommand = async (output, context) => {
1689
1575
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1690
1576
  return deserializeAws_restJson1GetLaunchConfigurationCommandError(output, context);
1691
1577
  }
1692
- const contents = {
1578
+ const contents = map({
1693
1579
  $metadata: deserializeMetadata(output),
1694
- copyPrivateIp: undefined,
1695
- copyTags: undefined,
1696
- ec2LaunchTemplateID: undefined,
1697
- launchDisposition: undefined,
1698
- licensing: undefined,
1699
- name: undefined,
1700
- sourceServerID: undefined,
1701
- targetInstanceTypeRightSizingMethod: undefined,
1702
- };
1580
+ });
1703
1581
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1704
- if (data.copyPrivateIp !== undefined && data.copyPrivateIp !== null) {
1582
+ if (data.copyPrivateIp != null) {
1705
1583
  contents.copyPrivateIp = (0, smithy_client_1.expectBoolean)(data.copyPrivateIp);
1706
1584
  }
1707
- if (data.copyTags !== undefined && data.copyTags !== null) {
1585
+ if (data.copyTags != null) {
1708
1586
  contents.copyTags = (0, smithy_client_1.expectBoolean)(data.copyTags);
1709
1587
  }
1710
- if (data.ec2LaunchTemplateID !== undefined && data.ec2LaunchTemplateID !== null) {
1588
+ if (data.ec2LaunchTemplateID != null) {
1711
1589
  contents.ec2LaunchTemplateID = (0, smithy_client_1.expectString)(data.ec2LaunchTemplateID);
1712
1590
  }
1713
- if (data.launchDisposition !== undefined && data.launchDisposition !== null) {
1591
+ if (data.launchDisposition != null) {
1714
1592
  contents.launchDisposition = (0, smithy_client_1.expectString)(data.launchDisposition);
1715
1593
  }
1716
- if (data.licensing !== undefined && data.licensing !== null) {
1594
+ if (data.licensing != null) {
1717
1595
  contents.licensing = deserializeAws_restJson1Licensing(data.licensing, context);
1718
1596
  }
1719
- if (data.name !== undefined && data.name !== null) {
1597
+ if (data.name != null) {
1720
1598
  contents.name = (0, smithy_client_1.expectString)(data.name);
1721
1599
  }
1722
- if (data.sourceServerID !== undefined && data.sourceServerID !== null) {
1600
+ if (data.sourceServerID != null) {
1723
1601
  contents.sourceServerID = (0, smithy_client_1.expectString)(data.sourceServerID);
1724
1602
  }
1725
- if (data.targetInstanceTypeRightSizingMethod !== undefined && data.targetInstanceTypeRightSizingMethod !== null) {
1603
+ if (data.targetInstanceTypeRightSizingMethod != null) {
1726
1604
  contents.targetInstanceTypeRightSizingMethod = (0, smithy_client_1.expectString)(data.targetInstanceTypeRightSizingMethod);
1727
1605
  }
1728
- return Promise.resolve(contents);
1606
+ return contents;
1729
1607
  };
1730
1608
  exports.deserializeAws_restJson1GetLaunchConfigurationCommand = deserializeAws_restJson1GetLaunchConfigurationCommand;
1731
1609
  const deserializeAws_restJson1GetLaunchConfigurationCommandError = async (output, context) => {
@@ -1733,7 +1611,6 @@ const deserializeAws_restJson1GetLaunchConfigurationCommandError = async (output
1733
1611
  ...output,
1734
1612
  body: await parseBody(output.body, context),
1735
1613
  };
1736
- let response;
1737
1614
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1738
1615
  switch (errorCode) {
1739
1616
  case "InternalServerException":
@@ -1750,89 +1627,71 @@ const deserializeAws_restJson1GetLaunchConfigurationCommandError = async (output
1750
1627
  throw await deserializeAws_restJson1UninitializedAccountExceptionResponse(parsedOutput, context);
1751
1628
  default:
1752
1629
  const parsedBody = parsedOutput.body;
1753
- const $metadata = deserializeMetadata(output);
1754
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1755
- response = new DrsServiceException_1.DrsServiceException({
1756
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1757
- $fault: "client",
1758
- $metadata,
1630
+ (0, smithy_client_1.throwDefaultError)({
1631
+ output,
1632
+ parsedBody,
1633
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
1634
+ errorCode,
1759
1635
  });
1760
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1761
1636
  }
1762
1637
  };
1763
1638
  const deserializeAws_restJson1GetReplicationConfigurationCommand = async (output, context) => {
1764
1639
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1765
1640
  return deserializeAws_restJson1GetReplicationConfigurationCommandError(output, context);
1766
1641
  }
1767
- const contents = {
1642
+ const contents = map({
1768
1643
  $metadata: deserializeMetadata(output),
1769
- associateDefaultSecurityGroup: undefined,
1770
- bandwidthThrottling: undefined,
1771
- createPublicIP: undefined,
1772
- dataPlaneRouting: undefined,
1773
- defaultLargeStagingDiskType: undefined,
1774
- ebsEncryption: undefined,
1775
- ebsEncryptionKeyArn: undefined,
1776
- name: undefined,
1777
- pitPolicy: undefined,
1778
- replicatedDisks: undefined,
1779
- replicationServerInstanceType: undefined,
1780
- replicationServersSecurityGroupsIDs: undefined,
1781
- sourceServerID: undefined,
1782
- stagingAreaSubnetId: undefined,
1783
- stagingAreaTags: undefined,
1784
- useDedicatedReplicationServer: undefined,
1785
- };
1644
+ });
1786
1645
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1787
- if (data.associateDefaultSecurityGroup !== undefined && data.associateDefaultSecurityGroup !== null) {
1646
+ if (data.associateDefaultSecurityGroup != null) {
1788
1647
  contents.associateDefaultSecurityGroup = (0, smithy_client_1.expectBoolean)(data.associateDefaultSecurityGroup);
1789
1648
  }
1790
- if (data.bandwidthThrottling !== undefined && data.bandwidthThrottling !== null) {
1649
+ if (data.bandwidthThrottling != null) {
1791
1650
  contents.bandwidthThrottling = (0, smithy_client_1.expectLong)(data.bandwidthThrottling);
1792
1651
  }
1793
- if (data.createPublicIP !== undefined && data.createPublicIP !== null) {
1652
+ if (data.createPublicIP != null) {
1794
1653
  contents.createPublicIP = (0, smithy_client_1.expectBoolean)(data.createPublicIP);
1795
1654
  }
1796
- if (data.dataPlaneRouting !== undefined && data.dataPlaneRouting !== null) {
1655
+ if (data.dataPlaneRouting != null) {
1797
1656
  contents.dataPlaneRouting = (0, smithy_client_1.expectString)(data.dataPlaneRouting);
1798
1657
  }
1799
- if (data.defaultLargeStagingDiskType !== undefined && data.defaultLargeStagingDiskType !== null) {
1658
+ if (data.defaultLargeStagingDiskType != null) {
1800
1659
  contents.defaultLargeStagingDiskType = (0, smithy_client_1.expectString)(data.defaultLargeStagingDiskType);
1801
1660
  }
1802
- if (data.ebsEncryption !== undefined && data.ebsEncryption !== null) {
1661
+ if (data.ebsEncryption != null) {
1803
1662
  contents.ebsEncryption = (0, smithy_client_1.expectString)(data.ebsEncryption);
1804
1663
  }
1805
- if (data.ebsEncryptionKeyArn !== undefined && data.ebsEncryptionKeyArn !== null) {
1664
+ if (data.ebsEncryptionKeyArn != null) {
1806
1665
  contents.ebsEncryptionKeyArn = (0, smithy_client_1.expectString)(data.ebsEncryptionKeyArn);
1807
1666
  }
1808
- if (data.name !== undefined && data.name !== null) {
1667
+ if (data.name != null) {
1809
1668
  contents.name = (0, smithy_client_1.expectString)(data.name);
1810
1669
  }
1811
- if (data.pitPolicy !== undefined && data.pitPolicy !== null) {
1670
+ if (data.pitPolicy != null) {
1812
1671
  contents.pitPolicy = deserializeAws_restJson1PITPolicy(data.pitPolicy, context);
1813
1672
  }
1814
- if (data.replicatedDisks !== undefined && data.replicatedDisks !== null) {
1673
+ if (data.replicatedDisks != null) {
1815
1674
  contents.replicatedDisks = deserializeAws_restJson1ReplicationConfigurationReplicatedDisks(data.replicatedDisks, context);
1816
1675
  }
1817
- if (data.replicationServerInstanceType !== undefined && data.replicationServerInstanceType !== null) {
1676
+ if (data.replicationServerInstanceType != null) {
1818
1677
  contents.replicationServerInstanceType = (0, smithy_client_1.expectString)(data.replicationServerInstanceType);
1819
1678
  }
1820
- if (data.replicationServersSecurityGroupsIDs !== undefined && data.replicationServersSecurityGroupsIDs !== null) {
1679
+ if (data.replicationServersSecurityGroupsIDs != null) {
1821
1680
  contents.replicationServersSecurityGroupsIDs = deserializeAws_restJson1ReplicationServersSecurityGroupsIDs(data.replicationServersSecurityGroupsIDs, context);
1822
1681
  }
1823
- if (data.sourceServerID !== undefined && data.sourceServerID !== null) {
1682
+ if (data.sourceServerID != null) {
1824
1683
  contents.sourceServerID = (0, smithy_client_1.expectString)(data.sourceServerID);
1825
1684
  }
1826
- if (data.stagingAreaSubnetId !== undefined && data.stagingAreaSubnetId !== null) {
1685
+ if (data.stagingAreaSubnetId != null) {
1827
1686
  contents.stagingAreaSubnetId = (0, smithy_client_1.expectString)(data.stagingAreaSubnetId);
1828
1687
  }
1829
- if (data.stagingAreaTags !== undefined && data.stagingAreaTags !== null) {
1688
+ if (data.stagingAreaTags != null) {
1830
1689
  contents.stagingAreaTags = deserializeAws_restJson1TagsMap(data.stagingAreaTags, context);
1831
1690
  }
1832
- if (data.useDedicatedReplicationServer !== undefined && data.useDedicatedReplicationServer !== null) {
1691
+ if (data.useDedicatedReplicationServer != null) {
1833
1692
  contents.useDedicatedReplicationServer = (0, smithy_client_1.expectBoolean)(data.useDedicatedReplicationServer);
1834
1693
  }
1835
- return Promise.resolve(contents);
1694
+ return contents;
1836
1695
  };
1837
1696
  exports.deserializeAws_restJson1GetReplicationConfigurationCommand = deserializeAws_restJson1GetReplicationConfigurationCommand;
1838
1697
  const deserializeAws_restJson1GetReplicationConfigurationCommandError = async (output, context) => {
@@ -1840,7 +1699,6 @@ const deserializeAws_restJson1GetReplicationConfigurationCommandError = async (o
1840
1699
  ...output,
1841
1700
  body: await parseBody(output.body, context),
1842
1701
  };
1843
- let response;
1844
1702
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1845
1703
  switch (errorCode) {
1846
1704
  case "AccessDeniedException":
@@ -1860,25 +1718,23 @@ const deserializeAws_restJson1GetReplicationConfigurationCommandError = async (o
1860
1718
  throw await deserializeAws_restJson1UninitializedAccountExceptionResponse(parsedOutput, context);
1861
1719
  default:
1862
1720
  const parsedBody = parsedOutput.body;
1863
- const $metadata = deserializeMetadata(output);
1864
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1865
- response = new DrsServiceException_1.DrsServiceException({
1866
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1867
- $fault: "client",
1868
- $metadata,
1721
+ (0, smithy_client_1.throwDefaultError)({
1722
+ output,
1723
+ parsedBody,
1724
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
1725
+ errorCode,
1869
1726
  });
1870
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1871
1727
  }
1872
1728
  };
1873
1729
  const deserializeAws_restJson1InitializeServiceCommand = async (output, context) => {
1874
1730
  if (output.statusCode !== 204 && output.statusCode >= 300) {
1875
1731
  return deserializeAws_restJson1InitializeServiceCommandError(output, context);
1876
1732
  }
1877
- const contents = {
1733
+ const contents = map({
1878
1734
  $metadata: deserializeMetadata(output),
1879
- };
1735
+ });
1880
1736
  await collectBody(output.body, context);
1881
- return Promise.resolve(contents);
1737
+ return contents;
1882
1738
  };
1883
1739
  exports.deserializeAws_restJson1InitializeServiceCommand = deserializeAws_restJson1InitializeServiceCommand;
1884
1740
  const deserializeAws_restJson1InitializeServiceCommandError = async (output, context) => {
@@ -1886,7 +1742,6 @@ const deserializeAws_restJson1InitializeServiceCommandError = async (output, con
1886
1742
  ...output,
1887
1743
  body: await parseBody(output.body, context),
1888
1744
  };
1889
- let response;
1890
1745
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1891
1746
  switch (errorCode) {
1892
1747
  case "AccessDeniedException":
@@ -1903,33 +1758,29 @@ const deserializeAws_restJson1InitializeServiceCommandError = async (output, con
1903
1758
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1904
1759
  default:
1905
1760
  const parsedBody = parsedOutput.body;
1906
- const $metadata = deserializeMetadata(output);
1907
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1908
- response = new DrsServiceException_1.DrsServiceException({
1909
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1910
- $fault: "client",
1911
- $metadata,
1761
+ (0, smithy_client_1.throwDefaultError)({
1762
+ output,
1763
+ parsedBody,
1764
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
1765
+ errorCode,
1912
1766
  });
1913
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1914
1767
  }
1915
1768
  };
1916
1769
  const deserializeAws_restJson1ListExtensibleSourceServersCommand = async (output, context) => {
1917
1770
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1918
1771
  return deserializeAws_restJson1ListExtensibleSourceServersCommandError(output, context);
1919
1772
  }
1920
- const contents = {
1773
+ const contents = map({
1921
1774
  $metadata: deserializeMetadata(output),
1922
- items: undefined,
1923
- nextToken: undefined,
1924
- };
1775
+ });
1925
1776
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1926
- if (data.items !== undefined && data.items !== null) {
1777
+ if (data.items != null) {
1927
1778
  contents.items = deserializeAws_restJson1StagingSourceServersList(data.items, context);
1928
1779
  }
1929
- if (data.nextToken !== undefined && data.nextToken !== null) {
1780
+ if (data.nextToken != null) {
1930
1781
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1931
1782
  }
1932
- return Promise.resolve(contents);
1783
+ return contents;
1933
1784
  };
1934
1785
  exports.deserializeAws_restJson1ListExtensibleSourceServersCommand = deserializeAws_restJson1ListExtensibleSourceServersCommand;
1935
1786
  const deserializeAws_restJson1ListExtensibleSourceServersCommandError = async (output, context) => {
@@ -1937,7 +1788,6 @@ const deserializeAws_restJson1ListExtensibleSourceServersCommandError = async (o
1937
1788
  ...output,
1938
1789
  body: await parseBody(output.body, context),
1939
1790
  };
1940
- let response;
1941
1791
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1942
1792
  switch (errorCode) {
1943
1793
  case "AccessDeniedException":
@@ -1957,33 +1807,29 @@ const deserializeAws_restJson1ListExtensibleSourceServersCommandError = async (o
1957
1807
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
1958
1808
  default:
1959
1809
  const parsedBody = parsedOutput.body;
1960
- const $metadata = deserializeMetadata(output);
1961
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
1962
- response = new DrsServiceException_1.DrsServiceException({
1963
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
1964
- $fault: "client",
1965
- $metadata,
1810
+ (0, smithy_client_1.throwDefaultError)({
1811
+ output,
1812
+ parsedBody,
1813
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
1814
+ errorCode,
1966
1815
  });
1967
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
1968
1816
  }
1969
1817
  };
1970
1818
  const deserializeAws_restJson1ListStagingAccountsCommand = async (output, context) => {
1971
1819
  if (output.statusCode !== 200 && output.statusCode >= 300) {
1972
1820
  return deserializeAws_restJson1ListStagingAccountsCommandError(output, context);
1973
1821
  }
1974
- const contents = {
1822
+ const contents = map({
1975
1823
  $metadata: deserializeMetadata(output),
1976
- accounts: undefined,
1977
- nextToken: undefined,
1978
- };
1824
+ });
1979
1825
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
1980
- if (data.accounts !== undefined && data.accounts !== null) {
1826
+ if (data.accounts != null) {
1981
1827
  contents.accounts = deserializeAws_restJson1Accounts(data.accounts, context);
1982
1828
  }
1983
- if (data.nextToken !== undefined && data.nextToken !== null) {
1829
+ if (data.nextToken != null) {
1984
1830
  contents.nextToken = (0, smithy_client_1.expectString)(data.nextToken);
1985
1831
  }
1986
- return Promise.resolve(contents);
1832
+ return contents;
1987
1833
  };
1988
1834
  exports.deserializeAws_restJson1ListStagingAccountsCommand = deserializeAws_restJson1ListStagingAccountsCommand;
1989
1835
  const deserializeAws_restJson1ListStagingAccountsCommandError = async (output, context) => {
@@ -1991,7 +1837,6 @@ const deserializeAws_restJson1ListStagingAccountsCommandError = async (output, c
1991
1837
  ...output,
1992
1838
  body: await parseBody(output.body, context),
1993
1839
  };
1994
- let response;
1995
1840
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1996
1841
  switch (errorCode) {
1997
1842
  case "AccessDeniedException":
@@ -2011,29 +1856,26 @@ const deserializeAws_restJson1ListStagingAccountsCommandError = async (output, c
2011
1856
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2012
1857
  default:
2013
1858
  const parsedBody = parsedOutput.body;
2014
- const $metadata = deserializeMetadata(output);
2015
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2016
- response = new DrsServiceException_1.DrsServiceException({
2017
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2018
- $fault: "client",
2019
- $metadata,
1859
+ (0, smithy_client_1.throwDefaultError)({
1860
+ output,
1861
+ parsedBody,
1862
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
1863
+ errorCode,
2020
1864
  });
2021
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2022
1865
  }
2023
1866
  };
2024
1867
  const deserializeAws_restJson1ListTagsForResourceCommand = async (output, context) => {
2025
1868
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2026
1869
  return deserializeAws_restJson1ListTagsForResourceCommandError(output, context);
2027
1870
  }
2028
- const contents = {
1871
+ const contents = map({
2029
1872
  $metadata: deserializeMetadata(output),
2030
- tags: undefined,
2031
- };
1873
+ });
2032
1874
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2033
- if (data.tags !== undefined && data.tags !== null) {
1875
+ if (data.tags != null) {
2034
1876
  contents.tags = deserializeAws_restJson1TagsMap(data.tags, context);
2035
1877
  }
2036
- return Promise.resolve(contents);
1878
+ return contents;
2037
1879
  };
2038
1880
  exports.deserializeAws_restJson1ListTagsForResourceCommand = deserializeAws_restJson1ListTagsForResourceCommand;
2039
1881
  const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, context) => {
@@ -2041,7 +1883,6 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
2041
1883
  ...output,
2042
1884
  body: await parseBody(output.body, context),
2043
1885
  };
2044
- let response;
2045
1886
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2046
1887
  switch (errorCode) {
2047
1888
  case "AccessDeniedException":
@@ -2061,61 +1902,50 @@ const deserializeAws_restJson1ListTagsForResourceCommandError = async (output, c
2061
1902
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2062
1903
  default:
2063
1904
  const parsedBody = parsedOutput.body;
2064
- const $metadata = deserializeMetadata(output);
2065
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2066
- response = new DrsServiceException_1.DrsServiceException({
2067
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2068
- $fault: "client",
2069
- $metadata,
1905
+ (0, smithy_client_1.throwDefaultError)({
1906
+ output,
1907
+ parsedBody,
1908
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
1909
+ errorCode,
2070
1910
  });
2071
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2072
1911
  }
2073
1912
  };
2074
1913
  const deserializeAws_restJson1RetryDataReplicationCommand = async (output, context) => {
2075
1914
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2076
1915
  return deserializeAws_restJson1RetryDataReplicationCommandError(output, context);
2077
1916
  }
2078
- const contents = {
1917
+ const contents = map({
2079
1918
  $metadata: deserializeMetadata(output),
2080
- arn: undefined,
2081
- dataReplicationInfo: undefined,
2082
- lastLaunchResult: undefined,
2083
- lifeCycle: undefined,
2084
- recoveryInstanceId: undefined,
2085
- sourceProperties: undefined,
2086
- sourceServerID: undefined,
2087
- stagingArea: undefined,
2088
- tags: undefined,
2089
- };
1919
+ });
2090
1920
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2091
- if (data.arn !== undefined && data.arn !== null) {
1921
+ if (data.arn != null) {
2092
1922
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
2093
1923
  }
2094
- if (data.dataReplicationInfo !== undefined && data.dataReplicationInfo !== null) {
1924
+ if (data.dataReplicationInfo != null) {
2095
1925
  contents.dataReplicationInfo = deserializeAws_restJson1DataReplicationInfo(data.dataReplicationInfo, context);
2096
1926
  }
2097
- if (data.lastLaunchResult !== undefined && data.lastLaunchResult !== null) {
1927
+ if (data.lastLaunchResult != null) {
2098
1928
  contents.lastLaunchResult = (0, smithy_client_1.expectString)(data.lastLaunchResult);
2099
1929
  }
2100
- if (data.lifeCycle !== undefined && data.lifeCycle !== null) {
1930
+ if (data.lifeCycle != null) {
2101
1931
  contents.lifeCycle = deserializeAws_restJson1LifeCycle(data.lifeCycle, context);
2102
1932
  }
2103
- if (data.recoveryInstanceId !== undefined && data.recoveryInstanceId !== null) {
1933
+ if (data.recoveryInstanceId != null) {
2104
1934
  contents.recoveryInstanceId = (0, smithy_client_1.expectString)(data.recoveryInstanceId);
2105
1935
  }
2106
- if (data.sourceProperties !== undefined && data.sourceProperties !== null) {
1936
+ if (data.sourceProperties != null) {
2107
1937
  contents.sourceProperties = deserializeAws_restJson1SourceProperties(data.sourceProperties, context);
2108
1938
  }
2109
- if (data.sourceServerID !== undefined && data.sourceServerID !== null) {
1939
+ if (data.sourceServerID != null) {
2110
1940
  contents.sourceServerID = (0, smithy_client_1.expectString)(data.sourceServerID);
2111
1941
  }
2112
- if (data.stagingArea !== undefined && data.stagingArea !== null) {
1942
+ if (data.stagingArea != null) {
2113
1943
  contents.stagingArea = deserializeAws_restJson1StagingArea(data.stagingArea, context);
2114
1944
  }
2115
- if (data.tags !== undefined && data.tags !== null) {
1945
+ if (data.tags != null) {
2116
1946
  contents.tags = deserializeAws_restJson1TagsMap(data.tags, context);
2117
1947
  }
2118
- return Promise.resolve(contents);
1948
+ return contents;
2119
1949
  };
2120
1950
  exports.deserializeAws_restJson1RetryDataReplicationCommand = deserializeAws_restJson1RetryDataReplicationCommand;
2121
1951
  const deserializeAws_restJson1RetryDataReplicationCommandError = async (output, context) => {
@@ -2123,7 +1953,6 @@ const deserializeAws_restJson1RetryDataReplicationCommandError = async (output,
2123
1953
  ...output,
2124
1954
  body: await parseBody(output.body, context),
2125
1955
  };
2126
- let response;
2127
1956
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2128
1957
  switch (errorCode) {
2129
1958
  case "InternalServerException":
@@ -2143,29 +1972,26 @@ const deserializeAws_restJson1RetryDataReplicationCommandError = async (output,
2143
1972
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2144
1973
  default:
2145
1974
  const parsedBody = parsedOutput.body;
2146
- const $metadata = deserializeMetadata(output);
2147
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2148
- response = new DrsServiceException_1.DrsServiceException({
2149
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2150
- $fault: "client",
2151
- $metadata,
1975
+ (0, smithy_client_1.throwDefaultError)({
1976
+ output,
1977
+ parsedBody,
1978
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
1979
+ errorCode,
2152
1980
  });
2153
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2154
1981
  }
2155
1982
  };
2156
1983
  const deserializeAws_restJson1StartFailbackLaunchCommand = async (output, context) => {
2157
1984
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2158
1985
  return deserializeAws_restJson1StartFailbackLaunchCommandError(output, context);
2159
1986
  }
2160
- const contents = {
1987
+ const contents = map({
2161
1988
  $metadata: deserializeMetadata(output),
2162
- job: undefined,
2163
- };
1989
+ });
2164
1990
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2165
- if (data.job !== undefined && data.job !== null) {
1991
+ if (data.job != null) {
2166
1992
  contents.job = deserializeAws_restJson1Job(data.job, context);
2167
1993
  }
2168
- return Promise.resolve(contents);
1994
+ return contents;
2169
1995
  };
2170
1996
  exports.deserializeAws_restJson1StartFailbackLaunchCommand = deserializeAws_restJson1StartFailbackLaunchCommand;
2171
1997
  const deserializeAws_restJson1StartFailbackLaunchCommandError = async (output, context) => {
@@ -2173,7 +1999,6 @@ const deserializeAws_restJson1StartFailbackLaunchCommandError = async (output, c
2173
1999
  ...output,
2174
2000
  body: await parseBody(output.body, context),
2175
2001
  };
2176
- let response;
2177
2002
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2178
2003
  switch (errorCode) {
2179
2004
  case "ConflictException":
@@ -2196,29 +2021,26 @@ const deserializeAws_restJson1StartFailbackLaunchCommandError = async (output, c
2196
2021
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2197
2022
  default:
2198
2023
  const parsedBody = parsedOutput.body;
2199
- const $metadata = deserializeMetadata(output);
2200
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2201
- response = new DrsServiceException_1.DrsServiceException({
2202
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2203
- $fault: "client",
2204
- $metadata,
2024
+ (0, smithy_client_1.throwDefaultError)({
2025
+ output,
2026
+ parsedBody,
2027
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
2028
+ errorCode,
2205
2029
  });
2206
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2207
2030
  }
2208
2031
  };
2209
2032
  const deserializeAws_restJson1StartRecoveryCommand = async (output, context) => {
2210
2033
  if (output.statusCode !== 202 && output.statusCode >= 300) {
2211
2034
  return deserializeAws_restJson1StartRecoveryCommandError(output, context);
2212
2035
  }
2213
- const contents = {
2036
+ const contents = map({
2214
2037
  $metadata: deserializeMetadata(output),
2215
- job: undefined,
2216
- };
2038
+ });
2217
2039
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2218
- if (data.job !== undefined && data.job !== null) {
2040
+ if (data.job != null) {
2219
2041
  contents.job = deserializeAws_restJson1Job(data.job, context);
2220
2042
  }
2221
- return Promise.resolve(contents);
2043
+ return contents;
2222
2044
  };
2223
2045
  exports.deserializeAws_restJson1StartRecoveryCommand = deserializeAws_restJson1StartRecoveryCommand;
2224
2046
  const deserializeAws_restJson1StartRecoveryCommandError = async (output, context) => {
@@ -2226,7 +2048,6 @@ const deserializeAws_restJson1StartRecoveryCommandError = async (output, context
2226
2048
  ...output,
2227
2049
  body: await parseBody(output.body, context),
2228
2050
  };
2229
- let response;
2230
2051
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2231
2052
  switch (errorCode) {
2232
2053
  case "ConflictException":
@@ -2246,25 +2067,23 @@ const deserializeAws_restJson1StartRecoveryCommandError = async (output, context
2246
2067
  throw await deserializeAws_restJson1UninitializedAccountExceptionResponse(parsedOutput, context);
2247
2068
  default:
2248
2069
  const parsedBody = parsedOutput.body;
2249
- const $metadata = deserializeMetadata(output);
2250
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2251
- response = new DrsServiceException_1.DrsServiceException({
2252
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2253
- $fault: "client",
2254
- $metadata,
2070
+ (0, smithy_client_1.throwDefaultError)({
2071
+ output,
2072
+ parsedBody,
2073
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
2074
+ errorCode,
2255
2075
  });
2256
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2257
2076
  }
2258
2077
  };
2259
2078
  const deserializeAws_restJson1StopFailbackCommand = async (output, context) => {
2260
2079
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2261
2080
  return deserializeAws_restJson1StopFailbackCommandError(output, context);
2262
2081
  }
2263
- const contents = {
2082
+ const contents = map({
2264
2083
  $metadata: deserializeMetadata(output),
2265
- };
2084
+ });
2266
2085
  await collectBody(output.body, context);
2267
- return Promise.resolve(contents);
2086
+ return contents;
2268
2087
  };
2269
2088
  exports.deserializeAws_restJson1StopFailbackCommand = deserializeAws_restJson1StopFailbackCommand;
2270
2089
  const deserializeAws_restJson1StopFailbackCommandError = async (output, context) => {
@@ -2272,7 +2091,6 @@ const deserializeAws_restJson1StopFailbackCommandError = async (output, context)
2272
2091
  ...output,
2273
2092
  body: await parseBody(output.body, context),
2274
2093
  };
2275
- let response;
2276
2094
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2277
2095
  switch (errorCode) {
2278
2096
  case "InternalServerException":
@@ -2289,25 +2107,23 @@ const deserializeAws_restJson1StopFailbackCommandError = async (output, context)
2289
2107
  throw await deserializeAws_restJson1UninitializedAccountExceptionResponse(parsedOutput, context);
2290
2108
  default:
2291
2109
  const parsedBody = parsedOutput.body;
2292
- const $metadata = deserializeMetadata(output);
2293
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2294
- response = new DrsServiceException_1.DrsServiceException({
2295
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2296
- $fault: "client",
2297
- $metadata,
2110
+ (0, smithy_client_1.throwDefaultError)({
2111
+ output,
2112
+ parsedBody,
2113
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
2114
+ errorCode,
2298
2115
  });
2299
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2300
2116
  }
2301
2117
  };
2302
2118
  const deserializeAws_restJson1TagResourceCommand = async (output, context) => {
2303
2119
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2304
2120
  return deserializeAws_restJson1TagResourceCommandError(output, context);
2305
2121
  }
2306
- const contents = {
2122
+ const contents = map({
2307
2123
  $metadata: deserializeMetadata(output),
2308
- };
2124
+ });
2309
2125
  await collectBody(output.body, context);
2310
- return Promise.resolve(contents);
2126
+ return contents;
2311
2127
  };
2312
2128
  exports.deserializeAws_restJson1TagResourceCommand = deserializeAws_restJson1TagResourceCommand;
2313
2129
  const deserializeAws_restJson1TagResourceCommandError = async (output, context) => {
@@ -2315,7 +2131,6 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
2315
2131
  ...output,
2316
2132
  body: await parseBody(output.body, context),
2317
2133
  };
2318
- let response;
2319
2134
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2320
2135
  switch (errorCode) {
2321
2136
  case "AccessDeniedException":
@@ -2335,29 +2150,26 @@ const deserializeAws_restJson1TagResourceCommandError = async (output, context)
2335
2150
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2336
2151
  default:
2337
2152
  const parsedBody = parsedOutput.body;
2338
- const $metadata = deserializeMetadata(output);
2339
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2340
- response = new DrsServiceException_1.DrsServiceException({
2341
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2342
- $fault: "client",
2343
- $metadata,
2153
+ (0, smithy_client_1.throwDefaultError)({
2154
+ output,
2155
+ parsedBody,
2156
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
2157
+ errorCode,
2344
2158
  });
2345
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2346
2159
  }
2347
2160
  };
2348
2161
  const deserializeAws_restJson1TerminateRecoveryInstancesCommand = async (output, context) => {
2349
2162
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2350
2163
  return deserializeAws_restJson1TerminateRecoveryInstancesCommandError(output, context);
2351
2164
  }
2352
- const contents = {
2165
+ const contents = map({
2353
2166
  $metadata: deserializeMetadata(output),
2354
- job: undefined,
2355
- };
2167
+ });
2356
2168
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2357
- if (data.job !== undefined && data.job !== null) {
2169
+ if (data.job != null) {
2358
2170
  contents.job = deserializeAws_restJson1Job(data.job, context);
2359
2171
  }
2360
- return Promise.resolve(contents);
2172
+ return contents;
2361
2173
  };
2362
2174
  exports.deserializeAws_restJson1TerminateRecoveryInstancesCommand = deserializeAws_restJson1TerminateRecoveryInstancesCommand;
2363
2175
  const deserializeAws_restJson1TerminateRecoveryInstancesCommandError = async (output, context) => {
@@ -2365,7 +2177,6 @@ const deserializeAws_restJson1TerminateRecoveryInstancesCommandError = async (ou
2365
2177
  ...output,
2366
2178
  body: await parseBody(output.body, context),
2367
2179
  };
2368
- let response;
2369
2180
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2370
2181
  switch (errorCode) {
2371
2182
  case "ConflictException":
@@ -2385,25 +2196,23 @@ const deserializeAws_restJson1TerminateRecoveryInstancesCommandError = async (ou
2385
2196
  throw await deserializeAws_restJson1UninitializedAccountExceptionResponse(parsedOutput, context);
2386
2197
  default:
2387
2198
  const parsedBody = parsedOutput.body;
2388
- const $metadata = deserializeMetadata(output);
2389
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2390
- response = new DrsServiceException_1.DrsServiceException({
2391
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2392
- $fault: "client",
2393
- $metadata,
2199
+ (0, smithy_client_1.throwDefaultError)({
2200
+ output,
2201
+ parsedBody,
2202
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
2203
+ errorCode,
2394
2204
  });
2395
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2396
2205
  }
2397
2206
  };
2398
2207
  const deserializeAws_restJson1UntagResourceCommand = async (output, context) => {
2399
2208
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2400
2209
  return deserializeAws_restJson1UntagResourceCommandError(output, context);
2401
2210
  }
2402
- const contents = {
2211
+ const contents = map({
2403
2212
  $metadata: deserializeMetadata(output),
2404
- };
2213
+ });
2405
2214
  await collectBody(output.body, context);
2406
- return Promise.resolve(contents);
2215
+ return contents;
2407
2216
  };
2408
2217
  exports.deserializeAws_restJson1UntagResourceCommand = deserializeAws_restJson1UntagResourceCommand;
2409
2218
  const deserializeAws_restJson1UntagResourceCommandError = async (output, context) => {
@@ -2411,7 +2220,6 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
2411
2220
  ...output,
2412
2221
  body: await parseBody(output.body, context),
2413
2222
  };
2414
- let response;
2415
2223
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2416
2224
  switch (errorCode) {
2417
2225
  case "AccessDeniedException":
@@ -2431,25 +2239,23 @@ const deserializeAws_restJson1UntagResourceCommandError = async (output, context
2431
2239
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2432
2240
  default:
2433
2241
  const parsedBody = parsedOutput.body;
2434
- const $metadata = deserializeMetadata(output);
2435
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2436
- response = new DrsServiceException_1.DrsServiceException({
2437
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2438
- $fault: "client",
2439
- $metadata,
2242
+ (0, smithy_client_1.throwDefaultError)({
2243
+ output,
2244
+ parsedBody,
2245
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
2246
+ errorCode,
2440
2247
  });
2441
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2442
2248
  }
2443
2249
  };
2444
2250
  const deserializeAws_restJson1UpdateFailbackReplicationConfigurationCommand = async (output, context) => {
2445
2251
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2446
2252
  return deserializeAws_restJson1UpdateFailbackReplicationConfigurationCommandError(output, context);
2447
2253
  }
2448
- const contents = {
2254
+ const contents = map({
2449
2255
  $metadata: deserializeMetadata(output),
2450
- };
2256
+ });
2451
2257
  await collectBody(output.body, context);
2452
- return Promise.resolve(contents);
2258
+ return contents;
2453
2259
  };
2454
2260
  exports.deserializeAws_restJson1UpdateFailbackReplicationConfigurationCommand = deserializeAws_restJson1UpdateFailbackReplicationConfigurationCommand;
2455
2261
  const deserializeAws_restJson1UpdateFailbackReplicationConfigurationCommandError = async (output, context) => {
@@ -2457,7 +2263,6 @@ const deserializeAws_restJson1UpdateFailbackReplicationConfigurationCommandError
2457
2263
  ...output,
2458
2264
  body: await parseBody(output.body, context),
2459
2265
  };
2460
- let response;
2461
2266
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2462
2267
  switch (errorCode) {
2463
2268
  case "AccessDeniedException":
@@ -2477,57 +2282,47 @@ const deserializeAws_restJson1UpdateFailbackReplicationConfigurationCommandError
2477
2282
  throw await deserializeAws_restJson1UninitializedAccountExceptionResponse(parsedOutput, context);
2478
2283
  default:
2479
2284
  const parsedBody = parsedOutput.body;
2480
- const $metadata = deserializeMetadata(output);
2481
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2482
- response = new DrsServiceException_1.DrsServiceException({
2483
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2484
- $fault: "client",
2485
- $metadata,
2285
+ (0, smithy_client_1.throwDefaultError)({
2286
+ output,
2287
+ parsedBody,
2288
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
2289
+ errorCode,
2486
2290
  });
2487
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2488
2291
  }
2489
2292
  };
2490
2293
  const deserializeAws_restJson1UpdateLaunchConfigurationCommand = async (output, context) => {
2491
2294
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2492
2295
  return deserializeAws_restJson1UpdateLaunchConfigurationCommandError(output, context);
2493
2296
  }
2494
- const contents = {
2297
+ const contents = map({
2495
2298
  $metadata: deserializeMetadata(output),
2496
- copyPrivateIp: undefined,
2497
- copyTags: undefined,
2498
- ec2LaunchTemplateID: undefined,
2499
- launchDisposition: undefined,
2500
- licensing: undefined,
2501
- name: undefined,
2502
- sourceServerID: undefined,
2503
- targetInstanceTypeRightSizingMethod: undefined,
2504
- };
2299
+ });
2505
2300
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2506
- if (data.copyPrivateIp !== undefined && data.copyPrivateIp !== null) {
2301
+ if (data.copyPrivateIp != null) {
2507
2302
  contents.copyPrivateIp = (0, smithy_client_1.expectBoolean)(data.copyPrivateIp);
2508
2303
  }
2509
- if (data.copyTags !== undefined && data.copyTags !== null) {
2304
+ if (data.copyTags != null) {
2510
2305
  contents.copyTags = (0, smithy_client_1.expectBoolean)(data.copyTags);
2511
2306
  }
2512
- if (data.ec2LaunchTemplateID !== undefined && data.ec2LaunchTemplateID !== null) {
2307
+ if (data.ec2LaunchTemplateID != null) {
2513
2308
  contents.ec2LaunchTemplateID = (0, smithy_client_1.expectString)(data.ec2LaunchTemplateID);
2514
2309
  }
2515
- if (data.launchDisposition !== undefined && data.launchDisposition !== null) {
2310
+ if (data.launchDisposition != null) {
2516
2311
  contents.launchDisposition = (0, smithy_client_1.expectString)(data.launchDisposition);
2517
2312
  }
2518
- if (data.licensing !== undefined && data.licensing !== null) {
2313
+ if (data.licensing != null) {
2519
2314
  contents.licensing = deserializeAws_restJson1Licensing(data.licensing, context);
2520
2315
  }
2521
- if (data.name !== undefined && data.name !== null) {
2316
+ if (data.name != null) {
2522
2317
  contents.name = (0, smithy_client_1.expectString)(data.name);
2523
2318
  }
2524
- if (data.sourceServerID !== undefined && data.sourceServerID !== null) {
2319
+ if (data.sourceServerID != null) {
2525
2320
  contents.sourceServerID = (0, smithy_client_1.expectString)(data.sourceServerID);
2526
2321
  }
2527
- if (data.targetInstanceTypeRightSizingMethod !== undefined && data.targetInstanceTypeRightSizingMethod !== null) {
2322
+ if (data.targetInstanceTypeRightSizingMethod != null) {
2528
2323
  contents.targetInstanceTypeRightSizingMethod = (0, smithy_client_1.expectString)(data.targetInstanceTypeRightSizingMethod);
2529
2324
  }
2530
- return Promise.resolve(contents);
2325
+ return contents;
2531
2326
  };
2532
2327
  exports.deserializeAws_restJson1UpdateLaunchConfigurationCommand = deserializeAws_restJson1UpdateLaunchConfigurationCommand;
2533
2328
  const deserializeAws_restJson1UpdateLaunchConfigurationCommandError = async (output, context) => {
@@ -2535,7 +2330,6 @@ const deserializeAws_restJson1UpdateLaunchConfigurationCommandError = async (out
2535
2330
  ...output,
2536
2331
  body: await parseBody(output.body, context),
2537
2332
  };
2538
- let response;
2539
2333
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2540
2334
  switch (errorCode) {
2541
2335
  case "ConflictException":
@@ -2558,89 +2352,71 @@ const deserializeAws_restJson1UpdateLaunchConfigurationCommandError = async (out
2558
2352
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2559
2353
  default:
2560
2354
  const parsedBody = parsedOutput.body;
2561
- const $metadata = deserializeMetadata(output);
2562
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2563
- response = new DrsServiceException_1.DrsServiceException({
2564
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2565
- $fault: "client",
2566
- $metadata,
2355
+ (0, smithy_client_1.throwDefaultError)({
2356
+ output,
2357
+ parsedBody,
2358
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
2359
+ errorCode,
2567
2360
  });
2568
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2569
2361
  }
2570
2362
  };
2571
2363
  const deserializeAws_restJson1UpdateReplicationConfigurationCommand = async (output, context) => {
2572
2364
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2573
2365
  return deserializeAws_restJson1UpdateReplicationConfigurationCommandError(output, context);
2574
2366
  }
2575
- const contents = {
2367
+ const contents = map({
2576
2368
  $metadata: deserializeMetadata(output),
2577
- associateDefaultSecurityGroup: undefined,
2578
- bandwidthThrottling: undefined,
2579
- createPublicIP: undefined,
2580
- dataPlaneRouting: undefined,
2581
- defaultLargeStagingDiskType: undefined,
2582
- ebsEncryption: undefined,
2583
- ebsEncryptionKeyArn: undefined,
2584
- name: undefined,
2585
- pitPolicy: undefined,
2586
- replicatedDisks: undefined,
2587
- replicationServerInstanceType: undefined,
2588
- replicationServersSecurityGroupsIDs: undefined,
2589
- sourceServerID: undefined,
2590
- stagingAreaSubnetId: undefined,
2591
- stagingAreaTags: undefined,
2592
- useDedicatedReplicationServer: undefined,
2593
- };
2369
+ });
2594
2370
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2595
- if (data.associateDefaultSecurityGroup !== undefined && data.associateDefaultSecurityGroup !== null) {
2371
+ if (data.associateDefaultSecurityGroup != null) {
2596
2372
  contents.associateDefaultSecurityGroup = (0, smithy_client_1.expectBoolean)(data.associateDefaultSecurityGroup);
2597
2373
  }
2598
- if (data.bandwidthThrottling !== undefined && data.bandwidthThrottling !== null) {
2374
+ if (data.bandwidthThrottling != null) {
2599
2375
  contents.bandwidthThrottling = (0, smithy_client_1.expectLong)(data.bandwidthThrottling);
2600
2376
  }
2601
- if (data.createPublicIP !== undefined && data.createPublicIP !== null) {
2377
+ if (data.createPublicIP != null) {
2602
2378
  contents.createPublicIP = (0, smithy_client_1.expectBoolean)(data.createPublicIP);
2603
2379
  }
2604
- if (data.dataPlaneRouting !== undefined && data.dataPlaneRouting !== null) {
2380
+ if (data.dataPlaneRouting != null) {
2605
2381
  contents.dataPlaneRouting = (0, smithy_client_1.expectString)(data.dataPlaneRouting);
2606
2382
  }
2607
- if (data.defaultLargeStagingDiskType !== undefined && data.defaultLargeStagingDiskType !== null) {
2383
+ if (data.defaultLargeStagingDiskType != null) {
2608
2384
  contents.defaultLargeStagingDiskType = (0, smithy_client_1.expectString)(data.defaultLargeStagingDiskType);
2609
2385
  }
2610
- if (data.ebsEncryption !== undefined && data.ebsEncryption !== null) {
2386
+ if (data.ebsEncryption != null) {
2611
2387
  contents.ebsEncryption = (0, smithy_client_1.expectString)(data.ebsEncryption);
2612
2388
  }
2613
- if (data.ebsEncryptionKeyArn !== undefined && data.ebsEncryptionKeyArn !== null) {
2389
+ if (data.ebsEncryptionKeyArn != null) {
2614
2390
  contents.ebsEncryptionKeyArn = (0, smithy_client_1.expectString)(data.ebsEncryptionKeyArn);
2615
2391
  }
2616
- if (data.name !== undefined && data.name !== null) {
2392
+ if (data.name != null) {
2617
2393
  contents.name = (0, smithy_client_1.expectString)(data.name);
2618
2394
  }
2619
- if (data.pitPolicy !== undefined && data.pitPolicy !== null) {
2395
+ if (data.pitPolicy != null) {
2620
2396
  contents.pitPolicy = deserializeAws_restJson1PITPolicy(data.pitPolicy, context);
2621
2397
  }
2622
- if (data.replicatedDisks !== undefined && data.replicatedDisks !== null) {
2398
+ if (data.replicatedDisks != null) {
2623
2399
  contents.replicatedDisks = deserializeAws_restJson1ReplicationConfigurationReplicatedDisks(data.replicatedDisks, context);
2624
2400
  }
2625
- if (data.replicationServerInstanceType !== undefined && data.replicationServerInstanceType !== null) {
2401
+ if (data.replicationServerInstanceType != null) {
2626
2402
  contents.replicationServerInstanceType = (0, smithy_client_1.expectString)(data.replicationServerInstanceType);
2627
2403
  }
2628
- if (data.replicationServersSecurityGroupsIDs !== undefined && data.replicationServersSecurityGroupsIDs !== null) {
2404
+ if (data.replicationServersSecurityGroupsIDs != null) {
2629
2405
  contents.replicationServersSecurityGroupsIDs = deserializeAws_restJson1ReplicationServersSecurityGroupsIDs(data.replicationServersSecurityGroupsIDs, context);
2630
2406
  }
2631
- if (data.sourceServerID !== undefined && data.sourceServerID !== null) {
2407
+ if (data.sourceServerID != null) {
2632
2408
  contents.sourceServerID = (0, smithy_client_1.expectString)(data.sourceServerID);
2633
2409
  }
2634
- if (data.stagingAreaSubnetId !== undefined && data.stagingAreaSubnetId !== null) {
2410
+ if (data.stagingAreaSubnetId != null) {
2635
2411
  contents.stagingAreaSubnetId = (0, smithy_client_1.expectString)(data.stagingAreaSubnetId);
2636
2412
  }
2637
- if (data.stagingAreaTags !== undefined && data.stagingAreaTags !== null) {
2413
+ if (data.stagingAreaTags != null) {
2638
2414
  contents.stagingAreaTags = deserializeAws_restJson1TagsMap(data.stagingAreaTags, context);
2639
2415
  }
2640
- if (data.useDedicatedReplicationServer !== undefined && data.useDedicatedReplicationServer !== null) {
2416
+ if (data.useDedicatedReplicationServer != null) {
2641
2417
  contents.useDedicatedReplicationServer = (0, smithy_client_1.expectBoolean)(data.useDedicatedReplicationServer);
2642
2418
  }
2643
- return Promise.resolve(contents);
2419
+ return contents;
2644
2420
  };
2645
2421
  exports.deserializeAws_restJson1UpdateReplicationConfigurationCommand = deserializeAws_restJson1UpdateReplicationConfigurationCommand;
2646
2422
  const deserializeAws_restJson1UpdateReplicationConfigurationCommandError = async (output, context) => {
@@ -2648,7 +2424,6 @@ const deserializeAws_restJson1UpdateReplicationConfigurationCommandError = async
2648
2424
  ...output,
2649
2425
  body: await parseBody(output.body, context),
2650
2426
  };
2651
- let response;
2652
2427
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2653
2428
  switch (errorCode) {
2654
2429
  case "AccessDeniedException":
@@ -2674,89 +2449,71 @@ const deserializeAws_restJson1UpdateReplicationConfigurationCommandError = async
2674
2449
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2675
2450
  default:
2676
2451
  const parsedBody = parsedOutput.body;
2677
- const $metadata = deserializeMetadata(output);
2678
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2679
- response = new DrsServiceException_1.DrsServiceException({
2680
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2681
- $fault: "client",
2682
- $metadata,
2452
+ (0, smithy_client_1.throwDefaultError)({
2453
+ output,
2454
+ parsedBody,
2455
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
2456
+ errorCode,
2683
2457
  });
2684
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2685
2458
  }
2686
2459
  };
2687
2460
  const deserializeAws_restJson1UpdateReplicationConfigurationTemplateCommand = async (output, context) => {
2688
2461
  if (output.statusCode !== 200 && output.statusCode >= 300) {
2689
2462
  return deserializeAws_restJson1UpdateReplicationConfigurationTemplateCommandError(output, context);
2690
2463
  }
2691
- const contents = {
2464
+ const contents = map({
2692
2465
  $metadata: deserializeMetadata(output),
2693
- arn: undefined,
2694
- associateDefaultSecurityGroup: undefined,
2695
- bandwidthThrottling: undefined,
2696
- createPublicIP: undefined,
2697
- dataPlaneRouting: undefined,
2698
- defaultLargeStagingDiskType: undefined,
2699
- ebsEncryption: undefined,
2700
- ebsEncryptionKeyArn: undefined,
2701
- pitPolicy: undefined,
2702
- replicationConfigurationTemplateID: undefined,
2703
- replicationServerInstanceType: undefined,
2704
- replicationServersSecurityGroupsIDs: undefined,
2705
- stagingAreaSubnetId: undefined,
2706
- stagingAreaTags: undefined,
2707
- tags: undefined,
2708
- useDedicatedReplicationServer: undefined,
2709
- };
2466
+ });
2710
2467
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
2711
- if (data.arn !== undefined && data.arn !== null) {
2468
+ if (data.arn != null) {
2712
2469
  contents.arn = (0, smithy_client_1.expectString)(data.arn);
2713
2470
  }
2714
- if (data.associateDefaultSecurityGroup !== undefined && data.associateDefaultSecurityGroup !== null) {
2471
+ if (data.associateDefaultSecurityGroup != null) {
2715
2472
  contents.associateDefaultSecurityGroup = (0, smithy_client_1.expectBoolean)(data.associateDefaultSecurityGroup);
2716
2473
  }
2717
- if (data.bandwidthThrottling !== undefined && data.bandwidthThrottling !== null) {
2474
+ if (data.bandwidthThrottling != null) {
2718
2475
  contents.bandwidthThrottling = (0, smithy_client_1.expectLong)(data.bandwidthThrottling);
2719
2476
  }
2720
- if (data.createPublicIP !== undefined && data.createPublicIP !== null) {
2477
+ if (data.createPublicIP != null) {
2721
2478
  contents.createPublicIP = (0, smithy_client_1.expectBoolean)(data.createPublicIP);
2722
2479
  }
2723
- if (data.dataPlaneRouting !== undefined && data.dataPlaneRouting !== null) {
2480
+ if (data.dataPlaneRouting != null) {
2724
2481
  contents.dataPlaneRouting = (0, smithy_client_1.expectString)(data.dataPlaneRouting);
2725
2482
  }
2726
- if (data.defaultLargeStagingDiskType !== undefined && data.defaultLargeStagingDiskType !== null) {
2483
+ if (data.defaultLargeStagingDiskType != null) {
2727
2484
  contents.defaultLargeStagingDiskType = (0, smithy_client_1.expectString)(data.defaultLargeStagingDiskType);
2728
2485
  }
2729
- if (data.ebsEncryption !== undefined && data.ebsEncryption !== null) {
2486
+ if (data.ebsEncryption != null) {
2730
2487
  contents.ebsEncryption = (0, smithy_client_1.expectString)(data.ebsEncryption);
2731
2488
  }
2732
- if (data.ebsEncryptionKeyArn !== undefined && data.ebsEncryptionKeyArn !== null) {
2489
+ if (data.ebsEncryptionKeyArn != null) {
2733
2490
  contents.ebsEncryptionKeyArn = (0, smithy_client_1.expectString)(data.ebsEncryptionKeyArn);
2734
2491
  }
2735
- if (data.pitPolicy !== undefined && data.pitPolicy !== null) {
2492
+ if (data.pitPolicy != null) {
2736
2493
  contents.pitPolicy = deserializeAws_restJson1PITPolicy(data.pitPolicy, context);
2737
2494
  }
2738
- if (data.replicationConfigurationTemplateID !== undefined && data.replicationConfigurationTemplateID !== null) {
2495
+ if (data.replicationConfigurationTemplateID != null) {
2739
2496
  contents.replicationConfigurationTemplateID = (0, smithy_client_1.expectString)(data.replicationConfigurationTemplateID);
2740
2497
  }
2741
- if (data.replicationServerInstanceType !== undefined && data.replicationServerInstanceType !== null) {
2498
+ if (data.replicationServerInstanceType != null) {
2742
2499
  contents.replicationServerInstanceType = (0, smithy_client_1.expectString)(data.replicationServerInstanceType);
2743
2500
  }
2744
- if (data.replicationServersSecurityGroupsIDs !== undefined && data.replicationServersSecurityGroupsIDs !== null) {
2501
+ if (data.replicationServersSecurityGroupsIDs != null) {
2745
2502
  contents.replicationServersSecurityGroupsIDs = deserializeAws_restJson1ReplicationServersSecurityGroupsIDs(data.replicationServersSecurityGroupsIDs, context);
2746
2503
  }
2747
- if (data.stagingAreaSubnetId !== undefined && data.stagingAreaSubnetId !== null) {
2504
+ if (data.stagingAreaSubnetId != null) {
2748
2505
  contents.stagingAreaSubnetId = (0, smithy_client_1.expectString)(data.stagingAreaSubnetId);
2749
2506
  }
2750
- if (data.stagingAreaTags !== undefined && data.stagingAreaTags !== null) {
2507
+ if (data.stagingAreaTags != null) {
2751
2508
  contents.stagingAreaTags = deserializeAws_restJson1TagsMap(data.stagingAreaTags, context);
2752
2509
  }
2753
- if (data.tags !== undefined && data.tags !== null) {
2510
+ if (data.tags != null) {
2754
2511
  contents.tags = deserializeAws_restJson1TagsMap(data.tags, context);
2755
2512
  }
2756
- if (data.useDedicatedReplicationServer !== undefined && data.useDedicatedReplicationServer !== null) {
2513
+ if (data.useDedicatedReplicationServer != null) {
2757
2514
  contents.useDedicatedReplicationServer = (0, smithy_client_1.expectBoolean)(data.useDedicatedReplicationServer);
2758
2515
  }
2759
- return Promise.resolve(contents);
2516
+ return contents;
2760
2517
  };
2761
2518
  exports.deserializeAws_restJson1UpdateReplicationConfigurationTemplateCommand = deserializeAws_restJson1UpdateReplicationConfigurationTemplateCommand;
2762
2519
  const deserializeAws_restJson1UpdateReplicationConfigurationTemplateCommandError = async (output, context) => {
@@ -2764,7 +2521,6 @@ const deserializeAws_restJson1UpdateReplicationConfigurationTemplateCommandError
2764
2521
  ...output,
2765
2522
  body: await parseBody(output.body, context),
2766
2523
  };
2767
- let response;
2768
2524
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2769
2525
  switch (errorCode) {
2770
2526
  case "AccessDeniedException":
@@ -2787,23 +2543,22 @@ const deserializeAws_restJson1UpdateReplicationConfigurationTemplateCommandError
2787
2543
  throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
2788
2544
  default:
2789
2545
  const parsedBody = parsedOutput.body;
2790
- const $metadata = deserializeMetadata(output);
2791
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
2792
- response = new DrsServiceException_1.DrsServiceException({
2793
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
2794
- $fault: "client",
2795
- $metadata,
2546
+ (0, smithy_client_1.throwDefaultError)({
2547
+ output,
2548
+ parsedBody,
2549
+ exceptionCtor: DrsServiceException_1.DrsServiceException,
2550
+ errorCode,
2796
2551
  });
2797
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
2798
2552
  }
2799
2553
  };
2554
+ const map = smithy_client_1.map;
2800
2555
  const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
2801
- const contents = {};
2556
+ const contents = map({});
2802
2557
  const data = parsedOutput.body;
2803
- if (data.code !== undefined && data.code !== null) {
2558
+ if (data.code != null) {
2804
2559
  contents.code = (0, smithy_client_1.expectString)(data.code);
2805
2560
  }
2806
- if (data.message !== undefined && data.message !== null) {
2561
+ if (data.message != null) {
2807
2562
  contents.message = (0, smithy_client_1.expectString)(data.message);
2808
2563
  }
2809
2564
  const exception = new models_0_1.AccessDeniedException({
@@ -2813,18 +2568,18 @@ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutpu
2813
2568
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2814
2569
  };
2815
2570
  const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
2816
- const contents = {};
2571
+ const contents = map({});
2817
2572
  const data = parsedOutput.body;
2818
- if (data.code !== undefined && data.code !== null) {
2573
+ if (data.code != null) {
2819
2574
  contents.code = (0, smithy_client_1.expectString)(data.code);
2820
2575
  }
2821
- if (data.message !== undefined && data.message !== null) {
2576
+ if (data.message != null) {
2822
2577
  contents.message = (0, smithy_client_1.expectString)(data.message);
2823
2578
  }
2824
- if (data.resourceId !== undefined && data.resourceId !== null) {
2579
+ if (data.resourceId != null) {
2825
2580
  contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
2826
2581
  }
2827
- if (data.resourceType !== undefined && data.resourceType !== null) {
2582
+ if (data.resourceType != null) {
2828
2583
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
2829
2584
  }
2830
2585
  const exception = new models_0_1.ConflictException({
@@ -2834,12 +2589,14 @@ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, c
2834
2589
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2835
2590
  };
2836
2591
  const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
2837
- const contents = {};
2838
- if (parsedOutput.headers["retry-after"] !== undefined) {
2839
- contents.retryAfterSeconds = (0, smithy_client_1.strictParseLong)(parsedOutput.headers["retry-after"]);
2840
- }
2592
+ const contents = map({
2593
+ retryAfterSeconds: [
2594
+ () => void 0 !== parsedOutput.headers["retry-after"],
2595
+ () => (0, smithy_client_1.strictParseLong)(parsedOutput.headers["retry-after"]),
2596
+ ],
2597
+ });
2841
2598
  const data = parsedOutput.body;
2842
- if (data.message !== undefined && data.message !== null) {
2599
+ if (data.message != null) {
2843
2600
  contents.message = (0, smithy_client_1.expectString)(data.message);
2844
2601
  }
2845
2602
  const exception = new models_0_1.InternalServerException({
@@ -2849,18 +2606,18 @@ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOut
2849
2606
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2850
2607
  };
2851
2608
  const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
2852
- const contents = {};
2609
+ const contents = map({});
2853
2610
  const data = parsedOutput.body;
2854
- if (data.code !== undefined && data.code !== null) {
2611
+ if (data.code != null) {
2855
2612
  contents.code = (0, smithy_client_1.expectString)(data.code);
2856
2613
  }
2857
- if (data.message !== undefined && data.message !== null) {
2614
+ if (data.message != null) {
2858
2615
  contents.message = (0, smithy_client_1.expectString)(data.message);
2859
2616
  }
2860
- if (data.resourceId !== undefined && data.resourceId !== null) {
2617
+ if (data.resourceId != null) {
2861
2618
  contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
2862
2619
  }
2863
- if (data.resourceType !== undefined && data.resourceType !== null) {
2620
+ if (data.resourceType != null) {
2864
2621
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
2865
2622
  }
2866
2623
  const exception = new models_0_1.ResourceNotFoundException({
@@ -2870,24 +2627,24 @@ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedO
2870
2627
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2871
2628
  };
2872
2629
  const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
2873
- const contents = {};
2630
+ const contents = map({});
2874
2631
  const data = parsedOutput.body;
2875
- if (data.code !== undefined && data.code !== null) {
2632
+ if (data.code != null) {
2876
2633
  contents.code = (0, smithy_client_1.expectString)(data.code);
2877
2634
  }
2878
- if (data.message !== undefined && data.message !== null) {
2635
+ if (data.message != null) {
2879
2636
  contents.message = (0, smithy_client_1.expectString)(data.message);
2880
2637
  }
2881
- if (data.quotaCode !== undefined && data.quotaCode !== null) {
2638
+ if (data.quotaCode != null) {
2882
2639
  contents.quotaCode = (0, smithy_client_1.expectString)(data.quotaCode);
2883
2640
  }
2884
- if (data.resourceId !== undefined && data.resourceId !== null) {
2641
+ if (data.resourceId != null) {
2885
2642
  contents.resourceId = (0, smithy_client_1.expectString)(data.resourceId);
2886
2643
  }
2887
- if (data.resourceType !== undefined && data.resourceType !== null) {
2644
+ if (data.resourceType != null) {
2888
2645
  contents.resourceType = (0, smithy_client_1.expectString)(data.resourceType);
2889
2646
  }
2890
- if (data.serviceCode !== undefined && data.serviceCode !== null) {
2647
+ if (data.serviceCode != null) {
2891
2648
  contents.serviceCode = (0, smithy_client_1.expectString)(data.serviceCode);
2892
2649
  }
2893
2650
  const exception = new models_0_1.ServiceQuotaExceededException({
@@ -2897,18 +2654,17 @@ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (par
2897
2654
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2898
2655
  };
2899
2656
  const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
2900
- const contents = {};
2901
- if (parsedOutput.headers["retry-after"] !== undefined) {
2902
- contents.retryAfterSeconds = parsedOutput.headers["retry-after"];
2903
- }
2657
+ const contents = map({
2658
+ retryAfterSeconds: [, parsedOutput.headers["retry-after"]],
2659
+ });
2904
2660
  const data = parsedOutput.body;
2905
- if (data.message !== undefined && data.message !== null) {
2661
+ if (data.message != null) {
2906
2662
  contents.message = (0, smithy_client_1.expectString)(data.message);
2907
2663
  }
2908
- if (data.quotaCode !== undefined && data.quotaCode !== null) {
2664
+ if (data.quotaCode != null) {
2909
2665
  contents.quotaCode = (0, smithy_client_1.expectString)(data.quotaCode);
2910
2666
  }
2911
- if (data.serviceCode !== undefined && data.serviceCode !== null) {
2667
+ if (data.serviceCode != null) {
2912
2668
  contents.serviceCode = (0, smithy_client_1.expectString)(data.serviceCode);
2913
2669
  }
2914
2670
  const exception = new models_0_1.ThrottlingException({
@@ -2918,12 +2674,12 @@ const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput,
2918
2674
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2919
2675
  };
2920
2676
  const deserializeAws_restJson1UninitializedAccountExceptionResponse = async (parsedOutput, context) => {
2921
- const contents = {};
2677
+ const contents = map({});
2922
2678
  const data = parsedOutput.body;
2923
- if (data.code !== undefined && data.code !== null) {
2679
+ if (data.code != null) {
2924
2680
  contents.code = (0, smithy_client_1.expectString)(data.code);
2925
2681
  }
2926
- if (data.message !== undefined && data.message !== null) {
2682
+ if (data.message != null) {
2927
2683
  contents.message = (0, smithy_client_1.expectString)(data.message);
2928
2684
  }
2929
2685
  const exception = new models_0_1.UninitializedAccountException({
@@ -2933,18 +2689,18 @@ const deserializeAws_restJson1UninitializedAccountExceptionResponse = async (par
2933
2689
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
2934
2690
  };
2935
2691
  const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
2936
- const contents = {};
2692
+ const contents = map({});
2937
2693
  const data = parsedOutput.body;
2938
- if (data.code !== undefined && data.code !== null) {
2694
+ if (data.code != null) {
2939
2695
  contents.code = (0, smithy_client_1.expectString)(data.code);
2940
2696
  }
2941
- if (data.fieldList !== undefined && data.fieldList !== null) {
2697
+ if (data.fieldList != null) {
2942
2698
  contents.fieldList = deserializeAws_restJson1ValidationExceptionFieldList(data.fieldList, context);
2943
2699
  }
2944
- if (data.message !== undefined && data.message !== null) {
2700
+ if (data.message != null) {
2945
2701
  contents.message = (0, smithy_client_1.expectString)(data.message);
2946
2702
  }
2947
- if (data.reason !== undefined && data.reason !== null) {
2703
+ if (data.reason != null) {
2948
2704
  contents.reason = (0, smithy_client_1.expectString)(data.reason);
2949
2705
  }
2950
2706
  const exception = new models_0_1.ValidationException({
@@ -2957,9 +2713,6 @@ const serializeAws_restJson1AccountIDs = (input, context) => {
2957
2713
  return input
2958
2714
  .filter((e) => e != null)
2959
2715
  .map((entry) => {
2960
- if (entry === null) {
2961
- return null;
2962
- }
2963
2716
  return entry;
2964
2717
  });
2965
2718
  };
@@ -2976,9 +2729,6 @@ const serializeAws_restJson1DescribeJobsRequestFiltersJobIDs = (input, context)
2976
2729
  return input
2977
2730
  .filter((e) => e != null)
2978
2731
  .map((entry) => {
2979
- if (entry === null) {
2980
- return null;
2981
- }
2982
2732
  return entry;
2983
2733
  });
2984
2734
  };
@@ -3013,9 +2763,6 @@ const serializeAws_restJson1DescribeSourceServersRequestFiltersIDs = (input, con
3013
2763
  return input
3014
2764
  .filter((e) => e != null)
3015
2765
  .map((entry) => {
3016
- if (entry === null) {
3017
- return null;
3018
- }
3019
2766
  return entry;
3020
2767
  });
3021
2768
  };
@@ -3028,9 +2775,6 @@ const serializeAws_restJson1PITPolicy = (input, context) => {
3028
2775
  return input
3029
2776
  .filter((e) => e != null)
3030
2777
  .map((entry) => {
3031
- if (entry === null) {
3032
- return null;
3033
- }
3034
2778
  return serializeAws_restJson1PITPolicyRule(entry, context);
3035
2779
  });
3036
2780
  };
@@ -3047,9 +2791,6 @@ const serializeAws_restJson1RecoveryInstanceIDs = (input, context) => {
3047
2791
  return input
3048
2792
  .filter((e) => e != null)
3049
2793
  .map((entry) => {
3050
- if (entry === null) {
3051
- return null;
3052
- }
3053
2794
  return entry;
3054
2795
  });
3055
2796
  };
@@ -3057,9 +2798,6 @@ const serializeAws_restJson1RecoveryInstancesForTerminationRequest = (input, con
3057
2798
  return input
3058
2799
  .filter((e) => e != null)
3059
2800
  .map((entry) => {
3060
- if (entry === null) {
3061
- return null;
3062
- }
3063
2801
  return entry;
3064
2802
  });
3065
2803
  };
@@ -3077,9 +2815,6 @@ const serializeAws_restJson1ReplicationConfigurationReplicatedDisks = (input, co
3077
2815
  return input
3078
2816
  .filter((e) => e != null)
3079
2817
  .map((entry) => {
3080
- if (entry === null) {
3081
- return null;
3082
- }
3083
2818
  return serializeAws_restJson1ReplicationConfigurationReplicatedDisk(entry, context);
3084
2819
  });
3085
2820
  };
@@ -3087,9 +2822,6 @@ const serializeAws_restJson1ReplicationConfigurationTemplateIDs = (input, contex
3087
2822
  return input
3088
2823
  .filter((e) => e != null)
3089
2824
  .map((entry) => {
3090
- if (entry === null) {
3091
- return null;
3092
- }
3093
2825
  return entry;
3094
2826
  });
3095
2827
  };
@@ -3097,9 +2829,6 @@ const serializeAws_restJson1ReplicationServersSecurityGroupsIDs = (input, contex
3097
2829
  return input
3098
2830
  .filter((e) => e != null)
3099
2831
  .map((entry) => {
3100
- if (entry === null) {
3101
- return null;
3102
- }
3103
2832
  return entry;
3104
2833
  });
3105
2834
  };
@@ -3107,9 +2836,6 @@ const serializeAws_restJson1SourceServerIDs = (input, context) => {
3107
2836
  return input
3108
2837
  .filter((e) => e != null)
3109
2838
  .map((entry) => {
3110
- if (entry === null) {
3111
- return null;
3112
- }
3113
2839
  return entry;
3114
2840
  });
3115
2841
  };
@@ -3117,9 +2843,6 @@ const serializeAws_restJson1StartFailbackRequestRecoveryInstanceIDs = (input, co
3117
2843
  return input
3118
2844
  .filter((e) => e != null)
3119
2845
  .map((entry) => {
3120
- if (entry === null) {
3121
- return null;
3122
- }
3123
2846
  return entry;
3124
2847
  });
3125
2848
  };
@@ -3133,9 +2856,6 @@ const serializeAws_restJson1StartRecoveryRequestSourceServers = (input, context)
3133
2856
  return input
3134
2857
  .filter((e) => e != null)
3135
2858
  .map((entry) => {
3136
- if (entry === null) {
3137
- return null;
3138
- }
3139
2859
  return serializeAws_restJson1StartRecoveryRequestSourceServer(entry, context);
3140
2860
  });
3141
2861
  };