@aws-sdk/client-ebs 3.183.0 → 3.185.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,638 +1,825 @@
1
+ import { __assign, __awaiter, __generator } from "tslib";
1
2
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
3
  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";
3
4
  import { v4 as generateIdempotencyToken } from "uuid";
4
5
  import { EBSServiceException as __BaseException } from "../models/EBSServiceException";
5
6
  import { AccessDeniedException, ConcurrentLimitExceededException, ConflictException, InternalServerException, RequestThrottledException, ResourceNotFoundException, ServiceQuotaExceededException, ValidationException, } from "../models/models_0";
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,
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
+ }
28
35
  });
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,
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
+ }
50
63
  });
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,
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
+ }
74
93
  });
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,
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
+ }
96
121
  });
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,
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
+ }
124
155
  });
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,
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
+ }
151
180
  });
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),
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
+ }
159
203
  });
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
- contents.BlockData = data;
216
- return contents;
217
- };
218
- const deserializeAws_restJson1GetSnapshotBlockCommandError = async (output, context) => {
219
- const parsedOutput = {
220
- ...output,
221
- body: await parseErrorBody(output.body, context),
222
- };
223
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
224
- switch (errorCode) {
225
- case "AccessDeniedException":
226
- case "com.amazonaws.ebs#AccessDeniedException":
227
- throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
228
- case "InternalServerException":
229
- case "com.amazonaws.ebs#InternalServerException":
230
- throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
231
- case "RequestThrottledException":
232
- case "com.amazonaws.ebs#RequestThrottledException":
233
- throw await deserializeAws_restJson1RequestThrottledExceptionResponse(parsedOutput, context);
234
- case "ResourceNotFoundException":
235
- case "com.amazonaws.ebs#ResourceNotFoundException":
236
- throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
237
- case "ServiceQuotaExceededException":
238
- case "com.amazonaws.ebs#ServiceQuotaExceededException":
239
- throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
240
- case "ValidationException":
241
- case "com.amazonaws.ebs#ValidationException":
242
- throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
243
- default:
244
- const parsedBody = parsedOutput.body;
245
- throwDefaultError({
246
- output,
247
- parsedBody,
248
- exceptionCtor: __BaseException,
249
- errorCode,
250
- });
251
- }
252
- };
253
- export const deserializeAws_restJson1ListChangedBlocksCommand = async (output, context) => {
254
- if (output.statusCode !== 200 && output.statusCode >= 300) {
255
- return deserializeAws_restJson1ListChangedBlocksCommandError(output, context);
256
- }
257
- const contents = map({
258
- $metadata: deserializeMetadata(output),
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
+ }
259
256
  });
260
- const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
261
- if (data.BlockSize != null) {
262
- contents.BlockSize = __expectInt32(data.BlockSize);
263
- }
264
- if (data.ChangedBlocks != null) {
265
- contents.ChangedBlocks = deserializeAws_restJson1ChangedBlocks(data.ChangedBlocks, context);
266
- }
267
- if (data.ExpiryTime != null) {
268
- contents.ExpiryTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.ExpiryTime)));
269
- }
270
- if (data.NextToken != null) {
271
- contents.NextToken = __expectString(data.NextToken);
272
- }
273
- if (data.VolumeSize != null) {
274
- contents.VolumeSize = __expectLong(data.VolumeSize);
275
- }
276
- return contents;
277
- };
278
- const deserializeAws_restJson1ListChangedBlocksCommandError = async (output, context) => {
279
- const parsedOutput = {
280
- ...output,
281
- body: await parseErrorBody(output.body, context),
282
- };
283
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
284
- switch (errorCode) {
285
- case "AccessDeniedException":
286
- case "com.amazonaws.ebs#AccessDeniedException":
287
- throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
288
- case "InternalServerException":
289
- case "com.amazonaws.ebs#InternalServerException":
290
- throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
291
- case "RequestThrottledException":
292
- case "com.amazonaws.ebs#RequestThrottledException":
293
- throw await deserializeAws_restJson1RequestThrottledExceptionResponse(parsedOutput, context);
294
- case "ResourceNotFoundException":
295
- case "com.amazonaws.ebs#ResourceNotFoundException":
296
- throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
297
- case "ServiceQuotaExceededException":
298
- case "com.amazonaws.ebs#ServiceQuotaExceededException":
299
- throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
300
- case "ValidationException":
301
- case "com.amazonaws.ebs#ValidationException":
302
- throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
303
- default:
304
- const parsedBody = parsedOutput.body;
305
- throwDefaultError({
306
- output,
307
- parsedBody,
308
- exceptionCtor: __BaseException,
309
- errorCode,
310
- });
311
- }
312
- };
313
- export const deserializeAws_restJson1ListSnapshotBlocksCommand = async (output, context) => {
314
- if (output.statusCode !== 200 && output.statusCode >= 300) {
315
- return deserializeAws_restJson1ListSnapshotBlocksCommandError(output, context);
316
- }
317
- const contents = map({
318
- $metadata: deserializeMetadata(output),
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];
319
276
  });
