@aws-sdk/client-ebs 3.137.0 → 3.145.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,32 +1,27 @@
1
1
  import { __assign, __awaiter, __generator } from "tslib";
2
2
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
3
- import { decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectLong as __expectLong, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, extendedEncodeURIComponent as __extendedEncodeURIComponent, parseEpochTimestamp as __parseEpochTimestamp, strictParseInt32 as __strictParseInt32, } from "@aws-sdk/smithy-client";
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";
4
4
  import { v4 as generateIdempotencyToken } from "uuid";
5
5
  import { EBSServiceException as __BaseException } from "../models/EBSServiceException";
6
6
  import { AccessDeniedException, ConcurrentLimitExceededException, ConflictException, InternalServerException, RequestThrottledException, ResourceNotFoundException, ServiceQuotaExceededException, ValidationException, } from "../models/models_0";
7
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, labelValue, body;
8
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
9
9
  return __generator(this, function (_c) {
10
10
  switch (_c.label) {
11
11
  case 0: return [4, context.endpoint()];
12
12
  case 1:
13
13
  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
14
- headers = __assign(__assign(__assign(__assign({}, (isSerializableHeaderValue(input.ChangedBlocksCount) && {
15
- "x-amz-changedblockscount": input.ChangedBlocksCount.toString(),
16
- })), (isSerializableHeaderValue(input.Checksum) && { "x-amz-checksum": input.Checksum })), (isSerializableHeaderValue(input.ChecksumAlgorithm) && { "x-amz-checksum-algorithm": input.ChecksumAlgorithm })), (isSerializableHeaderValue(input.ChecksumAggregationMethod) && {
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,
17
21
  "x-amz-checksum-aggregation-method": input.ChecksumAggregationMethod,
18
- }));
22
+ });
19
23
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/snapshots/completion/{SnapshotId}";
20
- if (input.SnapshotId !== undefined) {
21
- labelValue = input.SnapshotId;
22
- if (labelValue.length <= 0) {
23
- throw new Error("Empty value provided for input HTTP label: SnapshotId.");
24
- }
25
- resolvedPath = resolvedPath.replace("{SnapshotId}", __extendedEncodeURIComponent(labelValue));
26
- }
27
- else {
28
- throw new Error("No value provided for input HTTP label: SnapshotId.");
29
- }
24
+ resolvedPath = __resolvedPath(resolvedPath, input, "SnapshotId", function () { return input.SnapshotId; }, "{SnapshotId}", false);
30
25
  return [2, new __HttpRequest({
31
26
  protocol: protocol,
32
27
  hostname: hostname,
@@ -40,7 +35,7 @@ export var serializeAws_restJson1CompleteSnapshotCommand = function (input, cont
40
35
  });
41
36
  }); };
42
37
  export var serializeAws_restJson1GetSnapshotBlockCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
