@aws-sdk/client-ebs 3.186.0 → 3.190.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist-cjs/protocols/Aws_restJson1.js +1 -0
  3. package/dist-cjs/runtimeConfig.browser.js +9 -7
  4. package/dist-cjs/runtimeConfig.js +9 -7
  5. package/dist-es/EBS.js +26 -33
  6. package/dist-es/EBSClient.js +22 -28
  7. package/dist-es/commands/CompleteSnapshotCommand.js +21 -28
  8. package/dist-es/commands/GetSnapshotBlockCommand.js +21 -28
  9. package/dist-es/commands/ListChangedBlocksCommand.js +21 -28
  10. package/dist-es/commands/ListSnapshotBlocksCommand.js +21 -28
  11. package/dist-es/commands/PutSnapshotBlockCommand.js +21 -28
  12. package/dist-es/commands/StartSnapshotCommand.js +21 -28
  13. package/dist-es/endpoints.js +8 -8
  14. package/dist-es/models/EBSServiceException.js +5 -10
  15. package/dist-es/models/models_0.js +152 -117
  16. package/dist-es/pagination/ListChangedBlocksPaginator.js +25 -68
  17. package/dist-es/pagination/ListSnapshotBlocksPaginator.js +25 -68
  18. package/dist-es/protocols/Aws_restJson1.js +640 -844
  19. package/dist-es/runtimeConfig.browser.js +28 -12
  20. package/dist-es/runtimeConfig.js +32 -12
  21. package/dist-es/runtimeConfig.native.js +8 -5
  22. package/dist-es/runtimeConfig.shared.js +8 -11
  23. package/dist-types/EBSClient.d.ts +6 -1
  24. package/dist-types/commands/GetSnapshotBlockCommand.d.ts +2 -2
  25. package/dist-types/protocols/Aws_restJson1.d.ts +2 -2
  26. package/dist-types/runtimeConfig.browser.d.ts +1 -0
  27. package/dist-types/runtimeConfig.d.ts +1 -0
  28. package/dist-types/runtimeConfig.native.d.ts +1 -0
  29. package/dist-types/ts3.4/EBSClient.d.ts +2 -0
  30. package/dist-types/ts3.4/commands/GetSnapshotBlockCommand.d.ts +2 -1
  31. package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +5 -2
  32. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -0
  33. package/dist-types/ts3.4/runtimeConfig.d.ts +1 -0
  34. package/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -0
  35. package/package.json +35 -33
@@ -1,825 +1,639 @@
1
- import { __assign, __awaiter, __generator } from "tslib";
2
1
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
3
2
  import { decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectLong as __expectLong, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, map as __map, parseEpochTimestamp as __parseEpochTimestamp, resolvedPath as __resolvedPath, strictParseInt32 as __strictParseInt32, throwDefaultError, } from "@aws-sdk/smithy-client";
4
3
  import { v4 as generateIdempotencyToken } from "uuid";
5
4
  import { EBSServiceException as __BaseException } from "../models/EBSServiceException";
6
5
  import { AccessDeniedException, ConcurrentLimitExceededException, ConflictException, InternalServerException, RequestThrottledException, ResourceNotFoundException, ServiceQuotaExceededException, ValidationException, } from "../models/models_0";