320
- const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
321
- if (data.BlockSize != null) {
322
- contents.BlockSize = __expectInt32(data.BlockSize);
323
- }
324
- if (data.Blocks != null) {
325
- contents.Blocks = deserializeAws_restJson1Blocks(data.Blocks, context);
326
- }
327
- if (data.ExpiryTime != null) {
328
- contents.ExpiryTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.ExpiryTime)));
329
- }
330
- if (data.NextToken != null) {
331
- contents.NextToken = __expectString(data.NextToken);
332
- }
333
- if (data.VolumeSize != null) {
334
- contents.VolumeSize = __expectLong(data.VolumeSize);
335
- }
336
- return contents;
337
- };
338
- const deserializeAws_restJson1ListSnapshotBlocksCommandError = async (output, context) => {
339
- const parsedOutput = {
340
- ...output,
341
- body: await parseErrorBody(output.body, context),
342
- };
343
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
344
- switch (errorCode) {
345
- case "AccessDeniedException":
346
- case "com.amazonaws.ebs#AccessDeniedException":
347
- throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
348
- case "InternalServerException":
349
- case "com.amazonaws.ebs#InternalServerException":
350
- throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
351
- case "RequestThrottledException":
352
- case "com.amazonaws.ebs#RequestThrottledException":
353
- throw await deserializeAws_restJson1RequestThrottledExceptionResponse(parsedOutput, context);
354
- case "ResourceNotFoundException":
355
- case "com.amazonaws.ebs#ResourceNotFoundException":
356
- throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
357
- case "ServiceQuotaExceededException":
358
- case "com.amazonaws.ebs#ServiceQuotaExceededException":
359
- throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
360
- case "ValidationException":
361
- case "com.amazonaws.ebs#ValidationException":
362
- throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
363
- default:
364
- const parsedBody = parsedOutput.body;
365
- throwDefaultError({
366
- output,
367
- parsedBody,
368
- exceptionCtor: __BaseException,
369
- errorCode,
370
- });
371
- }
372
- };
373
- export const deserializeAws_restJson1PutSnapshotBlockCommand = async (output, context) => {
374
- if (output.statusCode !== 201 && output.statusCode >= 300) {
375
- return deserializeAws_restJson1PutSnapshotBlockCommandError(output, context);
376
- }
377
- const contents = map({
378
- $metadata: deserializeMetadata(output),
379
- Checksum: [, output.headers["x-amz-checksum"]],
380
- ChecksumAlgorithm: [, output.headers["x-amz-checksum-algorithm"]],
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
+ }
381
329
  });
382
- await collectBody(output.body, context);
383
- return contents;
384
- };
385
- const deserializeAws_restJson1PutSnapshotBlockCommandError = async (output, context) => {
386
- const parsedOutput = {
387
- ...output,
388
- body: await parseErrorBody(output.body, context),
389
- };
390
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
391
- switch (errorCode) {
392
- case "AccessDeniedException":
393
- case "com.amazonaws.ebs#AccessDeniedException":
394
- throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
395
- case "InternalServerException":
396
- case "com.amazonaws.ebs#InternalServerException":
397
- throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
398
- case "RequestThrottledException":
399
- case "com.amazonaws.ebs#RequestThrottledException":
400
- throw await deserializeAws_restJson1RequestThrottledExceptionResponse(parsedOutput, context);
401
- case "ResourceNotFoundException":
402
- case "com.amazonaws.ebs#ResourceNotFoundException":
403
- throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
404
- case "ServiceQuotaExceededException":
405
- case "com.amazonaws.ebs#ServiceQuotaExceededException":
406
- throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
407
- case "ValidationException":
408
- case "com.amazonaws.ebs#ValidationException":
409
- throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
410
- default:
411
- const parsedBody = parsedOutput.body;
412
- throwDefaultError({
413
- output,
414
- parsedBody,
415
- exceptionCtor: __BaseException,
416
- errorCode,
417
- });
418
- }
419
- };
420
- export const deserializeAws_restJson1StartSnapshotCommand = async (output, context) => {
421
- if (output.statusCode !== 201 && output.statusCode >= 300) {
422
- return deserializeAws_restJson1StartSnapshotCommandError(output, context);
423
- }
424
- const contents = map({
425
- $metadata: deserializeMetadata(output),
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
+ }
426
364
  });