43
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, labelValue, query, body;
38
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
44
39
  return __generator(this, function (_c) {
45
40
  switch (_c.label) {
46
41
  case 0: return [4, context.endpoint()];
@@ -49,27 +44,11 @@ export var serializeAws_restJson1GetSnapshotBlockCommand = function (input, cont
49
44
  headers = {};
50
45
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
51
46
  "/snapshots/{SnapshotId}/blocks/{BlockIndex}";
52
- if (input.SnapshotId !== undefined) {
53
- labelValue = input.SnapshotId;
54
- if (labelValue.length <= 0) {
55
- throw new Error("Empty value provided for input HTTP label: SnapshotId.");
56
- }
57
- resolvedPath = resolvedPath.replace("{SnapshotId}", __extendedEncodeURIComponent(labelValue));
58
- }
59
- else {
60
- throw new Error("No value provided for input HTTP label: SnapshotId.");
61
- }
62
- if (input.BlockIndex !== undefined) {
63
- labelValue = input.BlockIndex.toString();
64
- if (labelValue.length <= 0) {
65
- throw new Error("Empty value provided for input HTTP label: BlockIndex.");
66
- }
67
- resolvedPath = resolvedPath.replace("{BlockIndex}", __extendedEncodeURIComponent(labelValue));
68
- }
69
- else {
70
- throw new Error("No value provided for input HTTP label: BlockIndex.");
71
- }
72
- query = __assign({}, (input.BlockToken !== undefined && { blockToken: input.BlockToken }));
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
+ });
73
52
  return [2, new __HttpRequest({
74
53
  protocol: protocol,
75
54
  hostname: hostname,
@@ -84,7 +63,7 @@ export var serializeAws_restJson1GetSnapshotBlockCommand = function (input, cont
84
63
  });
85
64
  }); };
86
65
  export var serializeAws_restJson1ListChangedBlocksCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
87
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, query, body;
66
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
88
67
  return __generator(this, function (_c) {
89
68
  switch (_c.label) {
90
69
  case 0: return [4, context.endpoint()];
@@ -93,17 +72,13 @@ export var serializeAws_restJson1ListChangedBlocksCommand = function (input, con
93
72
  headers = {};
94
73
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
95
74
  "/snapshots/{SecondSnapshotId}/changedblocks";
96
- if (input.SecondSnapshotId !== undefined) {
97
- labelValue = input.SecondSnapshotId;
98
- if (labelValue.length <= 0) {
99
- throw new Error("Empty value provided for input HTTP label: SecondSnapshotId.");
100
- }
101
- resolvedPath = resolvedPath.replace("{SecondSnapshotId}", __extendedEncodeURIComponent(labelValue));
102
- }
103
- else {
104
- throw new Error("No value provided for input HTTP label: SecondSnapshotId.");
105
- }
106
- query = __assign(__assign(__assign(__assign({}, (input.FirstSnapshotId !== undefined && { firstSnapshotId: input.FirstSnapshotId })), (input.NextToken !== undefined && { pageToken: input.NextToken })), (input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() })), (input.StartingBlockIndex !== undefined && { startingBlockIndex: input.StartingBlockIndex.toString() }));
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
+ });
107
82
  return [2, new __HttpRequest({
108
83
  protocol: protocol,
109
84
  hostname: hostname,
@@ -118,7 +93,7 @@ export var serializeAws_restJson1ListChangedBlocksCommand = function (input, con
118
93
  });
119
94
  }); };
120
95
  export var serializeAws_restJson1ListSnapshotBlocksCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
121
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, query, body;
96
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
122
97
  return __generator(this, function (_c) {
123
98
  switch (_c.label) {
124
99
  case 0: return [4, context.endpoint()];
@@ -126,17 +101,12 @@ export var serializeAws_restJson1ListSnapshotBlocksCommand = function (input, co
126
101
  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
127
102
  headers = {};
128
103
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/snapshots/{SnapshotId}/blocks";
129
- if (input.SnapshotId !== undefined) {
130
- labelValue = input.SnapshotId;
131
- if (labelValue.length <= 0) {
132
- throw new Error("Empty value provided for input HTTP label: SnapshotId.");
133
- }
134
- resolvedPath = resolvedPath.replace("{SnapshotId}", __extendedEncodeURIComponent(labelValue));
135
- }
136
- else {
137
- throw new Error("No value provided for input HTTP label: SnapshotId.");
138
- }
139
- query = __assign(__assign(__assign({}, (input.NextToken !== undefined && { pageToken: input.NextToken })), (input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() })), (input.StartingBlockIndex !== undefined && { startingBlockIndex: input.StartingBlockIndex.toString() }));
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
+ });
140
110
  return [2, new __HttpRequest({
141
111
  protocol: protocol,
142
112
  hostname: hostname,
@@ -151,35 +121,24 @@ export var serializeAws_restJson1ListSnapshotBlocksCommand = function (input, co
151
121
  });
152
122
  }); };
153
123
  export var serializeAws_restJson1PutSnapshotBlockCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
154
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, labelValue, body;
124
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
155
125
  return __generator(this, function (_c) {
156
126
  switch (_c.label) {
157
127
  case 0: return [4, context.endpoint()];
158
128
  case 1:
159
129
  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
160
- headers = __assign(__assign(__assign(__assign({ "content-type": "application/octet-stream", "x-amz-content-sha256": "UNSIGNED-PAYLOAD" }, (isSerializableHeaderValue(input.DataLength) && { "x-amz-data-length": input.DataLength.toString() })), (isSerializableHeaderValue(input.Progress) && { "x-amz-progress": input.Progress.toString() })), (isSerializableHeaderValue(input.Checksum) && { "x-amz-checksum": input.Checksum })), (isSerializableHeaderValue(input.ChecksumAlgorithm) && { "x-amz-checksum-algorithm": input.ChecksumAlgorithm }));
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
+ });
161
138
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
162
139
  "/snapshots/{SnapshotId}/blocks/{BlockIndex}";
163
- if (input.SnapshotId !== undefined) {
164
- labelValue = input.SnapshotId;
165
- if (labelValue.length <= 0) {
166
- throw new Error("Empty value provided for input HTTP label: SnapshotId.");
167
- }
168
- resolvedPath = resolvedPath.replace("{SnapshotId}", __extendedEncodeURIComponent(labelValue));
169
- }
170
- else {
171
- throw new Error("No value provided for input HTTP label: SnapshotId.");
172
- }
173
- if (input.BlockIndex !== undefined) {
174
- labelValue = input.BlockIndex.toString();
175
- if (labelValue.length <= 0) {
176
- throw new Error("Empty value provided for input HTTP label: BlockIndex.");
177
- }
178
- resolvedPath = resolvedPath.replace("{BlockIndex}", __extendedEncodeURIComponent(labelValue));
179
- }
180
- else {
181
- throw new Error("No value provided for input HTTP label: BlockIndex.");
182
- }
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);
183
142
  if (input.BlockData !== undefined) {
184
143
  body = input.BlockData;
185
144
  }
@@ -228,24 +187,23 @@ export var deserializeAws_restJson1CompleteSnapshotCommand = function (output, c
228
187
  if (output.statusCode !== 202 && output.statusCode >= 300) {
229
188
  return [2, deserializeAws_restJson1CompleteSnapshotCommandError(output, context)];
230
189
  }
231
- contents = {
190
+ contents = map({
232
191
  $metadata: deserializeMetadata(output),
233
- Status: undefined,
234
- };
192
+ });
235
193
  _a = __expectNonNull;
236
194
  _b = __expectObject;
237
195
  return [4, parseBody(output.body, context)];
238
196
  case 1:
239
197
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
240
- if (data.Status !== undefined && data.Status !== null) {
198
+ if (data.Status != null) {
241
199
  contents.Status = __expectString(data.Status);
242
200
  }
243
- return [2, Promise.resolve(contents)];
201
+ return [2, contents];
244
202
  }
245
203
  });
