@aws-sdk/client-mwaa 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.
Files changed (30) hide show
  1. package/dist-cjs/MWAA.js +1 -33
  2. package/dist-cjs/MWAAClient.js +1 -43
  3. package/dist-cjs/commands/CreateCliTokenCommand.js +1 -29
  4. package/dist-cjs/commands/CreateEnvironmentCommand.js +1 -29
  5. package/dist-cjs/commands/CreateWebLoginTokenCommand.js +1 -29
  6. package/dist-cjs/commands/DeleteEnvironmentCommand.js +1 -28
  7. package/dist-cjs/commands/GetEnvironmentCommand.js +1 -29
  8. package/dist-cjs/commands/ListEnvironmentsCommand.js +1 -28
  9. package/dist-cjs/commands/ListTagsForResourceCommand.js +1 -28
  10. package/dist-cjs/commands/PublishMetricsCommand.js +1 -28
  11. package/dist-cjs/commands/TagResourceCommand.js +1 -28
  12. package/dist-cjs/commands/UntagResourceCommand.js +1 -28
  13. package/dist-cjs/commands/UpdateEnvironmentCommand.js +1 -29
  14. package/dist-cjs/commands/index.js +1 -14
  15. package/dist-cjs/endpoint/EndpointParameters.js +1 -18
  16. package/dist-cjs/extensionConfiguration.js +1 -2
  17. package/dist-cjs/index.js +1413 -11
  18. package/dist-cjs/models/MWAAServiceException.js +1 -12
  19. package/dist-cjs/models/index.js +1 -4
  20. package/dist-cjs/models/models_0.js +1 -150
  21. package/dist-cjs/pagination/Interfaces.js +1 -2
  22. package/dist-cjs/pagination/ListEnvironmentsPaginator.js +1 -7
  23. package/dist-cjs/pagination/index.js +1 -5
  24. package/dist-cjs/protocols/Aws_restJson1.js +1 -866
  25. package/dist-cjs/runtimeExtensions.js +1 -22
  26. package/dist-es/protocols/Aws_restJson1.js +2 -0
  27. package/dist-types/commands/CreateWebLoginTokenCommand.d.ts +2 -0
  28. package/dist-types/models/models_0.d.ts +10 -0
  29. package/dist-types/ts3.4/models/models_0.d.ts +2 -0
  30. package/package.json +40 -40
