@aws-sdk/client-ebs 3.490.0 → 3.495.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,611 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.de_StartSnapshotCommand = exports.de_PutSnapshotBlockCommand = exports.de_ListSnapshotBlocksCommand = exports.de_ListChangedBlocksCommand = exports.de_GetSnapshotBlockCommand = exports.de_CompleteSnapshotCommand = exports.se_StartSnapshotCommand = exports.se_PutSnapshotBlockCommand = exports.se_ListSnapshotBlocksCommand = exports.se_ListChangedBlocksCommand = exports.se_GetSnapshotBlockCommand = exports.se_CompleteSnapshotCommand = void 0;
4
- const core_1 = require("@smithy/core");
5
- const smithy_client_1 = require("@smithy/smithy-client");
6
- const uuid_1 = require("uuid");
7
- const EBSServiceException_1 = require("../models/EBSServiceException");
8
- const models_0_1 = require("../models/models_0");
9
- const se_CompleteSnapshotCommand = async (input, context) => {
10
- const b = (0, core_1.requestBuilder)(input, context);
11
- const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
12
- [_xac]: [() => isSerializableHeaderValue(input[_CBC]), () => input[_CBC].toString()],
13
- [_xac_]: input[_C],
14
- [_xaca]: input[_CA],
15
- [_xacam]: input[_CAM],
16
- });
17
- b.bp("/snapshots/completion/{SnapshotId}");
18
- b.p("SnapshotId", () => input.SnapshotId, "{SnapshotId}", false);
19
- let body;
20
- b.m("POST").h(headers).b(body);
21
- return b.build();
22
- };
23
- exports.se_CompleteSnapshotCommand = se_CompleteSnapshotCommand;
24
- const se_GetSnapshotBlockCommand = async (input, context) => {
25
- const b = (0, core_1.requestBuilder)(input, context);
26
- const headers = {};
27
- b.bp("/snapshots/{SnapshotId}/blocks/{BlockIndex}");
28
- b.p("SnapshotId", () => input.SnapshotId, "{SnapshotId}", false);
29
- b.p("BlockIndex", () => input.BlockIndex.toString(), "{BlockIndex}", false);
30
- const query = (0, smithy_client_1.map)({
31
- [_bT]: [, (0, smithy_client_1.expectNonNull)(input[_BT], `BlockToken`)],
32
- });
33
- let body;
34
- b.m("GET").h(headers).q(query).b(body);
35
- return b.build();
36
- };
37
- exports.se_GetSnapshotBlockCommand = se_GetSnapshotBlockCommand;
38
- const se_ListChangedBlocksCommand = async (input, context) => {
39
- const b = (0, core_1.requestBuilder)(input, context);
40
- const headers = {};
41
- b.bp("/snapshots/{SecondSnapshotId}/changedblocks");
42
- b.p("SecondSnapshotId", () => input.SecondSnapshotId, "{SecondSnapshotId}", false);
43
- const query = (0, smithy_client_1.map)({
44
- [_fSI]: [, input[_FSI]],
45
- [_pT]: [, input[_NT]],
46
- [_mR]: [() => input.MaxResults !== void 0, () => input[_MR].toString()],
47
- [_sBI]: [() => input.StartingBlockIndex !== void 0, () => input[_SBI].toString()],
48
- });
49
- let body;
50
- b.m("GET").h(headers).q(query).b(body);
51
- return b.build();
52
- };
53
- exports.se_ListChangedBlocksCommand = se_ListChangedBlocksCommand;
54
- const se_ListSnapshotBlocksCommand = async (input, context) => {
55
- const b = (0, core_1.requestBuilder)(input, context);
56
- const headers = {};
57
- b.bp("/snapshots/{SnapshotId}/blocks");
58
- b.p("SnapshotId", () => input.SnapshotId, "{SnapshotId}", false);
59
- const query = (0, smithy_client_1.map)({
60
- [_pT]: [, input[_NT]],
61
- [_mR]: [() => input.MaxResults !== void 0, () => input[_MR].toString()],
62
- [_sBI]: [() => input.StartingBlockIndex !== void 0, () => input[_SBI].toString()],
63
- });
64
- let body;
65
- b.m("GET").h(headers).q(query).b(body);
66
- return b.build();
67
- };
68
- exports.se_ListSnapshotBlocksCommand = se_ListSnapshotBlocksCommand;
69
- const se_PutSnapshotBlockCommand = async (input, context) => {
70
- const b = (0, core_1.requestBuilder)(input, context);
71
- const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
72
- "x-amz-content-sha256": "UNSIGNED-PAYLOAD",
73
- "content-type": "application/octet-stream",
74
- [_xadl]: [() => isSerializableHeaderValue(input[_DL]), () => input[_DL].toString()],
75
- [_xap]: [() => isSerializableHeaderValue(input[_P]), () => input[_P].toString()],
76
- [_xac_]: input[_C],
77
- [_xaca]: input[_CA],
78
- });
79
- b.bp("/snapshots/{SnapshotId}/blocks/{BlockIndex}");
80
- b.p("SnapshotId", () => input.SnapshotId, "{SnapshotId}", false);
81
- b.p("BlockIndex", () => input.BlockIndex.toString(), "{BlockIndex}", false);
82
- let body;
83
- if (input.BlockData !== undefined) {
84
- body = input.BlockData;
85
- }
86
- b.m("PUT").h(headers).b(body);
87
- return b.build();
88
- };
89
- exports.se_PutSnapshotBlockCommand = se_PutSnapshotBlockCommand;
90
- const se_StartSnapshotCommand = async (input, context) => {
91
- const b = (0, core_1.requestBuilder)(input, context);
92
- const headers = {
93
- "content-type": "application/json",
94
- };
95
- b.bp("/snapshots");
96
- let body;
97
- body = JSON.stringify((0, smithy_client_1.take)(input, {
98
- ClientToken: [true, (_) => _ ?? (0, uuid_1.v4)()],
99
- Description: [],
100
- Encrypted: [],
101
- KmsKeyArn: [],
102
- ParentSnapshotId: [],
103
- Tags: (_) => (0, smithy_client_1._json)(_),
104
- Timeout: [],
105
- VolumeSize: [],
106
- }));
107
- b.m("POST").h(headers).b(body);
108
- return b.build();
109
- };
110
- exports.se_StartSnapshotCommand = se_StartSnapshotCommand;
111
- const de_CompleteSnapshotCommand = async (output, context) => {
112
- if (output.statusCode !== 202 && output.statusCode >= 300) {
113
- return de_CompleteSnapshotCommandError(output, context);
114
- }
115
- const contents = (0, smithy_client_1.map)({
116
- $metadata: deserializeMetadata(output),
117
- });
118
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
119
- const doc = (0, smithy_client_1.take)(data, {
120
- Status: smithy_client_1.expectString,
121
- });
122
- Object.assign(contents, doc);
123
- return contents;
124
- };
125
- exports.de_CompleteSnapshotCommand = de_CompleteSnapshotCommand;
126
- const de_CompleteSnapshotCommandError = async (output, context) => {
127
- const parsedOutput = {
128
- ...output,
129
- body: await parseErrorBody(output.body, context),
130
- };
131
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
132
- switch (errorCode) {
133
- case "AccessDeniedException":
134
- case "com.amazonaws.ebs#AccessDeniedException":
135
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
136
- case "InternalServerException":
137
- case "com.amazonaws.ebs#InternalServerException":
138
- throw await de_InternalServerExceptionRes(parsedOutput, context);
139
- case "RequestThrottledException":
140
- case "com.amazonaws.ebs#RequestThrottledException":
141
- throw await de_RequestThrottledExceptionRes(parsedOutput, context);
142
- case "ResourceNotFoundException":
143
- case "com.amazonaws.ebs#ResourceNotFoundException":
144
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
145
- case "ServiceQuotaExceededException":
146
- case "com.amazonaws.ebs#ServiceQuotaExceededException":
147
- throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
148
- case "ValidationException":
149
- case "com.amazonaws.ebs#ValidationException":
150
- throw await de_ValidationExceptionRes(parsedOutput, context);
151
- default:
152
- const parsedBody = parsedOutput.body;
153
- return throwDefaultError({
154
- output,
155
- parsedBody,
156
- errorCode,
157
- });
158
- }
159
- };
160
- const de_GetSnapshotBlockCommand = async (output, context) => {
161
- if (output.statusCode !== 200 && output.statusCode >= 300) {
162
- return de_GetSnapshotBlockCommandError(output, context);
163
- }
164
- const contents = (0, smithy_client_1.map)({
165
- $metadata: deserializeMetadata(output),
166
- [_DL]: [() => void 0 !== output.headers[_xadl], () => (0, smithy_client_1.strictParseInt32)(output.headers[_xadl])],
167
- [_C]: [, output.headers[_xac_]],
168
- [_CA]: [, output.headers[_xaca]],
169
- });
170
- const data = output.body;
171
- context.sdkStreamMixin(data);
172
- contents.BlockData = data;
173
- return contents;
174
- };
175
- exports.de_GetSnapshotBlockCommand = de_GetSnapshotBlockCommand;
176
- const de_GetSnapshotBlockCommandError = async (output, context) => {
177
- const parsedOutput = {
178
- ...output,
179
- body: await parseErrorBody(output.body, context),
180
- };
181
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
182
- switch (errorCode) {
183
- case "AccessDeniedException":
184
- case "com.amazonaws.ebs#AccessDeniedException":
185
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
186
- case "InternalServerException":
187
- case "com.amazonaws.ebs#InternalServerException":
188
- throw await de_InternalServerExceptionRes(parsedOutput, context);
189
- case "RequestThrottledException":
190
- case "com.amazonaws.ebs#RequestThrottledException":
191
- throw await de_RequestThrottledExceptionRes(parsedOutput, context);
192
- case "ResourceNotFoundException":
193
- case "com.amazonaws.ebs#ResourceNotFoundException":
194
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
195
- case "ServiceQuotaExceededException":
196
- case "com.amazonaws.ebs#ServiceQuotaExceededException":
197
- throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
198
- case "ValidationException":
199
- case "com.amazonaws.ebs#ValidationException":
200
- throw await de_ValidationExceptionRes(parsedOutput, context);
201
- default:
202
- const parsedBody = parsedOutput.body;
203
- return throwDefaultError({
204
- output,
205
- parsedBody,
206
- errorCode,
207
- });
208
- }
209
- };
210
- const de_ListChangedBlocksCommand = async (output, context) => {
211
- if (output.statusCode !== 200 && output.statusCode >= 300) {
212
- return de_ListChangedBlocksCommandError(output, context);
213
- }
214
- const contents = (0, smithy_client_1.map)({
215
- $metadata: deserializeMetadata(output),
216
- });
217
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
218
- const doc = (0, smithy_client_1.take)(data, {
219
- BlockSize: smithy_client_1.expectInt32,
220
- ChangedBlocks: smithy_client_1._json,
221
- ExpiryTime: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
222
- NextToken: smithy_client_1.expectString,
223
- VolumeSize: smithy_client_1.expectLong,
224
- });
225
- Object.assign(contents, doc);
226
- return contents;
227
- };
228
- exports.de_ListChangedBlocksCommand = de_ListChangedBlocksCommand;
229
- const de_ListChangedBlocksCommandError = async (output, context) => {
230
- const parsedOutput = {
231
- ...output,
232
- body: await parseErrorBody(output.body, context),
233
- };
234
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
235
- switch (errorCode) {
236
- case "AccessDeniedException":
237
- case "com.amazonaws.ebs#AccessDeniedException":
238
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
239
- case "InternalServerException":
240
- case "com.amazonaws.ebs#InternalServerException":
241
- throw await de_InternalServerExceptionRes(parsedOutput, context);
242
- case "RequestThrottledException":
243
- case "com.amazonaws.ebs#RequestThrottledException":
244
- throw await de_RequestThrottledExceptionRes(parsedOutput, context);
245
- case "ResourceNotFoundException":
246
- case "com.amazonaws.ebs#ResourceNotFoundException":
247
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
248
- case "ServiceQuotaExceededException":
249
- case "com.amazonaws.ebs#ServiceQuotaExceededException":
250
- throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
251
- case "ValidationException":
252
- case "com.amazonaws.ebs#ValidationException":
253
- throw await de_ValidationExceptionRes(parsedOutput, context);
254
- default:
255
- const parsedBody = parsedOutput.body;
256
- return throwDefaultError({
257
- output,
258
- parsedBody,
259
- errorCode,
260
- });
261
- }
262
- };
263
- const de_ListSnapshotBlocksCommand = async (output, context) => {
264
- if (output.statusCode !== 200 && output.statusCode >= 300) {
265
- return de_ListSnapshotBlocksCommandError(output, context);
266
- }
267
- const contents = (0, smithy_client_1.map)({
268
- $metadata: deserializeMetadata(output),
269
- });
270
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
271
- const doc = (0, smithy_client_1.take)(data, {
272
- BlockSize: smithy_client_1.expectInt32,
273
- Blocks: smithy_client_1._json,
274
- ExpiryTime: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
275
- NextToken: smithy_client_1.expectString,
276
- VolumeSize: smithy_client_1.expectLong,
277
- });
278
- Object.assign(contents, doc);
279
- return contents;
280
- };
281
- exports.de_ListSnapshotBlocksCommand = de_ListSnapshotBlocksCommand;
282
- const de_ListSnapshotBlocksCommandError = async (output, context) => {
283
- const parsedOutput = {
284
- ...output,
285
- body: await parseErrorBody(output.body, context),
286
- };
287
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
288
- switch (errorCode) {
289
- case "AccessDeniedException":
290
- case "com.amazonaws.ebs#AccessDeniedException":
291
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
292
- case "InternalServerException":
293
- case "com.amazonaws.ebs#InternalServerException":
294
- throw await de_InternalServerExceptionRes(parsedOutput, context);
295
- case "RequestThrottledException":
296
- case "com.amazonaws.ebs#RequestThrottledException":
297
- throw await de_RequestThrottledExceptionRes(parsedOutput, context);
298
- case "ResourceNotFoundException":
299
- case "com.amazonaws.ebs#ResourceNotFoundException":
300
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
301
- case "ServiceQuotaExceededException":
302
- case "com.amazonaws.ebs#ServiceQuotaExceededException":
303
- throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
304
- case "ValidationException":
305
- case "com.amazonaws.ebs#ValidationException":
306
- throw await de_ValidationExceptionRes(parsedOutput, context);
307
- default:
308
- const parsedBody = parsedOutput.body;
309
- return throwDefaultError({
310
- output,
311
- parsedBody,
312
- errorCode,
313
- });
314
- }
315
- };
316
- const de_PutSnapshotBlockCommand = async (output, context) => {
317
- if (output.statusCode !== 201 && output.statusCode >= 300) {
318
- return de_PutSnapshotBlockCommandError(output, context);
319
- }
320
- const contents = (0, smithy_client_1.map)({
321
- $metadata: deserializeMetadata(output),
322
- [_C]: [, output.headers[_xac_]],
323
- [_CA]: [, output.headers[_xaca]],
324
- });
325
- await (0, smithy_client_1.collectBody)(output.body, context);
326
- return contents;
327
- };
328
- exports.de_PutSnapshotBlockCommand = de_PutSnapshotBlockCommand;
329
- const de_PutSnapshotBlockCommandError = async (output, context) => {
330
- const parsedOutput = {
331
- ...output,
332
- body: await parseErrorBody(output.body, context),
333
- };
334
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
335
- switch (errorCode) {
336
- case "AccessDeniedException":
337
- case "com.amazonaws.ebs#AccessDeniedException":
338
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
339
- case "InternalServerException":
340
- case "com.amazonaws.ebs#InternalServerException":
341
- throw await de_InternalServerExceptionRes(parsedOutput, context);
342
- case "RequestThrottledException":
343
- case "com.amazonaws.ebs#RequestThrottledException":
344
- throw await de_RequestThrottledExceptionRes(parsedOutput, context);
345
- case "ResourceNotFoundException":
346
- case "com.amazonaws.ebs#ResourceNotFoundException":
347
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
348
- case "ServiceQuotaExceededException":
349
- case "com.amazonaws.ebs#ServiceQuotaExceededException":
350
- throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
351
- case "ValidationException":
352
- case "com.amazonaws.ebs#ValidationException":
353
- throw await de_ValidationExceptionRes(parsedOutput, context);
354
- default:
355
- const parsedBody = parsedOutput.body;
356
- return throwDefaultError({
357
- output,
358
- parsedBody,
359
- errorCode,
360
- });
361
- }
362
- };
363
- const de_StartSnapshotCommand = async (output, context) => {
364
- if (output.statusCode !== 201 && output.statusCode >= 300) {
365
- return de_StartSnapshotCommandError(output, context);
366
- }
367
- const contents = (0, smithy_client_1.map)({
368
- $metadata: deserializeMetadata(output),
369
- });
370
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
371
- const doc = (0, smithy_client_1.take)(data, {
372
- BlockSize: smithy_client_1.expectInt32,
373
- Description: smithy_client_1.expectString,
374
- KmsKeyArn: smithy_client_1.expectString,
375
- OwnerId: smithy_client_1.expectString,
376
- ParentSnapshotId: smithy_client_1.expectString,
377
- SnapshotId: smithy_client_1.expectString,
378
- SseType: smithy_client_1.expectString,
379
- StartTime: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
380
- Status: smithy_client_1.expectString,
381
- Tags: smithy_client_1._json,
382
- VolumeSize: smithy_client_1.expectLong,
383
- });
384
- Object.assign(contents, doc);
385
- return contents;
386
- };
387
- exports.de_StartSnapshotCommand = de_StartSnapshotCommand;
388
- const de_StartSnapshotCommandError = async (output, context) => {
389
- const parsedOutput = {
390
- ...output,
391
- body: await parseErrorBody(output.body, context),
392
- };
393
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
394
- switch (errorCode) {
395
- case "AccessDeniedException":
396
- case "com.amazonaws.ebs#AccessDeniedException":
397
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
398
- case "ConcurrentLimitExceededException":
399
- case "com.amazonaws.ebs#ConcurrentLimitExceededException":
400
- throw await de_ConcurrentLimitExceededExceptionRes(parsedOutput, context);
401
- case "ConflictException":
402
- case "com.amazonaws.ebs#ConflictException":
403
- throw await de_ConflictExceptionRes(parsedOutput, context);
404
- case "InternalServerException":
405
- case "com.amazonaws.ebs#InternalServerException":
406
- throw await de_InternalServerExceptionRes(parsedOutput, context);
407
- case "RequestThrottledException":
408
- case "com.amazonaws.ebs#RequestThrottledException":
409
- throw await de_RequestThrottledExceptionRes(parsedOutput, context);
410
- case "ResourceNotFoundException":
411
- case "com.amazonaws.ebs#ResourceNotFoundException":
412
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
413
- case "ServiceQuotaExceededException":
414
- case "com.amazonaws.ebs#ServiceQuotaExceededException":
415
- throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
416
- case "ValidationException":
417
- case "com.amazonaws.ebs#ValidationException":
418
- throw await de_ValidationExceptionRes(parsedOutput, context);
419
- default:
420
- const parsedBody = parsedOutput.body;
421
- return throwDefaultError({
422
- output,
423
- parsedBody,
424
- errorCode,
425
- });
426
- }
427
- };
428
- const throwDefaultError = (0, smithy_client_1.withBaseException)(EBSServiceException_1.EBSServiceException);
429
- const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
430
- const contents = (0, smithy_client_1.map)({});
431
- const data = parsedOutput.body;
432
- const doc = (0, smithy_client_1.take)(data, {
433
- Message: smithy_client_1.expectString,
434
- Reason: smithy_client_1.expectString,
435
- });
436
- Object.assign(contents, doc);
437
- const exception = new models_0_1.AccessDeniedException({
438
- $metadata: deserializeMetadata(parsedOutput),
439
- ...contents,
440
- });
441
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
442
- };
443
- const de_ConcurrentLimitExceededExceptionRes = async (parsedOutput, context) => {
444
- const contents = (0, smithy_client_1.map)({});
445
- const data = parsedOutput.body;
446
- const doc = (0, smithy_client_1.take)(data, {
447
- Message: smithy_client_1.expectString,
448
- });
449
- Object.assign(contents, doc);
450
- const exception = new models_0_1.ConcurrentLimitExceededException({
451
- $metadata: deserializeMetadata(parsedOutput),
452
- ...contents,
453
- });
454
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
455
- };
456
- const de_ConflictExceptionRes = async (parsedOutput, context) => {
457
- const contents = (0, smithy_client_1.map)({});
458
- const data = parsedOutput.body;
459
- const doc = (0, smithy_client_1.take)(data, {
460
- Message: smithy_client_1.expectString,
461
- });
462
- Object.assign(contents, doc);
463
- const exception = new models_0_1.ConflictException({
464
- $metadata: deserializeMetadata(parsedOutput),
465
- ...contents,
466
- });
467
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
468
- };
469
- const de_InternalServerExceptionRes = async (parsedOutput, context) => {
470
- const contents = (0, smithy_client_1.map)({});
471
- const data = parsedOutput.body;
472
- const doc = (0, smithy_client_1.take)(data, {
473
- Message: smithy_client_1.expectString,
474
- });
475
- Object.assign(contents, doc);
476
- const exception = new models_0_1.InternalServerException({
477
- $metadata: deserializeMetadata(parsedOutput),
478
- ...contents,
479
- });
480
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
481
- };
482
- const de_RequestThrottledExceptionRes = async (parsedOutput, context) => {
483
- const contents = (0, smithy_client_1.map)({});
484
- const data = parsedOutput.body;
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);
490
- const exception = new models_0_1.RequestThrottledException({
491
- $metadata: deserializeMetadata(parsedOutput),
492
- ...contents,
493
- });
494
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
495
- };
496
- const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
497
- const contents = (0, smithy_client_1.map)({});
498
- const data = parsedOutput.body;
499
- const doc = (0, smithy_client_1.take)(data, {
500
- Message: smithy_client_1.expectString,
501
- Reason: smithy_client_1.expectString,
502
- });
503
- Object.assign(contents, doc);
504
- const exception = new models_0_1.ResourceNotFoundException({
505
- $metadata: deserializeMetadata(parsedOutput),
506
- ...contents,
507
- });
508
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
509
- };
510
- const de_ServiceQuotaExceededExceptionRes = async (parsedOutput, context) => {
511
- const contents = (0, smithy_client_1.map)({});
512
- const data = parsedOutput.body;
513
- const doc = (0, smithy_client_1.take)(data, {
514
- Message: smithy_client_1.expectString,
515
- Reason: smithy_client_1.expectString,
516
- });
517
- Object.assign(contents, doc);
518
- const exception = new models_0_1.ServiceQuotaExceededException({
519
- $metadata: deserializeMetadata(parsedOutput),
520
- ...contents,
521
- });
522
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
523
- };
524
- const de_ValidationExceptionRes = async (parsedOutput, context) => {
525
- const contents = (0, smithy_client_1.map)({});
526
- const data = parsedOutput.body;
527
- const doc = (0, smithy_client_1.take)(data, {
528
- Message: smithy_client_1.expectString,
529
- Reason: smithy_client_1.expectString,
530
- });
531
- Object.assign(contents, doc);
532
- const exception = new models_0_1.ValidationException({
533
- $metadata: deserializeMetadata(parsedOutput),
534
- ...contents,
535
- });
536
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
537
- };
538
- const deserializeMetadata = (output) => ({
539
- httpStatusCode: output.statusCode,
540
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
541
- extendedRequestId: output.headers["x-amz-id-2"],
542
- cfId: output.headers["x-amz-cf-id"],
543
- });
544
- const collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body));
545
- const isSerializableHeaderValue = (value) => value !== undefined &&
546
- value !== null &&
547
- value !== "" &&
548
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
549
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
550
- const _BT = "BlockToken";
551
- const _C = "Checksum";
552
- const _CA = "ChecksumAlgorithm";
553
- const _CAM = "ChecksumAggregationMethod";
554
- const _CBC = "ChangedBlocksCount";
555
- const _DL = "DataLength";
556
- const _FSI = "FirstSnapshotId";
557
- const _MR = "MaxResults";
558
- const _NT = "NextToken";
559
- const _P = "Progress";
560
- const _SBI = "StartingBlockIndex";
561
- const _bT = "blockToken";
562
- const _fSI = "firstSnapshotId";
563
- const _mR = "maxResults";
564
- const _pT = "pageToken";
565
- const _sBI = "startingBlockIndex";
566
- const _xac = "x-amz-changedblockscount";
567
- const _xac_ = "x-amz-checksum";
568
- const _xaca = "x-amz-checksum-algorithm";
569
- const _xacam = "x-amz-checksum-aggregation-method";
570
- const _xadl = "x-amz-data-length";
571
- const _xap = "x-amz-progress";
572
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
573
- if (encoded.length) {
574
- return JSON.parse(encoded);
575
- }
576
- return {};
577
- });
578
- const parseErrorBody = async (errorBody, context) => {
579
- const value = await parseBody(errorBody, context);
580
- value.message = value.message ?? value.Message;
581
- return value;
582
- };
583
- const loadRestJsonErrorCode = (output, data) => {
584
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
585
- const sanitizeErrorCode = (rawValue) => {
586
- let cleanValue = rawValue;
587
- if (typeof cleanValue === "number") {
588
- cleanValue = cleanValue.toString();
589
- }
590
- if (cleanValue.indexOf(",") >= 0) {
591
- cleanValue = cleanValue.split(",")[0];
592
- }
593
- if (cleanValue.indexOf(":") >= 0) {
594
- cleanValue = cleanValue.split(":")[0];
595
- }
596
- if (cleanValue.indexOf("#") >= 0) {
597
- cleanValue = cleanValue.split("#")[1];
598
- }
599
- return cleanValue;
600
- };
601
- const headerKey = findKey(output.headers, "x-amzn-errortype");
602
- if (headerKey !== undefined) {
603
- return sanitizeErrorCode(output.headers[headerKey]);
604
- }
605
- if (data.code !== undefined) {
606
- return sanitizeErrorCode(data.code);
607
- }
608
- if (data["__type"] !== undefined) {
609
- return sanitizeErrorCode(data["__type"]);
610
- }
611
- };
1
+ module.exports = require("../index.js");
@@ -1,22 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveRuntimeExtensions = void 0;
4
- const region_config_resolver_1 = require("@aws-sdk/region-config-resolver");
5
- const protocol_http_1 = require("@smithy/protocol-http");
6
- const smithy_client_1 = require("@smithy/smithy-client");
7
- const asPartial = (t) => t;
8
- const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
9
- const extensionConfiguration = {
10
- ...asPartial((0, region_config_resolver_1.getAwsRegionExtensionConfiguration)(runtimeConfig)),
11
- ...asPartial((0, smithy_client_1.getDefaultExtensionConfiguration)(runtimeConfig)),
12
- ...asPartial((0, protocol_http_1.getHttpHandlerExtensionConfiguration)(runtimeConfig)),
13
- };
14
- extensions.forEach((extension) => extension.configure(extensionConfiguration));
15
- return {
16
- ...runtimeConfig,
17
- ...(0, region_config_resolver_1.resolveAwsRegionExtensionConfiguration)(extensionConfiguration),
18
- ...(0, smithy_client_1.resolveDefaultRuntimeConfig)(extensionConfiguration),
19
- ...(0, protocol_http_1.resolveHttpHandlerRuntimeConfig)(extensionConfiguration),
20
- };
21
- };
22
- exports.resolveRuntimeExtensions = resolveRuntimeExtensions;
1
+ module.exports = require("./index.js");