7
- export var serializeAws_restJson1CompleteSnapshotCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
8
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
9
- return __generator(this, function (_c) {
10
- switch (_c.label) {
11
- case 0: return [4, context.endpoint()];
12
- case 1:
13
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
14
- headers = map({}, isSerializableHeaderValue, {
15
- "x-amz-changedblockscount": [
16
- function () { return isSerializableHeaderValue(input.ChangedBlocksCount); },
17
- function () { return input.ChangedBlocksCount.toString(); },
18
- ],
19
- "x-amz-checksum": input.Checksum,
20
- "x-amz-checksum-algorithm": input.ChecksumAlgorithm,
21
- "x-amz-checksum-aggregation-method": input.ChecksumAggregationMethod,
22
- });
23
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/snapshots/completion/{SnapshotId}";
24
- resolvedPath = __resolvedPath(resolvedPath, input, "SnapshotId", function () { return input.SnapshotId; }, "{SnapshotId}", false);
25
- return [2, new __HttpRequest({
26
- protocol: protocol,
27
- hostname: hostname,
28
- port: port,
29
- method: "POST",
30
- headers: headers,
31
- path: resolvedPath,
32
- body: body,
33
- })];
34
- }
35
- });
36
- }); };
37
- export var serializeAws_restJson1GetSnapshotBlockCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
38
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
39
- return __generator(this, function (_c) {
40
- switch (_c.label) {
41
- case 0: return [4, context.endpoint()];
42
- case 1:
43
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
44
- headers = {};
45
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
46
- "/snapshots/{SnapshotId}/blocks/{BlockIndex}";
47
- resolvedPath = __resolvedPath(resolvedPath, input, "SnapshotId", function () { return input.SnapshotId; }, "{SnapshotId}", false);
48
- resolvedPath = __resolvedPath(resolvedPath, input, "BlockIndex", function () { return input.BlockIndex.toString(); }, "{BlockIndex}", false);
49
- query = map({
50
- blockToken: [, input.BlockToken],
51
- });
52
- return [2, new __HttpRequest({
53
- protocol: protocol,
54
- hostname: hostname,
55
- port: port,
56
- method: "GET",
57
- headers: headers,
58
- path: resolvedPath,
59
- query: query,
60
- body: body,
61
- })];
62
- }
63
- });
64
- }); };
65
- export var serializeAws_restJson1ListChangedBlocksCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
66
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
67
- return __generator(this, function (_c) {
68
- switch (_c.label) {
69
- case 0: return [4, context.endpoint()];
70
- case 1:
71
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
72
- headers = {};
73
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
74
- "/snapshots/{SecondSnapshotId}/changedblocks";
75
- resolvedPath = __resolvedPath(resolvedPath, input, "SecondSnapshotId", function () { return input.SecondSnapshotId; }, "{SecondSnapshotId}", false);
76
- query = map({
77
- firstSnapshotId: [, input.FirstSnapshotId],
78
- pageToken: [, input.NextToken],
79
- maxResults: [function () { return input.MaxResults !== void 0; }, function () { return input.MaxResults.toString(); }],
80
- startingBlockIndex: [function () { return input.StartingBlockIndex !== void 0; }, function () { return input.StartingBlockIndex.toString(); }],
81
- });
82
- return [2, new __HttpRequest({
83
- protocol: protocol,
84
- hostname: hostname,
85
- port: port,
86
- method: "GET",
87
- headers: headers,
88
- path: resolvedPath,
89
- query: query,
90
- body: body,
91
- })];
92
- }
93
- });
94
- }); };
95
- export var serializeAws_restJson1ListSnapshotBlocksCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
96
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
97
- return __generator(this, function (_c) {
98
- switch (_c.label) {
99
- case 0: return [4, context.endpoint()];
100
- case 1:
101
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
102
- headers = {};
103
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/snapshots/{SnapshotId}/blocks";
104
- resolvedPath = __resolvedPath(resolvedPath, input, "SnapshotId", function () { return input.SnapshotId; }, "{SnapshotId}", false);
105
- query = map({
106
- pageToken: [, input.NextToken],
107
- maxResults: [function () { return input.MaxResults !== void 0; }, function () { return input.MaxResults.toString(); }],
108
- startingBlockIndex: [function () { return input.StartingBlockIndex !== void 0; }, function () { return input.StartingBlockIndex.toString(); }],
109
- });
110
- return [2, new __HttpRequest({
111
- protocol: protocol,
112
- hostname: hostname,
113
- port: port,
114
- method: "GET",
115
- headers: headers,
116
- path: resolvedPath,
117
- query: query,
118
- body: body,
119
- })];
120
- }
121
- });
122
- }); };
123
- export var serializeAws_restJson1PutSnapshotBlockCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
124
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
125
- return __generator(this, function (_c) {
126
- switch (_c.label) {
127
- case 0: return [4, context.endpoint()];
128
- case 1:
129
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
130
- headers = map({}, isSerializableHeaderValue, {
131
- "x-amz-content-sha256": "UNSIGNED-PAYLOAD",
132
- "content-type": "application/octet-stream",
133
- "x-amz-data-length": [function () { return isSerializableHeaderValue(input.DataLength); }, function () { return input.DataLength.toString(); }],
134
- "x-amz-progress": [function () { return isSerializableHeaderValue(input.Progress); }, function () { return input.Progress.toString(); }],
135
- "x-amz-checksum": input.Checksum,
136
- "x-amz-checksum-algorithm": input.ChecksumAlgorithm,
137
- });
138
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
139
- "/snapshots/{SnapshotId}/blocks/{BlockIndex}";
140
- resolvedPath = __resolvedPath(resolvedPath, input, "SnapshotId", function () { return input.SnapshotId; }, "{SnapshotId}", false);
141
- resolvedPath = __resolvedPath(resolvedPath, input, "BlockIndex", function () { return input.BlockIndex.toString(); }, "{BlockIndex}", false);
142
- if (input.BlockData !== undefined) {
143
- body = input.BlockData;
144
- }
145
- return [2, new __HttpRequest({
146
- protocol: protocol,
147
- hostname: hostname,
148
- port: port,
149
- method: "PUT",
150
- headers: headers,
151
- path: resolvedPath,
152
- body: body,
153
- })];
154
- }
6
+ export const serializeAws_restJson1CompleteSnapshotCommand = async (input, context) => {
7
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
8
+ const headers = map({}, isSerializableHeaderValue, {
9
+ "x-amz-changedblockscount": [
10
+ () => isSerializableHeaderValue(input.ChangedBlocksCount),
11
+ () => input.ChangedBlocksCount.toString(),
12
+ ],
13
+ "x-amz-checksum": input.Checksum,
14
+ "x-amz-checksum-algorithm": input.ChecksumAlgorithm,
15
+ "x-amz-checksum-aggregation-method": input.ChecksumAggregationMethod,
16
+ });
17
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/snapshots/completion/{SnapshotId}";
18
+ resolvedPath = __resolvedPath(resolvedPath, input, "SnapshotId", () => input.SnapshotId, "{SnapshotId}", false);
19
+ let body;
20
+ return new __HttpRequest({
21
+ protocol,
22
+ hostname,
23
+ port,
24
+ method: "POST",
25
+ headers,
26
+ path: resolvedPath,
27
+ body,
155
28
  });
156
- }); };
157
- export var serializeAws_restJson1StartSnapshotCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
158
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
159
- var _c;
160
- return __generator(this, function (_d) {
161
- switch (_d.label) {
162
- case 0: return [4, context.endpoint()];
163
- case 1:
164
- _a = _d.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
165
- headers = {
166
- "content-type": "application/json",
167
- };
168
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/snapshots";
169
- body = JSON.stringify(__assign(__assign(__assign(__assign(__assign(__assign(__assign({ ClientToken: (_c = input.ClientToken) !== null && _c !== void 0 ? _c : generateIdempotencyToken() }, (input.Description != null && { Description: input.Description })), (input.Encrypted != null && { Encrypted: input.Encrypted })), (input.KmsKeyArn != null && { KmsKeyArn: input.KmsKeyArn })), (input.ParentSnapshotId != null && { ParentSnapshotId: input.ParentSnapshotId })), (input.Tags != null && { Tags: serializeAws_restJson1Tags(input.Tags, context) })), (input.Timeout != null && { Timeout: input.Timeout })), (input.VolumeSize != null && { VolumeSize: input.VolumeSize })));
170
- return [2, new __HttpRequest({
171
- protocol: protocol,
172
- hostname: hostname,
173
- port: port,
174
- method: "POST",
175
- headers: headers,
176
- path: resolvedPath,
177
- body: body,
178
- })];
179
- }
180
- });
181
- }); };
182
- export var deserializeAws_restJson1CompleteSnapshotCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
183
- var contents, data, _a, _b;
184
- return __generator(this, function (_c) {
185
- switch (_c.label) {
186
- case 0:
187
- if (output.statusCode !== 202 && output.statusCode >= 300) {
188
- return [2, deserializeAws_restJson1CompleteSnapshotCommandError(output, context)];
189
- }
190
- contents = map({
191
- $metadata: deserializeMetadata(output),
192
- });
193
- _a = __expectNonNull;
194
- _b = __expectObject;
195
- return [4, parseBody(output.body, context)];
196
- case 1:
197
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
198
- if (data.Status != null) {
199
- contents.Status = __expectString(data.Status);
200
- }
201
- return [2, contents];
202
- }
203
- });
204
- }); };
205
- var deserializeAws_restJson1CompleteSnapshotCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
206
- var parsedOutput, _a, errorCode, _b, parsedBody;
207
- var _c;
208
- return __generator(this, function (_d) {
209
- switch (_d.label) {
210
- case 0:
211
- _a = [__assign({}, output)];
212
- _c = {};
213
- return [4, parseErrorBody(output.body, context)];
214
- case 1:
215
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
216
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
217
- _b = errorCode;
218
- switch (_b) {
219
- case "AccessDeniedException": return [3, 2];
220
- case "com.amazonaws.ebs#AccessDeniedException": return [3, 2];
221
- case "InternalServerException": return [3, 4];
222
- case "com.amazonaws.ebs#InternalServerException": return [3, 4];
223
- case "RequestThrottledException": return [3, 6];
224
- case "com.amazonaws.ebs#RequestThrottledException": return [3, 6];
225
- case "ResourceNotFoundException": return [3, 8];
226
- case "com.amazonaws.ebs#ResourceNotFoundException": return [3, 8];
227
- case "ServiceQuotaExceededException": return [3, 10];
228
- case "com.amazonaws.ebs#ServiceQuotaExceededException": return [3, 10];
229
- case "ValidationException": return [3, 12];
230
- case "com.amazonaws.ebs#ValidationException": return [3, 12];
231
- }
232
- return [3, 14];
233
- case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
234
- case 3: throw _d.sent();
235
- case 4: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
236
- case 5: throw _d.sent();
237
- case 6: return [4, deserializeAws_restJson1RequestThrottledExceptionResponse(parsedOutput, context)];
238
- case 7: throw _d.sent();
239
- case 8: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
240
- case 9: throw _d.sent();
241
- case 10: return [4, deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)];
242
- case 11: throw _d.sent();
243
- case 12: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
244
- case 13: throw _d.sent();
245
- case 14:
246
- parsedBody = parsedOutput.body;
247
- throwDefaultError({
248
- output: output,
249
- parsedBody: parsedBody,
250
- exceptionCtor: __BaseException,
251
- errorCode: errorCode,
252
- });
253
- _d.label = 15;
254
- case 15: return [2];
255
- }
256
- });
257
- }); };
258
- export var deserializeAws_restJson1GetSnapshotBlockCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
259
- var contents, data;
260
- return __generator(this, function (_a) {
261
- if (output.statusCode !== 200 && output.statusCode >= 300) {
262
- return [2, deserializeAws_restJson1GetSnapshotBlockCommandError(output, context)];
263
- }
264
- contents = map({
265
- $metadata: deserializeMetadata(output),
266
- DataLength: [
267
- function () { return void 0 !== output.headers["x-amz-data-length"]; },
268
- function () { return __strictParseInt32(output.headers["x-amz-data-length"]); },
269
- ],
270
- Checksum: [, output.headers["x-amz-checksum"]],
271
- ChecksumAlgorithm: [, output.headers["x-amz-checksum-algorithm"]],
272
- });
273
- data = output.body;
274
- contents.BlockData = data;
275
- return [2, contents];
29
+ };
30
+ export const serializeAws_restJson1GetSnapshotBlockCommand = async (input, context) => {
31
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
32
+ const headers = {};
33
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
34
+ "/snapshots/{SnapshotId}/blocks/{BlockIndex}";
35
+ resolvedPath = __resolvedPath(resolvedPath, input, "SnapshotId", () => input.SnapshotId, "{SnapshotId}", false);
36
+ resolvedPath = __resolvedPath(resolvedPath, input, "BlockIndex", () => input.BlockIndex.toString(), "{BlockIndex}", false);
37
+ const query = map({
38
+ blockToken: [, input.BlockToken],
39
+ });
40
+ let body;
41
+ return new __HttpRequest({
42
+ protocol,
43
+ hostname,
44
+ port,
45
+ method: "GET",
46
+ headers,
47
+ path: resolvedPath,
48
+ query,
49
+ body,
276
50
  });
277
- }); };
278
- var deserializeAws_restJson1GetSnapshotBlockCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
279
- var parsedOutput, _a, errorCode, _b, parsedBody;
280
- var _c;
281
- return __generator(this, function (_d) {
282
- switch (_d.label) {
283
- case 0:
284
- _a = [__assign({}, output)];
285
- _c = {};
286
- return [4, parseErrorBody(output.body, context)];
287
- case 1:
288
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
289
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
290
- _b = errorCode;
291
- switch (_b) {
292
- case "AccessDeniedException": return [3, 2];
293
- case "com.amazonaws.ebs#AccessDeniedException": return [3, 2];
294
- case "InternalServerException": return [3, 4];
295
- case "com.amazonaws.ebs#InternalServerException": return [3, 4];
296
- case "RequestThrottledException": return [3, 6];
297
- case "com.amazonaws.ebs#RequestThrottledException": return [3, 6];
298
- case "ResourceNotFoundException": return [3, 8];
299
- case "com.amazonaws.ebs#ResourceNotFoundException": return [3, 8];
300
- case "ServiceQuotaExceededException": return [3, 10];
301
- case "com.amazonaws.ebs#ServiceQuotaExceededException": return [3, 10];
302
- case "ValidationException": return [3, 12];
303
- case "com.amazonaws.ebs#ValidationException": return [3, 12];
304
- }
305
- return [3, 14];
306
- case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
307
- case 3: throw _d.sent();
308
- case 4: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
309
- case 5: throw _d.sent();
310
- case 6: return [4, deserializeAws_restJson1RequestThrottledExceptionResponse(parsedOutput, context)];
311
- case 7: throw _d.sent();
312
- case 8: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
313
- case 9: throw _d.sent();
314
- case 10: return [4, deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)];
315
- case 11: throw _d.sent();
316
- case 12: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
317
- case 13: throw _d.sent();
318
- case 14:
319
- parsedBody = parsedOutput.body;
320
- throwDefaultError({
321
- output: output,
322
- parsedBody: parsedBody,
323
- exceptionCtor: __BaseException,
324
- errorCode: errorCode,
325
- });
326
- _d.label = 15;
327
- case 15: return [2];
328
- }
51
+ };
52
+ export const serializeAws_restJson1ListChangedBlocksCommand = async (input, context) => {
53
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
54
+ const headers = {};
55
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
56
+ "/snapshots/{SecondSnapshotId}/changedblocks";
57
+ resolvedPath = __resolvedPath(resolvedPath, input, "SecondSnapshotId", () => input.SecondSnapshotId, "{SecondSnapshotId}", false);
58
+ const query = map({
59
+ firstSnapshotId: [, input.FirstSnapshotId],
60
+ pageToken: [, input.NextToken],
61
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
62
+ startingBlockIndex: [() => input.StartingBlockIndex !== void 0, () => input.StartingBlockIndex.toString()],
63
+ });
64
+ let body;
65
+ return new __HttpRequest({
66
+ protocol,
67
+ hostname,
68
+ port,
69
+ method: "GET",
70
+ headers,
71
+ path: resolvedPath,
72
+ query,
73
+ body,
329
74
  });
330
- }); };
331
- export var deserializeAws_restJson1ListChangedBlocksCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
332
- var contents, data, _a, _b;
333
- return __generator(this, function (_c) {
334
- switch (_c.label) {
335
- case 0:
336
- if (output.statusCode !== 200 && output.statusCode >= 300) {
337
- return [2, deserializeAws_restJson1ListChangedBlocksCommandError(output, context)];
338
- }
339
- contents = map({
340
- $metadata: deserializeMetadata(output),
341
- });
342
- _a = __expectNonNull;
343
- _b = __expectObject;
344
- return [4, parseBody(output.body, context)];
345
- case 1:
346
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
347
- if (data.BlockSize != null) {
348
- contents.BlockSize = __expectInt32(data.BlockSize);
349
- }
350
- if (data.ChangedBlocks != null) {
351
- contents.ChangedBlocks = deserializeAws_restJson1ChangedBlocks(data.ChangedBlocks, context);
352
- }
353
- if (data.ExpiryTime != null) {
354
- contents.ExpiryTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.ExpiryTime)));
355
- }
356
- if (data.NextToken != null) {
357
- contents.NextToken = __expectString(data.NextToken);
358
- }
359
- if (data.VolumeSize != null) {
360
- contents.VolumeSize = __expectLong(data.VolumeSize);
361
- }
362
- return [2, contents];
363
- }
75
+ };
76
+ export const serializeAws_restJson1ListSnapshotBlocksCommand = async (input, context) => {
77
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
78
+ const headers = {};
79
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/snapshots/{SnapshotId}/blocks";
80
+ resolvedPath = __resolvedPath(resolvedPath, input, "SnapshotId", () => input.SnapshotId, "{SnapshotId}", false);
81
+ const query = map({
82
+ pageToken: [, input.NextToken],
83
+ maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
84
+ startingBlockIndex: [() => input.StartingBlockIndex !== void 0, () => input.StartingBlockIndex.toString()],
85
+ });
86
+ let body;
87
+ return new __HttpRequest({
88
+ protocol,
89
+ hostname,
90
+ port,
91
+ method: "GET",
92
+ headers,
93
+ path: resolvedPath,
94
+ query,
95
+ body,
364
96
  });
365
- }); };
366
- var deserializeAws_restJson1ListChangedBlocksCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
367
- var parsedOutput, _a, errorCode, _b, parsedBody;
368
- var _c;
369
- return __generator(this, function (_d) {
370
- switch (_d.label) {
371
- case 0:
372
- _a = [__assign({}, output)];
373
- _c = {};
374
- return [4, parseErrorBody(output.body, context)];
375
- case 1:
376
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
377
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
378
- _b = errorCode;
379
- switch (_b) {
380
- case "AccessDeniedException": return [3, 2];
381
- case "com.amazonaws.ebs#AccessDeniedException": return [3, 2];
382
- case "InternalServerException": return [3, 4];
383
- case "com.amazonaws.ebs#InternalServerException": return [3, 4];
384
- case "RequestThrottledException": return [3, 6];
385
- case "com.amazonaws.ebs#RequestThrottledException": return [3, 6];
386
- case "ResourceNotFoundException": return [3, 8];
387
- case "com.amazonaws.ebs#ResourceNotFoundException": return [3, 8];
388
- case "ServiceQuotaExceededException": return [3, 10];
389
- case "com.amazonaws.ebs#ServiceQuotaExceededException": return [3, 10];
390
- case "ValidationException": return [3, 12];
391
- case "com.amazonaws.ebs#ValidationException": return [3, 12];
392
- }
393
- return [3, 14];
394
- case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
395
- case 3: throw _d.sent();
396
- case 4: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
397
- case 5: throw _d.sent();
398
- case 6: return [4, deserializeAws_restJson1RequestThrottledExceptionResponse(parsedOutput, context)];
399
- case 7: throw _d.sent();
400
- case 8: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
401
- case 9: throw _d.sent();
402
- case 10: return [4, deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)];
403
- case 11: throw _d.sent();
404
- case 12: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
405
- case 13: throw _d.sent();
406
- case 14:
407
- parsedBody = parsedOutput.body;
408
- throwDefaultError({
409
- output: output,
410
- parsedBody: parsedBody,
411
- exceptionCtor: __BaseException,
412
- errorCode: errorCode,
413
- });
414
- _d.label = 15;
415
- case 15: return [2];
416
- }
97
+ };
98
+ export const serializeAws_restJson1PutSnapshotBlockCommand = async (input, context) => {
99
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
100
+ const headers = map({}, isSerializableHeaderValue, {
101
+ "x-amz-content-sha256": "UNSIGNED-PAYLOAD",
102
+ "content-type": "application/octet-stream",
103
+ "x-amz-data-length": [() => isSerializableHeaderValue(input.DataLength), () => input.DataLength.toString()],
104
+ "x-amz-progress": [() => isSerializableHeaderValue(input.Progress), () => input.Progress.toString()],
105
+ "x-amz-checksum": input.Checksum,
106
+ "x-amz-checksum-algorithm": input.ChecksumAlgorithm,
107
+ });
108
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
109
+ "/snapshots/{SnapshotId}/blocks/{BlockIndex}";
110
+ resolvedPath = __resolvedPath(resolvedPath, input, "SnapshotId", () => input.SnapshotId, "{SnapshotId}", false);
111
+ resolvedPath = __resolvedPath(resolvedPath, input, "BlockIndex", () => input.BlockIndex.toString(), "{BlockIndex}", false);
112
+ let body;
113
+ if (input.BlockData !== undefined) {
114
+ body = input.BlockData;
115
+ }
116
+ return new __HttpRequest({
117
+ protocol,
118
+ hostname,
119
+ port,
120
+ method: "PUT",
121
+ headers,
122
+ path: resolvedPath,
123
+ body,
417
124
  });
418
- }); };
419
- export var deserializeAws_restJson1ListSnapshotBlocksCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
420
- var contents, data, _a, _b;
421
- return __generator(this, function (_c) {
422
- switch (_c.label) {
423
- case 0:
424
- if (output.statusCode !== 200 && output.statusCode >= 300) {
425
- return [2, deserializeAws_restJson1ListSnapshotBlocksCommandError(output, context)];
426
- }
427
- contents = map({
428
- $metadata: deserializeMetadata(output),
429
- });
430
- _a = __expectNonNull;
431
- _b = __expectObject;
432
- return [4, parseBody(output.body, context)];
433
- case 1:
434
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
435
- if (data.BlockSize != null) {
436
- contents.BlockSize = __expectInt32(data.BlockSize);
437
- }
438
- if (data.Blocks != null) {
439
- contents.Blocks = deserializeAws_restJson1Blocks(data.Blocks, context);
440
- }
441
- if (data.ExpiryTime != null) {
442
- contents.ExpiryTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.ExpiryTime)));
443
- }
444
- if (data.NextToken != null) {
445
- contents.NextToken = __expectString(data.NextToken);
446
- }
447
- if (data.VolumeSize != null) {
448
- contents.VolumeSize = __expectLong(data.VolumeSize);
449
- }
450
- return [2, contents];
451
- }
125
+ };
126
+ export const serializeAws_restJson1StartSnapshotCommand = async (input, context) => {
127
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
128
+ const headers = {
129
+ "content-type": "application/json",
130
+ };
131
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/snapshots";
132
+ let body;
133
+ body = JSON.stringify({
134
+ ClientToken: input.ClientToken ?? generateIdempotencyToken(),
135
+ ...(input.Description != null && { Description: input.Description }),
136
+ ...(input.Encrypted != null && { Encrypted: input.Encrypted }),
137
+ ...(input.KmsKeyArn != null && { KmsKeyArn: input.KmsKeyArn }),
138
+ ...(input.ParentSnapshotId != null && { ParentSnapshotId: input.ParentSnapshotId }),
139
+ ...(input.Tags != null && { Tags: serializeAws_restJson1Tags(input.Tags, context) }),
140
+ ...(input.Timeout != null && { Timeout: input.Timeout }),
141
+ ...(input.VolumeSize != null && { VolumeSize: input.VolumeSize }),
142
+ });
143
+ return new __HttpRequest({
144
+ protocol,
145
+ hostname,
146
+ port,
147
+ method: "POST",
148
+ headers,
149
+ path: resolvedPath,
150
+ body,
452
151
  });
453
- }); };
454
- var deserializeAws_restJson1ListSnapshotBlocksCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
455
- var parsedOutput, _a, errorCode, _b, parsedBody;
456
- var _c;
457
- return __generator(this, function (_d) {
458
- switch (_d.label) {
459
- case 0:
460
- _a = [__assign({}, output)];
461
- _c = {};
462
- return [4, parseErrorBody(output.body, context)];
463
- case 1:
464
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
465
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
466
- _b = errorCode;
467
- switch (_b) {
468
- case "AccessDeniedException": return [3, 2];
469
- case "com.amazonaws.ebs#AccessDeniedException": return [3, 2];
470
- case "InternalServerException": return [3, 4];
471
- case "com.amazonaws.ebs#InternalServerException": return [3, 4];
472
- case "RequestThrottledException": return [3, 6];
473
- case "com.amazonaws.ebs#RequestThrottledException": return [3, 6];
474
- case "ResourceNotFoundException": return [3, 8];
475
- case "com.amazonaws.ebs#ResourceNotFoundException": return [3, 8];
476
- case "ServiceQuotaExceededException": return [3, 10];
477
- case "com.amazonaws.ebs#ServiceQuotaExceededException": return [3, 10];
478
- case "ValidationException": return [3, 12];
479
- case "com.amazonaws.ebs#ValidationException": return [3, 12];
480
- }
481
- return [3, 14];
482
- case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
483
- case 3: throw _d.sent();
484
- case 4: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
485
- case 5: throw _d.sent();
486
- case 6: return [4, deserializeAws_restJson1RequestThrottledExceptionResponse(parsedOutput, context)];
487
- case 7: throw _d.sent();
488
- case 8: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
489
- case 9: throw _d.sent();
490
- case 10: return [4, deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)];
491
- case 11: throw _d.sent();
492
- case 12: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
493
- case 13: throw _d.sent();
494
- case 14:
495
- parsedBody = parsedOutput.body;
496
- throwDefaultError({
497
- output: output,
498
- parsedBody: parsedBody,
499
- exceptionCtor: __BaseException,
500
- errorCode: errorCode,
501
- });
502
- _d.label = 15;
503
- case 15: return [2];
504
- }
152
+ };
153
+ export const deserializeAws_restJson1CompleteSnapshotCommand = async (output, context) => {
154
+ if (output.statusCode !== 202 && output.statusCode >= 300) {
155
+ return deserializeAws_restJson1CompleteSnapshotCommandError(output, context);
156
+ }
157
+ const contents = map({
158
+ $metadata: deserializeMetadata(output),
505
159
  });
506
- }); };
507
- export var deserializeAws_restJson1PutSnapshotBlockCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
508
- var contents;
509
- return __generator(this, function (_a) {
510
- switch (_a.label) {
511
- case 0:
512
- if (output.statusCode !== 201 && output.statusCode >= 300) {
513
- return [2, deserializeAws_restJson1PutSnapshotBlockCommandError(output, context)];
514
- }
515
- contents = map({
516
- $metadata: deserializeMetadata(output),
517
- Checksum: [, output.headers["x-amz-checksum"]],
518
- ChecksumAlgorithm: [, output.headers["x-amz-checksum-algorithm"]],
519
- });
520
- return [4, collectBody(output.body, context)];
521
- case 1:
522
- _a.sent();
523
- return [2, contents];
524
- }
160
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
161
+ if (data.Status != null) {
162
+ contents.Status = __expectString(data.Status);
163
+ }
164
+ return contents;
165
+ };
166
+ const deserializeAws_restJson1CompleteSnapshotCommandError = async (output, context) => {
167
+ const parsedOutput = {
168
+ ...output,
169
+ body: await parseErrorBody(output.body, context),
170
+ };
171
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
172
+ switch (errorCode) {
173
+ case "AccessDeniedException":
174
+ case "com.amazonaws.ebs#AccessDeniedException":
175
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
176
+ case "InternalServerException":
177
+ case "com.amazonaws.ebs#InternalServerException":
178
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
179
+ case "RequestThrottledException":
180
+ case "com.amazonaws.ebs#RequestThrottledException":
181
+ throw await deserializeAws_restJson1RequestThrottledExceptionResponse(parsedOutput, context);
182
+ case "ResourceNotFoundException":
183
+ case "com.amazonaws.ebs#ResourceNotFoundException":
184
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
185
+ case "ServiceQuotaExceededException":
186
+ case "com.amazonaws.ebs#ServiceQuotaExceededException":
187
+ throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
188
+ case "ValidationException":
189
+ case "com.amazonaws.ebs#ValidationException":
190
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
191
+ default:
192
+ const parsedBody = parsedOutput.body;
193
+ throwDefaultError({
194
+ output,
195
+ parsedBody,
196
+ exceptionCtor: __BaseException,
197
+ errorCode,
198
+ });
199
+ }
200
+ };
201
+ export const deserializeAws_restJson1GetSnapshotBlockCommand = async (output, context) => {
202
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
203
+ return deserializeAws_restJson1GetSnapshotBlockCommandError(output, context);
204
+ }
205
+ const contents = map({
206
+ $metadata: deserializeMetadata(output),
207
+ DataLength: [
208
+ () => void 0 !== output.headers["x-amz-data-length"],
209
+ () => __strictParseInt32(output.headers["x-amz-data-length"]),
210
+ ],
211
+ Checksum: [, output.headers["x-amz-checksum"]],
212
+ ChecksumAlgorithm: [, output.headers["x-amz-checksum-algorithm"]],
213
+ });
214
+ const data = output.body;
215
+ context.sdkStreamMixin(data);
216
+ contents.BlockData = data;
217
+ return contents;
218
+ };
219
+ const deserializeAws_restJson1GetSnapshotBlockCommandError = async (output, context) => {
220
+ const parsedOutput = {
221
+ ...output,
222
+ body: await parseErrorBody(output.body, context),
223
+ };
224
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
225
+ switch (errorCode) {
226
+ case "AccessDeniedException":
227
+ case "com.amazonaws.ebs#AccessDeniedException":
228
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
229
+ case "InternalServerException":
230
+ case "com.amazonaws.ebs#InternalServerException":
231
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
232
+ case "RequestThrottledException":
233
+ case "com.amazonaws.ebs#RequestThrottledException":
234
+ throw await deserializeAws_restJson1RequestThrottledExceptionResponse(parsedOutput, context);
235
+ case "ResourceNotFoundException":
236
+ case "com.amazonaws.ebs#ResourceNotFoundException":
237
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
238
+ case "ServiceQuotaExceededException":
239
+ case "com.amazonaws.ebs#ServiceQuotaExceededException":
240
+ throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
241
+ case "ValidationException":
242
+ case "com.amazonaws.ebs#ValidationException":
243
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
244
+ default:
245
+ const parsedBody = parsedOutput.body;
246
+ throwDefaultError({
247
+ output,
248
+ parsedBody,
249
+ exceptionCtor: __BaseException,
250
+ errorCode,
251
+ });
252
+ }
253
+ };
254
+ export const deserializeAws_restJson1ListChangedBlocksCommand = async (output, context) => {
255
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
256
+ return deserializeAws_restJson1ListChangedBlocksCommandError(output, context);
257
+ }
258
+ const contents = map({
259
+ $metadata: deserializeMetadata(output),
525
260
  });