427
- const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
428
- if (data.BlockSize != null) {
429
- contents.BlockSize = __expectInt32(data.BlockSize);
430
- }
431
- if (data.Description != null) {
432
- contents.Description = __expectString(data.Description);
433
- }
434
- if (data.KmsKeyArn != null) {
435
- contents.KmsKeyArn = __expectString(data.KmsKeyArn);
436
- }
437
- if (data.OwnerId != null) {
438
- contents.OwnerId = __expectString(data.OwnerId);
439
- }
440
- if (data.ParentSnapshotId != null) {
441
- contents.ParentSnapshotId = __expectString(data.ParentSnapshotId);
442
- }
443
- if (data.SnapshotId != null) {
444
- contents.SnapshotId = __expectString(data.SnapshotId);
445
- }
446
- if (data.StartTime != null) {
447
- contents.StartTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.StartTime)));
448
- }
449
- if (data.Status != null) {
450
- contents.Status = __expectString(data.Status);
451
- }
452
- if (data.Tags != null) {
453
- contents.Tags = deserializeAws_restJson1Tags(data.Tags, context);
454
- }
455
- if (data.VolumeSize != null) {
456
- contents.VolumeSize = __expectLong(data.VolumeSize);
457
- }
458
- return contents;
459
- };
460
- const deserializeAws_restJson1StartSnapshotCommandError = async (output, context) => {
461
- const parsedOutput = {
462
- ...output,
463
- body: await parseErrorBody(output.body, context),
464
- };
465
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
466
- switch (errorCode) {
467
- case "AccessDeniedException":
468
- case "com.amazonaws.ebs#AccessDeniedException":
469
- throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
470
- case "ConcurrentLimitExceededException":
471
- case "com.amazonaws.ebs#ConcurrentLimitExceededException":
472
- throw await deserializeAws_restJson1ConcurrentLimitExceededExceptionResponse(parsedOutput, context);
473
- case "ConflictException":
474
- case "com.amazonaws.ebs#ConflictException":
475
- throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
476
- case "InternalServerException":
477
- case "com.amazonaws.ebs#InternalServerException":
478
- throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
479
- case "RequestThrottledException":
480
- case "com.amazonaws.ebs#RequestThrottledException":
481
- throw await deserializeAws_restJson1RequestThrottledExceptionResponse(parsedOutput, context);
482
- case "ResourceNotFoundException":
483
- case "com.amazonaws.ebs#ResourceNotFoundException":
484
- throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
485
- case "ServiceQuotaExceededException":
486
- case "com.amazonaws.ebs#ServiceQuotaExceededException":
487
- throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
488
- case "ValidationException":
489
- case "com.amazonaws.ebs#ValidationException":
490
- throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
491
- default:
492
- const parsedBody = parsedOutput.body;
493
- throwDefaultError({
494
- output,
495
- parsedBody,
496
- exceptionCtor: __BaseException,
497
- errorCode,
498
- });
499
- }
500
- };
501
- const map = __map;
502
- const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
503
- const contents = map({});
504
- const data = parsedOutput.body;
505
- if (data.Message != null) {
506
- contents.Message = __expectString(data.Message);
507
- }
508
- if (data.Reason != null) {
509
- contents.Reason = __expectString(data.Reason);
510
- }
511
- const exception = new AccessDeniedException({
512
- $metadata: deserializeMetadata(parsedOutput),
513
- ...contents,
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
+ }
514
417
  });
515
- return __decorateServiceException(exception, parsedOutput.body);
516
- };
517
- const deserializeAws_restJson1ConcurrentLimitExceededExceptionResponse = async (parsedOutput, context) => {
518
- const contents = map({});
519
- const data = parsedOutput.body;
520
- if (data.Message != null) {
521
- contents.Message = __expectString(data.Message);
522
- }
523
- const exception = new ConcurrentLimitExceededException({
524
- $metadata: deserializeMetadata(parsedOutput),
525
- ...contents,
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
+ }
526
452
  });
