@aws-sdk/client-scheduler 3.489.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,915 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.de_UpdateScheduleCommand = exports.de_UntagResourceCommand = exports.de_TagResourceCommand = exports.de_ListTagsForResourceCommand = exports.de_ListSchedulesCommand = exports.de_ListScheduleGroupsCommand = exports.de_GetScheduleGroupCommand = exports.de_GetScheduleCommand = exports.de_DeleteScheduleGroupCommand = exports.de_DeleteScheduleCommand = exports.de_CreateScheduleGroupCommand = exports.de_CreateScheduleCommand = exports.se_UpdateScheduleCommand = exports.se_UntagResourceCommand = exports.se_TagResourceCommand = exports.se_ListTagsForResourceCommand = exports.se_ListSchedulesCommand = exports.se_ListScheduleGroupsCommand = exports.se_GetScheduleGroupCommand = exports.se_GetScheduleCommand = exports.se_DeleteScheduleGroupCommand = exports.se_DeleteScheduleCommand = exports.se_CreateScheduleGroupCommand = exports.se_CreateScheduleCommand = 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 models_0_1 = require("../models/models_0");
8
- const SchedulerServiceException_1 = require("../models/SchedulerServiceException");
9
- const se_CreateScheduleCommand = async (input, context) => {
10
- const b = (0, core_1.requestBuilder)(input, context);
11
- const headers = {
12
- "content-type": "application/json",
13
- };
14
- b.bp("/schedules/{Name}");
15
- b.p("Name", () => input.Name, "{Name}", false);
16
- let body;
17
- body = JSON.stringify((0, smithy_client_1.take)(input, {
18
- ActionAfterCompletion: [],
19
- ClientToken: [true, (_) => _ ?? (0, uuid_1.v4)()],
20
- Description: [],
21
- EndDate: (_) => Math.round(_.getTime() / 1000),
22
- FlexibleTimeWindow: (_) => (0, smithy_client_1._json)(_),
23
- GroupName: [],
24
- KmsKeyArn: [],
25
- ScheduleExpression: [],
26
- ScheduleExpressionTimezone: [],
27
- StartDate: (_) => Math.round(_.getTime() / 1000),
28
- State: [],
29
- Target: (_) => (0, smithy_client_1._json)(_),
30
- }));
31
- b.m("POST").h(headers).b(body);
32
- return b.build();
33
- };
34
- exports.se_CreateScheduleCommand = se_CreateScheduleCommand;
35
- const se_CreateScheduleGroupCommand = async (input, context) => {
36
- const b = (0, core_1.requestBuilder)(input, context);
37
- const headers = {
38
- "content-type": "application/json",
39
- };
40
- b.bp("/schedule-groups/{Name}");
41
- b.p("Name", () => input.Name, "{Name}", false);
42
- let body;
43
- body = JSON.stringify((0, smithy_client_1.take)(input, {
44
- ClientToken: [true, (_) => _ ?? (0, uuid_1.v4)()],
45
- Tags: (_) => (0, smithy_client_1._json)(_),
46
- }));
47
- b.m("POST").h(headers).b(body);
48
- return b.build();
49
- };
50
- exports.se_CreateScheduleGroupCommand = se_CreateScheduleGroupCommand;
51
- const se_DeleteScheduleCommand = async (input, context) => {
52
- const b = (0, core_1.requestBuilder)(input, context);
53
- const headers = {};
54
- b.bp("/schedules/{Name}");
55
- b.p("Name", () => input.Name, "{Name}", false);
56
- const query = (0, smithy_client_1.map)({
57
- [_gN]: [, input[_GN]],
58
- [_cT]: [, input[_CT] ?? (0, uuid_1.v4)()],
59
- });
60
- let body;
61
- b.m("DELETE").h(headers).q(query).b(body);
62
- return b.build();
63
- };
64
- exports.se_DeleteScheduleCommand = se_DeleteScheduleCommand;
65
- const se_DeleteScheduleGroupCommand = async (input, context) => {
66
- const b = (0, core_1.requestBuilder)(input, context);
67
- const headers = {};
68
- b.bp("/schedule-groups/{Name}");
69
- b.p("Name", () => input.Name, "{Name}", false);
70
- const query = (0, smithy_client_1.map)({
71
- [_cT]: [, input[_CT] ?? (0, uuid_1.v4)()],
72
- });
73
- let body;
74
- b.m("DELETE").h(headers).q(query).b(body);
75
- return b.build();
76
- };
77
- exports.se_DeleteScheduleGroupCommand = se_DeleteScheduleGroupCommand;
78
- const se_GetScheduleCommand = async (input, context) => {
79
- const b = (0, core_1.requestBuilder)(input, context);
80
- const headers = {};
81
- b.bp("/schedules/{Name}");
82
- b.p("Name", () => input.Name, "{Name}", false);
83
- const query = (0, smithy_client_1.map)({
84
- [_gN]: [, input[_GN]],
85
- });
86
- let body;
87
- b.m("GET").h(headers).q(query).b(body);
88
- return b.build();
89
- };
90
- exports.se_GetScheduleCommand = se_GetScheduleCommand;
91
- const se_GetScheduleGroupCommand = async (input, context) => {
92
- const b = (0, core_1.requestBuilder)(input, context);
93
- const headers = {};
94
- b.bp("/schedule-groups/{Name}");
95
- b.p("Name", () => input.Name, "{Name}", false);
96
- let body;
97
- b.m("GET").h(headers).b(body);
98
- return b.build();
99
- };
100
- exports.se_GetScheduleGroupCommand = se_GetScheduleGroupCommand;
101
- const se_ListScheduleGroupsCommand = async (input, context) => {
102
- const b = (0, core_1.requestBuilder)(input, context);
103
- const headers = {};
104
- b.bp("/schedule-groups");
105
- const query = (0, smithy_client_1.map)({
106
- [_NP]: [, input[_NP]],
107
- [_NT]: [, input[_NT]],
108
- [_MR]: [() => input.MaxResults !== void 0, () => input[_MR].toString()],
109
- });
110
- let body;
111
- b.m("GET").h(headers).q(query).b(body);
112
- return b.build();
113
- };
114
- exports.se_ListScheduleGroupsCommand = se_ListScheduleGroupsCommand;
115
- const se_ListSchedulesCommand = async (input, context) => {
116
- const b = (0, core_1.requestBuilder)(input, context);
117
- const headers = {};
118
- b.bp("/schedules");
119
- const query = (0, smithy_client_1.map)({
120
- [_SG]: [, input[_GN]],
121
- [_NP]: [, input[_NP]],
122
- [_S]: [, input[_S]],
123
- [_NT]: [, input[_NT]],
124
- [_MR]: [() => input.MaxResults !== void 0, () => input[_MR].toString()],
125
- });
126
- let body;
127
- b.m("GET").h(headers).q(query).b(body);
128
- return b.build();
129
- };
130
- exports.se_ListSchedulesCommand = se_ListSchedulesCommand;
131
- const se_ListTagsForResourceCommand = async (input, context) => {
132
- const b = (0, core_1.requestBuilder)(input, context);
133
- const headers = {};
134
- b.bp("/tags/{ResourceArn}");
135
- b.p("ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
136
- let body;
137
- b.m("GET").h(headers).b(body);
138
- return b.build();
139
- };
140
- exports.se_ListTagsForResourceCommand = se_ListTagsForResourceCommand;
141
- const se_TagResourceCommand = async (input, context) => {
142
- const b = (0, core_1.requestBuilder)(input, context);
143
- const headers = {
144
- "content-type": "application/json",
145
- };
146
- b.bp("/tags/{ResourceArn}");
147
- b.p("ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
148
- let body;
149
- body = JSON.stringify((0, smithy_client_1.take)(input, {
150
- Tags: (_) => (0, smithy_client_1._json)(_),
151
- }));
152
- b.m("POST").h(headers).b(body);
153
- return b.build();
154
- };
155
- exports.se_TagResourceCommand = se_TagResourceCommand;
156
- const se_UntagResourceCommand = async (input, context) => {
157
- const b = (0, core_1.requestBuilder)(input, context);
158
- const headers = {};
159
- b.bp("/tags/{ResourceArn}");
160
- b.p("ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
161
- const query = (0, smithy_client_1.map)({
162
- [_TK]: [
163
- (0, smithy_client_1.expectNonNull)(input.TagKeys, `TagKeys`) != null,
164
- () => (input[_TK] || []).map((_entry) => _entry),
165
- ],
166
- });
167
- let body;
168
- b.m("DELETE").h(headers).q(query).b(body);
169
- return b.build();
170
- };
171
- exports.se_UntagResourceCommand = se_UntagResourceCommand;
172
- const se_UpdateScheduleCommand = async (input, context) => {
173
- const b = (0, core_1.requestBuilder)(input, context);
174
- const headers = {
175
- "content-type": "application/json",
176
- };
177
- b.bp("/schedules/{Name}");
178
- b.p("Name", () => input.Name, "{Name}", false);
179
- let body;
180
- body = JSON.stringify((0, smithy_client_1.take)(input, {
181
- ActionAfterCompletion: [],
182
- ClientToken: [true, (_) => _ ?? (0, uuid_1.v4)()],
183
- Description: [],
184
- EndDate: (_) => Math.round(_.getTime() / 1000),
185
- FlexibleTimeWindow: (_) => (0, smithy_client_1._json)(_),
186
- GroupName: [],
187
- KmsKeyArn: [],
188
- ScheduleExpression: [],
189
- ScheduleExpressionTimezone: [],
190
- StartDate: (_) => Math.round(_.getTime() / 1000),
191
- State: [],
192
- Target: (_) => (0, smithy_client_1._json)(_),
193
- }));
194
- b.m("PUT").h(headers).b(body);
195
- return b.build();
196
- };
197
- exports.se_UpdateScheduleCommand = se_UpdateScheduleCommand;
198
- const de_CreateScheduleCommand = async (output, context) => {
199
- if (output.statusCode !== 200 && output.statusCode >= 300) {
200
- return de_CreateScheduleCommandError(output, context);
201
- }
202
- const contents = (0, smithy_client_1.map)({
203
- $metadata: deserializeMetadata(output),
204
- });
205
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
206
- const doc = (0, smithy_client_1.take)(data, {
207
- ScheduleArn: smithy_client_1.expectString,
208
- });
209
- Object.assign(contents, doc);
210
- return contents;
211
- };
212
- exports.de_CreateScheduleCommand = de_CreateScheduleCommand;
213
- const de_CreateScheduleCommandError = async (output, context) => {
214
- const parsedOutput = {
215
- ...output,
216
- body: await parseErrorBody(output.body, context),
217
- };
218
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
219
- switch (errorCode) {
220
- case "ConflictException":
221
- case "com.amazonaws.scheduler#ConflictException":
222
- throw await de_ConflictExceptionRes(parsedOutput, context);
223
- case "InternalServerException":
224
- case "com.amazonaws.scheduler#InternalServerException":
225
- throw await de_InternalServerExceptionRes(parsedOutput, context);
226
- case "ResourceNotFoundException":
227
- case "com.amazonaws.scheduler#ResourceNotFoundException":
228
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
229
- case "ServiceQuotaExceededException":
230
- case "com.amazonaws.scheduler#ServiceQuotaExceededException":
231
- throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
232
- case "ThrottlingException":
233
- case "com.amazonaws.scheduler#ThrottlingException":
234
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
235
- case "ValidationException":
236
- case "com.amazonaws.scheduler#ValidationException":
237
- throw await de_ValidationExceptionRes(parsedOutput, context);
238
- default:
239
- const parsedBody = parsedOutput.body;
240
- return throwDefaultError({
241
- output,
242
- parsedBody,
243
- errorCode,
244
- });
245
- }
246
- };
247
- const de_CreateScheduleGroupCommand = async (output, context) => {
248
- if (output.statusCode !== 200 && output.statusCode >= 300) {
249
- return de_CreateScheduleGroupCommandError(output, context);
250
- }
251
- const contents = (0, smithy_client_1.map)({
252
- $metadata: deserializeMetadata(output),
253
- });
254
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
255
- const doc = (0, smithy_client_1.take)(data, {
256
- ScheduleGroupArn: smithy_client_1.expectString,
257
- });
258
- Object.assign(contents, doc);
259
- return contents;
260
- };
261
- exports.de_CreateScheduleGroupCommand = de_CreateScheduleGroupCommand;
262
- const de_CreateScheduleGroupCommandError = async (output, context) => {
263
- const parsedOutput = {
264
- ...output,
265
- body: await parseErrorBody(output.body, context),
266
- };
267
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
268
- switch (errorCode) {
269
- case "ConflictException":
270
- case "com.amazonaws.scheduler#ConflictException":
271
- throw await de_ConflictExceptionRes(parsedOutput, context);
272
- case "InternalServerException":
273
- case "com.amazonaws.scheduler#InternalServerException":
274
- throw await de_InternalServerExceptionRes(parsedOutput, context);
275
- case "ServiceQuotaExceededException":
276
- case "com.amazonaws.scheduler#ServiceQuotaExceededException":
277
- throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
278
- case "ThrottlingException":
279
- case "com.amazonaws.scheduler#ThrottlingException":
280
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
281
- case "ValidationException":
282
- case "com.amazonaws.scheduler#ValidationException":
283
- throw await de_ValidationExceptionRes(parsedOutput, context);
284
- default:
285
- const parsedBody = parsedOutput.body;
286
- return throwDefaultError({
287
- output,
288
- parsedBody,
289
- errorCode,
290
- });
291
- }
292
- };
293
- const de_DeleteScheduleCommand = async (output, context) => {
294
- if (output.statusCode !== 200 && output.statusCode >= 300) {
295
- return de_DeleteScheduleCommandError(output, context);
296
- }
297
- const contents = (0, smithy_client_1.map)({
298
- $metadata: deserializeMetadata(output),
299
- });
300
- await (0, smithy_client_1.collectBody)(output.body, context);
301
- return contents;
302
- };
303
- exports.de_DeleteScheduleCommand = de_DeleteScheduleCommand;
304
- const de_DeleteScheduleCommandError = async (output, context) => {
305
- const parsedOutput = {
306
- ...output,
307
- body: await parseErrorBody(output.body, context),
308
- };
309
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
310
- switch (errorCode) {
311
- case "ConflictException":
312
- case "com.amazonaws.scheduler#ConflictException":
313
- throw await de_ConflictExceptionRes(parsedOutput, context);
314
- case "InternalServerException":
315
- case "com.amazonaws.scheduler#InternalServerException":
316
- throw await de_InternalServerExceptionRes(parsedOutput, context);
317
- case "ResourceNotFoundException":
318
- case "com.amazonaws.scheduler#ResourceNotFoundException":
319
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
320
- case "ThrottlingException":
321
- case "com.amazonaws.scheduler#ThrottlingException":
322
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
323
- case "ValidationException":
324
- case "com.amazonaws.scheduler#ValidationException":
325
- throw await de_ValidationExceptionRes(parsedOutput, context);
326
- default:
327
- const parsedBody = parsedOutput.body;
328
- return throwDefaultError({
329
- output,
330
- parsedBody,
331
- errorCode,
332
- });
333
- }
334
- };
335
- const de_DeleteScheduleGroupCommand = async (output, context) => {
336
- if (output.statusCode !== 200 && output.statusCode >= 300) {
337
- return de_DeleteScheduleGroupCommandError(output, context);
338
- }
339
- const contents = (0, smithy_client_1.map)({
340
- $metadata: deserializeMetadata(output),
341
- });
342
- await (0, smithy_client_1.collectBody)(output.body, context);
343
- return contents;
344
- };
345
- exports.de_DeleteScheduleGroupCommand = de_DeleteScheduleGroupCommand;
346
- const de_DeleteScheduleGroupCommandError = async (output, context) => {
347
- const parsedOutput = {
348
- ...output,
349
- body: await parseErrorBody(output.body, context),
350
- };
351
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
352
- switch (errorCode) {
353
- case "ConflictException":
354
- case "com.amazonaws.scheduler#ConflictException":
355
- throw await de_ConflictExceptionRes(parsedOutput, context);
356
- case "InternalServerException":
357
- case "com.amazonaws.scheduler#InternalServerException":
358
- throw await de_InternalServerExceptionRes(parsedOutput, context);
359
- case "ResourceNotFoundException":
360
- case "com.amazonaws.scheduler#ResourceNotFoundException":
361
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
362
- case "ThrottlingException":
363
- case "com.amazonaws.scheduler#ThrottlingException":
364
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
365
- case "ValidationException":
366
- case "com.amazonaws.scheduler#ValidationException":
367
- throw await de_ValidationExceptionRes(parsedOutput, context);
368
- default:
369
- const parsedBody = parsedOutput.body;
370
- return throwDefaultError({
371
- output,
372
- parsedBody,
373
- errorCode,
374
- });
375
- }
376
- };
377
- const de_GetScheduleCommand = async (output, context) => {
378
- if (output.statusCode !== 200 && output.statusCode >= 300) {
379
- return de_GetScheduleCommandError(output, context);
380
- }
381
- const contents = (0, smithy_client_1.map)({
382
- $metadata: deserializeMetadata(output),
383
- });
384
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
385
- const doc = (0, smithy_client_1.take)(data, {
386
- ActionAfterCompletion: smithy_client_1.expectString,
387
- Arn: smithy_client_1.expectString,
388
- CreationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
389
- Description: smithy_client_1.expectString,
390
- EndDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
391
- FlexibleTimeWindow: smithy_client_1._json,
392
- GroupName: smithy_client_1.expectString,
393
- KmsKeyArn: smithy_client_1.expectString,
394
- LastModificationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
395
- Name: smithy_client_1.expectString,
396
- ScheduleExpression: smithy_client_1.expectString,
397
- ScheduleExpressionTimezone: smithy_client_1.expectString,
398
- StartDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
399
- State: smithy_client_1.expectString,
400
- Target: smithy_client_1._json,
401
- });
402
- Object.assign(contents, doc);
403
- return contents;
404
- };
405
- exports.de_GetScheduleCommand = de_GetScheduleCommand;
406
- const de_GetScheduleCommandError = async (output, context) => {
407
- const parsedOutput = {
408
- ...output,
409
- body: await parseErrorBody(output.body, context),
410
- };
411
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
412
- switch (errorCode) {
413
- case "InternalServerException":
414
- case "com.amazonaws.scheduler#InternalServerException":
415
- throw await de_InternalServerExceptionRes(parsedOutput, context);
416
- case "ResourceNotFoundException":
417
- case "com.amazonaws.scheduler#ResourceNotFoundException":
418
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
419
- case "ThrottlingException":
420
- case "com.amazonaws.scheduler#ThrottlingException":
421
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
422
- case "ValidationException":
423
- case "com.amazonaws.scheduler#ValidationException":
424
- throw await de_ValidationExceptionRes(parsedOutput, context);
425
- default:
426
- const parsedBody = parsedOutput.body;
427
- return throwDefaultError({
428
- output,
429
- parsedBody,
430
- errorCode,
431
- });
432
- }
433
- };
434
- const de_GetScheduleGroupCommand = async (output, context) => {
435
- if (output.statusCode !== 200 && output.statusCode >= 300) {
436
- return de_GetScheduleGroupCommandError(output, context);
437
- }
438
- const contents = (0, smithy_client_1.map)({
439
- $metadata: deserializeMetadata(output),
440
- });
441
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
442
- const doc = (0, smithy_client_1.take)(data, {
443
- Arn: smithy_client_1.expectString,
444
- CreationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
445
- LastModificationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
446
- Name: smithy_client_1.expectString,
447
- State: smithy_client_1.expectString,
448
- });
449
- Object.assign(contents, doc);
450
- return contents;
451
- };
452
- exports.de_GetScheduleGroupCommand = de_GetScheduleGroupCommand;
453
- const de_GetScheduleGroupCommandError = async (output, context) => {
454
- const parsedOutput = {
455
- ...output,
456
- body: await parseErrorBody(output.body, context),
457
- };
458
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
459
- switch (errorCode) {
460
- case "InternalServerException":
461
- case "com.amazonaws.scheduler#InternalServerException":
462
- throw await de_InternalServerExceptionRes(parsedOutput, context);
463
- case "ResourceNotFoundException":
464
- case "com.amazonaws.scheduler#ResourceNotFoundException":
465
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
466
- case "ThrottlingException":
467
- case "com.amazonaws.scheduler#ThrottlingException":
468
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
469
- case "ValidationException":
470
- case "com.amazonaws.scheduler#ValidationException":
471
- throw await de_ValidationExceptionRes(parsedOutput, context);
472
- default:
473
- const parsedBody = parsedOutput.body;
474
- return throwDefaultError({
475
- output,
476
- parsedBody,
477
- errorCode,
478
- });
479
- }
480
- };
481
- const de_ListScheduleGroupsCommand = async (output, context) => {
482
- if (output.statusCode !== 200 && output.statusCode >= 300) {
483
- return de_ListScheduleGroupsCommandError(output, context);
484
- }
485
- const contents = (0, smithy_client_1.map)({
486
- $metadata: deserializeMetadata(output),
487
- });
488
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
489
- const doc = (0, smithy_client_1.take)(data, {
490
- NextToken: smithy_client_1.expectString,
491
- ScheduleGroups: (_) => de_ScheduleGroupList(_, context),
492
- });
493
- Object.assign(contents, doc);
494
- return contents;
495
- };
496
- exports.de_ListScheduleGroupsCommand = de_ListScheduleGroupsCommand;
497
- const de_ListScheduleGroupsCommandError = async (output, context) => {
498
- const parsedOutput = {
499
- ...output,
500
- body: await parseErrorBody(output.body, context),
501
- };
502
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
503
- switch (errorCode) {
504
- case "InternalServerException":
505
- case "com.amazonaws.scheduler#InternalServerException":
506
- throw await de_InternalServerExceptionRes(parsedOutput, context);
507
- case "ThrottlingException":
508
- case "com.amazonaws.scheduler#ThrottlingException":
509
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
510
- case "ValidationException":
511
- case "com.amazonaws.scheduler#ValidationException":
512
- throw await de_ValidationExceptionRes(parsedOutput, context);
513
- default:
514
- const parsedBody = parsedOutput.body;
515
- return throwDefaultError({
516
- output,
517
- parsedBody,
518
- errorCode,
519
- });
520
- }
521
- };
522
- const de_ListSchedulesCommand = async (output, context) => {
523
- if (output.statusCode !== 200 && output.statusCode >= 300) {
524
- return de_ListSchedulesCommandError(output, context);
525
- }
526
- const contents = (0, smithy_client_1.map)({
527
- $metadata: deserializeMetadata(output),
528
- });
529
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
530
- const doc = (0, smithy_client_1.take)(data, {
531
- NextToken: smithy_client_1.expectString,
532
- Schedules: (_) => de_ScheduleList(_, context),
533
- });
534
- Object.assign(contents, doc);
535
- return contents;
536
- };
537
- exports.de_ListSchedulesCommand = de_ListSchedulesCommand;
538
- const de_ListSchedulesCommandError = async (output, context) => {
539
- const parsedOutput = {
540
- ...output,
541
- body: await parseErrorBody(output.body, context),
542
- };
543
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
544
- switch (errorCode) {
545
- case "InternalServerException":
546
- case "com.amazonaws.scheduler#InternalServerException":
547
- throw await de_InternalServerExceptionRes(parsedOutput, context);
548
- case "ResourceNotFoundException":
549
- case "com.amazonaws.scheduler#ResourceNotFoundException":
550
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
551
- case "ThrottlingException":
552
- case "com.amazonaws.scheduler#ThrottlingException":
553
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
554
- case "ValidationException":
555
- case "com.amazonaws.scheduler#ValidationException":
556
- throw await de_ValidationExceptionRes(parsedOutput, context);
557
- default:
558
- const parsedBody = parsedOutput.body;
559
- return throwDefaultError({
560
- output,
561
- parsedBody,
562
- errorCode,
563
- });
564
- }
565
- };
566
- const de_ListTagsForResourceCommand = async (output, context) => {
567
- if (output.statusCode !== 200 && output.statusCode >= 300) {
568
- return de_ListTagsForResourceCommandError(output, context);
569
- }
570
- const contents = (0, smithy_client_1.map)({
571
- $metadata: deserializeMetadata(output),
572
- });
573
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
574
- const doc = (0, smithy_client_1.take)(data, {
575
- Tags: smithy_client_1._json,
576
- });
577
- Object.assign(contents, doc);
578
- return contents;
579
- };
580
- exports.de_ListTagsForResourceCommand = de_ListTagsForResourceCommand;
581
- const de_ListTagsForResourceCommandError = async (output, context) => {
582
- const parsedOutput = {
583
- ...output,
584
- body: await parseErrorBody(output.body, context),
585
- };
586
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
587
- switch (errorCode) {
588
- case "InternalServerException":
589
- case "com.amazonaws.scheduler#InternalServerException":
590
- throw await de_InternalServerExceptionRes(parsedOutput, context);
591
- case "ResourceNotFoundException":
592
- case "com.amazonaws.scheduler#ResourceNotFoundException":
593
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
594
- case "ThrottlingException":
595
- case "com.amazonaws.scheduler#ThrottlingException":
596
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
597
- case "ValidationException":
598
- case "com.amazonaws.scheduler#ValidationException":
599
- throw await de_ValidationExceptionRes(parsedOutput, context);
600
- default:
601
- const parsedBody = parsedOutput.body;
602
- return throwDefaultError({
603
- output,
604
- parsedBody,
605
- errorCode,
606
- });
607
- }
608
- };
609
- const de_TagResourceCommand = async (output, context) => {
610
- if (output.statusCode !== 200 && output.statusCode >= 300) {
611
- return de_TagResourceCommandError(output, context);
612
- }
613
- const contents = (0, smithy_client_1.map)({
614
- $metadata: deserializeMetadata(output),
615
- });
616
- await (0, smithy_client_1.collectBody)(output.body, context);
617
- return contents;
618
- };
619
- exports.de_TagResourceCommand = de_TagResourceCommand;
620
- const de_TagResourceCommandError = async (output, context) => {
621
- const parsedOutput = {
622
- ...output,
623
- body: await parseErrorBody(output.body, context),
624
- };
625
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
626
- switch (errorCode) {
627
- case "ConflictException":
628
- case "com.amazonaws.scheduler#ConflictException":
629
- throw await de_ConflictExceptionRes(parsedOutput, context);
630
- case "InternalServerException":
631
- case "com.amazonaws.scheduler#InternalServerException":
632
- throw await de_InternalServerExceptionRes(parsedOutput, context);
633
- case "ResourceNotFoundException":
634
- case "com.amazonaws.scheduler#ResourceNotFoundException":
635
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
636
- case "ThrottlingException":
637
- case "com.amazonaws.scheduler#ThrottlingException":
638
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
639
- case "ValidationException":
640
- case "com.amazonaws.scheduler#ValidationException":
641
- throw await de_ValidationExceptionRes(parsedOutput, context);
642
- default:
643
- const parsedBody = parsedOutput.body;
644
- return throwDefaultError({
645
- output,
646
- parsedBody,
647
- errorCode,
648
- });
649
- }
650
- };
651
- const de_UntagResourceCommand = async (output, context) => {
652
- if (output.statusCode !== 200 && output.statusCode >= 300) {
653
- return de_UntagResourceCommandError(output, context);
654
- }
655
- const contents = (0, smithy_client_1.map)({
656
- $metadata: deserializeMetadata(output),
657
- });
658
- await (0, smithy_client_1.collectBody)(output.body, context);
659
- return contents;
660
- };
661
- exports.de_UntagResourceCommand = de_UntagResourceCommand;
662
- const de_UntagResourceCommandError = async (output, context) => {
663
- const parsedOutput = {
664
- ...output,
665
- body: await parseErrorBody(output.body, context),
666
- };
667
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
668
- switch (errorCode) {
669
- case "ConflictException":
670
- case "com.amazonaws.scheduler#ConflictException":
671
- throw await de_ConflictExceptionRes(parsedOutput, context);
672
- case "InternalServerException":
673
- case "com.amazonaws.scheduler#InternalServerException":
674
- throw await de_InternalServerExceptionRes(parsedOutput, context);
675
- case "ResourceNotFoundException":
676
- case "com.amazonaws.scheduler#ResourceNotFoundException":
677
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
678
- case "ThrottlingException":
679
- case "com.amazonaws.scheduler#ThrottlingException":
680
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
681
- case "ValidationException":
682
- case "com.amazonaws.scheduler#ValidationException":
683
- throw await de_ValidationExceptionRes(parsedOutput, context);
684
- default:
685
- const parsedBody = parsedOutput.body;
686
- return throwDefaultError({
687
- output,
688
- parsedBody,
689
- errorCode,
690
- });
691
- }
692
- };
693
- const de_UpdateScheduleCommand = async (output, context) => {
694
- if (output.statusCode !== 200 && output.statusCode >= 300) {
695
- return de_UpdateScheduleCommandError(output, context);
696
- }
697
- const contents = (0, smithy_client_1.map)({
698
- $metadata: deserializeMetadata(output),
699
- });
700
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
701
- const doc = (0, smithy_client_1.take)(data, {
702
- ScheduleArn: smithy_client_1.expectString,
703
- });
704
- Object.assign(contents, doc);
705
- return contents;
706
- };
707
- exports.de_UpdateScheduleCommand = de_UpdateScheduleCommand;
708
- const de_UpdateScheduleCommandError = async (output, context) => {
709
- const parsedOutput = {
710
- ...output,
711
- body: await parseErrorBody(output.body, context),
712
- };
713
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
714
- switch (errorCode) {
715
- case "ConflictException":
716
- case "com.amazonaws.scheduler#ConflictException":
717
- throw await de_ConflictExceptionRes(parsedOutput, context);
718
- case "InternalServerException":
719
- case "com.amazonaws.scheduler#InternalServerException":
720
- throw await de_InternalServerExceptionRes(parsedOutput, context);
721
- case "ResourceNotFoundException":
722
- case "com.amazonaws.scheduler#ResourceNotFoundException":
723
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
724
- case "ThrottlingException":
725
- case "com.amazonaws.scheduler#ThrottlingException":
726
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
727
- case "ValidationException":
728
- case "com.amazonaws.scheduler#ValidationException":
729
- throw await de_ValidationExceptionRes(parsedOutput, context);
730
- default:
731
- const parsedBody = parsedOutput.body;
732
- return throwDefaultError({
733
- output,
734
- parsedBody,
735
- errorCode,
736
- });
737
- }
738
- };
739
- const throwDefaultError = (0, smithy_client_1.withBaseException)(SchedulerServiceException_1.SchedulerServiceException);
740
- const de_ConflictExceptionRes = async (parsedOutput, context) => {
741
- const contents = (0, smithy_client_1.map)({});
742
- const data = parsedOutput.body;
743
- const doc = (0, smithy_client_1.take)(data, {
744
- Message: smithy_client_1.expectString,
745
- });
746
- Object.assign(contents, doc);
747
- const exception = new models_0_1.ConflictException({
748
- $metadata: deserializeMetadata(parsedOutput),
749
- ...contents,
750
- });
751
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
752
- };
753
- const de_InternalServerExceptionRes = async (parsedOutput, context) => {
754
- const contents = (0, smithy_client_1.map)({});
755
- const data = parsedOutput.body;
756
- const doc = (0, smithy_client_1.take)(data, {
757
- Message: smithy_client_1.expectString,
758
- });
759
- Object.assign(contents, doc);
760
- const exception = new models_0_1.InternalServerException({
761
- $metadata: deserializeMetadata(parsedOutput),
762
- ...contents,
763
- });
764
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
765
- };
766
- const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
767
- const contents = (0, smithy_client_1.map)({});
768
- const data = parsedOutput.body;
769
- const doc = (0, smithy_client_1.take)(data, {
770
- Message: smithy_client_1.expectString,
771
- });
772
- Object.assign(contents, doc);
773
- const exception = new models_0_1.ResourceNotFoundException({
774
- $metadata: deserializeMetadata(parsedOutput),
775
- ...contents,
776
- });
777
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
778
- };
779
- const de_ServiceQuotaExceededExceptionRes = async (parsedOutput, context) => {
780
- const contents = (0, smithy_client_1.map)({});
781
- const data = parsedOutput.body;
782
- const doc = (0, smithy_client_1.take)(data, {
783
- Message: smithy_client_1.expectString,
784
- });
785
- Object.assign(contents, doc);
786
- const exception = new models_0_1.ServiceQuotaExceededException({
787
- $metadata: deserializeMetadata(parsedOutput),
788
- ...contents,
789
- });
790
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
791
- };
792
- const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
793
- const contents = (0, smithy_client_1.map)({});
794
- const data = parsedOutput.body;
795
- const doc = (0, smithy_client_1.take)(data, {
796
- Message: smithy_client_1.expectString,
797
- });
798
- Object.assign(contents, doc);
799
- const exception = new models_0_1.ThrottlingException({
800
- $metadata: deserializeMetadata(parsedOutput),
801
- ...contents,
802
- });
803
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
804
- };
805
- const de_ValidationExceptionRes = async (parsedOutput, context) => {
806
- const contents = (0, smithy_client_1.map)({});
807
- const data = parsedOutput.body;
808
- const doc = (0, smithy_client_1.take)(data, {
809
- Message: smithy_client_1.expectString,
810
- });
811
- Object.assign(contents, doc);
812
- const exception = new models_0_1.ValidationException({
813
- $metadata: deserializeMetadata(parsedOutput),
814
- ...contents,
815
- });
816
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
817
- };
818
- const de_ScheduleGroupList = (output, context) => {
819
- const retVal = (output || [])
820
- .filter((e) => e != null)
821
- .map((entry) => {
822
- return de_ScheduleGroupSummary(entry, context);
823
- });
824
- return retVal;
825
- };
826
- const de_ScheduleGroupSummary = (output, context) => {
827
- return (0, smithy_client_1.take)(output, {
828
- Arn: smithy_client_1.expectString,
829
- CreationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
830
- LastModificationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
831
- Name: smithy_client_1.expectString,
832
- State: smithy_client_1.expectString,
833
- });
834
- };
835
- const de_ScheduleList = (output, context) => {
836
- const retVal = (output || [])
837
- .filter((e) => e != null)
838
- .map((entry) => {
839
- return de_ScheduleSummary(entry, context);
840
- });
841
- return retVal;
842
- };
843
- const de_ScheduleSummary = (output, context) => {
844
- return (0, smithy_client_1.take)(output, {
845
- Arn: smithy_client_1.expectString,
846
- CreationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
847
- GroupName: smithy_client_1.expectString,
848
- LastModificationDate: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
849
- Name: smithy_client_1.expectString,
850
- State: smithy_client_1.expectString,
851
- Target: smithy_client_1._json,
852
- });
853
- };
854
- const deserializeMetadata = (output) => ({
855
- httpStatusCode: output.statusCode,
856
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
857
- extendedRequestId: output.headers["x-amz-id-2"],
858
- cfId: output.headers["x-amz-cf-id"],
859
- });
860
- const collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body));
861
- const isSerializableHeaderValue = (value) => value !== undefined &&
862
- value !== null &&
863
- value !== "" &&
864
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
865
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
866
- const _CT = "ClientToken";
867
- const _GN = "GroupName";
868
- const _MR = "MaxResults";
869
- const _NP = "NamePrefix";
870
- const _NT = "NextToken";
871
- const _S = "State";
872
- const _SG = "ScheduleGroup";
873
- const _TK = "TagKeys";
874
- const _cT = "clientToken";
875
- const _gN = "groupName";
876
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
877
- if (encoded.length) {
878
- return JSON.parse(encoded);
879
- }
880
- return {};
881
- });
882
- const parseErrorBody = async (errorBody, context) => {
883
- const value = await parseBody(errorBody, context);
884
- value.message = value.message ?? value.Message;
885
- return value;
886
- };
887
- const loadRestJsonErrorCode = (output, data) => {
888
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
889
- const sanitizeErrorCode = (rawValue) => {
890
- let cleanValue = rawValue;
891
- if (typeof cleanValue === "number") {
892
- cleanValue = cleanValue.toString();
893
- }
894
- if (cleanValue.indexOf(",") >= 0) {
895
- cleanValue = cleanValue.split(",")[0];
896
- }
897
- if (cleanValue.indexOf(":") >= 0) {
898
- cleanValue = cleanValue.split(":")[0];
899
- }
900
- if (cleanValue.indexOf("#") >= 0) {
901
- cleanValue = cleanValue.split("#")[1];
902
- }
903
- return cleanValue;
904
- };
905
- const headerKey = findKey(output.headers, "x-amzn-errortype");
906
- if (headerKey !== undefined) {
907
- return sanitizeErrorCode(output.headers[headerKey]);
908
- }
909
- if (data.code !== undefined) {
910
- return sanitizeErrorCode(data.code);
911
- }
912
- if (data["__type"] !== undefined) {
913
- return sanitizeErrorCode(data["__type"]);
914
- }
915
- };
1
+ module.exports = require("../index.js");