526
- }); };
527
- var deserializeAws_restJson1PutSnapshotBlockCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
528
- var parsedOutput, _a, errorCode, _b, parsedBody;
529
- var _c;
530
- return __generator(this, function (_d) {
531
- switch (_d.label) {
532
- case 0:
533
- _a = [__assign({}, output)];
534
- _c = {};
535
- return [4, parseErrorBody(output.body, context)];
536
- case 1:
537
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
538
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
539
- _b = errorCode;
540
- switch (_b) {
541
- case "AccessDeniedException": return [3, 2];
542
- case "com.amazonaws.ebs#AccessDeniedException": return [3, 2];
543
- case "InternalServerException": return [3, 4];
544
- case "com.amazonaws.ebs#InternalServerException": return [3, 4];
545
- case "RequestThrottledException": return [3, 6];
546
- case "com.amazonaws.ebs#RequestThrottledException": return [3, 6];
547
- case "ResourceNotFoundException": return [3, 8];
548
- case "com.amazonaws.ebs#ResourceNotFoundException": return [3, 8];
549
- case "ServiceQuotaExceededException": return [3, 10];
550
- case "com.amazonaws.ebs#ServiceQuotaExceededException": return [3, 10];
551
- case "ValidationException": return [3, 12];
552
- case "com.amazonaws.ebs#ValidationException": return [3, 12];
553
- }
554
- return [3, 14];
555
- case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
556
- case 3: throw _d.sent();
557
- case 4: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
558
- case 5: throw _d.sent();
559
- case 6: return [4, deserializeAws_restJson1RequestThrottledExceptionResponse(parsedOutput, context)];
560
- case 7: throw _d.sent();
561
- case 8: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
562
- case 9: throw _d.sent();
563
- case 10: return [4, deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)];
564
- case 11: throw _d.sent();
565
- case 12: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
566
- case 13: throw _d.sent();
567
- case 14:
568
- parsedBody = parsedOutput.body;
569
- throwDefaultError({
570
- output: output,
571
- parsedBody: parsedBody,
572
- exceptionCtor: __BaseException,
573
- errorCode: errorCode,
574
- });
575
- _d.label = 15;
576
- case 15: return [2];
577
- }
261
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
262
+ if (data.BlockSize != null) {
263
+ contents.BlockSize = __expectInt32(data.BlockSize);
264
+ }
265
+ if (data.ChangedBlocks != null) {
266
+ contents.ChangedBlocks = deserializeAws_restJson1ChangedBlocks(data.ChangedBlocks, context);
267
+ }
268
+ if (data.ExpiryTime != null) {
269
+ contents.ExpiryTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.ExpiryTime)));
270
+ }
271
+ if (data.NextToken != null) {
272
+ contents.NextToken = __expectString(data.NextToken);
273
+ }
274
+ if (data.VolumeSize != null) {
275
+ contents.VolumeSize = __expectLong(data.VolumeSize);
276
+ }
277
+ return contents;
278
+ };
279
+ const deserializeAws_restJson1ListChangedBlocksCommandError = async (output, context) => {
280
+ const parsedOutput = {
281
+ ...output,
282
+ body: await parseErrorBody(output.body, context),
283
+ };
284
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
285
+ switch (errorCode) {
286
+ case "AccessDeniedException":
287
+ case "com.amazonaws.ebs#AccessDeniedException":
288
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
289
+ case "InternalServerException":
290
+ case "com.amazonaws.ebs#InternalServerException":
291
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
292
+ case "RequestThrottledException":
293
+ case "com.amazonaws.ebs#RequestThrottledException":
294
+ throw await deserializeAws_restJson1RequestThrottledExceptionResponse(parsedOutput, context);
295
+ case "ResourceNotFoundException":
296
+ case "com.amazonaws.ebs#ResourceNotFoundException":
297
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
298
+ case "ServiceQuotaExceededException":
299
+ case "com.amazonaws.ebs#ServiceQuotaExceededException":
300
+ throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
301
+ case "ValidationException":
302
+ case "com.amazonaws.ebs#ValidationException":
303
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
304
+ default:
305
+ const parsedBody = parsedOutput.body;
306
+ throwDefaultError({
307
+ output,
308
+ parsedBody,
309
+ exceptionCtor: __BaseException,
310
+ errorCode,
311
+ });
312
+ }
313
+ };
314
+ export const deserializeAws_restJson1ListSnapshotBlocksCommand = async (output, context) => {
315
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
316
+ return deserializeAws_restJson1ListSnapshotBlocksCommandError(output, context);
317
+ }
318
+ const contents = map({
319
+ $metadata: deserializeMetadata(output),
578
320
  });