246
204
  }); };
247
205
  var deserializeAws_restJson1CompleteSnapshotCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
248
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
206
+ var parsedOutput, _a, errorCode, _b, parsedBody;
249
207
  var _c;
250
208
  return __generator(this, function (_d) {
251
209
  switch (_d.label) {
@@ -286,14 +244,14 @@ var deserializeAws_restJson1CompleteSnapshotCommandError = function (output, con
286
244
  case 13: throw _d.sent();
287
245
  case 14:
288
246
  parsedBody = parsedOutput.body;
289
- $metadata = deserializeMetadata(output);
290
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
291
- response = new __BaseException({
292
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
293
- $fault: "client",
294
- $metadata: $metadata,
247
+ throwDefaultError({
248
+ output: output,
249
+ parsedBody: parsedBody,
250
+ exceptionCtor: __BaseException,
251
+ errorCode: errorCode,
295
252
  });
296
- throw __decorateServiceException(response, parsedBody);
253
+ _d.label = 15;
254
+ case 15: return [2];
297
255
  }
298
256
  });
299
257
  }); };
@@ -303,29 +261,22 @@ export var deserializeAws_restJson1GetSnapshotBlockCommand = function (output, c
303
261
  if (output.statusCode !== 200 && output.statusCode >= 300) {
304
262
  return [2, deserializeAws_restJson1GetSnapshotBlockCommandError(output, context)];
305
263
  }
306
- contents = {
264
+ contents = map({
307
265
  $metadata: deserializeMetadata(output),
308
- BlockData: undefined,
309
- Checksum: undefined,
310
- ChecksumAlgorithm: undefined,
311
- DataLength: undefined,
312
- };
313
- if (output.headers["x-amz-data-length"] !== undefined) {
314
- contents.DataLength = __strictParseInt32(output.headers["x-amz-data-length"]);
315
- }
316
- if (output.headers["x-amz-checksum"] !== undefined) {
317
- contents.Checksum = output.headers["x-amz-checksum"];
318
- }
319
- if (output.headers["x-amz-checksum-algorithm"] !== undefined) {
320
- contents.ChecksumAlgorithm = output.headers["x-amz-checksum-algorithm"];
321
- }
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
+ });
322
273
  data = output.body;
323
274
  contents.BlockData = data;
324
- return [2, Promise.resolve(contents)];
275
+ return [2, contents];
325
276
  });
