@aws-sdk/client-osis 3.490.0 → 3.496.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist-cjs/OSIS.js +1 -39
  2. package/dist-cjs/OSISClient.js +1 -43
  3. package/dist-cjs/commands/CreatePipelineCommand.js +1 -28
  4. package/dist-cjs/commands/DeletePipelineCommand.js +1 -28
  5. package/dist-cjs/commands/GetPipelineBlueprintCommand.js +1 -28
  6. package/dist-cjs/commands/GetPipelineChangeProgressCommand.js +1 -28
  7. package/dist-cjs/commands/GetPipelineCommand.js +1 -28
  8. package/dist-cjs/commands/ListPipelineBlueprintsCommand.js +1 -28
  9. package/dist-cjs/commands/ListPipelinesCommand.js +1 -28
  10. package/dist-cjs/commands/ListTagsForResourceCommand.js +1 -28
  11. package/dist-cjs/commands/StartPipelineCommand.js +1 -28
  12. package/dist-cjs/commands/StopPipelineCommand.js +1 -28
  13. package/dist-cjs/commands/TagResourceCommand.js +1 -28
  14. package/dist-cjs/commands/UntagResourceCommand.js +1 -28
  15. package/dist-cjs/commands/UpdatePipelineCommand.js +1 -28
  16. package/dist-cjs/commands/ValidatePipelineCommand.js +1 -28
  17. package/dist-cjs/commands/index.js +1 -17
  18. package/dist-cjs/endpoint/EndpointParameters.js +1 -18
  19. package/dist-cjs/extensionConfiguration.js +1 -2
  20. package/dist-cjs/index.js +1638 -11
  21. package/dist-cjs/models/OSISServiceException.js +1 -12
  22. package/dist-cjs/models/index.js +1 -4
  23. package/dist-cjs/models/models_0.js +1 -135
  24. package/dist-cjs/pagination/Interfaces.js +1 -2
  25. package/dist-cjs/pagination/ListPipelinesPaginator.js +1 -7
  26. package/dist-cjs/pagination/index.js +1 -5
  27. package/dist-cjs/protocols/Aws_restJson1.js +1 -1040
  28. package/dist-cjs/runtimeExtensions.js +1 -22
  29. package/package.json +40 -40