579
- }); };
580
- export var deserializeAws_restJson1StartSnapshotCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
581
- var contents, data, _a, _b;
582
- return __generator(this, function (_c) {
583
- switch (_c.label) {
584
- case 0:
585
- if (output.statusCode !== 201 && output.statusCode >= 300) {
586
- return [2, deserializeAws_restJson1StartSnapshotCommandError(output, context)];
587
- }
588
- contents = map({
589
- $metadata: deserializeMetadata(output),
590
- });
591
- _a = __expectNonNull;
592
- _b = __expectObject;
593
- return [4, parseBody(output.body, context)];
594
- case 1:
595
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
596
- if (data.BlockSize != null) {
597
- contents.BlockSize = __expectInt32(data.BlockSize);
598
- }
599
- if (data.Description != null) {
600
- contents.Description = __expectString(data.Description);
601
- }
602
- if (data.KmsKeyArn != null) {
603
- contents.KmsKeyArn = __expectString(data.KmsKeyArn);
604
- }
605
- if (data.OwnerId != null) {
606
- contents.OwnerId = __expectString(data.OwnerId);
607
- }
608
- if (data.ParentSnapshotId != null) {
609
- contents.ParentSnapshotId = __expectString(data.ParentSnapshotId);
610
- }
611
- if (data.SnapshotId != null) {
612
- contents.SnapshotId = __expectString(data.SnapshotId);
613
- }
614
- if (data.StartTime != null) {
615
- contents.StartTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.StartTime)));
616
- }
617
- if (data.Status != null) {
618
- contents.Status = __expectString(data.Status);
619
- }
620
- if (data.Tags != null) {
621
- contents.Tags = deserializeAws_restJson1Tags(data.Tags, context);
622
- }
623
- if (data.VolumeSize != null) {
624
- contents.VolumeSize = __expectLong(data.VolumeSize);
625
- }
626
- return [2, contents];
627
- }
321
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
322
+ if (data.BlockSize != null) {
323
+ contents.BlockSize = __expectInt32(data.BlockSize);
324
+ }
325
+ if (data.Blocks != null) {
326
+ contents.Blocks = deserializeAws_restJson1Blocks(data.Blocks, context);
327
+ }
328
+ if (data.ExpiryTime != null) {
329
+ contents.ExpiryTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.ExpiryTime)));
330
+ }
331
+ if (data.NextToken != null) {
332
+ contents.NextToken = __expectString(data.NextToken);
333
+ }
334
+ if (data.VolumeSize != null) {
335
+ contents.VolumeSize = __expectLong(data.VolumeSize);
336
+ }
337
+ return contents;
338
+ };
339
+ const deserializeAws_restJson1ListSnapshotBlocksCommandError = async (output, context) => {
340
+ const parsedOutput = {
341
+ ...output,
342
+ body: await parseErrorBody(output.body, context),
343
+ };
344
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
345
+ switch (errorCode) {
346
+ case "AccessDeniedException":
347
+ case "com.amazonaws.ebs#AccessDeniedException":
348
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
349
+ case "InternalServerException":
350
+ case "com.amazonaws.ebs#InternalServerException":
351
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
352
+ case "RequestThrottledException":
353
+ case "com.amazonaws.ebs#RequestThrottledException":
354
+ throw await deserializeAws_restJson1RequestThrottledExceptionResponse(parsedOutput, context);
355
+ case "ResourceNotFoundException":
356
+ case "com.amazonaws.ebs#ResourceNotFoundException":
357
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
358
+ case "ServiceQuotaExceededException":
359
+ case "com.amazonaws.ebs#ServiceQuotaExceededException":
360
+ throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
361
+ case "ValidationException":
362
+ case "com.amazonaws.ebs#ValidationException":
363
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
364
+ default:
365
+ const parsedBody = parsedOutput.body;
366
+ throwDefaultError({
367
+ output,
368
+ parsedBody,
369
+ exceptionCtor: __BaseException,
370
+ errorCode,
371
+ });
372
+ }
373
+ };
374
+ export const deserializeAws_restJson1PutSnapshotBlockCommand = async (output, context) => {
375
+ if (output.statusCode !== 201 && output.statusCode >= 300) {
376
+ return deserializeAws_restJson1PutSnapshotBlockCommandError(output, context);
377
+ }
378
+ const contents = map({
379
+ $metadata: deserializeMetadata(output),
380
+ Checksum: [, output.headers["x-amz-checksum"]],
381
+ ChecksumAlgorithm: [, output.headers["x-amz-checksum-algorithm"]],
628
382
  });
629
- }); };
630
- var deserializeAws_restJson1StartSnapshotCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
631
- var parsedOutput, _a, errorCode, _b, parsedBody;
632
- var _c;
633
- return __generator(this, function (_d) {
634
- switch (_d.label) {
635
- case 0:
636
- _a = [__assign({}, output)];
637
- _c = {};
638
- return [4, parseErrorBody(output.body, context)];
639
- case 1:
640
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
641
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
642
- _b = errorCode;
643
- switch (_b) {
644
- case "AccessDeniedException": return [3, 2];
645
- case "com.amazonaws.ebs#AccessDeniedException": return [3, 2];
646
- case "ConcurrentLimitExceededException": return [3, 4];
647
- case "com.amazonaws.ebs#ConcurrentLimitExceededException": return [3, 4];
648
- case "ConflictException": return [3, 6];
649
- case "com.amazonaws.ebs#ConflictException": return [3, 6];
650
- case "InternalServerException": return [3, 8];
651
- case "com.amazonaws.ebs#InternalServerException": return [3, 8];
652
- case "RequestThrottledException": return [3, 10];
653
- case "com.amazonaws.ebs#RequestThrottledException": return [3, 10];
654
- case "ResourceNotFoundException": return [3, 12];
655
- case "com.amazonaws.ebs#ResourceNotFoundException": return [3, 12];
656
- case "ServiceQuotaExceededException": return [3, 14];
657
- case "com.amazonaws.ebs#ServiceQuotaExceededException": return [3, 14];
658
- case "ValidationException": return [3, 16];
659
- case "com.amazonaws.ebs#ValidationException": return [3, 16];
660
- }
661
- return [3, 18];
662
- case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
663
- case 3: throw _d.sent();
664
- case 4: return [4, deserializeAws_restJson1ConcurrentLimitExceededExceptionResponse(parsedOutput, context)];
665
- case 5: throw _d.sent();
666
- case 6: return [4, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
667
- case 7: throw _d.sent();
668
- case 8: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
669
- case 9: throw _d.sent();
670
- case 10: return [4, deserializeAws_restJson1RequestThrottledExceptionResponse(parsedOutput, context)];
671
- case 11: throw _d.sent();
672
- case 12: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
673
- case 13: throw _d.sent();
674
- case 14: return [4, deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)];
675
- case 15: throw _d.sent();
676
- case 16: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
677
- case 17: throw _d.sent();
678
- case 18:
679
- parsedBody = parsedOutput.body;
680
- throwDefaultError({
681
- output: output,
682
- parsedBody: parsedBody,
683
- exceptionCtor: __BaseException,
684
- errorCode: errorCode,
685
- });
686
- _d.label = 19;
687
- case 19: return [2];
688
- }
383
+ await collectBody(output.body, context);
384
+ return contents;
385
+ };
386
+ const deserializeAws_restJson1PutSnapshotBlockCommandError = async (output, context) => {
387
+ const parsedOutput = {
388
+ ...output,
389
+ body: await parseErrorBody(output.body, context),
390
+ };
391
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
392
+ switch (errorCode) {
393
+ case "AccessDeniedException":
394
+ case "com.amazonaws.ebs#AccessDeniedException":
395
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
396
+ case "InternalServerException":
397
+ case "com.amazonaws.ebs#InternalServerException":
398
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
399
+ case "RequestThrottledException":
400
+ case "com.amazonaws.ebs#RequestThrottledException":
401
+ throw await deserializeAws_restJson1RequestThrottledExceptionResponse(parsedOutput, context);
402
+ case "ResourceNotFoundException":
403
+ case "com.amazonaws.ebs#ResourceNotFoundException":
404
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
405
+ case "ServiceQuotaExceededException":
406
+ case "com.amazonaws.ebs#ServiceQuotaExceededException":
407
+ throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
408
+ case "ValidationException":
409
+ case "com.amazonaws.ebs#ValidationException":
410
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
411
+ default:
412
+ const parsedBody = parsedOutput.body;
413
+ throwDefaultError({
414
+ output,
415
+ parsedBody,
416
+ exceptionCtor: __BaseException,
417
+ errorCode,
418
+ });
419
+ }
420
+ };
421
+ export const deserializeAws_restJson1StartSnapshotCommand = async (output, context) => {
422
+ if (output.statusCode !== 201 && output.statusCode >= 300) {
423
+ return deserializeAws_restJson1StartSnapshotCommandError(output, context);
424
+ }
425
+ const contents = map({
426
+ $metadata: deserializeMetadata(output),
689
427
  });
690
- }); };
691
- var map = __map;
692
- var deserializeAws_restJson1AccessDeniedExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
693
- var contents, data, exception;
694
- return __generator(this, function (_a) {
695
- contents = map({});
696
- data = parsedOutput.body;
697
- if (data.Message != null) {
698
- contents.Message = __expectString(data.Message);
699
- }
700
- if (data.Reason != null) {
701
- contents.Reason = __expectString(data.Reason);
702
- }
703
- exception = new AccessDeniedException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
704
- return [2, __decorateServiceException(exception, parsedOutput.body)];
428
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
429
+ if (data.BlockSize != null) {
430
+ contents.BlockSize = __expectInt32(data.BlockSize);
431
+ }
432
+ if (data.Description != null) {
433
+ contents.Description = __expectString(data.Description);
434
+ }
435
+ if (data.KmsKeyArn != null) {
436
+ contents.KmsKeyArn = __expectString(data.KmsKeyArn);
437
+ }
438
+ if (data.OwnerId != null) {
439
+ contents.OwnerId = __expectString(data.OwnerId);
440
+ }
441
+ if (data.ParentSnapshotId != null) {
442
+ contents.ParentSnapshotId = __expectString(data.ParentSnapshotId);
443
+ }
444
+ if (data.SnapshotId != null) {
445
+ contents.SnapshotId = __expectString(data.SnapshotId);
446
+ }
447
+ if (data.StartTime != null) {
448
+ contents.StartTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.StartTime)));
449
+ }
450
+ if (data.Status != null) {
451
+ contents.Status = __expectString(data.Status);
452
+ }
453
+ if (data.Tags != null) {
454
+ contents.Tags = deserializeAws_restJson1Tags(data.Tags, context);
455
+ }
456
+ if (data.VolumeSize != null) {
457
+ contents.VolumeSize = __expectLong(data.VolumeSize);
458
+ }
459
+ return contents;
460
+ };
461
+ const deserializeAws_restJson1StartSnapshotCommandError = async (output, context) => {
462
+ const parsedOutput = {
463
+ ...output,
464
+ body: await parseErrorBody(output.body, context),
465
+ };
466
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
467
+ switch (errorCode) {
468
+ case "AccessDeniedException":
469
+ case "com.amazonaws.ebs#AccessDeniedException":
470
+ throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
471
+ case "ConcurrentLimitExceededException":
472
+ case "com.amazonaws.ebs#ConcurrentLimitExceededException":
473
+ throw await deserializeAws_restJson1ConcurrentLimitExceededExceptionResponse(parsedOutput, context);
474
+ case "ConflictException":
475
+ case "com.amazonaws.ebs#ConflictException":
476
+ throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
477
+ case "InternalServerException":
478
+ case "com.amazonaws.ebs#InternalServerException":
479
+ throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
480
+ case "RequestThrottledException":
481
+ case "com.amazonaws.ebs#RequestThrottledException":
482
+ throw await deserializeAws_restJson1RequestThrottledExceptionResponse(parsedOutput, context);
483
+ case "ResourceNotFoundException":
484
+ case "com.amazonaws.ebs#ResourceNotFoundException":
485
+ throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
486
+ case "ServiceQuotaExceededException":
487
+ case "com.amazonaws.ebs#ServiceQuotaExceededException":
488
+ throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
489
+ case "ValidationException":
490
+ case "com.amazonaws.ebs#ValidationException":
491
+ throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
492
+ default:
493
+ const parsedBody = parsedOutput.body;
494
+ throwDefaultError({
495
+ output,
496
+ parsedBody,
497
+ exceptionCtor: __BaseException,
498
+ errorCode,
499
+ });
500
+ }
501
+ };
502
+ const map = __map;
503
+ const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
504
+ const contents = map({});
505
+ const data = parsedOutput.body;
506
+ if (data.Message != null) {
507
+ contents.Message = __expectString(data.Message);
508
+ }
509
+ if (data.Reason != null) {
510
+ contents.Reason = __expectString(data.Reason);
511
+ }
512
+ const exception = new AccessDeniedException({
513
+ $metadata: deserializeMetadata(parsedOutput),
514
+ ...contents,
705
515
  });