527
- return __decorateServiceException(exception, parsedOutput.body);
528
- };
529
- const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
530
- const contents = map({});
531
- const data = parsedOutput.body;
532
- if (data.Message != null) {
533
- contents.Message = __expectString(data.Message);
534
- }
535
- const exception = new ConflictException({
536
- $metadata: deserializeMetadata(parsedOutput),
537
- ...contents,
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
+ }
538
505
  });
539
- return __decorateServiceException(exception, parsedOutput.body);
540
- };
541
- const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
542
- const contents = map({});
543
- const data = parsedOutput.body;
544
- if (data.Message != null) {
545
- contents.Message = __expectString(data.Message);
546
- }
547
- const exception = new InternalServerException({
548
- $metadata: deserializeMetadata(parsedOutput),
549
- ...contents,
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
+ }
550
525
  });
551
- return __decorateServiceException(exception, parsedOutput.body);
552
- };
553
- const deserializeAws_restJson1RequestThrottledExceptionResponse = async (parsedOutput, context) => {
554
- const contents = map({});
555
- const data = parsedOutput.body;
556
- if (data.Message != null) {
557
- contents.Message = __expectString(data.Message);
558
- }
559
- if (data.Reason != null) {
560
- contents.Reason = __expectString(data.Reason);
561
- }
562
- const exception = new RequestThrottledException({
563
- $metadata: deserializeMetadata(parsedOutput),
564
- ...contents,
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
+ }
565
578
  });
566
- return __decorateServiceException(exception, parsedOutput.body);
567
- };
568
- const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
569
- const contents = map({});
570
- const data = parsedOutput.body;
571
- if (data.Message != null) {
572
- contents.Message = __expectString(data.Message);
573
- }
574
- if (data.Reason != null) {
575
- contents.Reason = __expectString(data.Reason);
576
- }
577
- const exception = new ResourceNotFoundException({
578
- $metadata: deserializeMetadata(parsedOutput),
579
- ...contents,
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
+ }
580
628
  });
581
- return __decorateServiceException(exception, parsedOutput.body);
582
- };
583
- const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
584
- const contents = map({});
585
- const data = parsedOutput.body;
586
- if (data.Message != null) {
587
- contents.Message = __expectString(data.Message);
588
- }
589
- if (data.Reason != null) {
590
- contents.Reason = __expectString(data.Reason);
591
- }
592
- const exception = new ServiceQuotaExceededException({
593
- $metadata: deserializeMetadata(parsedOutput),
594
- ...contents,
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
+ }
595
689
  });
596
- return __decorateServiceException(exception, parsedOutput.body);
597
- };
598
- const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
599
- const contents = map({});
600
- const data = parsedOutput.body;
601
- if (data.Message != null) {
602
- contents.Message = __expectString(data.Message);
603
- }
604
- if (data.Reason != null) {
605
- contents.Reason = __expectString(data.Reason);
606
- }
607
- const exception = new ValidationException({
608
- $metadata: deserializeMetadata(parsedOutput),
609
- ...contents,
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)];
610
705
  });
611
- return __decorateServiceException(exception, parsedOutput.body);
612
- };
613
- const serializeAws_restJson1Tag = (input, context) => {
614
- return {
615
- ...(input.Key != null && { Key: input.Key }),
616
- ...(input.Value != null && { Value: input.Value }),
617
- };
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)];
717
+ });
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)];
729
+ });
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)];
741
+ });
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)];
756
+ });
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)];
771
+ });
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)];
786
+ });
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)];
801
+ });
802
+ }); };
803
+ var serializeAws_restJson1Tag = function (input, context) {
804
+ return __assign(__assign({}, (input.Key != null && { Key: input.Key })), (input.Value != null && { Value: input.Value }));
618
805
  };
