@aws-sdk/client-ebs 3.312.0 → 3.316.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.
package/dist-cjs/EBS.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EBS = void 0;
4
+ const smithy_client_1 = require("@aws-sdk/smithy-client");
4
5
  const CompleteSnapshotCommand_1 = require("./commands/CompleteSnapshotCommand");
5
6
  const GetSnapshotBlockCommand_1 = require("./commands/GetSnapshotBlockCommand");
6
7
  const ListChangedBlocksCommand_1 = require("./commands/ListChangedBlocksCommand");
@@ -8,90 +9,15 @@ const ListSnapshotBlocksCommand_1 = require("./commands/ListSnapshotBlocksComman
8
9
  const PutSnapshotBlockCommand_1 = require("./commands/PutSnapshotBlockCommand");
9
10
  const StartSnapshotCommand_1 = require("./commands/StartSnapshotCommand");
10
11
  const EBSClient_1 = require("./EBSClient");
12
+ const commands = {
13
+ CompleteSnapshotCommand: CompleteSnapshotCommand_1.CompleteSnapshotCommand,
14
+ GetSnapshotBlockCommand: GetSnapshotBlockCommand_1.GetSnapshotBlockCommand,
15
+ ListChangedBlocksCommand: ListChangedBlocksCommand_1.ListChangedBlocksCommand,
16
+ ListSnapshotBlocksCommand: ListSnapshotBlocksCommand_1.ListSnapshotBlocksCommand,
17
+ PutSnapshotBlockCommand: PutSnapshotBlockCommand_1.PutSnapshotBlockCommand,
18
+ StartSnapshotCommand: StartSnapshotCommand_1.StartSnapshotCommand,
19
+ };
11
20
  class EBS extends EBSClient_1.EBSClient {
12
- completeSnapshot(args, optionsOrCb, cb) {
13
- const command = new CompleteSnapshotCommand_1.CompleteSnapshotCommand(args);
14
- if (typeof optionsOrCb === "function") {
15
- this.send(command, optionsOrCb);
16
- }
17
- else if (typeof cb === "function") {
18
- if (typeof optionsOrCb !== "object")
19
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
20
- this.send(command, optionsOrCb || {}, cb);
21
- }
22
- else {
23
- return this.send(command, optionsOrCb);
24
- }
25
- }
26
- getSnapshotBlock(args, optionsOrCb, cb) {
27
- const command = new GetSnapshotBlockCommand_1.GetSnapshotBlockCommand(args);
28
- if (typeof optionsOrCb === "function") {
29
- this.send(command, optionsOrCb);
30
- }
31
- else if (typeof cb === "function") {
32
- if (typeof optionsOrCb !== "object")
33
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
34
- this.send(command, optionsOrCb || {}, cb);
35
- }
36
- else {
37
- return this.send(command, optionsOrCb);
38
- }
39
- }
40
- listChangedBlocks(args, optionsOrCb, cb) {
41
- const command = new ListChangedBlocksCommand_1.ListChangedBlocksCommand(args);
42
- if (typeof optionsOrCb === "function") {
43
- this.send(command, optionsOrCb);
44
- }
45
- else if (typeof cb === "function") {
46
- if (typeof optionsOrCb !== "object")
47
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
48
- this.send(command, optionsOrCb || {}, cb);
49
- }
50
- else {
51
- return this.send(command, optionsOrCb);
52
- }
53
- }
54
- listSnapshotBlocks(args, optionsOrCb, cb) {
55
- const command = new ListSnapshotBlocksCommand_1.ListSnapshotBlocksCommand(args);
56
- if (typeof optionsOrCb === "function") {
57
- this.send(command, optionsOrCb);
58
- }
59
- else if (typeof cb === "function") {
60
- if (typeof optionsOrCb !== "object")
61
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
62
- this.send(command, optionsOrCb || {}, cb);
63
- }
64
- else {
65
- return this.send(command, optionsOrCb);
66
- }
67
- }
68
- putSnapshotBlock(args, optionsOrCb, cb) {
69
- const command = new PutSnapshotBlockCommand_1.PutSnapshotBlockCommand(args);
70
- if (typeof optionsOrCb === "function") {
71
- this.send(command, optionsOrCb);
72
- }
73
- else if (typeof cb === "function") {
74
- if (typeof optionsOrCb !== "object")
75
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
76
- this.send(command, optionsOrCb || {}, cb);
77
- }
78
- else {
79
- return this.send(command, optionsOrCb);
80
- }
81
- }
82
- startSnapshot(args, optionsOrCb, cb) {
83
- const command = new StartSnapshotCommand_1.StartSnapshotCommand(args);
84
- if (typeof optionsOrCb === "function") {
85
- this.send(command, optionsOrCb);
86
- }
87
- else if (typeof cb === "function") {
88
- if (typeof optionsOrCb !== "object")
89
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
90
- this.send(command, optionsOrCb || {}, cb);
91
- }
92
- else {
93
- return this.send(command, optionsOrCb);
94
- }
95
- }
96
21
  }
97
22
  exports.EBS = EBS;
23
+ (0, smithy_client_1.createAggregatedClient)(commands, EBS);
@@ -8,7 +8,7 @@ const EBSServiceException_1 = require("../models/EBSServiceException");
8
8
  const models_0_1 = require("../models/models_0");
9
9
  const se_CompleteSnapshotCommand = async (input, context) => {
10
10
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
11
- const headers = map({}, isSerializableHeaderValue, {
11
+ const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
12
12
  "x-amz-changedblockscount": [
13
13
  () => isSerializableHeaderValue(input.ChangedBlocksCount),
14
14
  () => input.ChangedBlocksCount.toString(),
@@ -38,7 +38,7 @@ const se_GetSnapshotBlockCommand = async (input, context) => {
38
38
  "/snapshots/{SnapshotId}/blocks/{BlockIndex}";
39
39
  resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SnapshotId", () => input.SnapshotId, "{SnapshotId}", false);
40
40
  resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "BlockIndex", () => input.BlockIndex.toString(), "{BlockIndex}", false);
41
- const query = map({
41
+ const query = (0, smithy_client_1.map)({
42
42
  blockToken: [, (0, smithy_client_1.expectNonNull)(input.BlockToken, `BlockToken`)],
43
43
  });
44
44
  let body;
@@ -60,7 +60,7 @@ const se_ListChangedBlocksCommand = async (input, context) => {
60
60
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
61
61
  "/snapshots/{SecondSnapshotId}/changedblocks";
62
62
  resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SecondSnapshotId", () => input.SecondSnapshotId, "{SecondSnapshotId}", false);
63
- const query = map({
63
+ const query = (0, smithy_client_1.map)({
64
64
  firstSnapshotId: [, input.FirstSnapshotId],
65
65
  pageToken: [, input.NextToken],
66
66
  maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
@@ -84,7 +84,7 @@ const se_ListSnapshotBlocksCommand = async (input, context) => {
84
84
  const headers = {};
85
85
  let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/snapshots/{SnapshotId}/blocks";
86
86
  resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "SnapshotId", () => input.SnapshotId, "{SnapshotId}", false);
87
- const query = map({
87
+ const query = (0, smithy_client_1.map)({
88
88
  pageToken: [, input.NextToken],
89
89
  maxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
90
90
  startingBlockIndex: [() => input.StartingBlockIndex !== void 0, () => input.StartingBlockIndex.toString()],
@@ -104,7 +104,7 @@ const se_ListSnapshotBlocksCommand = async (input, context) => {
104
104
  exports.se_ListSnapshotBlocksCommand = se_ListSnapshotBlocksCommand;
105
105
  const se_PutSnapshotBlockCommand = async (input, context) => {
106
106
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
107
- const headers = map({}, isSerializableHeaderValue, {
107
+ const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
108
108
  "x-amz-content-sha256": "UNSIGNED-PAYLOAD",
109
109
  "content-type": "application/octet-stream",
110
110
  "x-amz-data-length": [() => isSerializableHeaderValue(input.DataLength), () => input.DataLength.toString()],
@@ -138,16 +138,16 @@ const se_StartSnapshotCommand = async (input, context) => {
138
138
  };
139
139
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/snapshots";
140
140
  let body;
141
- body = JSON.stringify({
142
- ClientToken: input.ClientToken ?? (0, uuid_1.v4)(),
143
- ...(input.Description != null && { Description: input.Description }),
144
- ...(input.Encrypted != null && { Encrypted: input.Encrypted }),
145
- ...(input.KmsKeyArn != null && { KmsKeyArn: input.KmsKeyArn }),
146
- ...(input.ParentSnapshotId != null && { ParentSnapshotId: input.ParentSnapshotId }),
147
- ...(input.Tags != null && { Tags: se_Tags(input.Tags, context) }),
148
- ...(input.Timeout != null && { Timeout: input.Timeout }),
149
- ...(input.VolumeSize != null && { VolumeSize: input.VolumeSize }),
150
- });
141
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
142
+ ClientToken: [true, (_) => _ ?? (0, uuid_1.v4)()],
143
+ Description: [],
144
+ Encrypted: [],
145
+ KmsKeyArn: [],
146
+ ParentSnapshotId: [],
147
+ Tags: (_) => (0, smithy_client_1._json)(_),
148
+ Timeout: [],
149
+ VolumeSize: [],
150
+ }));
151
151
  return new protocol_http_1.HttpRequest({
152
152
  protocol,
153
153
  hostname,
@@ -163,13 +163,14 @@ const de_CompleteSnapshotCommand = async (output, context) => {
163
163
  if (output.statusCode !== 202 && output.statusCode >= 300) {
164
164
  return de_CompleteSnapshotCommandError(output, context);
165
165
  }
166
- const contents = map({
166
+ const contents = (0, smithy_client_1.map)({
167
167
  $metadata: deserializeMetadata(output),
168
168
  });
169
169
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
170
- if (data.Status != null) {
171
- contents.Status = (0, smithy_client_1.expectString)(data.Status);
172
- }
170
+ const doc = (0, smithy_client_1.take)(data, {
171
+ Status: smithy_client_1.expectString,
172
+ });
173
+ Object.assign(contents, doc);
173
174
  return contents;
174
175
  };
175
176
  exports.de_CompleteSnapshotCommand = de_CompleteSnapshotCommand;
@@ -200,10 +201,9 @@ const de_CompleteSnapshotCommandError = async (output, context) => {
200
201
  throw await de_ValidationExceptionRes(parsedOutput, context);
201
202
  default:
202
203
  const parsedBody = parsedOutput.body;
203
- (0, smithy_client_1.throwDefaultError)({
204
+ return throwDefaultError({
204
205
  output,
205
206
  parsedBody,
206
- exceptionCtor: EBSServiceException_1.EBSServiceException,
207
207
  errorCode,
208
208
  });
209
209
  }
@@ -212,7 +212,7 @@ const de_GetSnapshotBlockCommand = async (output, context) => {
212
212
  if (output.statusCode !== 200 && output.statusCode >= 300) {
213
213
  return de_GetSnapshotBlockCommandError(output, context);
214
214
  }
215
- const contents = map({
215
+ const contents = (0, smithy_client_1.map)({
216
216
  $metadata: deserializeMetadata(output),
217
217
  DataLength: [
218
218
  () => void 0 !== output.headers["x-amz-data-length"],
@@ -254,10 +254,9 @@ const de_GetSnapshotBlockCommandError = async (output, context) => {
254
254
  throw await de_ValidationExceptionRes(parsedOutput, context);
255
255
  default:
256
256
  const parsedBody = parsedOutput.body;
257
- (0, smithy_client_1.throwDefaultError)({
257
+ return throwDefaultError({
258
258
  output,
259
259
  parsedBody,
260
- exceptionCtor: EBSServiceException_1.EBSServiceException,
261
260
  errorCode,
262
261
  });
263
262
  }
@@ -266,25 +265,18 @@ const de_ListChangedBlocksCommand = async (output, context) => {
266
265
  if (output.statusCode !== 200 && output.statusCode >= 300) {
267
266
  return de_ListChangedBlocksCommandError(output, context);
268
267
  }
269
- const contents = map({
268
+ const contents = (0, smithy_client_1.map)({
270
269
  $metadata: deserializeMetadata(output),
271
270
  });
272
271
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
273
- if (data.BlockSize != null) {
274
- contents.BlockSize = (0, smithy_client_1.expectInt32)(data.BlockSize);
275
- }
276
- if (data.ChangedBlocks != null) {
277
- contents.ChangedBlocks = de_ChangedBlocks(data.ChangedBlocks, context);
278
- }
279
- if (data.ExpiryTime != null) {
280
- contents.ExpiryTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.ExpiryTime)));
281
- }
282
- if (data.NextToken != null) {
283
- contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
284
- }
285
- if (data.VolumeSize != null) {
286
- contents.VolumeSize = (0, smithy_client_1.expectLong)(data.VolumeSize);
287
- }
272
+ const doc = (0, smithy_client_1.take)(data, {
273
+ BlockSize: smithy_client_1.expectInt32,
274
+ ChangedBlocks: smithy_client_1._json,
275
+ ExpiryTime: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
276
+ NextToken: smithy_client_1.expectString,
277
+ VolumeSize: smithy_client_1.expectLong,
278
+ });
279
+ Object.assign(contents, doc);
288
280
  return contents;
289
281
  };
290
282
  exports.de_ListChangedBlocksCommand = de_ListChangedBlocksCommand;
@@ -315,10 +307,9 @@ const de_ListChangedBlocksCommandError = async (output, context) => {
315
307
  throw await de_ValidationExceptionRes(parsedOutput, context);
316
308
  default:
317
309
  const parsedBody = parsedOutput.body;
318
- (0, smithy_client_1.throwDefaultError)({
310
+ return throwDefaultError({
319
311
  output,
320
312
  parsedBody,
321
- exceptionCtor: EBSServiceException_1.EBSServiceException,
322
313
  errorCode,
323
314
  });
324
315
  }
@@ -327,25 +318,18 @@ const de_ListSnapshotBlocksCommand = async (output, context) => {
327
318
  if (output.statusCode !== 200 && output.statusCode >= 300) {
328
319
  return de_ListSnapshotBlocksCommandError(output, context);
329
320
  }
330
- const contents = map({
321
+ const contents = (0, smithy_client_1.map)({
331
322
  $metadata: deserializeMetadata(output),
332
323
  });
333
324
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
334
- if (data.BlockSize != null) {
335
- contents.BlockSize = (0, smithy_client_1.expectInt32)(data.BlockSize);
336
- }
337
- if (data.Blocks != null) {
338
- contents.Blocks = de_Blocks(data.Blocks, context);
339
- }
340
- if (data.ExpiryTime != null) {
341
- contents.ExpiryTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.ExpiryTime)));
342
- }
343
- if (data.NextToken != null) {
344
- contents.NextToken = (0, smithy_client_1.expectString)(data.NextToken);
345
- }
346
- if (data.VolumeSize != null) {
347
- contents.VolumeSize = (0, smithy_client_1.expectLong)(data.VolumeSize);
348
- }
325
+ const doc = (0, smithy_client_1.take)(data, {
326
+ BlockSize: smithy_client_1.expectInt32,
327
+ Blocks: smithy_client_1._json,
328
+ ExpiryTime: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
329
+ NextToken: smithy_client_1.expectString,
330
+ VolumeSize: smithy_client_1.expectLong,
331
+ });
332
+ Object.assign(contents, doc);
349
333
  return contents;
350
334
  };
351
335
  exports.de_ListSnapshotBlocksCommand = de_ListSnapshotBlocksCommand;
@@ -376,10 +360,9 @@ const de_ListSnapshotBlocksCommandError = async (output, context) => {
376
360
  throw await de_ValidationExceptionRes(parsedOutput, context);
377
361
  default:
378
362
  const parsedBody = parsedOutput.body;
379
- (0, smithy_client_1.throwDefaultError)({
363
+ return throwDefaultError({
380
364
  output,
381
365
  parsedBody,
382
- exceptionCtor: EBSServiceException_1.EBSServiceException,
383
366
  errorCode,
384
367
  });
385
368
  }
@@ -388,7 +371,7 @@ const de_PutSnapshotBlockCommand = async (output, context) => {
388
371
  if (output.statusCode !== 201 && output.statusCode >= 300) {
389
372
  return de_PutSnapshotBlockCommandError(output, context);
390
373
  }
391
- const contents = map({
374
+ const contents = (0, smithy_client_1.map)({
392
375
  $metadata: deserializeMetadata(output),
393
376
  Checksum: [, output.headers["x-amz-checksum"]],
394
377
  ChecksumAlgorithm: [, output.headers["x-amz-checksum-algorithm"]],
@@ -424,10 +407,9 @@ const de_PutSnapshotBlockCommandError = async (output, context) => {
424
407
  throw await de_ValidationExceptionRes(parsedOutput, context);
425
408
  default:
426
409
  const parsedBody = parsedOutput.body;
427
- (0, smithy_client_1.throwDefaultError)({
410
+ return throwDefaultError({
428
411
  output,
429
412
  parsedBody,
430
- exceptionCtor: EBSServiceException_1.EBSServiceException,
431
413
  errorCode,
432
414
  });
433
415
  }
@@ -436,40 +418,23 @@ const de_StartSnapshotCommand = async (output, context) => {
436
418
  if (output.statusCode !== 201 && output.statusCode >= 300) {
437
419
  return de_StartSnapshotCommandError(output, context);
438
420
  }
439
- const contents = map({
421
+ const contents = (0, smithy_client_1.map)({
440
422
  $metadata: deserializeMetadata(output),
441
423
  });
442
424
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
443
- if (data.BlockSize != null) {
444
- contents.BlockSize = (0, smithy_client_1.expectInt32)(data.BlockSize);
445
- }
446
- if (data.Description != null) {
447
- contents.Description = (0, smithy_client_1.expectString)(data.Description);
448
- }
449
- if (data.KmsKeyArn != null) {
450
- contents.KmsKeyArn = (0, smithy_client_1.expectString)(data.KmsKeyArn);
451
- }
452
- if (data.OwnerId != null) {
453
- contents.OwnerId = (0, smithy_client_1.expectString)(data.OwnerId);
454
- }
455
- if (data.ParentSnapshotId != null) {
456
- contents.ParentSnapshotId = (0, smithy_client_1.expectString)(data.ParentSnapshotId);
457
- }
458
- if (data.SnapshotId != null) {
459
- contents.SnapshotId = (0, smithy_client_1.expectString)(data.SnapshotId);
460
- }
461
- if (data.StartTime != null) {
462
- contents.StartTime = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(data.StartTime)));
463
- }
464
- if (data.Status != null) {
465
- contents.Status = (0, smithy_client_1.expectString)(data.Status);
466
- }
467
- if (data.Tags != null) {
468
- contents.Tags = de_Tags(data.Tags, context);
469
- }
470
- if (data.VolumeSize != null) {
471
- contents.VolumeSize = (0, smithy_client_1.expectLong)(data.VolumeSize);
472
- }
425
+ const doc = (0, smithy_client_1.take)(data, {
426
+ BlockSize: smithy_client_1.expectInt32,
427
+ Description: smithy_client_1.expectString,
428
+ KmsKeyArn: smithy_client_1.expectString,
429
+ OwnerId: smithy_client_1.expectString,
430
+ ParentSnapshotId: smithy_client_1.expectString,
431
+ SnapshotId: smithy_client_1.expectString,
432
+ StartTime: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
433
+ Status: smithy_client_1.expectString,
434
+ Tags: smithy_client_1._json,
435
+ VolumeSize: smithy_client_1.expectLong,
436
+ });
437
+ Object.assign(contents, doc);
473
438
  return contents;
474
439
  };
475
440
  exports.de_StartSnapshotCommand = de_StartSnapshotCommand;
@@ -506,24 +471,22 @@ const de_StartSnapshotCommandError = async (output, context) => {
506
471
  throw await de_ValidationExceptionRes(parsedOutput, context);
507
472
  default:
508
473
  const parsedBody = parsedOutput.body;
509
- (0, smithy_client_1.throwDefaultError)({
474
+ return throwDefaultError({
510
475
  output,
511
476
  parsedBody,
512
- exceptionCtor: EBSServiceException_1.EBSServiceException,
513
477
  errorCode,
514
478
  });
515
479
  }
516
480
  };
517
- const map = smithy_client_1.map;
481
+ const throwDefaultError = (0, smithy_client_1.withBaseException)(EBSServiceException_1.EBSServiceException);
518
482
  const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
519
- const contents = map({});
483
+ const contents = (0, smithy_client_1.map)({});
520
484
  const data = parsedOutput.body;
521
- if (data.Message != null) {
522
- contents.Message = (0, smithy_client_1.expectString)(data.Message);
523
- }
524
- if (data.Reason != null) {
525
- contents.Reason = (0, smithy_client_1.expectString)(data.Reason);
526
- }
485
+ const doc = (0, smithy_client_1.take)(data, {
486
+ Message: smithy_client_1.expectString,
487
+ Reason: smithy_client_1.expectString,
488
+ });
489
+ Object.assign(contents, doc);
527
490
  const exception = new models_0_1.AccessDeniedException({
528
491
  $metadata: deserializeMetadata(parsedOutput),
529
492
  ...contents,
@@ -531,11 +494,12 @@ const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
531
494
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
532
495
  };
533
496
  const de_ConcurrentLimitExceededExceptionRes = async (parsedOutput, context) => {
534
- const contents = map({});
497
+ const contents = (0, smithy_client_1.map)({});
535
498
  const data = parsedOutput.body;
536
- if (data.Message != null) {
537
- contents.Message = (0, smithy_client_1.expectString)(data.Message);
538
- }
499
+ const doc = (0, smithy_client_1.take)(data, {
500
+ Message: smithy_client_1.expectString,
501
+ });
502
+ Object.assign(contents, doc);
539
503
  const exception = new models_0_1.ConcurrentLimitExceededException({
540
504
  $metadata: deserializeMetadata(parsedOutput),
541
505
  ...contents,
@@ -543,11 +507,12 @@ const de_ConcurrentLimitExceededExceptionRes = async (parsedOutput, context) =>
543
507
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
544
508
  };
545
509
  const de_ConflictExceptionRes = async (parsedOutput, context) => {
546
- const contents = map({});
510
+ const contents = (0, smithy_client_1.map)({});
547
511
  const data = parsedOutput.body;
548
- if (data.Message != null) {
549
- contents.Message = (0, smithy_client_1.expectString)(data.Message);
550
- }
512
+ const doc = (0, smithy_client_1.take)(data, {
513
+ Message: smithy_client_1.expectString,
514
+ });
515
+ Object.assign(contents, doc);
551
516
  const exception = new models_0_1.ConflictException({
552
517
  $metadata: deserializeMetadata(parsedOutput),
553
518
  ...contents,
@@ -555,11 +520,12 @@ const de_ConflictExceptionRes = async (parsedOutput, context) => {
555
520
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
556
521
  };
557
522
  const de_InternalServerExceptionRes = async (parsedOutput, context) => {
558
- const contents = map({});
523
+ const contents = (0, smithy_client_1.map)({});
559
524
  const data = parsedOutput.body;
560
- if (data.Message != null) {
561
- contents.Message = (0, smithy_client_1.expectString)(data.Message);
562
- }
525
+ const doc = (0, smithy_client_1.take)(data, {
526
+ Message: smithy_client_1.expectString,
527
+ });
528
+ Object.assign(contents, doc);
563
529
  const exception = new models_0_1.InternalServerException({
564
530
  $metadata: deserializeMetadata(parsedOutput),
565
531
  ...contents,
@@ -567,14 +533,13 @@ const de_InternalServerExceptionRes = async (parsedOutput, context) => {
567
533
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
568
534
  };
569
535
  const de_RequestThrottledExceptionRes = async (parsedOutput, context) => {
570
- const contents = map({});
536
+ const contents = (0, smithy_client_1.map)({});
571
537
  const data = parsedOutput.body;
572
- if (data.Message != null) {
573
- contents.Message = (0, smithy_client_1.expectString)(data.Message);
574
- }
575
- if (data.Reason != null) {
576
- contents.Reason = (0, smithy_client_1.expectString)(data.Reason);
577
- }
538
+ const doc = (0, smithy_client_1.take)(data, {
539
+ Message: smithy_client_1.expectString,
540
+ Reason: smithy_client_1.expectString,
541
+ });
542
+ Object.assign(contents, doc);
578
543
  const exception = new models_0_1.RequestThrottledException({
579
544
  $metadata: deserializeMetadata(parsedOutput),
580
545
  ...contents,
@@ -582,14 +547,13 @@ const de_RequestThrottledExceptionRes = async (parsedOutput, context) => {
582
547
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
583
548
  };
584
549
  const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
585
- const contents = map({});
550
+ const contents = (0, smithy_client_1.map)({});
586
551
  const data = parsedOutput.body;
587
- if (data.Message != null) {
588
- contents.Message = (0, smithy_client_1.expectString)(data.Message);
589
- }
590
- if (data.Reason != null) {
591
- contents.Reason = (0, smithy_client_1.expectString)(data.Reason);
592
- }
552
+ const doc = (0, smithy_client_1.take)(data, {
553
+ Message: smithy_client_1.expectString,
554
+ Reason: smithy_client_1.expectString,
555
+ });
556
+ Object.assign(contents, doc);
593
557
  const exception = new models_0_1.ResourceNotFoundException({
594
558
  $metadata: deserializeMetadata(parsedOutput),
595
559
  ...contents,
@@ -597,14 +561,13 @@ const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
597
561
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
598
562
  };
599
563
  const de_ServiceQuotaExceededExceptionRes = async (parsedOutput, context) => {
600
- const contents = map({});
564
+ const contents = (0, smithy_client_1.map)({});
601
565
  const data = parsedOutput.body;
602
- if (data.Message != null) {
603
- contents.Message = (0, smithy_client_1.expectString)(data.Message);
604
- }
605
- if (data.Reason != null) {
606
- contents.Reason = (0, smithy_client_1.expectString)(data.Reason);
607
- }
566
+ const doc = (0, smithy_client_1.take)(data, {
567
+ Message: smithy_client_1.expectString,
568
+ Reason: smithy_client_1.expectString,
569
+ });
570
+ Object.assign(contents, doc);
608
571
  const exception = new models_0_1.ServiceQuotaExceededException({
609
572
  $metadata: deserializeMetadata(parsedOutput),
610
573
  ...contents,
@@ -612,85 +575,19 @@ const de_ServiceQuotaExceededExceptionRes = async (parsedOutput, context) => {
612
575
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
613
576
  };
614
577
  const de_ValidationExceptionRes = async (parsedOutput, context) => {
615
- const contents = map({});
578
+ const contents = (0, smithy_client_1.map)({});
616
579
  const data = parsedOutput.body;
617
- if (data.Message != null) {
618
- contents.Message = (0, smithy_client_1.expectString)(data.Message);
619
- }
620
- if (data.Reason != null) {
621
- contents.Reason = (0, smithy_client_1.expectString)(data.Reason);
622
- }
580
+ const doc = (0, smithy_client_1.take)(data, {
581
+ Message: smithy_client_1.expectString,
582
+ Reason: smithy_client_1.expectString,
583
+ });
584
+ Object.assign(contents, doc);
623
585
  const exception = new models_0_1.ValidationException({
624
586
  $metadata: deserializeMetadata(parsedOutput),
625
587
  ...contents,
626
588
  });
627
589
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
628
590
  };
629
- const se_Tag = (input, context) => {
630
- return {
631
- ...(input.Key != null && { Key: input.Key }),
632
- ...(input.Value != null && { Value: input.Value }),
633
- };
634
- };
635
- const se_Tags = (input, context) => {
636
- return input
637
- .filter((e) => e != null)
638
- .map((entry) => {
639
- return se_Tag(entry, context);
640
- });
641
- };
642
- const de_Block = (output, context) => {
643
- return {
644
- BlockIndex: (0, smithy_client_1.expectInt32)(output.BlockIndex),
645
- BlockToken: (0, smithy_client_1.expectString)(output.BlockToken),
646
- };
647
- };
648
- const de_Blocks = (output, context) => {
649
- const retVal = (output || [])
650
- .filter((e) => e != null)
651
- .map((entry) => {
652
- if (entry === null) {
653
- return null;
654
- }
655
- return de_Block(entry, context);
656
- });
657
- return retVal;
658
- };
659
- const de_ChangedBlock = (output, context) => {
660
- return {
661
- BlockIndex: (0, smithy_client_1.expectInt32)(output.BlockIndex),
662
- FirstBlockToken: (0, smithy_client_1.expectString)(output.FirstBlockToken),
663
- SecondBlockToken: (0, smithy_client_1.expectString)(output.SecondBlockToken),
664
- };
665
- };
666
- const de_ChangedBlocks = (output, context) => {
667
- const retVal = (output || [])
668
- .filter((e) => e != null)
669
- .map((entry) => {
670
- if (entry === null) {
671
- return null;
672
- }
673
- return de_ChangedBlock(entry, context);
674
- });
675
- return retVal;
676
- };
677
- const de_Tag = (output, context) => {
678
- return {
679
- Key: (0, smithy_client_1.expectString)(output.Key),
680
- Value: (0, smithy_client_1.expectString)(output.Value),
681
- };
682
- };
683
- const de_Tags = (output, context) => {
684
- const retVal = (output || [])
685
- .filter((e) => e != null)
686
- .map((entry) => {
687
- if (entry === null) {
688
- return null;
689
- }
690
- return de_Tag(entry, context);
691
- });
692
- return retVal;
693
- };
694
591
  const deserializeMetadata = (output) => ({
695
592
  httpStatusCode: output.statusCode,
696
593
  requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],