@@ -1,866 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.de_UpdateEnvironmentCommand = exports.de_UntagResourceCommand = exports.de_TagResourceCommand = exports.de_PublishMetricsCommand = exports.de_ListTagsForResourceCommand = exports.de_ListEnvironmentsCommand = exports.de_GetEnvironmentCommand = exports.de_DeleteEnvironmentCommand = exports.de_CreateWebLoginTokenCommand = exports.de_CreateEnvironmentCommand = exports.de_CreateCliTokenCommand = exports.se_UpdateEnvironmentCommand = exports.se_UntagResourceCommand = exports.se_TagResourceCommand = exports.se_PublishMetricsCommand = exports.se_ListTagsForResourceCommand = exports.se_ListEnvironmentsCommand = exports.se_GetEnvironmentCommand = exports.se_DeleteEnvironmentCommand = exports.se_CreateWebLoginTokenCommand = exports.se_CreateEnvironmentCommand = exports.se_CreateCliTokenCommand = void 0;
4
- const core_1 = require("@smithy/core");
5
- const protocol_http_1 = require("@smithy/protocol-http");
6
- const smithy_client_1 = require("@smithy/smithy-client");
7
- const models_0_1 = require("../models/models_0");
8
- const MWAAServiceException_1 = require("../models/MWAAServiceException");
9
- const se_CreateCliTokenCommand = async (input, context) => {
10
- const b = (0, core_1.requestBuilder)(input, context);
11
- const headers = {};
12
- b.bp("/clitoken/{Name}");
13
- b.p("Name", () => input.Name, "{Name}", false);
14
- let body;
15
- let { hostname: resolvedHostname } = await context.endpoint();
16
- if (context.disableHostPrefix !== true) {
17
- resolvedHostname = "env." + resolvedHostname;
18
- if (!(0, protocol_http_1.isValidHostname)(resolvedHostname)) {
19
- throw new Error("ValidationError: prefixed hostname must be hostname compatible.");
20
- }
21
- }
22
- b.hn(resolvedHostname);
23
- b.m("POST").h(headers).b(body);
24
- return b.build();
25
- };
26
- exports.se_CreateCliTokenCommand = se_CreateCliTokenCommand;
27
- const se_CreateEnvironmentCommand = async (input, context) => {
28
- const b = (0, core_1.requestBuilder)(input, context);
29
- const headers = {
30
- "content-type": "application/json",
31
- };
32
- b.bp("/environments/{Name}");
33
- b.p("Name", () => input.Name, "{Name}", false);
34
- let body;
35
- body = JSON.stringify((0, smithy_client_1.take)(input, {
36
- AirflowConfigurationOptions: (_) => (0, smithy_client_1._json)(_),
37
- AirflowVersion: [],
38
- DagS3Path: [],
39
- EndpointManagement: [],
40
- EnvironmentClass: [],
41
- ExecutionRoleArn: [],
42
- KmsKey: [],
43
- LoggingConfiguration: (_) => (0, smithy_client_1._json)(_),
44
- MaxWorkers: [],
45
- MinWorkers: [],
46
- NetworkConfiguration: (_) => (0, smithy_client_1._json)(_),
47
- PluginsS3ObjectVersion: [],
48
- PluginsS3Path: [],
49
- RequirementsS3ObjectVersion: [],
50
- RequirementsS3Path: [],
51
- Schedulers: [],
52
- SourceBucketArn: [],
53
- StartupScriptS3ObjectVersion: [],
54
- StartupScriptS3Path: [],
55
- Tags: (_) => (0, smithy_client_1._json)(_),
56
- WebserverAccessMode: [],
57
- WeeklyMaintenanceWindowStart: [],
58
- }));
59
- let { hostname: resolvedHostname } = await context.endpoint();
60
- if (context.disableHostPrefix !== true) {
61
- resolvedHostname = "api." + resolvedHostname;
62
- if (!(0, protocol_http_1.isValidHostname)(resolvedHostname)) {
63
- throw new Error("ValidationError: prefixed hostname must be hostname compatible.");
64
- }
65
- }
66
- b.hn(resolvedHostname);
67
- b.m("PUT").h(headers).b(body);
68
- return b.build();
69
- };
70
- exports.se_CreateEnvironmentCommand = se_CreateEnvironmentCommand;
71
- const se_CreateWebLoginTokenCommand = async (input, context) => {
72
- const b = (0, core_1.requestBuilder)(input, context);
73
- const headers = {};
74
- b.bp("/webtoken/{Name}");
75
- b.p("Name", () => input.Name, "{Name}", false);
76
- let body;
77
- let { hostname: resolvedHostname } = await context.endpoint();
78
- if (context.disableHostPrefix !== true) {
79
- resolvedHostname = "env." + resolvedHostname;
80
- if (!(0, protocol_http_1.isValidHostname)(resolvedHostname)) {
81
- throw new Error("ValidationError: prefixed hostname must be hostname compatible.");
82
- }
83
- }
84
- b.hn(resolvedHostname);
85
- b.m("POST").h(headers).b(body);
86
- return b.build();
87
- };
88
- exports.se_CreateWebLoginTokenCommand = se_CreateWebLoginTokenCommand;
89
- const se_DeleteEnvironmentCommand = async (input, context) => {
90
- const b = (0, core_1.requestBuilder)(input, context);
91
- const headers = {};
92
- b.bp("/environments/{Name}");
93
- b.p("Name", () => input.Name, "{Name}", false);
94
- let body;
95
- let { hostname: resolvedHostname } = await context.endpoint();
96
- if (context.disableHostPrefix !== true) {
97
- resolvedHostname = "api." + resolvedHostname;
98
- if (!(0, protocol_http_1.isValidHostname)(resolvedHostname)) {
99
- throw new Error("ValidationError: prefixed hostname must be hostname compatible.");
100
- }
101
- }
102
- b.hn(resolvedHostname);
103
- b.m("DELETE").h(headers).b(body);
104
- return b.build();
105
- };
106
- exports.se_DeleteEnvironmentCommand = se_DeleteEnvironmentCommand;
107
- const se_GetEnvironmentCommand = async (input, context) => {
108
- const b = (0, core_1.requestBuilder)(input, context);
109
- const headers = {};
110
- b.bp("/environments/{Name}");
111
- b.p("Name", () => input.Name, "{Name}", false);
112
- let body;
113
- let { hostname: resolvedHostname } = await context.endpoint();
114
- if (context.disableHostPrefix !== true) {
115
- resolvedHostname = "api." + resolvedHostname;
116
- if (!(0, protocol_http_1.isValidHostname)(resolvedHostname)) {
117
- throw new Error("ValidationError: prefixed hostname must be hostname compatible.");
118
- }
119
- }
120
- b.hn(resolvedHostname);
121
- b.m("GET").h(headers).b(body);
122
- return b.build();
123
- };
124
- exports.se_GetEnvironmentCommand = se_GetEnvironmentCommand;
125
- const se_ListEnvironmentsCommand = async (input, context) => {
126
- const b = (0, core_1.requestBuilder)(input, context);
127
- const headers = {};
128
- b.bp("/environments");
129
- const query = (0, smithy_client_1.map)({
130
- [_NT]: [, input[_NT]],
131
- [_MR]: [() => input.MaxResults !== void 0, () => input[_MR].toString()],
132
- });
133
- let body;
134
- let { hostname: resolvedHostname } = await context.endpoint();
135
- if (context.disableHostPrefix !== true) {
136
- resolvedHostname = "api." + resolvedHostname;
137
- if (!(0, protocol_http_1.isValidHostname)(resolvedHostname)) {
138
- throw new Error("ValidationError: prefixed hostname must be hostname compatible.");
139
- }
140
- }
141
- b.hn(resolvedHostname);
142
- b.m("GET").h(headers).q(query).b(body);
143
- return b.build();
144
- };
145
- exports.se_ListEnvironmentsCommand = se_ListEnvironmentsCommand;
146
- const se_ListTagsForResourceCommand = async (input, context) => {
147
- const b = (0, core_1.requestBuilder)(input, context);
148
- const headers = {};
149
- b.bp("/tags/{ResourceArn}");
150
- b.p("ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
151
- let body;
152
- let { hostname: resolvedHostname } = await context.endpoint();
153
- if (context.disableHostPrefix !== true) {
154
- resolvedHostname = "api." + resolvedHostname;
155
- if (!(0, protocol_http_1.isValidHostname)(resolvedHostname)) {
156
- throw new Error("ValidationError: prefixed hostname must be hostname compatible.");
157
- }
158
- }
159
- b.hn(resolvedHostname);
160
- b.m("GET").h(headers).b(body);
161
- return b.build();
162
- };
163
- exports.se_ListTagsForResourceCommand = se_ListTagsForResourceCommand;
164
- const se_PublishMetricsCommand = async (input, context) => {
165
- const b = (0, core_1.requestBuilder)(input, context);
166
- const headers = {
167
- "content-type": "application/json",
168
- };
169
- b.bp("/metrics/environments/{EnvironmentName}");
170
- b.p("EnvironmentName", () => input.EnvironmentName, "{EnvironmentName}", false);
171
- let body;
172
- body = JSON.stringify((0, smithy_client_1.take)(input, {
173
- MetricData: (_) => se_MetricData(_, context),
174
- }));
175
- let { hostname: resolvedHostname } = await context.endpoint();
176
- if (context.disableHostPrefix !== true) {
177
- resolvedHostname = "ops." + resolvedHostname;
178
- if (!(0, protocol_http_1.isValidHostname)(resolvedHostname)) {
179
- throw new Error("ValidationError: prefixed hostname must be hostname compatible.");
180
- }
181
- }
182
- b.hn(resolvedHostname);
183
- b.m("POST").h(headers).b(body);
184
- return b.build();
185
- };
186
- exports.se_PublishMetricsCommand = se_PublishMetricsCommand;
187
- const se_TagResourceCommand = async (input, context) => {
188
- const b = (0, core_1.requestBuilder)(input, context);
189
- const headers = {
190
- "content-type": "application/json",
191
- };
192
- b.bp("/tags/{ResourceArn}");
193
- b.p("ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
194
- let body;
195
- body = JSON.stringify((0, smithy_client_1.take)(input, {
196
- Tags: (_) => (0, smithy_client_1._json)(_),
197
- }));
198
- let { hostname: resolvedHostname } = await context.endpoint();
199
- if (context.disableHostPrefix !== true) {
200
- resolvedHostname = "api." + resolvedHostname;
201
- if (!(0, protocol_http_1.isValidHostname)(resolvedHostname)) {
202
- throw new Error("ValidationError: prefixed hostname must be hostname compatible.");
203
- }
204
- }
205
- b.hn(resolvedHostname);
206
- b.m("POST").h(headers).b(body);
207
- return b.build();
208
- };
209
- exports.se_TagResourceCommand = se_TagResourceCommand;
210
- const se_UntagResourceCommand = async (input, context) => {
211
- const b = (0, core_1.requestBuilder)(input, context);
212
- const headers = {};
213
- b.bp("/tags/{ResourceArn}");
214
- b.p("ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
215
- const query = (0, smithy_client_1.map)({
216
- [_tK]: [
217
- (0, smithy_client_1.expectNonNull)(input.tagKeys, `tagKeys`) != null,
218
- () => (input[_tK] || []).map((_entry) => _entry),
219
- ],
220
- });
221
- let body;
222
- let { hostname: resolvedHostname } = await context.endpoint();
223
- if (context.disableHostPrefix !== true) {
224
- resolvedHostname = "api." + resolvedHostname;
225
- if (!(0, protocol_http_1.isValidHostname)(resolvedHostname)) {
226
- throw new Error("ValidationError: prefixed hostname must be hostname compatible.");
227
- }
228
- }
229
- b.hn(resolvedHostname);
230
- b.m("DELETE").h(headers).q(query).b(body);
231
- return b.build();
232
- };
233
- exports.se_UntagResourceCommand = se_UntagResourceCommand;
234
- const se_UpdateEnvironmentCommand = async (input, context) => {
235
- const b = (0, core_1.requestBuilder)(input, context);
236
- const headers = {
237
- "content-type": "application/json",
238
- };
239
- b.bp("/environments/{Name}");
240
- b.p("Name", () => input.Name, "{Name}", false);
241
- let body;
242
- body = JSON.stringify((0, smithy_client_1.take)(input, {
243
- AirflowConfigurationOptions: (_) => (0, smithy_client_1._json)(_),
244
- AirflowVersion: [],
245
- DagS3Path: [],
246
- EnvironmentClass: [],
247
- ExecutionRoleArn: [],
248
- LoggingConfiguration: (_) => (0, smithy_client_1._json)(_),
249
- MaxWorkers: [],
250
- MinWorkers: [],
251
- NetworkConfiguration: (_) => (0, smithy_client_1._json)(_),
252
- PluginsS3ObjectVersion: [],
253
- PluginsS3Path: [],
254
- RequirementsS3ObjectVersion: [],
255
- RequirementsS3Path: [],
256
- Schedulers: [],
257
- SourceBucketArn: [],
258
- StartupScriptS3ObjectVersion: [],
259
- StartupScriptS3Path: [],
260
- WebserverAccessMode: [],
261
- WeeklyMaintenanceWindowStart: [],
262
- }));
263
- let { hostname: resolvedHostname } = await context.endpoint();
264
- if (context.disableHostPrefix !== true) {
265
- resolvedHostname = "api." + resolvedHostname;
266
- if (!(0, protocol_http_1.isValidHostname)(resolvedHostname)) {
267
- throw new Error("ValidationError: prefixed hostname must be hostname compatible.");
268
- }
269
- }
270
- b.hn(resolvedHostname);
271
- b.m("PATCH").h(headers).b(body);
272
- return b.build();
273
- };
274
- exports.se_UpdateEnvironmentCommand = se_UpdateEnvironmentCommand;
275
- const de_CreateCliTokenCommand = async (output, context) => {
276
- if (output.statusCode !== 200 && output.statusCode >= 300) {
277
- return de_CreateCliTokenCommandError(output, context);
278
- }
279
- const contents = (0, smithy_client_1.map)({
280
- $metadata: deserializeMetadata(output),
281
- });
282
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
283
- const doc = (0, smithy_client_1.take)(data, {
284
- CliToken: smithy_client_1.expectString,
285
- WebServerHostname: smithy_client_1.expectString,
286
- });
287
- Object.assign(contents, doc);
288
- return contents;
289
- };
290
- exports.de_CreateCliTokenCommand = de_CreateCliTokenCommand;
291
- const de_CreateCliTokenCommandError = async (output, context) => {
292
- const parsedOutput = {
293
- ...output,
294
- body: await parseErrorBody(output.body, context),
295
- };
296
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
297
- switch (errorCode) {
298
- case "ResourceNotFoundException":
299
- case "com.amazonaws.mwaa#ResourceNotFoundException":
300
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
301
- default:
302
- const parsedBody = parsedOutput.body;
303
- return throwDefaultError({
304
- output,
305
- parsedBody,
306
- errorCode,
307
- });
308
- }
309
- };
310
- const de_CreateEnvironmentCommand = async (output, context) => {
311
- if (output.statusCode !== 200 && output.statusCode >= 300) {
312
- return de_CreateEnvironmentCommandError(output, context);
313
- }
314
- const contents = (0, smithy_client_1.map)({
315
- $metadata: deserializeMetadata(output),
316
- });
317
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
318
- const doc = (0, smithy_client_1.take)(data, {
319
- Arn: smithy_client_1.expectString,
320
- });
321
- Object.assign(contents, doc);
322
- return contents;
323
- };
324
- exports.de_CreateEnvironmentCommand = de_CreateEnvironmentCommand;
325
- const de_CreateEnvironmentCommandError = async (output, context) => {
326
- const parsedOutput = {
327
- ...output,
328
- body: await parseErrorBody(output.body, context),
329
- };
330
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
331
- switch (errorCode) {
332
- case "InternalServerException":
333
- case "com.amazonaws.mwaa#InternalServerException":
334
- throw await de_InternalServerExceptionRes(parsedOutput, context);
335
- case "ValidationException":
336
- case "com.amazonaws.mwaa#ValidationException":
337
- throw await de_ValidationExceptionRes(parsedOutput, context);
338
- default:
339
- const parsedBody = parsedOutput.body;
340
- return throwDefaultError({
341
- output,
342
- parsedBody,
343
- errorCode,
344
- });
345
- }
346
- };
347
- const de_CreateWebLoginTokenCommand = async (output, context) => {
348
- if (output.statusCode !== 200 && output.statusCode >= 300) {
349
- return de_CreateWebLoginTokenCommandError(output, context);
350
- }
351
- const contents = (0, smithy_client_1.map)({
352
- $metadata: deserializeMetadata(output),
353
- });
354
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
355
- const doc = (0, smithy_client_1.take)(data, {
356
- WebServerHostname: smithy_client_1.expectString,
357
- WebToken: smithy_client_1.expectString,
358
- });
359
- Object.assign(contents, doc);
360
- return contents;
361
- };
362
- exports.de_CreateWebLoginTokenCommand = de_CreateWebLoginTokenCommand;
363
- const de_CreateWebLoginTokenCommandError = async (output, context) => {
364
- const parsedOutput = {
365
- ...output,
366
- body: await parseErrorBody(output.body, context),
367
- };
368
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
369
- switch (errorCode) {
370
- case "AccessDeniedException":
371
- case "com.amazonaws.mwaa#AccessDeniedException":
372
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
373
- case "InternalServerException":
374
- case "com.amazonaws.mwaa#InternalServerException":
375
- throw await de_InternalServerExceptionRes(parsedOutput, context);
376
- case "ResourceNotFoundException":
377
- case "com.amazonaws.mwaa#ResourceNotFoundException":
378
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
379
- case "ValidationException":
380
- case "com.amazonaws.mwaa#ValidationException":
381
- throw await de_ValidationExceptionRes(parsedOutput, context);
382
- default:
383
- const parsedBody = parsedOutput.body;
384
- return throwDefaultError({
385
- output,
386
- parsedBody,
387
- errorCode,
388
- });
389
- }
390
- };
391
- const de_DeleteEnvironmentCommand = async (output, context) => {
392
- if (output.statusCode !== 200 && output.statusCode >= 300) {
393
- return de_DeleteEnvironmentCommandError(output, context);
394
- }
395
- const contents = (0, smithy_client_1.map)({
396
- $metadata: deserializeMetadata(output),
397
- });
398
- await (0, smithy_client_1.collectBody)(output.body, context);
399
- return contents;
400
- };
401
- exports.de_DeleteEnvironmentCommand = de_DeleteEnvironmentCommand;
402
- const de_DeleteEnvironmentCommandError = async (output, context) => {
403
- const parsedOutput = {
404
- ...output,
405
- body: await parseErrorBody(output.body, context),
406
- };
407
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
408
- switch (errorCode) {
409
- case "InternalServerException":
410
- case "com.amazonaws.mwaa#InternalServerException":
411
- throw await de_InternalServerExceptionRes(parsedOutput, context);
412
- case "ResourceNotFoundException":
413
- case "com.amazonaws.mwaa#ResourceNotFoundException":
414
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
415
- case "ValidationException":
416
- case "com.amazonaws.mwaa#ValidationException":
417
- throw await de_ValidationExceptionRes(parsedOutput, context);
418
- default:
419
- const parsedBody = parsedOutput.body;
420
- return throwDefaultError({
421
- output,
422
- parsedBody,
423
- errorCode,
424
- });
425
- }
426
- };
427
- const de_GetEnvironmentCommand = async (output, context) => {
428
- if (output.statusCode !== 200 && output.statusCode >= 300) {
429
- return de_GetEnvironmentCommandError(output, context);
430
- }
431
- const contents = (0, smithy_client_1.map)({
432
- $metadata: deserializeMetadata(output),
433
- });
434
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
435
- const doc = (0, smithy_client_1.take)(data, {
436
- Environment: (_) => de_Environment(_, context),
437
- });
438
- Object.assign(contents, doc);
439
- return contents;
440
- };
441
- exports.de_GetEnvironmentCommand = de_GetEnvironmentCommand;
442
- const de_GetEnvironmentCommandError = async (output, context) => {
443
- const parsedOutput = {
444
- ...output,
445
- body: await parseErrorBody(output.body, context),
446
- };
447
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
448
- switch (errorCode) {
449
- case "InternalServerException":
450
- case "com.amazonaws.mwaa#InternalServerException":
451
- throw await de_InternalServerExceptionRes(parsedOutput, context);
452
- case "ResourceNotFoundException":
453
- case "com.amazonaws.mwaa#ResourceNotFoundException":
454
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
455
- case "ValidationException":
456
- case "com.amazonaws.mwaa#ValidationException":
457
- throw await de_ValidationExceptionRes(parsedOutput, context);
458
- default:
459
- const parsedBody = parsedOutput.body;
460
- return throwDefaultError({
461
- output,
462
- parsedBody,
463
- errorCode,
464
- });
465
- }
466
- };
467
- const de_ListEnvironmentsCommand = async (output, context) => {
468
- if (output.statusCode !== 200 && output.statusCode >= 300) {
469
- return de_ListEnvironmentsCommandError(output, context);
470
- }
471
- const contents = (0, smithy_client_1.map)({
472
- $metadata: deserializeMetadata(output),
473
- });
474
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
475
- const doc = (0, smithy_client_1.take)(data, {
476
- Environments: smithy_client_1._json,
477
- NextToken: smithy_client_1.expectString,
478
- });
479
- Object.assign(contents, doc);
480
- return contents;
481
- };
482
- exports.de_ListEnvironmentsCommand = de_ListEnvironmentsCommand;
483
- const de_ListEnvironmentsCommandError = async (output, context) => {
484
- const parsedOutput = {
485
- ...output,
486
- body: await parseErrorBody(output.body, context),
487
- };
488
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
489
- switch (errorCode) {
490
- case "InternalServerException":
491
- case "com.amazonaws.mwaa#InternalServerException":
492
- throw await de_InternalServerExceptionRes(parsedOutput, context);
493
- case "ValidationException":
494
- case "com.amazonaws.mwaa#ValidationException":
495
- throw await de_ValidationExceptionRes(parsedOutput, context);
496
- default:
497
- const parsedBody = parsedOutput.body;
498
- return throwDefaultError({
499
- output,
500
- parsedBody,
501
- errorCode,
502
- });
503
- }
504
- };
505
- const de_ListTagsForResourceCommand = async (output, context) => {
506
- if (output.statusCode !== 200 && output.statusCode >= 300) {
507
- return de_ListTagsForResourceCommandError(output, context);
508
- }
509
- const contents = (0, smithy_client_1.map)({
510
- $metadata: deserializeMetadata(output),
511
- });
512
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
513
- const doc = (0, smithy_client_1.take)(data, {
514
- Tags: smithy_client_1._json,
515
- });
516
- Object.assign(contents, doc);
517
- return contents;
518
- };
519
- exports.de_ListTagsForResourceCommand = de_ListTagsForResourceCommand;
520
- const de_ListTagsForResourceCommandError = async (output, context) => {
521
- const parsedOutput = {
522
- ...output,
523
- body: await parseErrorBody(output.body, context),
524
- };
525
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
526
- switch (errorCode) {
527
- case "InternalServerException":
528
- case "com.amazonaws.mwaa#InternalServerException":
529
- throw await de_InternalServerExceptionRes(parsedOutput, context);
530
- case "ResourceNotFoundException":
531
- case "com.amazonaws.mwaa#ResourceNotFoundException":
532
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
533
- case "ValidationException":
534
- case "com.amazonaws.mwaa#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_PublishMetricsCommand = async (output, context) => {
546
- if (output.statusCode !== 200 && output.statusCode >= 300) {
547
- return de_PublishMetricsCommandError(output, context);
548
- }
549
- const contents = (0, smithy_client_1.map)({
550
- $metadata: deserializeMetadata(output),
551
- });
552
- await (0, smithy_client_1.collectBody)(output.body, context);
553
- return contents;
554
- };
555
- exports.de_PublishMetricsCommand = de_PublishMetricsCommand;
556
- const de_PublishMetricsCommandError = async (output, context) => {
557
- const parsedOutput = {
558
- ...output,
559
- body: await parseErrorBody(output.body, context),
560
- };
561
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
562
- switch (errorCode) {
563
- case "InternalServerException":
564
- case "com.amazonaws.mwaa#InternalServerException":
565
- throw await de_InternalServerExceptionRes(parsedOutput, context);
566
- case "ValidationException":
567
- case "com.amazonaws.mwaa#ValidationException":
568
- throw await de_ValidationExceptionRes(parsedOutput, context);
569
- default:
570
- const parsedBody = parsedOutput.body;
571
- return throwDefaultError({
572
- output,
573
- parsedBody,
574
- errorCode,
575
- });
576
- }
577
- };
578
- const de_TagResourceCommand = async (output, context) => {
579
- if (output.statusCode !== 200 && output.statusCode >= 300) {
580
- return de_TagResourceCommandError(output, context);
581
- }
582
- const contents = (0, smithy_client_1.map)({
583
- $metadata: deserializeMetadata(output),
584
- });
585
- await (0, smithy_client_1.collectBody)(output.body, context);
586
- return contents;
587
- };
588
- exports.de_TagResourceCommand = de_TagResourceCommand;
589
- const de_TagResourceCommandError = async (output, context) => {
590
- const parsedOutput = {
591
- ...output,
592
- body: await parseErrorBody(output.body, context),
593
- };
594
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
595
- switch (errorCode) {
596
- case "InternalServerException":
597
- case "com.amazonaws.mwaa#InternalServerException":
598
- throw await de_InternalServerExceptionRes(parsedOutput, context);
599
- case "ResourceNotFoundException":
600
- case "com.amazonaws.mwaa#ResourceNotFoundException":
601
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
602
- case "ValidationException":
603
- case "com.amazonaws.mwaa#ValidationException":
604
- throw await de_ValidationExceptionRes(parsedOutput, context);
605
- default:
606
- const parsedBody = parsedOutput.body;
607
- return throwDefaultError({
608
- output,
609
- parsedBody,
610
- errorCode,
611
- });
612
- }
613
- };
614
- const de_UntagResourceCommand = async (output, context) => {
615
- if (output.statusCode !== 200 && output.statusCode >= 300) {
616
- return de_UntagResourceCommandError(output, context);
617
- }
618
- const contents = (0, smithy_client_1.map)({
619
- $metadata: deserializeMetadata(output),
620
- });
621
- await (0, smithy_client_1.collectBody)(output.body, context);
622
- return contents;
623
- };
624
- exports.de_UntagResourceCommand = de_UntagResourceCommand;
625
- const de_UntagResourceCommandError = async (output, context) => {
626
- const parsedOutput = {
627
- ...output,
628
- body: await parseErrorBody(output.body, context),
629
- };
630
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
631
- switch (errorCode) {
632
- case "InternalServerException":
633
- case "com.amazonaws.mwaa#InternalServerException":
634
- throw await de_InternalServerExceptionRes(parsedOutput, context);
635
- case "ResourceNotFoundException":
636
- case "com.amazonaws.mwaa#ResourceNotFoundException":
637
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
638
- case "ValidationException":
639
- case "com.amazonaws.mwaa#ValidationException":
640
- throw await de_ValidationExceptionRes(parsedOutput, context);
641
- default:
642
- const parsedBody = parsedOutput.body;
643
- return throwDefaultError({
644
- output,
645
- parsedBody,
646
- errorCode,
647
- });
648
- }
649
- };
650
- const de_UpdateEnvironmentCommand = async (output, context) => {
651
- if (output.statusCode !== 200 && output.statusCode >= 300) {
652
- return de_UpdateEnvironmentCommandError(output, context);
653
- }
654
- const contents = (0, smithy_client_1.map)({
655
- $metadata: deserializeMetadata(output),
656
- });
657
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
658
- const doc = (0, smithy_client_1.take)(data, {
659
- Arn: smithy_client_1.expectString,
660
- });
661
- Object.assign(contents, doc);
662
- return contents;
663
- };
664
- exports.de_UpdateEnvironmentCommand = de_UpdateEnvironmentCommand;
665
- const de_UpdateEnvironmentCommandError = async (output, context) => {
666
- const parsedOutput = {
667
- ...output,
668
- body: await parseErrorBody(output.body, context),
669
- };
670
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
671
- switch (errorCode) {
672
- case "InternalServerException":
673
- case "com.amazonaws.mwaa#InternalServerException":
674
- throw await de_InternalServerExceptionRes(parsedOutput, context);
675
- case "ResourceNotFoundException":
676
- case "com.amazonaws.mwaa#ResourceNotFoundException":
677
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
678
- case "ValidationException":
679
- case "com.amazonaws.mwaa#ValidationException":
680
- throw await de_ValidationExceptionRes(parsedOutput, context);
681
- default:
682
- const parsedBody = parsedOutput.body;
683
- return throwDefaultError({
684
- output,
685
- parsedBody,
686
- errorCode,
687
- });
688
- }
689
- };
690
- const throwDefaultError = (0, smithy_client_1.withBaseException)(MWAAServiceException_1.MWAAServiceException);
691
- const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
692
- const contents = (0, smithy_client_1.map)({});
693
- const data = parsedOutput.body;
694
- const doc = (0, smithy_client_1.take)(data, {
695
- Message: smithy_client_1.expectString,
696
- });
697
- Object.assign(contents, doc);
698
- const exception = new models_0_1.AccessDeniedException({
699
- $metadata: deserializeMetadata(parsedOutput),
700
- ...contents,
701
- });
702
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
703
- };
704
- const de_InternalServerExceptionRes = async (parsedOutput, context) => {
705
- const contents = (0, smithy_client_1.map)({});
706
- const data = parsedOutput.body;
707
- const doc = (0, smithy_client_1.take)(data, {
708
- message: smithy_client_1.expectString,
709
- });
710
- Object.assign(contents, doc);
711
- const exception = new models_0_1.InternalServerException({
712
- $metadata: deserializeMetadata(parsedOutput),
713
- ...contents,
714
- });
715
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
716
- };
717
- const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
718
- const contents = (0, smithy_client_1.map)({});
719
- const data = parsedOutput.body;
720
- const doc = (0, smithy_client_1.take)(data, {
721
- message: smithy_client_1.expectString,
722
- });
723
- Object.assign(contents, doc);
724
- const exception = new models_0_1.ResourceNotFoundException({
725
- $metadata: deserializeMetadata(parsedOutput),
726
- ...contents,
727
- });
728
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
729
- };
730
- const de_ValidationExceptionRes = async (parsedOutput, context) => {
731
- const contents = (0, smithy_client_1.map)({});
732
- const data = parsedOutput.body;
733
- const doc = (0, smithy_client_1.take)(data, {
734
- message: smithy_client_1.expectString,
735
- });
736
- Object.assign(contents, doc);
737
- const exception = new models_0_1.ValidationException({
738
- $metadata: deserializeMetadata(parsedOutput),
739
- ...contents,
740
- });
741
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
742
- };
743
- const se_MetricData = (input, context) => {
744
- return input
745
- .filter((e) => e != null)
746
- .map((entry) => {
747
- return se_MetricDatum(entry, context);
748
- });
749
- };
750
- const se_MetricDatum = (input, context) => {
751
- return (0, smithy_client_1.take)(input, {
752
- Dimensions: smithy_client_1._json,
753
- MetricName: [],
754
- StatisticValues: (_) => se_StatisticSet(_, context),
755
- Timestamp: (_) => Math.round(_.getTime() / 1000),
756
- Unit: [],
757
- Value: smithy_client_1.serializeFloat,
758
- });
759
- };
760
- const se_StatisticSet = (input, context) => {
761
- return (0, smithy_client_1.take)(input, {
762
- Maximum: smithy_client_1.serializeFloat,
763
- Minimum: smithy_client_1.serializeFloat,
764
- SampleCount: [],
765
- Sum: smithy_client_1.serializeFloat,
766
- });
767
- };
768
- const de_Environment = (output, context) => {
769
- return (0, smithy_client_1.take)(output, {
770
- AirflowConfigurationOptions: smithy_client_1._json,
771
- AirflowVersion: smithy_client_1.expectString,
772
- Arn: smithy_client_1.expectString,
773
- CeleryExecutorQueue: smithy_client_1.expectString,
774
- CreatedAt: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
775
- DagS3Path: smithy_client_1.expectString,
776
- DatabaseVpcEndpointService: smithy_client_1.expectString,
777
- EndpointManagement: smithy_client_1.expectString,
778
- EnvironmentClass: smithy_client_1.expectString,
779
- ExecutionRoleArn: smithy_client_1.expectString,
780
- KmsKey: smithy_client_1.expectString,
781
- LastUpdate: (_) => de_LastUpdate(_, context),
782
- LoggingConfiguration: smithy_client_1._json,
783
- MaxWorkers: smithy_client_1.expectInt32,
784
- MinWorkers: smithy_client_1.expectInt32,
785
- Name: smithy_client_1.expectString,
786
- NetworkConfiguration: smithy_client_1._json,
787
- PluginsS3ObjectVersion: smithy_client_1.expectString,
788
- PluginsS3Path: smithy_client_1.expectString,
789
- RequirementsS3ObjectVersion: smithy_client_1.expectString,
790
- RequirementsS3Path: smithy_client_1.expectString,
791
- Schedulers: smithy_client_1.expectInt32,
792
- ServiceRoleArn: smithy_client_1.expectString,
793
- SourceBucketArn: smithy_client_1.expectString,
794
- StartupScriptS3ObjectVersion: smithy_client_1.expectString,
795
- StartupScriptS3Path: smithy_client_1.expectString,
796
- Status: smithy_client_1.expectString,
797
- Tags: smithy_client_1._json,
798
- WebserverAccessMode: smithy_client_1.expectString,
799
- WebserverUrl: smithy_client_1.expectString,
800
- WebserverVpcEndpointService: smithy_client_1.expectString,
801
- WeeklyMaintenanceWindowStart: smithy_client_1.expectString,
802
- });
803
- };
804
- const de_LastUpdate = (output, context) => {
805
- return (0, smithy_client_1.take)(output, {
806
- CreatedAt: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
807
- Error: smithy_client_1._json,
808
- Source: smithy_client_1.expectString,
809
- Status: smithy_client_1.expectString,
810
- });
811
- };
812
- const deserializeMetadata = (output) => ({
813
- httpStatusCode: output.statusCode,
814
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
815
- extendedRequestId: output.headers["x-amz-id-2"],
816
- cfId: output.headers["x-amz-cf-id"],
817
- });
818
- const collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body));
819
- const isSerializableHeaderValue = (value) => value !== undefined &&
820
- value !== null &&
821
- value !== "" &&
822
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
823
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
824
- const _MR = "MaxResults";
825
- const _NT = "NextToken";
826
- const _tK = "tagKeys";
827
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
828
- if (encoded.length) {
829
- return JSON.parse(encoded);
830
- }
831
- return {};
832
- });
833
- const parseErrorBody = async (errorBody, context) => {
834
- const value = await parseBody(errorBody, context);
835
- value.message = value.message ?? value.Message;
836
- return value;
837
- };
838
- const loadRestJsonErrorCode = (output, data) => {
839
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
840
- const sanitizeErrorCode = (rawValue) => {
841
- let cleanValue = rawValue;
842
- if (typeof cleanValue === "number") {
843
- cleanValue = cleanValue.toString();
844
- }
845
- if (cleanValue.indexOf(",") >= 0) {
846
- cleanValue = cleanValue.split(",")[0];
847
- }
848
- if (cleanValue.indexOf(":") >= 0) {
849
- cleanValue = cleanValue.split(":")[0];
850
- }
851
- if (cleanValue.indexOf("#") >= 0) {
852
- cleanValue = cleanValue.split("#")[1];
853
- }
854
- return cleanValue;
855
- };
856
- const headerKey = findKey(output.headers, "x-amzn-errortype");
857
- if (headerKey !== undefined) {
858
- return sanitizeErrorCode(output.headers[headerKey]);
859
- }
860
- if (data.code !== undefined) {
861
- return sanitizeErrorCode(data.code);
862
- }
863
- if (data["__type"] !== undefined) {
864
- return sanitizeErrorCode(data["__type"]);
865
- }
866
- };
1
+ module.exports = require("../index.js");