326
277
  }); };
327
278
  var deserializeAws_restJson1GetSnapshotBlockCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
328
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
279
+ var parsedOutput, _a, errorCode, _b, parsedBody;
329
280
  var _c;
330
281
  return __generator(this, function (_d) {
331
282
  switch (_d.label) {
@@ -366,14 +317,14 @@ var deserializeAws_restJson1GetSnapshotBlockCommandError = function (output, con
366
317
  case 13: throw _d.sent();
367
318
  case 14:
368
319
  parsedBody = parsedOutput.body;
369
- $metadata = deserializeMetadata(output);
370
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
371
- response = new __BaseException({
372
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
373
- $fault: "client",
374
- $metadata: $metadata,
320
+ throwDefaultError({
321
+ output: output,
322
+ parsedBody: parsedBody,
323
+ exceptionCtor: __BaseException,
324
+ errorCode: errorCode,
375
325
  });
376
- throw __decorateServiceException(response, parsedBody);
326
+ _d.label = 15;
327
+ case 15: return [2];
377
328
  }
378
329
  });
379
330
  }); };
@@ -385,40 +336,35 @@ export var deserializeAws_restJson1ListChangedBlocksCommand = function (output,
385
336
  if (output.statusCode !== 200 && output.statusCode >= 300) {
386
337
  return [2, deserializeAws_restJson1ListChangedBlocksCommandError(output, context)];
387
338
  }
388
- contents = {
339
+ contents = map({
389
340
  $metadata: deserializeMetadata(output),
390
- BlockSize: undefined,
391
- ChangedBlocks: undefined,
392
- ExpiryTime: undefined,
393
- NextToken: undefined,
394
- VolumeSize: undefined,
395
- };
341
+ });
396
342
  _a = __expectNonNull;
397
343
  _b = __expectObject;
398
344
  return [4, parseBody(output.body, context)];
399
345
  case 1:
400
346
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
401
- if (data.BlockSize !== undefined && data.BlockSize !== null) {
347
+ if (data.BlockSize != null) {
402
348
  contents.BlockSize = __expectInt32(data.BlockSize);
403
349
  }
404
- if (data.ChangedBlocks !== undefined && data.ChangedBlocks !== null) {
350
+ if (data.ChangedBlocks != null) {
405
351
  contents.ChangedBlocks = deserializeAws_restJson1ChangedBlocks(data.ChangedBlocks, context);
406
352
  }
407
- if (data.ExpiryTime !== undefined && data.ExpiryTime !== null) {
353
+ if (data.ExpiryTime != null) {
408
354
  contents.ExpiryTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.ExpiryTime)));
409
355
  }
410
- if (data.NextToken !== undefined && data.NextToken !== null) {
356
+ if (data.NextToken != null) {
411
357
  contents.NextToken = __expectString(data.NextToken);
412
358
  }
413
- if (data.VolumeSize !== undefined && data.VolumeSize !== null) {
359
+ if (data.VolumeSize != null) {
414
360
  contents.VolumeSize = __expectLong(data.VolumeSize);
415
361
  }
416
- return [2, Promise.resolve(contents)];
362
+ return [2, contents];
417
363
  }
418
364
  });
419
365
  }); };
420
366
  var deserializeAws_restJson1ListChangedBlocksCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