706
- }); };
707
- var deserializeAws_restJson1ConcurrentLimitExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
708
- var contents, data, exception;
709
- return __generator(this, function (_a) {
710
- contents = map({});
711
- data = parsedOutput.body;
712
- if (data.Message != null) {
713
- contents.Message = __expectString(data.Message);
714
- }
715
- exception = new ConcurrentLimitExceededException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
716
- return [2, __decorateServiceException(exception, parsedOutput.body)];
516
+ return __decorateServiceException(exception, parsedOutput.body);
517
+ };
518
+ const deserializeAws_restJson1ConcurrentLimitExceededExceptionResponse = async (parsedOutput, context) => {
519
+ const contents = map({});
520
+ const data = parsedOutput.body;
521
+ if (data.Message != null) {
522
+ contents.Message = __expectString(data.Message);
523
+ }
524
+ const exception = new ConcurrentLimitExceededException({
525
+ $metadata: deserializeMetadata(parsedOutput),
526
+ ...contents,
717
527
  });
718
- }); };
719
- var deserializeAws_restJson1ConflictExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
720
- var contents, data, exception;
721
- return __generator(this, function (_a) {
722
- contents = map({});
723
- data = parsedOutput.body;
724
- if (data.Message != null) {
725
- contents.Message = __expectString(data.Message);
726
- }
727
- exception = new ConflictException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
728
- return [2, __decorateServiceException(exception, parsedOutput.body)];
528
+ return __decorateServiceException(exception, parsedOutput.body);
529
+ };
530
+ const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
531
+ const contents = map({});
532
+ const data = parsedOutput.body;
533
+ if (data.Message != null) {
534
+ contents.Message = __expectString(data.Message);
535
+ }
536
+ const exception = new ConflictException({
537
+ $metadata: deserializeMetadata(parsedOutput),
538
+ ...contents,
729
539
  });
730
- }); };
731
- var deserializeAws_restJson1InternalServerExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
732
- var contents, data, exception;
733
- return __generator(this, function (_a) {
734
- contents = map({});
735
- data = parsedOutput.body;
736
- if (data.Message != null) {
737
- contents.Message = __expectString(data.Message);
738
- }
739
- exception = new InternalServerException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
740
- return [2, __decorateServiceException(exception, parsedOutput.body)];
540
+ return __decorateServiceException(exception, parsedOutput.body);
541
+ };
542
+ const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
543
+ const contents = map({});
544
+ const data = parsedOutput.body;
545
+ if (data.Message != null) {
546
+ contents.Message = __expectString(data.Message);
547
+ }
548
+ const exception = new InternalServerException({
549
+ $metadata: deserializeMetadata(parsedOutput),
550
+ ...contents,
741
551
  });
742
- }); };
743
- var deserializeAws_restJson1RequestThrottledExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
744
- var contents, data, exception;
745
- return __generator(this, function (_a) {
746
- contents = map({});
747
- data = parsedOutput.body;
748
- if (data.Message != null) {
749
- contents.Message = __expectString(data.Message);
750
- }
751
- if (data.Reason != null) {
752
- contents.Reason = __expectString(data.Reason);
753
- }
754
- exception = new RequestThrottledException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
755
- return [2, __decorateServiceException(exception, parsedOutput.body)];
552
+ return __decorateServiceException(exception, parsedOutput.body);
553
+ };
554
+ const deserializeAws_restJson1RequestThrottledExceptionResponse = async (parsedOutput, context) => {
555
+ const contents = map({});
556
+ const data = parsedOutput.body;
557
+ if (data.Message != null) {
558
+ contents.Message = __expectString(data.Message);
559
+ }
560
+ if (data.Reason != null) {
561
+ contents.Reason = __expectString(data.Reason);
562
+ }
563
+ const exception = new RequestThrottledException({
564
+ $metadata: deserializeMetadata(parsedOutput),
565
+ ...contents,
756
566
  });
757
- }); };
758
- var deserializeAws_restJson1ResourceNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
759
- var contents, data, exception;
760
- return __generator(this, function (_a) {
761
- contents = map({});
762
- data = parsedOutput.body;
763
- if (data.Message != null) {
764
- contents.Message = __expectString(data.Message);
765
- }
766
- if (data.Reason != null) {
767
- contents.Reason = __expectString(data.Reason);
768
- }
769
- exception = new ResourceNotFoundException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
770
- return [2, __decorateServiceException(exception, parsedOutput.body)];
567
+ return __decorateServiceException(exception, parsedOutput.body);
568
+ };
569
+ const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
570
+ const contents = map({});
571
+ const data = parsedOutput.body;
572
+ if (data.Message != null) {
573
+ contents.Message = __expectString(data.Message);
574
+ }
575
+ if (data.Reason != null) {
576
+ contents.Reason = __expectString(data.Reason);
577
+ }
578
+ const exception = new ResourceNotFoundException({
579
+ $metadata: deserializeMetadata(parsedOutput),
580
+ ...contents,
771
581
  });
772
- }); };
773
- var deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
774
- var contents, data, exception;
775
- return __generator(this, function (_a) {
776
- contents = map({});
777
- data = parsedOutput.body;
778
- if (data.Message != null) {
779
- contents.Message = __expectString(data.Message);
780
- }
781
- if (data.Reason != null) {
782
- contents.Reason = __expectString(data.Reason);
783
- }
784
- exception = new ServiceQuotaExceededException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
785
- return [2, __decorateServiceException(exception, parsedOutput.body)];
582
+ return __decorateServiceException(exception, parsedOutput.body);
583
+ };
584
+ const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
585
+ const contents = map({});
586
+ const data = parsedOutput.body;
587
+ if (data.Message != null) {
588
+ contents.Message = __expectString(data.Message);
589
+ }
590
+ if (data.Reason != null) {
591
+ contents.Reason = __expectString(data.Reason);
592
+ }
593
+ const exception = new ServiceQuotaExceededException({
594
+ $metadata: deserializeMetadata(parsedOutput),
595
+ ...contents,
786
596
  });
787
- }); };
788
- var deserializeAws_restJson1ValidationExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
789
- var contents, data, exception;
790
- return __generator(this, function (_a) {
791
- contents = map({});
792
- data = parsedOutput.body;
793
- if (data.Message != null) {
794
- contents.Message = __expectString(data.Message);
795
- }
796
- if (data.Reason != null) {
797
- contents.Reason = __expectString(data.Reason);
798
- }
799
- exception = new ValidationException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
800
- return [2, __decorateServiceException(exception, parsedOutput.body)];
597
+ return __decorateServiceException(exception, parsedOutput.body);
598
+ };
599
+ const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
600
+ const contents = map({});
601
+ const data = parsedOutput.body;
602
+ if (data.Message != null) {
603
+ contents.Message = __expectString(data.Message);
604
+ }
605
+ if (data.Reason != null) {
606
+ contents.Reason = __expectString(data.Reason);
607
+ }
608
+ const exception = new ValidationException({
609
+ $metadata: deserializeMetadata(parsedOutput),
610
+ ...contents,
801
611
  });
802
- }); };
803
- var serializeAws_restJson1Tag = function (input, context) {
804
- return __assign(__assign({}, (input.Key != null && { Key: input.Key })), (input.Value != null && { Value: input.Value }));
612
+ return __decorateServiceException(exception, parsedOutput.body);
805
613
  };