@@ -1,1040 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.de_ValidatePipelineCommand = exports.de_UpdatePipelineCommand = exports.de_UntagResourceCommand = exports.de_TagResourceCommand = exports.de_StopPipelineCommand = exports.de_StartPipelineCommand = exports.de_ListTagsForResourceCommand = exports.de_ListPipelinesCommand = exports.de_ListPipelineBlueprintsCommand = exports.de_GetPipelineChangeProgressCommand = exports.de_GetPipelineBlueprintCommand = exports.de_GetPipelineCommand = exports.de_DeletePipelineCommand = exports.de_CreatePipelineCommand = exports.se_ValidatePipelineCommand = exports.se_UpdatePipelineCommand = exports.se_UntagResourceCommand = exports.se_TagResourceCommand = exports.se_StopPipelineCommand = exports.se_StartPipelineCommand = exports.se_ListTagsForResourceCommand = exports.se_ListPipelinesCommand = exports.se_ListPipelineBlueprintsCommand = exports.se_GetPipelineChangeProgressCommand = exports.se_GetPipelineBlueprintCommand = exports.se_GetPipelineCommand = exports.se_DeletePipelineCommand = exports.se_CreatePipelineCommand = void 0;
4
- const core_1 = require("@smithy/core");
5
- const smithy_client_1 = require("@smithy/smithy-client");
6
- const models_0_1 = require("../models/models_0");
7
- const OSISServiceException_1 = require("../models/OSISServiceException");
8
- const se_CreatePipelineCommand = async (input, context) => {
9
- const b = (0, core_1.requestBuilder)(input, context);
10
- const headers = {
11
- "content-type": "application/json",
12
- };
13
- b.bp("/2022-01-01/osis/createPipeline");
14
- let body;
15
- body = JSON.stringify((0, smithy_client_1.take)(input, {
16
- BufferOptions: (_) => (0, smithy_client_1._json)(_),
17
- EncryptionAtRestOptions: (_) => (0, smithy_client_1._json)(_),
18
- LogPublishingOptions: (_) => (0, smithy_client_1._json)(_),
19
- MaxUnits: [],
20
- MinUnits: [],
21
- PipelineConfigurationBody: [],
22
- PipelineName: [],
23
- Tags: (_) => (0, smithy_client_1._json)(_),
24
- VpcOptions: (_) => (0, smithy_client_1._json)(_),
25
- }));
26
- b.m("POST").h(headers).b(body);
27
- return b.build();
28
- };
29
- exports.se_CreatePipelineCommand = se_CreatePipelineCommand;
30
- const se_DeletePipelineCommand = async (input, context) => {
31
- const b = (0, core_1.requestBuilder)(input, context);
32
- const headers = {};
33
- b.bp("/2022-01-01/osis/deletePipeline/{PipelineName}");
34
- b.p("PipelineName", () => input.PipelineName, "{PipelineName}", false);
35
- let body;
36
- b.m("DELETE").h(headers).b(body);
37
- return b.build();
38
- };
39
- exports.se_DeletePipelineCommand = se_DeletePipelineCommand;
40
- const se_GetPipelineCommand = async (input, context) => {
41
- const b = (0, core_1.requestBuilder)(input, context);
42
- const headers = {};
43
- b.bp("/2022-01-01/osis/getPipeline/{PipelineName}");
44
- b.p("PipelineName", () => input.PipelineName, "{PipelineName}", false);
45
- let body;
46
- b.m("GET").h(headers).b(body);
47
- return b.build();
48
- };
49
- exports.se_GetPipelineCommand = se_GetPipelineCommand;
50
- const se_GetPipelineBlueprintCommand = async (input, context) => {
51
- const b = (0, core_1.requestBuilder)(input, context);
52
- const headers = {};
53
- b.bp("/2022-01-01/osis/getPipelineBlueprint/{BlueprintName}");
54
- b.p("BlueprintName", () => input.BlueprintName, "{BlueprintName}", false);
55
- let body;
56
- b.m("GET").h(headers).b(body);
57
- return b.build();
58
- };
59
- exports.se_GetPipelineBlueprintCommand = se_GetPipelineBlueprintCommand;
60
- const se_GetPipelineChangeProgressCommand = async (input, context) => {
61
- const b = (0, core_1.requestBuilder)(input, context);
62
- const headers = {};
63
- b.bp("/2022-01-01/osis/getPipelineChangeProgress/{PipelineName}");
64
- b.p("PipelineName", () => input.PipelineName, "{PipelineName}", false);
65
- let body;
66
- b.m("GET").h(headers).b(body);
67
- return b.build();
68
- };
69
- exports.se_GetPipelineChangeProgressCommand = se_GetPipelineChangeProgressCommand;
70
- const se_ListPipelineBlueprintsCommand = async (input, context) => {
71
- const b = (0, core_1.requestBuilder)(input, context);
72
- const headers = {
73
- "content-type": "application/json",
74
- };
75
- b.bp("/2022-01-01/osis/listPipelineBlueprints");
76
- let body;
77
- body = "";
78
- b.m("POST").h(headers).b(body);
79
- return b.build();
80
- };
81
- exports.se_ListPipelineBlueprintsCommand = se_ListPipelineBlueprintsCommand;
82
- const se_ListPipelinesCommand = async (input, context) => {
83
- const b = (0, core_1.requestBuilder)(input, context);
84
- const headers = {};
85
- b.bp("/2022-01-01/osis/listPipelines");
86
- const query = (0, smithy_client_1.map)({
87
- [_mR]: [() => input.MaxResults !== void 0, () => input[_MR].toString()],
88
- [_nT]: [, input[_NT]],
89
- });
90
- let body;
91
- b.m("GET").h(headers).q(query).b(body);
92
- return b.build();
93
- };
94
- exports.se_ListPipelinesCommand = se_ListPipelinesCommand;
95
- const se_ListTagsForResourceCommand = async (input, context) => {
96
- const b = (0, core_1.requestBuilder)(input, context);
97
- const headers = {};
98
- b.bp("/2022-01-01/osis/listTagsForResource");
99
- const query = (0, smithy_client_1.map)({
100
- [_a]: [, (0, smithy_client_1.expectNonNull)(input[_A], `Arn`)],
101
- });
102
- let body;
103
- b.m("GET").h(headers).q(query).b(body);
104
- return b.build();
105
- };
106
- exports.se_ListTagsForResourceCommand = se_ListTagsForResourceCommand;
107
- const se_StartPipelineCommand = async (input, context) => {
108
- const b = (0, core_1.requestBuilder)(input, context);
109
- const headers = {};
110
- b.bp("/2022-01-01/osis/startPipeline/{PipelineName}");
111
- b.p("PipelineName", () => input.PipelineName, "{PipelineName}", false);
112
- let body;
113
- b.m("PUT").h(headers).b(body);
114
- return b.build();
115
- };
116
- exports.se_StartPipelineCommand = se_StartPipelineCommand;
117
- const se_StopPipelineCommand = async (input, context) => {
118
- const b = (0, core_1.requestBuilder)(input, context);
119
- const headers = {};
120
- b.bp("/2022-01-01/osis/stopPipeline/{PipelineName}");
121
- b.p("PipelineName", () => input.PipelineName, "{PipelineName}", false);
122
- let body;
123
- b.m("PUT").h(headers).b(body);
124
- return b.build();
125
- };
126
- exports.se_StopPipelineCommand = se_StopPipelineCommand;
127
- const se_TagResourceCommand = async (input, context) => {
128
- const b = (0, core_1.requestBuilder)(input, context);
129
- const headers = {
130
- "content-type": "application/json",
131
- };
132
- b.bp("/2022-01-01/osis/tagResource");
133
- const query = (0, smithy_client_1.map)({
134
- [_a]: [, (0, smithy_client_1.expectNonNull)(input[_A], `Arn`)],
135
- });
136
- let body;
137
- body = JSON.stringify((0, smithy_client_1.take)(input, {
138
- Tags: (_) => (0, smithy_client_1._json)(_),
139
- }));
140
- b.m("POST").h(headers).q(query).b(body);
141
- return b.build();
142
- };
143
- exports.se_TagResourceCommand = se_TagResourceCommand;
144
- const se_UntagResourceCommand = async (input, context) => {
145
- const b = (0, core_1.requestBuilder)(input, context);
146
- const headers = {
147
- "content-type": "application/json",
148
- };
149
- b.bp("/2022-01-01/osis/untagResource");
150
- const query = (0, smithy_client_1.map)({
151
- [_a]: [, (0, smithy_client_1.expectNonNull)(input[_A], `Arn`)],
152
- });
153
- let body;
154
- body = JSON.stringify((0, smithy_client_1.take)(input, {
155
- TagKeys: (_) => (0, smithy_client_1._json)(_),
156
- }));
157
- b.m("POST").h(headers).q(query).b(body);
158
- return b.build();
159
- };
160
- exports.se_UntagResourceCommand = se_UntagResourceCommand;
161
- const se_UpdatePipelineCommand = async (input, context) => {
162
- const b = (0, core_1.requestBuilder)(input, context);
163
- const headers = {
164
- "content-type": "application/json",
165
- };
166
- b.bp("/2022-01-01/osis/updatePipeline/{PipelineName}");
167
- b.p("PipelineName", () => input.PipelineName, "{PipelineName}", false);
168
- let body;
169
- body = JSON.stringify((0, smithy_client_1.take)(input, {
170
- BufferOptions: (_) => (0, smithy_client_1._json)(_),
171
- EncryptionAtRestOptions: (_) => (0, smithy_client_1._json)(_),
172
- LogPublishingOptions: (_) => (0, smithy_client_1._json)(_),
173
- MaxUnits: [],
174
- MinUnits: [],
175
- PipelineConfigurationBody: [],
176
- }));
177
- b.m("PUT").h(headers).b(body);
178
- return b.build();
179
- };
180
- exports.se_UpdatePipelineCommand = se_UpdatePipelineCommand;
181
- const se_ValidatePipelineCommand = async (input, context) => {
182
- const b = (0, core_1.requestBuilder)(input, context);
183
- const headers = {
184
- "content-type": "application/json",
185
- };
186
- b.bp("/2022-01-01/osis/validatePipeline");
187
- let body;
188
- body = JSON.stringify((0, smithy_client_1.take)(input, {
189
- PipelineConfigurationBody: [],
190
- }));
191
- b.m("POST").h(headers).b(body);
192
- return b.build();
193
- };
194
- exports.se_ValidatePipelineCommand = se_ValidatePipelineCommand;
195
- const de_CreatePipelineCommand = async (output, context) => {
196
- if (output.statusCode !== 200 && output.statusCode >= 300) {
197
- return de_CreatePipelineCommandError(output, context);
198
- }
199
- const contents = (0, smithy_client_1.map)({
200
- $metadata: deserializeMetadata(output),
201
- });
202
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
203
- const doc = (0, smithy_client_1.take)(data, {
204
- Pipeline: (_) => de_Pipeline(_, context),
205
- });
206
- Object.assign(contents, doc);
207
- return contents;
208
- };
209
- exports.de_CreatePipelineCommand = de_CreatePipelineCommand;
210
- const de_CreatePipelineCommandError = async (output, context) => {
211
- const parsedOutput = {
212
- ...output,
213
- body: await parseErrorBody(output.body, context),
214
- };
215
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
216
- switch (errorCode) {
217
- case "AccessDeniedException":
218
- case "com.amazonaws.osis#AccessDeniedException":
219
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
220
- case "InternalException":
221
- case "com.amazonaws.osis#InternalException":
222
- throw await de_InternalExceptionRes(parsedOutput, context);
223
- case "LimitExceededException":
224
- case "com.amazonaws.osis#LimitExceededException":
225
- throw await de_LimitExceededExceptionRes(parsedOutput, context);
226
- case "ResourceAlreadyExistsException":
227
- case "com.amazonaws.osis#ResourceAlreadyExistsException":
228
- throw await de_ResourceAlreadyExistsExceptionRes(parsedOutput, context);
229
- case "ResourceNotFoundException":
230
- case "com.amazonaws.osis#ResourceNotFoundException":
231
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
232
- case "ValidationException":
233
- case "com.amazonaws.osis#ValidationException":
234
- throw await de_ValidationExceptionRes(parsedOutput, context);
235
- default:
236
- const parsedBody = parsedOutput.body;
237
- return throwDefaultError({
238
- output,
239
- parsedBody,
240
- errorCode,
241
- });
242
- }
243
- };
244
- const de_DeletePipelineCommand = async (output, context) => {
245
- if (output.statusCode !== 200 && output.statusCode >= 300) {
246
- return de_DeletePipelineCommandError(output, context);
247
- }
248
- const contents = (0, smithy_client_1.map)({
249
- $metadata: deserializeMetadata(output),
250
- });
251
- await (0, smithy_client_1.collectBody)(output.body, context);
252
- return contents;
253
- };
254
- exports.de_DeletePipelineCommand = de_DeletePipelineCommand;
255
- const de_DeletePipelineCommandError = async (output, context) => {
256
- const parsedOutput = {
257
- ...output,
258
- body: await parseErrorBody(output.body, context),
259
- };
260
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
261
- switch (errorCode) {
262
- case "AccessDeniedException":
263
- case "com.amazonaws.osis#AccessDeniedException":
264
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
265
- case "ConflictException":
266
- case "com.amazonaws.osis#ConflictException":
267
- throw await de_ConflictExceptionRes(parsedOutput, context);
268
- case "InternalException":
269
- case "com.amazonaws.osis#InternalException":
270
- throw await de_InternalExceptionRes(parsedOutput, context);
271
- case "ResourceNotFoundException":
272
- case "com.amazonaws.osis#ResourceNotFoundException":
273
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
274
- case "ValidationException":
275
- case "com.amazonaws.osis#ValidationException":
276
- throw await de_ValidationExceptionRes(parsedOutput, context);
277
- default:
278
- const parsedBody = parsedOutput.body;
279
- return throwDefaultError({
280
- output,
281
- parsedBody,
282
- errorCode,
283
- });
284
- }
285
- };
286
- const de_GetPipelineCommand = async (output, context) => {
287
- if (output.statusCode !== 200 && output.statusCode >= 300) {
288
- return de_GetPipelineCommandError(output, context);
289
- }
290
- const contents = (0, smithy_client_1.map)({
291
- $metadata: deserializeMetadata(output),
292
- });
293
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
294
- const doc = (0, smithy_client_1.take)(data, {
295
- Pipeline: (_) => de_Pipeline(_, context),
296
- });
297
- Object.assign(contents, doc);
298
- return contents;
299
- };
300
- exports.de_GetPipelineCommand = de_GetPipelineCommand;
301
- const de_GetPipelineCommandError = async (output, context) => {
302
- const parsedOutput = {
303
- ...output,
304
- body: await parseErrorBody(output.body, context),
305
- };
306
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
307
- switch (errorCode) {
308
- case "AccessDeniedException":
309
- case "com.amazonaws.osis#AccessDeniedException":
310
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
311
- case "InternalException":
312
- case "com.amazonaws.osis#InternalException":
313
- throw await de_InternalExceptionRes(parsedOutput, context);
314
- case "ResourceNotFoundException":
315
- case "com.amazonaws.osis#ResourceNotFoundException":
316
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
317
- case "ValidationException":
318
- case "com.amazonaws.osis#ValidationException":
319
- throw await de_ValidationExceptionRes(parsedOutput, context);
320
- default:
321
- const parsedBody = parsedOutput.body;
322
- return throwDefaultError({
323
- output,
324
- parsedBody,
325
- errorCode,
326
- });
327
- }
328
- };
329
- const de_GetPipelineBlueprintCommand = async (output, context) => {
330
- if (output.statusCode !== 200 && output.statusCode >= 300) {
331
- return de_GetPipelineBlueprintCommandError(output, context);
332
- }
333
- const contents = (0, smithy_client_1.map)({
334
- $metadata: deserializeMetadata(output),
335
- });
336
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
337
- const doc = (0, smithy_client_1.take)(data, {
338
- Blueprint: smithy_client_1._json,
339
- });
340
- Object.assign(contents, doc);
341
- return contents;
342
- };
343
- exports.de_GetPipelineBlueprintCommand = de_GetPipelineBlueprintCommand;
344
- const de_GetPipelineBlueprintCommandError = async (output, context) => {
345
- const parsedOutput = {
346
- ...output,
347
- body: await parseErrorBody(output.body, context),
348
- };
349
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
350
- switch (errorCode) {
351
- case "AccessDeniedException":
352
- case "com.amazonaws.osis#AccessDeniedException":
353
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
354
- case "InternalException":
355
- case "com.amazonaws.osis#InternalException":
356
- throw await de_InternalExceptionRes(parsedOutput, context);
357
- case "ResourceNotFoundException":
358
- case "com.amazonaws.osis#ResourceNotFoundException":
359
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
360
- case "ValidationException":
361
- case "com.amazonaws.osis#ValidationException":
362
- throw await de_ValidationExceptionRes(parsedOutput, context);
363
- default:
364
- const parsedBody = parsedOutput.body;
365
- return throwDefaultError({
366
- output,
367
- parsedBody,
368
- errorCode,
369
- });
370
- }
371
- };
372
- const de_GetPipelineChangeProgressCommand = async (output, context) => {
373
- if (output.statusCode !== 200 && output.statusCode >= 300) {
374
- return de_GetPipelineChangeProgressCommandError(output, context);
375
- }
376
- const contents = (0, smithy_client_1.map)({
377
- $metadata: deserializeMetadata(output),
378
- });
379
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
380
- const doc = (0, smithy_client_1.take)(data, {
381
- ChangeProgressStatuses: (_) => de_ChangeProgressStatusList(_, context),
382
- });
383
- Object.assign(contents, doc);
384
- return contents;
385
- };
386
- exports.de_GetPipelineChangeProgressCommand = de_GetPipelineChangeProgressCommand;
387
- const de_GetPipelineChangeProgressCommandError = async (output, context) => {
388
- const parsedOutput = {
389
- ...output,
390
- body: await parseErrorBody(output.body, context),
391
- };
392
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
393
- switch (errorCode) {
394
- case "AccessDeniedException":
395
- case "com.amazonaws.osis#AccessDeniedException":
396
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
397
- case "InternalException":
398
- case "com.amazonaws.osis#InternalException":
399
- throw await de_InternalExceptionRes(parsedOutput, context);
400
- case "ResourceNotFoundException":
401
- case "com.amazonaws.osis#ResourceNotFoundException":
402
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
403
- case "ValidationException":
404
- case "com.amazonaws.osis#ValidationException":
405
- throw await de_ValidationExceptionRes(parsedOutput, context);
406
- default:
407
- const parsedBody = parsedOutput.body;
408
- return throwDefaultError({
409
- output,
410
- parsedBody,
411
- errorCode,
412
- });
413
- }
414
- };
415
- const de_ListPipelineBlueprintsCommand = async (output, context) => {
416
- if (output.statusCode !== 200 && output.statusCode >= 300) {
417
- return de_ListPipelineBlueprintsCommandError(output, context);
418
- }
419
- const contents = (0, smithy_client_1.map)({
420
- $metadata: deserializeMetadata(output),
421
- });
422
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
423
- const doc = (0, smithy_client_1.take)(data, {
424
- Blueprints: smithy_client_1._json,
425
- });
426
- Object.assign(contents, doc);
427
- return contents;
428
- };
429
- exports.de_ListPipelineBlueprintsCommand = de_ListPipelineBlueprintsCommand;
430
- const de_ListPipelineBlueprintsCommandError = async (output, context) => {
431
- const parsedOutput = {
432
- ...output,
433
- body: await parseErrorBody(output.body, context),
434
- };
435
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
436
- switch (errorCode) {
437
- case "AccessDeniedException":
438
- case "com.amazonaws.osis#AccessDeniedException":
439
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
440
- case "InternalException":
441
- case "com.amazonaws.osis#InternalException":
442
- throw await de_InternalExceptionRes(parsedOutput, context);
443
- case "InvalidPaginationTokenException":
444
- case "com.amazonaws.osis#InvalidPaginationTokenException":
445
- throw await de_InvalidPaginationTokenExceptionRes(parsedOutput, context);
446
- case "ValidationException":
447
- case "com.amazonaws.osis#ValidationException":
448
- throw await de_ValidationExceptionRes(parsedOutput, context);
449
- default:
450
- const parsedBody = parsedOutput.body;
451
- return throwDefaultError({
452
- output,
453
- parsedBody,
454
- errorCode,
455
- });
456
- }
457
- };
458
- const de_ListPipelinesCommand = async (output, context) => {
459
- if (output.statusCode !== 200 && output.statusCode >= 300) {
460
- return de_ListPipelinesCommandError(output, context);
461
- }
462
- const contents = (0, smithy_client_1.map)({
463
- $metadata: deserializeMetadata(output),
464
- });
465
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
466
- const doc = (0, smithy_client_1.take)(data, {
467
- NextToken: smithy_client_1.expectString,
468
- Pipelines: (_) => de_PipelineSummaryList(_, context),
469
- });
470
- Object.assign(contents, doc);
471
- return contents;
472
- };
473
- exports.de_ListPipelinesCommand = de_ListPipelinesCommand;
474
- const de_ListPipelinesCommandError = async (output, context) => {
475
- const parsedOutput = {
476
- ...output,
477
- body: await parseErrorBody(output.body, context),
478
- };
479
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
480
- switch (errorCode) {
481
- case "AccessDeniedException":
482
- case "com.amazonaws.osis#AccessDeniedException":
483
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
484
- case "InternalException":
485
- case "com.amazonaws.osis#InternalException":
486
- throw await de_InternalExceptionRes(parsedOutput, context);
487
- case "InvalidPaginationTokenException":
488
- case "com.amazonaws.osis#InvalidPaginationTokenException":
489
- throw await de_InvalidPaginationTokenExceptionRes(parsedOutput, context);
490
- case "ValidationException":
491
- case "com.amazonaws.osis#ValidationException":
492
- throw await de_ValidationExceptionRes(parsedOutput, context);
493
- default:
494
- const parsedBody = parsedOutput.body;
495
- return throwDefaultError({
496
- output,
497
- parsedBody,
498
- errorCode,
499
- });
500
- }
501
- };
502
- const de_ListTagsForResourceCommand = async (output, context) => {
503
- if (output.statusCode !== 200 && output.statusCode >= 300) {
504
- return de_ListTagsForResourceCommandError(output, context);
505
- }
506
- const contents = (0, smithy_client_1.map)({
507
- $metadata: deserializeMetadata(output),
508
- });
509
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
510
- const doc = (0, smithy_client_1.take)(data, {
511
- Tags: smithy_client_1._json,
512
- });
513
- Object.assign(contents, doc);
514
- return contents;
515
- };
516
- exports.de_ListTagsForResourceCommand = de_ListTagsForResourceCommand;
517
- const de_ListTagsForResourceCommandError = async (output, context) => {
518
- const parsedOutput = {
519
- ...output,
520
- body: await parseErrorBody(output.body, context),
521
- };
522
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
523
- switch (errorCode) {
524
- case "AccessDeniedException":
525
- case "com.amazonaws.osis#AccessDeniedException":
526
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
527
- case "InternalException":
528
- case "com.amazonaws.osis#InternalException":
529
- throw await de_InternalExceptionRes(parsedOutput, context);
530
- case "ResourceNotFoundException":
531
- case "com.amazonaws.osis#ResourceNotFoundException":
532
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
533
- case "ValidationException":
534
- case "com.amazonaws.osis#ValidationException":
535
- throw await de_ValidationExceptionRes(parsedOutput, context);
536
- default:
537
- const parsedBody = parsedOutput.body;
538
- return throwDefaultError({
539
- output,
540
- parsedBody,
541
- errorCode,
542
- });
543
- }
544
- };
545
- const de_StartPipelineCommand = async (output, context) => {
546
- if (output.statusCode !== 200 && output.statusCode >= 300) {
547
- return de_StartPipelineCommandError(output, context);
548
- }
549
- const contents = (0, smithy_client_1.map)({
550
- $metadata: deserializeMetadata(output),
551
- });
552
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
553
- const doc = (0, smithy_client_1.take)(data, {
554
- Pipeline: (_) => de_Pipeline(_, context),
555
- });
556
- Object.assign(contents, doc);
557
- return contents;
558
- };
559
- exports.de_StartPipelineCommand = de_StartPipelineCommand;
560
- const de_StartPipelineCommandError = async (output, context) => {
561
- const parsedOutput = {
562
- ...output,
563
- body: await parseErrorBody(output.body, context),
564
- };
565
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
566
- switch (errorCode) {
567
- case "AccessDeniedException":
568
- case "com.amazonaws.osis#AccessDeniedException":
569
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
570
- case "ConflictException":
571
- case "com.amazonaws.osis#ConflictException":
572
- throw await de_ConflictExceptionRes(parsedOutput, context);
573
- case "InternalException":
574
- case "com.amazonaws.osis#InternalException":
575
- throw await de_InternalExceptionRes(parsedOutput, context);
576
- case "ResourceNotFoundException":
577
- case "com.amazonaws.osis#ResourceNotFoundException":
578
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
579
- case "ValidationException":
580
- case "com.amazonaws.osis#ValidationException":
581
- throw await de_ValidationExceptionRes(parsedOutput, context);
582
- default:
583
- const parsedBody = parsedOutput.body;
584
- return throwDefaultError({
585
- output,
586
- parsedBody,
587
- errorCode,
588
- });
589
- }
590
- };
591
- const de_StopPipelineCommand = async (output, context) => {
592
- if (output.statusCode !== 200 && output.statusCode >= 300) {
593
- return de_StopPipelineCommandError(output, context);
594
- }
595
- const contents = (0, smithy_client_1.map)({
596
- $metadata: deserializeMetadata(output),
597
- });
598
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
599
- const doc = (0, smithy_client_1.take)(data, {
600
- Pipeline: (_) => de_Pipeline(_, context),
601
- });
602
- Object.assign(contents, doc);
603
- return contents;
604
- };
605
- exports.de_StopPipelineCommand = de_StopPipelineCommand;
606
- const de_StopPipelineCommandError = async (output, context) => {
607
- const parsedOutput = {
608
- ...output,
609
- body: await parseErrorBody(output.body, context),
610
- };
611
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
612
- switch (errorCode) {
613
- case "AccessDeniedException":
614
- case "com.amazonaws.osis#AccessDeniedException":
615
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
616
- case "ConflictException":
617
- case "com.amazonaws.osis#ConflictException":
618
- throw await de_ConflictExceptionRes(parsedOutput, context);
619
- case "InternalException":
620
- case "com.amazonaws.osis#InternalException":
621
- throw await de_InternalExceptionRes(parsedOutput, context);
622
- case "ResourceNotFoundException":
623
- case "com.amazonaws.osis#ResourceNotFoundException":
624
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
625
- case "ValidationException":
626
- case "com.amazonaws.osis#ValidationException":
627
- throw await de_ValidationExceptionRes(parsedOutput, context);
628
- default:
629
- const parsedBody = parsedOutput.body;
630
- return throwDefaultError({
631
- output,
632
- parsedBody,
633
- errorCode,
634
- });
635
- }
636
- };
637
- const de_TagResourceCommand = async (output, context) => {
638
- if (output.statusCode !== 200 && output.statusCode >= 300) {
639
- return de_TagResourceCommandError(output, context);
640
- }
641
- const contents = (0, smithy_client_1.map)({
642
- $metadata: deserializeMetadata(output),
643
- });
644
- await (0, smithy_client_1.collectBody)(output.body, context);
645
- return contents;
646
- };
647
- exports.de_TagResourceCommand = de_TagResourceCommand;
648
- const de_TagResourceCommandError = async (output, context) => {
649
- const parsedOutput = {
650
- ...output,
651
- body: await parseErrorBody(output.body, context),
652
- };
653
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
654
- switch (errorCode) {
655
- case "AccessDeniedException":
656
- case "com.amazonaws.osis#AccessDeniedException":
657
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
658
- case "InternalException":
659
- case "com.amazonaws.osis#InternalException":
660
- throw await de_InternalExceptionRes(parsedOutput, context);
661
- case "LimitExceededException":
662
- case "com.amazonaws.osis#LimitExceededException":
663
- throw await de_LimitExceededExceptionRes(parsedOutput, context);
664
- case "ResourceNotFoundException":
665
- case "com.amazonaws.osis#ResourceNotFoundException":
666
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
667
- case "ValidationException":
668
- case "com.amazonaws.osis#ValidationException":
669
- throw await de_ValidationExceptionRes(parsedOutput, context);
670
- default:
671
- const parsedBody = parsedOutput.body;
672
- return throwDefaultError({
673
- output,
674
- parsedBody,
675
- errorCode,
676
- });
677
- }
678
- };
679
- const de_UntagResourceCommand = async (output, context) => {
680
- if (output.statusCode !== 200 && output.statusCode >= 300) {
681
- return de_UntagResourceCommandError(output, context);
682
- }
683
- const contents = (0, smithy_client_1.map)({
684
- $metadata: deserializeMetadata(output),
685
- });
686
- await (0, smithy_client_1.collectBody)(output.body, context);
687
- return contents;
688
- };
689
- exports.de_UntagResourceCommand = de_UntagResourceCommand;
690
- const de_UntagResourceCommandError = async (output, context) => {
691
- const parsedOutput = {
692
- ...output,
693
- body: await parseErrorBody(output.body, context),
694
- };
695
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
696
- switch (errorCode) {
697
- case "AccessDeniedException":
698
- case "com.amazonaws.osis#AccessDeniedException":
699
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
700
- case "InternalException":
701
- case "com.amazonaws.osis#InternalException":
702
- throw await de_InternalExceptionRes(parsedOutput, context);
703
- case "ResourceNotFoundException":
704
- case "com.amazonaws.osis#ResourceNotFoundException":
705
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
706
- case "ValidationException":
707
- case "com.amazonaws.osis#ValidationException":
708
- throw await de_ValidationExceptionRes(parsedOutput, context);
709
- default:
710
- const parsedBody = parsedOutput.body;
711
- return throwDefaultError({
712
- output,
713
- parsedBody,
714
- errorCode,
715
- });
716
- }
717
- };
718
- const de_UpdatePipelineCommand = async (output, context) => {
719
- if (output.statusCode !== 200 && output.statusCode >= 300) {
720
- return de_UpdatePipelineCommandError(output, context);
721
- }
722
- const contents = (0, smithy_client_1.map)({
723
- $metadata: deserializeMetadata(output),
724
- });
725
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
726
- const doc = (0, smithy_client_1.take)(data, {
727
- Pipeline: (_) => de_Pipeline(_, context),
728
- });
729
- Object.assign(contents, doc);
730
- return contents;
731
- };
732
- exports.de_UpdatePipelineCommand = de_UpdatePipelineCommand;
733
- const de_UpdatePipelineCommandError = async (output, context) => {
734
- const parsedOutput = {
735
- ...output,
736
- body: await parseErrorBody(output.body, context),
737
- };
738
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
739
- switch (errorCode) {
740
- case "AccessDeniedException":
741
- case "com.amazonaws.osis#AccessDeniedException":
742
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
743
- case "ConflictException":
744
- case "com.amazonaws.osis#ConflictException":
745
- throw await de_ConflictExceptionRes(parsedOutput, context);
746
- case "InternalException":
747
- case "com.amazonaws.osis#InternalException":
748
- throw await de_InternalExceptionRes(parsedOutput, context);
749
- case "ResourceNotFoundException":
750
- case "com.amazonaws.osis#ResourceNotFoundException":
751
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
752
- case "ValidationException":
753
- case "com.amazonaws.osis#ValidationException":
754
- throw await de_ValidationExceptionRes(parsedOutput, context);
755
- default:
756
- const parsedBody = parsedOutput.body;
757
- return throwDefaultError({
758
- output,
759
- parsedBody,
760
- errorCode,
761
- });
762
- }
763
- };
764
- const de_ValidatePipelineCommand = async (output, context) => {
765
- if (output.statusCode !== 200 && output.statusCode >= 300) {
766
- return de_ValidatePipelineCommandError(output, context);
767
- }
768
- const contents = (0, smithy_client_1.map)({
769
- $metadata: deserializeMetadata(output),
770
- });
771
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
772
- const doc = (0, smithy_client_1.take)(data, {
773
- Errors: smithy_client_1._json,
774
- isValid: smithy_client_1.expectBoolean,
775
- });
776
- Object.assign(contents, doc);
777
- return contents;
778
- };
779
- exports.de_ValidatePipelineCommand = de_ValidatePipelineCommand;
780
- const de_ValidatePipelineCommandError = async (output, context) => {
781
- const parsedOutput = {
782
- ...output,
783
- body: await parseErrorBody(output.body, context),
784
- };
785
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
786
- switch (errorCode) {
787
- case "AccessDeniedException":
788
- case "com.amazonaws.osis#AccessDeniedException":
789
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
790
- case "InternalException":
791
- case "com.amazonaws.osis#InternalException":
792
- throw await de_InternalExceptionRes(parsedOutput, context);
793
- case "ValidationException":
794
- case "com.amazonaws.osis#ValidationException":
795
- throw await de_ValidationExceptionRes(parsedOutput, context);
796
- default:
797
- const parsedBody = parsedOutput.body;
798
- return throwDefaultError({
799
- output,
800
- parsedBody,
801
- errorCode,
802
- });
803
- }
804
- };
805
- const throwDefaultError = (0, smithy_client_1.withBaseException)(OSISServiceException_1.OSISServiceException);
806
- const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
807
- const contents = (0, smithy_client_1.map)({});
808
- const data = parsedOutput.body;
809
- const doc = (0, smithy_client_1.take)(data, {
810
- message: smithy_client_1.expectString,
811
- });
812
- Object.assign(contents, doc);
813
- const exception = new models_0_1.AccessDeniedException({
814
- $metadata: deserializeMetadata(parsedOutput),
815
- ...contents,
816
- });
817
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
818
- };
819
- const de_ConflictExceptionRes = async (parsedOutput, context) => {
820
- const contents = (0, smithy_client_1.map)({});
821
- const data = parsedOutput.body;
822
- const doc = (0, smithy_client_1.take)(data, {
823
- message: smithy_client_1.expectString,
824
- });
825
- Object.assign(contents, doc);
826
- const exception = new models_0_1.ConflictException({
827
- $metadata: deserializeMetadata(parsedOutput),
828
- ...contents,
829
- });
830
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
831
- };
832
- const de_InternalExceptionRes = async (parsedOutput, context) => {
833
- const contents = (0, smithy_client_1.map)({});
834
- const data = parsedOutput.body;
835
- const doc = (0, smithy_client_1.take)(data, {
836
- message: smithy_client_1.expectString,
837
- });
838
- Object.assign(contents, doc);
839
- const exception = new models_0_1.InternalException({
840
- $metadata: deserializeMetadata(parsedOutput),
841
- ...contents,
842
- });
843
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
844
- };
845
- const de_InvalidPaginationTokenExceptionRes = async (parsedOutput, context) => {
846
- const contents = (0, smithy_client_1.map)({});
847
- const data = parsedOutput.body;
848
- const doc = (0, smithy_client_1.take)(data, {
849
- message: smithy_client_1.expectString,
850
- });
851
- Object.assign(contents, doc);
852
- const exception = new models_0_1.InvalidPaginationTokenException({
853
- $metadata: deserializeMetadata(parsedOutput),
854
- ...contents,
855
- });
856
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
857
- };
858
- const de_LimitExceededExceptionRes = async (parsedOutput, context) => {
859
- const contents = (0, smithy_client_1.map)({});
860
- const data = parsedOutput.body;
861
- const doc = (0, smithy_client_1.take)(data, {
862
- message: smithy_client_1.expectString,
863
- });
864
- Object.assign(contents, doc);
865
- const exception = new models_0_1.LimitExceededException({
866
- $metadata: deserializeMetadata(parsedOutput),
867
- ...contents,
868
- });
869
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
870
- };
871
- const de_ResourceAlreadyExistsExceptionRes = async (parsedOutput, context) => {
872
- const contents = (0, smithy_client_1.map)({});
873
- const data = parsedOutput.body;
874
- const doc = (0, smithy_client_1.take)(data, {
875
- message: smithy_client_1.expectString,
876
- });
877
- Object.assign(contents, doc);
878
- const exception = new models_0_1.ResourceAlreadyExistsException({
879
- $metadata: deserializeMetadata(parsedOutput),
880
- ...contents,
881
- });
882
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
883
- };
884
- const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
885
- const contents = (0, smithy_client_1.map)({});
886
- const data = parsedOutput.body;
887
- const doc = (0, smithy_client_1.take)(data, {
888
- message: smithy_client_1.expectString,
889
- });
890
- Object.assign(contents, doc);
891
- const exception = new models_0_1.ResourceNotFoundException({
892
- $metadata: deserializeMetadata(parsedOutput),
893
- ...contents,
894
- });
895
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
896
- };
897
- const de_ValidationExceptionRes = async (parsedOutput, context) => {
898
- const contents = (0, smithy_client_1.map)({});
899
- const data = parsedOutput.body;
900
- const doc = (0, smithy_client_1.take)(data, {
901
- message: smithy_client_1.expectString,
902
- });
903
- Object.assign(contents, doc);
904
- const exception = new models_0_1.ValidationException({
905
- $metadata: deserializeMetadata(parsedOutput),
906
- ...contents,
907
- });
908
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
909
- };
910
- const de_ChangeProgressStage = (output, context) => {
911
- return (0, smithy_client_1.take)(output, {
912
- Description: smithy_client_1.expectString,
913
- LastUpdatedAt: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
914
- Name: smithy_client_1.expectString,
915
- Status: smithy_client_1.expectString,
916
- });
917
- };
918
- const de_ChangeProgressStageList = (output, context) => {
919
- const retVal = (output || [])
920
- .filter((e) => e != null)
921
- .map((entry) => {
922
- return de_ChangeProgressStage(entry, context);
923
- });
924
- return retVal;
925
- };
926
- const de_ChangeProgressStatus = (output, context) => {
927
- return (0, smithy_client_1.take)(output, {
928
- ChangeProgressStages: (_) => de_ChangeProgressStageList(_, context),
929
- StartTime: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
930
- Status: smithy_client_1.expectString,
931
- TotalNumberOfStages: smithy_client_1.expectInt32,
932
- });
933
- };
934
- const de_ChangeProgressStatusList = (output, context) => {
935
- const retVal = (output || [])
936
- .filter((e) => e != null)
937
- .map((entry) => {
938
- return de_ChangeProgressStatus(entry, context);
939
- });
940
- return retVal;
941
- };
942
- const de_Pipeline = (output, context) => {
943
- return (0, smithy_client_1.take)(output, {
944
- BufferOptions: smithy_client_1._json,
945
- CreatedAt: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
946
- EncryptionAtRestOptions: smithy_client_1._json,
947
- IngestEndpointUrls: smithy_client_1._json,
948
- LastUpdatedAt: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
949
- LogPublishingOptions: smithy_client_1._json,
950
- MaxUnits: smithy_client_1.expectInt32,
951
- MinUnits: smithy_client_1.expectInt32,
952
- PipelineArn: smithy_client_1.expectString,
953
- PipelineConfigurationBody: smithy_client_1.expectString,
954
- PipelineName: smithy_client_1.expectString,
955
- ServiceVpcEndpoints: smithy_client_1._json,
956
- Status: smithy_client_1.expectString,
957
- StatusReason: smithy_client_1._json,
958
- Tags: smithy_client_1._json,
959
- VpcEndpoints: smithy_client_1._json,
960
- });
961
- };
962
- const de_PipelineSummary = (output, context) => {
963
- return (0, smithy_client_1.take)(output, {
964
- CreatedAt: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
965
- LastUpdatedAt: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
966
- MaxUnits: smithy_client_1.expectInt32,
967
- MinUnits: smithy_client_1.expectInt32,
968
- PipelineArn: smithy_client_1.expectString,
969
- PipelineName: smithy_client_1.expectString,
970
- Status: smithy_client_1.expectString,
971
- StatusReason: smithy_client_1._json,
972
- Tags: smithy_client_1._json,
973
- });
974
- };
975
- const de_PipelineSummaryList = (output, context) => {
976
- const retVal = (output || [])
977
- .filter((e) => e != null)
978
- .map((entry) => {
979
- return de_PipelineSummary(entry, context);
980
- });
981
- return retVal;
982
- };
983
- const deserializeMetadata = (output) => ({
984
- httpStatusCode: output.statusCode,
985
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
986
- extendedRequestId: output.headers["x-amz-id-2"],
987
- cfId: output.headers["x-amz-cf-id"],
988
- });
989
- const collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body));
990
- const isSerializableHeaderValue = (value) => value !== undefined &&
991
- value !== null &&
992
- value !== "" &&
993
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
994
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
995
- const _A = "Arn";
996
- const _MR = "MaxResults";
997
- const _NT = "NextToken";
998
- const _a = "arn";
999
- const _mR = "maxResults";
1000
- const _nT = "nextToken";
1001
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
1002
- if (encoded.length) {
1003
- return JSON.parse(encoded);
1004
- }
1005
- return {};
1006
- });
1007
- const parseErrorBody = async (errorBody, context) => {
1008
- const value = await parseBody(errorBody, context);
1009
- value.message = value.message ?? value.Message;
1010
- return value;
1011
- };
1012
- const loadRestJsonErrorCode = (output, data) => {
1013
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
1014
- const sanitizeErrorCode = (rawValue) => {
1015
- let cleanValue = rawValue;
1016
- if (typeof cleanValue === "number") {
1017
- cleanValue = cleanValue.toString();
1018
- }
1019
- if (cleanValue.indexOf(",") >= 0) {
1020
- cleanValue = cleanValue.split(",")[0];
1021
- }
1022
- if (cleanValue.indexOf(":") >= 0) {
1023
- cleanValue = cleanValue.split(":")[0];
1024
- }
1025
- if (cleanValue.indexOf("#") >= 0) {
1026
- cleanValue = cleanValue.split("#")[1];
1027
- }
1028
- return cleanValue;
1029
- };
1030
- const headerKey = findKey(output.headers, "x-amzn-errortype");
1031
- if (headerKey !== undefined) {
1032
- return sanitizeErrorCode(output.headers[headerKey]);
1033
- }
1034
- if (data.code !== undefined) {
1035
- return sanitizeErrorCode(data.code);
1036
- }
1037
- if (data["__type"] !== undefined) {
1038
- return sanitizeErrorCode(data["__type"]);
1039
- }
1040
- };
1
+ module.exports = require("../index.js");