421
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
367
+ var parsedOutput, _a, errorCode, _b, parsedBody;
422
368
  var _c;
423
369
  return __generator(this, function (_d) {
424
370
  switch (_d.label) {
@@ -459,14 +405,14 @@ var deserializeAws_restJson1ListChangedBlocksCommandError = function (output, co
459
405
  case 13: throw _d.sent();
460
406
  case 14:
461
407
  parsedBody = parsedOutput.body;
462
- $metadata = deserializeMetadata(output);
463
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
464
- response = new __BaseException({
465
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
466
- $fault: "client",
467
- $metadata: $metadata,
408
+ throwDefaultError({
409
+ output: output,
410
+ parsedBody: parsedBody,
411
+ exceptionCtor: __BaseException,
412
+ errorCode: errorCode,
468
413
  });
469
- throw __decorateServiceException(response, parsedBody);
414
+ _d.label = 15;
415
+ case 15: return [2];
470
416
  }
471
417
  });
472
418
  }); };
@@ -478,40 +424,35 @@ export var deserializeAws_restJson1ListSnapshotBlocksCommand = function (output,
478
424
  if (output.statusCode !== 200 && output.statusCode >= 300) {
479
425
  return [2, deserializeAws_restJson1ListSnapshotBlocksCommandError(output, context)];
480
426
  }
481
- contents = {
427
+ contents = map({
482
428
  $metadata: deserializeMetadata(output),
483
- BlockSize: undefined,
484
- Blocks: undefined,
485
- ExpiryTime: undefined,
486
- NextToken: undefined,
487
- VolumeSize: undefined,
488
- };
429
+ });
489
430
  _a = __expectNonNull;
490
431
  _b = __expectObject;
491
432
  return [4, parseBody(output.body, context)];
492
433
  case 1:
493
434
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
494
- if (data.BlockSize !== undefined && data.BlockSize !== null) {
435
+ if (data.BlockSize != null) {
495
436
  contents.BlockSize = __expectInt32(data.BlockSize);
496
437
  }
497
- if (data.Blocks !== undefined && data.Blocks !== null) {
438
+ if (data.Blocks != null) {
498
439
  contents.Blocks = deserializeAws_restJson1Blocks(data.Blocks, context);
499
440
  }
500
- if (data.ExpiryTime !== undefined && data.ExpiryTime !== null) {
441
+ if (data.ExpiryTime != null) {
501
442
  contents.ExpiryTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.ExpiryTime)));
502
443
  }
503
- if (data.NextToken !== undefined && data.NextToken !== null) {
444
+ if (data.NextToken != null) {
504
445
  contents.NextToken = __expectString(data.NextToken);
505
446
  }
506
- if (data.VolumeSize !== undefined && data.VolumeSize !== null) {
447
+ if (data.VolumeSize != null) {
507
448
  contents.VolumeSize = __expectLong(data.VolumeSize);
508
449
  }
509
- return [2, Promise.resolve(contents)];
450
+ return [2, contents];
510
451
  }
511
452
  });
512
453
  }); };
513
454
  var deserializeAws_restJson1ListSnapshotBlocksCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
514
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
455
+ var parsedOutput, _a, errorCode, _b, parsedBody;
515
456
  var _c;
516
457
  return __generator(this, function (_d) {
517
458
  switch (_d.label) {
@@ -552,14 +493,14 @@ var deserializeAws_restJson1ListSnapshotBlocksCommandError = function (output, c
552
493
  case 13: throw _d.sent();
553
494
  case 14:
554
495
  parsedBody = parsedOutput.body;
555
- $metadata = deserializeMetadata(output);
556
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
557
- response = new __BaseException({
558
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
559
- $fault: "client",
560
- $metadata: $metadata,
496
+ throwDefaultError({
497
+ output: output,
498
+ parsedBody: parsedBody,
499
+ exceptionCtor: __BaseException,
500
+ errorCode: errorCode,
561
501
  });
562
- throw __decorateServiceException(response, parsedBody);
502
+ _d.label = 15;
503
+ case 15: return [2];
563
504
  }
564
505
  });
565
506
  }); };