806
- var serializeAws_restJson1Tags = function (input, context) {
614
+ const serializeAws_restJson1Tag = (input, context) => {
615
+ return {
616
+ ...(input.Key != null && { Key: input.Key }),
617
+ ...(input.Value != null && { Value: input.Value }),
618
+ };
619
+ };
620
+ const serializeAws_restJson1Tags = (input, context) => {
807
621
  return input
808
- .filter(function (e) { return e != null; })
809
- .map(function (entry) {
622
+ .filter((e) => e != null)
623
+ .map((entry) => {
810
624
  return serializeAws_restJson1Tag(entry, context);
811
625
  });
812
626
  };
813
- var deserializeAws_restJson1Block = function (output, context) {
627
+ const deserializeAws_restJson1Block = (output, context) => {
814
628
  return {
815
629
  BlockIndex: __expectInt32(output.BlockIndex),
816
630
  BlockToken: __expectString(output.BlockToken),
817
631
  };
818
632
  };
819
- var deserializeAws_restJson1Blocks = function (output, context) {
820
- var retVal = (output || [])
821
- .filter(function (e) { return e != null; })
822
- .map(function (entry) {
633
+ const deserializeAws_restJson1Blocks = (output, context) => {
634
+ const retVal = (output || [])
635
+ .filter((e) => e != null)
636
+ .map((entry) => {
823
637
  if (entry === null) {
824
638
  return null;
825
639
  }
@@ -827,17 +641,17 @@ var deserializeAws_restJson1Blocks = function (output, context) {
827
641
  });
828
642
  return retVal;
829
643
  };
830
- var deserializeAws_restJson1ChangedBlock = function (output, context) {
644
+ const deserializeAws_restJson1ChangedBlock = (output, context) => {
831
645
  return {
832
646
  BlockIndex: __expectInt32(output.BlockIndex),
833
647
  FirstBlockToken: __expectString(output.FirstBlockToken),
834
648
  SecondBlockToken: __expectString(output.SecondBlockToken),
835
649
  };
836
650
  };
837
- var deserializeAws_restJson1ChangedBlocks = function (output, context) {
838
- var retVal = (output || [])
839
- .filter(function (e) { return e != null; })
840
- .map(function (entry) {
651
+ const deserializeAws_restJson1ChangedBlocks = (output, context) => {
652
+ const retVal = (output || [])
653
+ .filter((e) => e != null)
654
+ .map((entry) => {
841
655
  if (entry === null) {
842
656
  return null;
843
657
  }
@@ -845,16 +659,16 @@ var deserializeAws_restJson1ChangedBlocks = function (output, context) {
845
659
  });
846
660
  return retVal;
847
661
  };
848
- var deserializeAws_restJson1Tag = function (output, context) {
662
+ const deserializeAws_restJson1Tag = (output, context) => {
849
663
  return {
850
664
  Key: __expectString(output.Key),
851
665
  Value: __expectString(output.Value),
852
666
  };
853
667
  };
854
- var deserializeAws_restJson1Tags = function (output, context) {
855
- var retVal = (output || [])
856
- .filter(function (e) { return e != null; })
857
- .map(function (entry) {
668
+ const deserializeAws_restJson1Tags = (output, context) => {
669
+ const retVal = (output || [])
670
+ .filter((e) => e != null)
671
+ .map((entry) => {
858
672
  if (entry === null) {
859
673
  return null;
860
674
  }
@@ -862,57 +676,39 @@ var deserializeAws_restJson1Tags = function (output, context) {
862
676
  });
863
677
  return retVal;
864
678
  };
865
- var deserializeMetadata = function (output) {
866
- var _a, _b;
867
- return ({
868
- httpStatusCode: output.statusCode,
869
- requestId: (_b = (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"]) !== null && _b !== void 0 ? _b : output.headers["x-amz-request-id"],
870
- extendedRequestId: output.headers["x-amz-id-2"],
871
- cfId: output.headers["x-amz-cf-id"],
872
- });
873
- };
874
- var collectBody = function (streamBody, context) {
875
- if (streamBody === void 0) { streamBody = new Uint8Array(); }
679
+ const deserializeMetadata = (output) => ({
680
+ httpStatusCode: output.statusCode,
681
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
682
+ extendedRequestId: output.headers["x-amz-id-2"],
683
+ cfId: output.headers["x-amz-cf-id"],
684
+ });
685
+ const collectBody = (streamBody = new Uint8Array(), context) => {
876
686
  if (streamBody instanceof Uint8Array) {
877
687
  return Promise.resolve(streamBody);
878
688
  }
879
689
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
880
690
  };
881
- var collectBodyString = function (streamBody, context) {
882
- return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });
883
- };
884
- var isSerializableHeaderValue = function (value) {
885
- return value !== undefined &&
886
- value !== null &&
887
- value !== "" &&
888
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
889
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
890
- };
891
- var parseBody = function (streamBody, context) {
892
- return collectBodyString(streamBody, context).then(function (encoded) {
893
- if (encoded.length) {
894
- return JSON.parse(encoded);
895
- }
896
- return {};
897
- });
691
+ const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
692
+ const isSerializableHeaderValue = (value) => value !== undefined &&
693
+ value !== null &&
694
+ value !== "" &&
695
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
696
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
697
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
698
+ if (encoded.length) {
699
+ return JSON.parse(encoded);
700
+ }
701
+ return {};
702
+ });
703
+ const parseErrorBody = async (errorBody, context) => {
704
+ const value = await parseBody(errorBody, context);
705
+ value.message = value.message ?? value.Message;
706
+ return value;
898
707
  };
899
- var parseErrorBody = function (errorBody, context) { return __awaiter(void 0, void 0, void 0, function () {
900
- var value;
901
- var _a;
902
- return __generator(this, function (_b) {
903
- switch (_b.label) {
904
- case 0: return [4, parseBody(errorBody, context)];
905
- case 1:
906
- value = _b.sent();
907
- value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message;
908
- return [2, value];
909
- }
910
- });
911
- }); };
912
- var loadRestJsonErrorCode = function (output, data) {
913
- var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
914
- var sanitizeErrorCode = function (rawValue) {
915
- var cleanValue = rawValue;
708
+ const loadRestJsonErrorCode = (output, data) => {
709
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
710
+ const sanitizeErrorCode = (rawValue) => {
711
+ let cleanValue = rawValue;
916
712
  if (typeof cleanValue === "number") {
917
713
  cleanValue = cleanValue.toString();
918
714
  }
@@ -927,7 +723,7 @@ var loadRestJsonErrorCode = function (output, data) {
927
723
  }
928
724
  return cleanValue;
929
725
  };
930
- var headerKey = findKey(output.headers, "x-amzn-errortype");
726
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
931
727
  if (headerKey !== undefined) {
932
728
  return sanitizeErrorCode(output.headers[headerKey]);
933
729
  }