619
- const serializeAws_restJson1Tags = (input, context) => {
806
+ var serializeAws_restJson1Tags = function (input, context) {
620
807
  return input
621
- .filter((e) => e != null)
622
- .map((entry) => {
808
+ .filter(function (e) { return e != null; })
809
+ .map(function (entry) {
623
810
  return serializeAws_restJson1Tag(entry, context);
624
811
  });
625
812
  };
626
- const deserializeAws_restJson1Block = (output, context) => {
813
+ var deserializeAws_restJson1Block = function (output, context) {
627
814
  return {
628
815
  BlockIndex: __expectInt32(output.BlockIndex),
629
816
  BlockToken: __expectString(output.BlockToken),
630
817
  };
631
818
  };
632
- const deserializeAws_restJson1Blocks = (output, context) => {
633
- const retVal = (output || [])
634
- .filter((e) => e != null)
635
- .map((entry) => {
819
+ var deserializeAws_restJson1Blocks = function (output, context) {
820
+ var retVal = (output || [])
821
+ .filter(function (e) { return e != null; })
822
+ .map(function (entry) {
636
823
  if (entry === null) {
637
824
  return null;
638
825
  }
@@ -640,17 +827,17 @@ const deserializeAws_restJson1Blocks = (output, context) => {
640
827
  });
641
828
  return retVal;
642
829
  };
643
- const deserializeAws_restJson1ChangedBlock = (output, context) => {
830
+ var deserializeAws_restJson1ChangedBlock = function (output, context) {
644
831
  return {
645
832
  BlockIndex: __expectInt32(output.BlockIndex),
646
833
  FirstBlockToken: __expectString(output.FirstBlockToken),
647
834
  SecondBlockToken: __expectString(output.SecondBlockToken),
648
835
  };
649
836
  };
650
- const deserializeAws_restJson1ChangedBlocks = (output, context) => {
651
- const retVal = (output || [])
652
- .filter((e) => e != null)
653
- .map((entry) => {
837
+ var deserializeAws_restJson1ChangedBlocks = function (output, context) {
838
+ var retVal = (output || [])
839
+ .filter(function (e) { return e != null; })
840
+ .map(function (entry) {
654
841
  if (entry === null) {
655
842
  return null;
656
843
  }
@@ -658,16 +845,16 @@ const deserializeAws_restJson1ChangedBlocks = (output, context) => {
658
845
  });
659
846
  return retVal;
660
847
  };
661
- const deserializeAws_restJson1Tag = (output, context) => {
848
+ var deserializeAws_restJson1Tag = function (output, context) {
662
849
  return {
663
850
  Key: __expectString(output.Key),
664
851
  Value: __expectString(output.Value),
665
852
  };
666
853
  };
667
- const deserializeAws_restJson1Tags = (output, context) => {
668
- const retVal = (output || [])
669
- .filter((e) => e != null)
670
- .map((entry) => {
854
+ var deserializeAws_restJson1Tags = function (output, context) {
855
+ var retVal = (output || [])
856
+ .filter(function (e) { return e != null; })
857
+ .map(function (entry) {
671
858
  if (entry === null) {
672
859
  return null;
673
860
  }
@@ -675,39 +862,57 @@ const deserializeAws_restJson1Tags = (output, context) => {
675
862
  });
676
863
  return retVal;
677
864
  };
678
- const deserializeMetadata = (output) => ({
679
- httpStatusCode: output.statusCode,
680
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
681
- extendedRequestId: output.headers["x-amz-id-2"],
682
- cfId: output.headers["x-amz-cf-id"],
683
- });
684
- const collectBody = (streamBody = new Uint8Array(), context) => {
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(); }
685
876
  if (streamBody instanceof Uint8Array) {
686
877
  return Promise.resolve(streamBody);
687
878
  }
688
879
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
689
880
  };
690
- const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
691
- const isSerializableHeaderValue = (value) => value !== undefined &&
692
- value !== null &&
693
- value !== "" &&
694
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
695
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
696
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
697
- if (encoded.length) {
698
- return JSON.parse(encoded);
699
- }
700
- return {};
701
- });
702
- const parseErrorBody = async (errorBody, context) => {
703
- const value = await parseBody(errorBody, context);
704
- value.message = value.message ?? value.Message;
705
- return value;
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
+ });
706
898
  };
707
- const loadRestJsonErrorCode = (output, data) => {
708
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
709
- const sanitizeErrorCode = (rawValue) => {
710
- let cleanValue = rawValue;
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;
711
916
  if (typeof cleanValue === "number") {
712
917
  cleanValue = cleanValue.toString();
713
918
  }
@@ -722,7 +927,7 @@ const loadRestJsonErrorCode = (output, data) => {
722
927
  }
723
928
  return cleanValue;
724
929
  };
725
- const headerKey = findKey(output.headers, "x-amzn-errortype");
930
+ var headerKey = findKey(output.headers, "x-amzn-errortype");
726
931
  if (headerKey !== undefined) {
727
932
  return sanitizeErrorCode(output.headers[headerKey]);
728
933
  }