@@ -571,26 +512,20 @@ export var deserializeAws_restJson1PutSnapshotBlockCommand = function (output, c
571
512
  if (output.statusCode !== 201 && output.statusCode >= 300) {
572
513
  return [2, deserializeAws_restJson1PutSnapshotBlockCommandError(output, context)];
573
514
  }
574
- contents = {
515
+ contents = map({
575
516
  $metadata: deserializeMetadata(output),
576
- Checksum: undefined,
577
- ChecksumAlgorithm: undefined,
578
- };
579
- if (output.headers["x-amz-checksum"] !== undefined) {
580
- contents.Checksum = output.headers["x-amz-checksum"];
581
- }
582
- if (output.headers["x-amz-checksum-algorithm"] !== undefined) {
583
- contents.ChecksumAlgorithm = output.headers["x-amz-checksum-algorithm"];
584
- }
517
+ Checksum: [, output.headers["x-amz-checksum"]],
518
+ ChecksumAlgorithm: [, output.headers["x-amz-checksum-algorithm"]],
519
+ });
585
520
  return [4, collectBody(output.body, context)];
586
521
  case 1:
587
522
  _a.sent();
588
- return [2, Promise.resolve(contents)];
523
+ return [2, contents];
589
524
  }
590
525
  });
591
526
  }); };
592
527
  var deserializeAws_restJson1PutSnapshotBlockCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
593
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
528
+ var parsedOutput, _a, errorCode, _b, parsedBody;
594
529
  var _c;
595
530
  return __generator(this, function (_d) {
596
531
  switch (_d.label) {
@@ -631,14 +566,14 @@ var deserializeAws_restJson1PutSnapshotBlockCommandError = function (output, con
631
566
  case 13: throw _d.sent();
632
567
  case 14:
633
568
  parsedBody = parsedOutput.body;
634
- $metadata = deserializeMetadata(output);
635
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
636
- response = new __BaseException({
637
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
638
- $fault: "client",
639
- $metadata: $metadata,
569
+ throwDefaultError({
570
+ output: output,
571
+ parsedBody: parsedBody,
572
+ exceptionCtor: __BaseException,
573
+ errorCode: errorCode,
640
574
  });
641
- throw __decorateServiceException(response, parsedBody);
575
+ _d.label = 15;
576
+ case 15: return [2];
642
577
  }
643
578
  });
644
579
  }); };
@@ -650,60 +585,50 @@ export var deserializeAws_restJson1StartSnapshotCommand = function (output, cont
650
585
  if (output.statusCode !== 201 && output.statusCode >= 300) {
651
586
  return [2, deserializeAws_restJson1StartSnapshotCommandError(output, context)];
652
587
  }
653
- contents = {
588
+ contents = map({
654
589
  $metadata: deserializeMetadata(output),
655
- BlockSize: undefined,
656
- Description: undefined,
657
- KmsKeyArn: undefined,
658
- OwnerId: undefined,
659
- ParentSnapshotId: undefined,
660
- SnapshotId: undefined,
661
- StartTime: undefined,
662
- Status: undefined,
663
- Tags: undefined,
664
- VolumeSize: undefined,
665
- };
590
+ });
666
591
  _a = __expectNonNull;
667
592
  _b = __expectObject;
668
593
  return [4, parseBody(output.body, context)];
669
594
  case 1:
670
595
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
671
- if (data.BlockSize !== undefined && data.BlockSize !== null) {
596
+ if (data.BlockSize != null) {
672
597
  contents.BlockSize = __expectInt32(data.BlockSize);
673
598
  }
674
- if (data.Description !== undefined && data.Description !== null) {
599
+ if (data.Description != null) {
675
600
  contents.Description = __expectString(data.Description);
676
601
  }
677
- if (data.KmsKeyArn !== undefined && data.KmsKeyArn !== null) {
602
+ if (data.KmsKeyArn != null) {
678
603
  contents.KmsKeyArn = __expectString(data.KmsKeyArn);
679
604
  }
680
- if (data.OwnerId !== undefined && data.OwnerId !== null) {
605
+ if (data.OwnerId != null) {
681
606
  contents.OwnerId = __expectString(data.OwnerId);
682
607
  }
683
- if (data.ParentSnapshotId !== undefined && data.ParentSnapshotId !== null) {
608
+ if (data.ParentSnapshotId != null) {
684
609
  contents.ParentSnapshotId = __expectString(data.ParentSnapshotId);
685
610
  }
686
- if (data.SnapshotId !== undefined && data.SnapshotId !== null) {
611
+ if (data.SnapshotId != null) {
687
612
  contents.SnapshotId = __expectString(data.SnapshotId);
688
613
  }
689
- if (data.StartTime !== undefined && data.StartTime !== null) {
614
+ if (data.StartTime != null) {
690
615
  contents.StartTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.StartTime)));
691
616
  }
692
- if (data.Status !== undefined && data.Status !== null) {
617
+ if (data.Status != null) {
693
618
  contents.Status = __expectString(data.Status);
694
619
  }
695
- if (data.Tags !== undefined && data.Tags !== null) {
620
+ if (data.Tags != null) {
696
621
  contents.Tags = deserializeAws_restJson1Tags(data.Tags, context);
697
622
  }
698
- if (data.VolumeSize !== undefined && data.VolumeSize !== null) {
623
+ if (data.VolumeSize != null) {
699
624
  contents.VolumeSize = __expectLong(data.VolumeSize);
700
625
  }
701
- return [2, Promise.resolve(contents)];
626
+ return [2, contents];
702
627
  }
703
628
  });
704
629
  }); };
705
630
  var deserializeAws_restJson1StartSnapshotCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
706
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
631
+ var parsedOutput, _a, errorCode, _b, parsedBody;
707
632
  var _c;
708
633
  return __generator(this, function (_d) {
709
634
  switch (_d.label) {
@@ -752,26 +677,27 @@ var deserializeAws_restJson1StartSnapshotCommandError = function (output, contex
752
677
  case 17: throw _d.sent();
753
678
  case 18:
754
679
  parsedBody = parsedOutput.body;
755
- $metadata = deserializeMetadata(output);
756
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
757
- response = new __BaseException({
758
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
759
- $fault: "client",
760
- $metadata: $metadata,
680
+ throwDefaultError({
681
+ output: output,
682
+ parsedBody: parsedBody,
683
+ exceptionCtor: __BaseException,
684
+ errorCode: errorCode,
761
685
  });
762
- throw __decorateServiceException(response, parsedBody);
686
+ _d.label = 19;
687
+ case 19: return [2];
763
688
  }
764
689
  });
765
690
  }); };
691
+ var map = __map;
766
692
  var deserializeAws_restJson1AccessDeniedExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
767
693
  var contents, data, exception;
768
694
  return __generator(this, function (_a) {
769
- contents = {};
695
+ contents = map({});
770
696
  data = parsedOutput.body;
771
- if (data.Message !== undefined && data.Message !== null) {
697
+ if (data.Message != null) {
772
698
  contents.Message = __expectString(data.Message);
773
699
  }
774
- if (data.Reason !== undefined && data.Reason !== null) {
700
+ if (data.Reason != null) {
775
701
  contents.Reason = __expectString(data.Reason);
776
702
  }
777
703
  exception = new AccessDeniedException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -781,9 +707,9 @@ var deserializeAws_restJson1AccessDeniedExceptionResponse = function (parsedOutp
781
707
  var deserializeAws_restJson1ConcurrentLimitExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
782
708
  var contents, data, exception;
783
709
  return __generator(this, function (_a) {
784
- contents = {};
710
+ contents = map({});
785
711
  data = parsedOutput.body;
786
- if (data.Message !== undefined && data.Message !== null) {
712
+ if (data.Message != null) {
787
713
  contents.Message = __expectString(data.Message);
788
714
  }
789
715
  exception = new ConcurrentLimitExceededException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -793,9 +719,9 @@ var deserializeAws_restJson1ConcurrentLimitExceededExceptionResponse = function
793
719
  var deserializeAws_restJson1ConflictExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
794
720
  var contents, data, exception;
795
721
  return __generator(this, function (_a) {
796
- contents = {};
722
+ contents = map({});
797
723
  data = parsedOutput.body;
798
- if (data.Message !== undefined && data.Message !== null) {
724
+ if (data.Message != null) {
799
725
  contents.Message = __expectString(data.Message);
800
726
  }
801
727
  exception = new ConflictException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -805,9 +731,9 @@ var deserializeAws_restJson1ConflictExceptionResponse = function (parsedOutput,
805
731
  var deserializeAws_restJson1InternalServerExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
806
732
  var contents, data, exception;
807
733
  return __generator(this, function (_a) {
808
- contents = {};
734
+ contents = map({});
809
735
  data = parsedOutput.body;
810
- if (data.Message !== undefined && data.Message !== null) {
736
+ if (data.Message != null) {
811
737
  contents.Message = __expectString(data.Message);
812
738
  }
813
739
  exception = new InternalServerException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -817,12 +743,12 @@ var deserializeAws_restJson1InternalServerExceptionResponse = function (parsedOu
817
743
  var deserializeAws_restJson1RequestThrottledExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
818
744
  var contents, data, exception;
819
745
  return __generator(this, function (_a) {
820
- contents = {};
746
+ contents = map({});
821
747
  data = parsedOutput.body;
822
- if (data.Message !== undefined && data.Message !== null) {
748
+ if (data.Message != null) {
823
749
  contents.Message = __expectString(data.Message);
824
750
  }
825
- if (data.Reason !== undefined && data.Reason !== null) {
751
+ if (data.Reason != null) {
826
752
  contents.Reason = __expectString(data.Reason);
827
753
  }
828
754
  exception = new RequestThrottledException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -832,12 +758,12 @@ var deserializeAws_restJson1RequestThrottledExceptionResponse = function (parsed
832
758
  var deserializeAws_restJson1ResourceNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
833
759
  var contents, data, exception;
834
760
  return __generator(this, function (_a) {
835
- contents = {};
761
+ contents = map({});
836
762
  data = parsedOutput.body;
837
- if (data.Message !== undefined && data.Message !== null) {
763
+ if (data.Message != null) {
838
764
  contents.Message = __expectString(data.Message);
839
765
  }
840
- if (data.Reason !== undefined && data.Reason !== null) {
766
+ if (data.Reason != null) {
841
767
  contents.Reason = __expectString(data.Reason);
842
768
  }
843
769
  exception = new ResourceNotFoundException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -847,12 +773,12 @@ var deserializeAws_restJson1ResourceNotFoundExceptionResponse = function (parsed
847
773
  var deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
848
774
  var contents, data, exception;
849
775
  return __generator(this, function (_a) {
850
- contents = {};
776
+ contents = map({});
851
777
  data = parsedOutput.body;
852
- if (data.Message !== undefined && data.Message !== null) {
778
+ if (data.Message != null) {
853
779
  contents.Message = __expectString(data.Message);
854
780
  }
855
- if (data.Reason !== undefined && data.Reason !== null) {
781
+ if (data.Reason != null) {
856
782
  contents.Reason = __expectString(data.Reason);
857
783
  }
858
784
  exception = new ServiceQuotaExceededException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -862,12 +788,12 @@ var deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = function (pa
862
788
  var deserializeAws_restJson1ValidationExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
863
789
  var contents, data, exception;
864
790
  return __generator(this, function (_a) {
865
- contents = {};
791
+ contents = map({});
866
792
  data = parsedOutput.body;
867
- if (data.Message !== undefined && data.Message !== null) {
793
+ if (data.Message != null) {
868
794
  contents.Message = __expectString(data.Message);
869
795
  }
870
- if (data.Reason !== undefined && data.Reason !== null) {
796
+ if (data.Reason != null) {
871
797
  contents.Reason = __expectString(data.Reason);
872
798
  }
873
799
  exception = new ValidationException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -881,9 +807,6 @@ var serializeAws_restJson1Tags = function (input, context) {
881
807
  return input
882
808
  .filter(function (e) { return e != null; })
883
809
  .map(function (entry) {
884
- if (entry === null) {
885
- return null;
886
- }
887
810
  return serializeAws_restJson1Tag(entry, context);
888
811
  });
889
812
  };