@aws-sdk/client-rbin 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.
@@ -1,719 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.de_UpdateRuleCommand = exports.de_UntagResourceCommand = exports.de_UnlockRuleCommand = exports.de_TagResourceCommand = exports.de_LockRuleCommand = exports.de_ListTagsForResourceCommand = exports.de_ListRulesCommand = exports.de_GetRuleCommand = exports.de_DeleteRuleCommand = exports.de_CreateRuleCommand = exports.se_UpdateRuleCommand = exports.se_UntagResourceCommand = exports.se_UnlockRuleCommand = exports.se_TagResourceCommand = exports.se_LockRuleCommand = exports.se_ListTagsForResourceCommand = exports.se_ListRulesCommand = exports.se_GetRuleCommand = exports.se_DeleteRuleCommand = exports.se_CreateRuleCommand = 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 RbinServiceException_1 = require("../models/RbinServiceException");
8
- const se_CreateRuleCommand = async (input, context) => {
9
- const b = (0, core_1.requestBuilder)(input, context);
10
- const headers = {
11
- "content-type": "application/json",
12
- };
13
- b.bp("/rules");
14
- let body;
15
- body = JSON.stringify((0, smithy_client_1.take)(input, {
16
- Description: [],
17
- LockConfiguration: (_) => (0, smithy_client_1._json)(_),
18
- ResourceTags: (_) => (0, smithy_client_1._json)(_),
19
- ResourceType: [],
20
- RetentionPeriod: (_) => (0, smithy_client_1._json)(_),
21
- Tags: (_) => (0, smithy_client_1._json)(_),
22
- }));
23
- b.m("POST").h(headers).b(body);
24
- return b.build();
25
- };
26
- exports.se_CreateRuleCommand = se_CreateRuleCommand;
27
- const se_DeleteRuleCommand = async (input, context) => {
28
- const b = (0, core_1.requestBuilder)(input, context);
29
- const headers = {};
30
- b.bp("/rules/{Identifier}");
31
- b.p("Identifier", () => input.Identifier, "{Identifier}", false);
32
- let body;
33
- b.m("DELETE").h(headers).b(body);
34
- return b.build();
35
- };
36
- exports.se_DeleteRuleCommand = se_DeleteRuleCommand;
37
- const se_GetRuleCommand = async (input, context) => {
38
- const b = (0, core_1.requestBuilder)(input, context);
39
- const headers = {};
40
- b.bp("/rules/{Identifier}");
41
- b.p("Identifier", () => input.Identifier, "{Identifier}", false);
42
- let body;
43
- b.m("GET").h(headers).b(body);
44
- return b.build();
45
- };
46
- exports.se_GetRuleCommand = se_GetRuleCommand;
47
- const se_ListRulesCommand = async (input, context) => {
48
- const b = (0, core_1.requestBuilder)(input, context);
49
- const headers = {
50
- "content-type": "application/json",
51
- };
52
- b.bp("/list-rules");
53
- let body;
54
- body = JSON.stringify((0, smithy_client_1.take)(input, {
55
- LockState: [],
56
- MaxResults: [],
57
- NextToken: [],
58
- ResourceTags: (_) => (0, smithy_client_1._json)(_),
59
- ResourceType: [],
60
- }));
61
- b.m("POST").h(headers).b(body);
62
- return b.build();
63
- };
64
- exports.se_ListRulesCommand = se_ListRulesCommand;
65
- const se_ListTagsForResourceCommand = async (input, context) => {
66
- const b = (0, core_1.requestBuilder)(input, context);
67
- const headers = {};
68
- b.bp("/tags/{ResourceArn}");
69
- b.p("ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
70
- let body;
71
- b.m("GET").h(headers).b(body);
72
- return b.build();
73
- };
74
- exports.se_ListTagsForResourceCommand = se_ListTagsForResourceCommand;
75
- const se_LockRuleCommand = async (input, context) => {
76
- const b = (0, core_1.requestBuilder)(input, context);
77
- const headers = {
78
- "content-type": "application/json",
79
- };
80
- b.bp("/rules/{Identifier}/lock");
81
- b.p("Identifier", () => input.Identifier, "{Identifier}", false);
82
- let body;
83
- body = JSON.stringify((0, smithy_client_1.take)(input, {
84
- LockConfiguration: (_) => (0, smithy_client_1._json)(_),
85
- }));
86
- b.m("PATCH").h(headers).b(body);
87
- return b.build();
88
- };
89
- exports.se_LockRuleCommand = se_LockRuleCommand;
90
- const se_TagResourceCommand = async (input, context) => {
91
- const b = (0, core_1.requestBuilder)(input, context);
92
- const headers = {
93
- "content-type": "application/json",
94
- };
95
- b.bp("/tags/{ResourceArn}");
96
- b.p("ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
97
- let body;
98
- body = JSON.stringify((0, smithy_client_1.take)(input, {
99
- Tags: (_) => (0, smithy_client_1._json)(_),
100
- }));
101
- b.m("POST").h(headers).b(body);
102
- return b.build();
103
- };
104
- exports.se_TagResourceCommand = se_TagResourceCommand;
105
- const se_UnlockRuleCommand = async (input, context) => {
106
- const b = (0, core_1.requestBuilder)(input, context);
107
- const headers = {};
108
- b.bp("/rules/{Identifier}/unlock");
109
- b.p("Identifier", () => input.Identifier, "{Identifier}", false);
110
- let body;
111
- b.m("PATCH").h(headers).b(body);
112
- return b.build();
113
- };
114
- exports.se_UnlockRuleCommand = se_UnlockRuleCommand;
115
- const se_UntagResourceCommand = async (input, context) => {
116
- const b = (0, core_1.requestBuilder)(input, context);
117
- const headers = {};
118
- b.bp("/tags/{ResourceArn}");
119
- b.p("ResourceArn", () => input.ResourceArn, "{ResourceArn}", false);
120
- const query = (0, smithy_client_1.map)({
121
- [_tK]: [
122
- (0, smithy_client_1.expectNonNull)(input.TagKeys, `TagKeys`) != null,
123
- () => (input[_TK] || []).map((_entry) => _entry),
124
- ],
125
- });
126
- let body;
127
- b.m("DELETE").h(headers).q(query).b(body);
128
- return b.build();
129
- };
130
- exports.se_UntagResourceCommand = se_UntagResourceCommand;
131
- const se_UpdateRuleCommand = async (input, context) => {
132
- const b = (0, core_1.requestBuilder)(input, context);
133
- const headers = {
134
- "content-type": "application/json",
135
- };
136
- b.bp("/rules/{Identifier}");
137
- b.p("Identifier", () => input.Identifier, "{Identifier}", false);
138
- let body;
139
- body = JSON.stringify((0, smithy_client_1.take)(input, {
140
- Description: [],
141
- ResourceTags: (_) => (0, smithy_client_1._json)(_),
142
- ResourceType: [],
143
- RetentionPeriod: (_) => (0, smithy_client_1._json)(_),
144
- }));
145
- b.m("PATCH").h(headers).b(body);
146
- return b.build();
147
- };
148
- exports.se_UpdateRuleCommand = se_UpdateRuleCommand;
149
- const de_CreateRuleCommand = async (output, context) => {
150
- if (output.statusCode !== 201 && output.statusCode >= 300) {
151
- return de_CreateRuleCommandError(output, context);
152
- }
153
- const contents = (0, smithy_client_1.map)({
154
- $metadata: deserializeMetadata(output),
155
- });
156
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
157
- const doc = (0, smithy_client_1.take)(data, {
158
- Description: smithy_client_1.expectString,
159
- Identifier: smithy_client_1.expectString,
160
- LockConfiguration: smithy_client_1._json,
161
- LockState: smithy_client_1.expectString,
162
- ResourceTags: smithy_client_1._json,
163
- ResourceType: smithy_client_1.expectString,
164
- RetentionPeriod: smithy_client_1._json,
165
- RuleArn: smithy_client_1.expectString,
166
- Status: smithy_client_1.expectString,
167
- Tags: smithy_client_1._json,
168
- });
169
- Object.assign(contents, doc);
170
- return contents;
171
- };
172
- exports.de_CreateRuleCommand = de_CreateRuleCommand;
173
- const de_CreateRuleCommandError = async (output, context) => {
174
- const parsedOutput = {
175
- ...output,
176
- body: await parseErrorBody(output.body, context),
177
- };
178
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
179
- switch (errorCode) {
180
- case "InternalServerException":
181
- case "com.amazonaws.rbin#InternalServerException":
182
- throw await de_InternalServerExceptionRes(parsedOutput, context);
183
- case "ServiceQuotaExceededException":
184
- case "com.amazonaws.rbin#ServiceQuotaExceededException":
185
- throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
186
- case "ValidationException":
187
- case "com.amazonaws.rbin#ValidationException":
188
- throw await de_ValidationExceptionRes(parsedOutput, context);
189
- default:
190
- const parsedBody = parsedOutput.body;
191
- return throwDefaultError({
192
- output,
193
- parsedBody,
194
- errorCode,
195
- });
196
- }
197
- };
198
- const de_DeleteRuleCommand = async (output, context) => {
199
- if (output.statusCode !== 204 && output.statusCode >= 300) {
200
- return de_DeleteRuleCommandError(output, context);
201
- }
202
- const contents = (0, smithy_client_1.map)({
203
- $metadata: deserializeMetadata(output),
204
- });
205
- await (0, smithy_client_1.collectBody)(output.body, context);
206
- return contents;
207
- };
208
- exports.de_DeleteRuleCommand = de_DeleteRuleCommand;
209
- const de_DeleteRuleCommandError = async (output, context) => {
210
- const parsedOutput = {
211
- ...output,
212
- body: await parseErrorBody(output.body, context),
213
- };
214
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
215
- switch (errorCode) {
216
- case "ConflictException":
217
- case "com.amazonaws.rbin#ConflictException":
218
- throw await de_ConflictExceptionRes(parsedOutput, context);
219
- case "InternalServerException":
220
- case "com.amazonaws.rbin#InternalServerException":
221
- throw await de_InternalServerExceptionRes(parsedOutput, context);
222
- case "ResourceNotFoundException":
223
- case "com.amazonaws.rbin#ResourceNotFoundException":
224
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
225
- case "ValidationException":
226
- case "com.amazonaws.rbin#ValidationException":
227
- throw await de_ValidationExceptionRes(parsedOutput, context);
228
- default:
229
- const parsedBody = parsedOutput.body;
230
- return throwDefaultError({
231
- output,
232
- parsedBody,
233
- errorCode,
234
- });
235
- }
236
- };
237
- const de_GetRuleCommand = async (output, context) => {
238
- if (output.statusCode !== 200 && output.statusCode >= 300) {
239
- return de_GetRuleCommandError(output, context);
240
- }
241
- const contents = (0, smithy_client_1.map)({
242
- $metadata: deserializeMetadata(output),
243
- });
244
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
245
- const doc = (0, smithy_client_1.take)(data, {
246
- Description: smithy_client_1.expectString,
247
- Identifier: smithy_client_1.expectString,
248
- LockConfiguration: smithy_client_1._json,
249
- LockEndTime: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
250
- LockState: smithy_client_1.expectString,
251
- ResourceTags: smithy_client_1._json,
252
- ResourceType: smithy_client_1.expectString,
253
- RetentionPeriod: smithy_client_1._json,
254
- RuleArn: smithy_client_1.expectString,
255
- Status: smithy_client_1.expectString,
256
- });
257
- Object.assign(contents, doc);
258
- return contents;
259
- };
260
- exports.de_GetRuleCommand = de_GetRuleCommand;
261
- const de_GetRuleCommandError = async (output, context) => {
262
- const parsedOutput = {
263
- ...output,
264
- body: await parseErrorBody(output.body, context),
265
- };
266
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
267
- switch (errorCode) {
268
- case "InternalServerException":
269
- case "com.amazonaws.rbin#InternalServerException":
270
- throw await de_InternalServerExceptionRes(parsedOutput, context);
271
- case "ResourceNotFoundException":
272
- case "com.amazonaws.rbin#ResourceNotFoundException":
273
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
274
- case "ValidationException":
275
- case "com.amazonaws.rbin#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_ListRulesCommand = async (output, context) => {
287
- if (output.statusCode !== 200 && output.statusCode >= 300) {
288
- return de_ListRulesCommandError(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
- NextToken: smithy_client_1.expectString,
296
- Rules: smithy_client_1._json,
297
- });
298
- Object.assign(contents, doc);
299
- return contents;
300
- };
301
- exports.de_ListRulesCommand = de_ListRulesCommand;
302
- const de_ListRulesCommandError = async (output, context) => {
303
- const parsedOutput = {
304
- ...output,
305
- body: await parseErrorBody(output.body, context),
306
- };
307
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
308
- switch (errorCode) {
309
- case "InternalServerException":
310
- case "com.amazonaws.rbin#InternalServerException":
311
- throw await de_InternalServerExceptionRes(parsedOutput, context);
312
- case "ValidationException":
313
- case "com.amazonaws.rbin#ValidationException":
314
- throw await de_ValidationExceptionRes(parsedOutput, context);
315
- default:
316
- const parsedBody = parsedOutput.body;
317
- return throwDefaultError({
318
- output,
319
- parsedBody,
320
- errorCode,
321
- });
322
- }
323
- };
324
- const de_ListTagsForResourceCommand = async (output, context) => {
325
- if (output.statusCode !== 200 && output.statusCode >= 300) {
326
- return de_ListTagsForResourceCommandError(output, context);
327
- }
328
- const contents = (0, smithy_client_1.map)({
329
- $metadata: deserializeMetadata(output),
330
- });
331
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
332
- const doc = (0, smithy_client_1.take)(data, {
333
- Tags: smithy_client_1._json,
334
- });
335
- Object.assign(contents, doc);
336
- return contents;
337
- };
338
- exports.de_ListTagsForResourceCommand = de_ListTagsForResourceCommand;
339
- const de_ListTagsForResourceCommandError = async (output, context) => {
340
- const parsedOutput = {
341
- ...output,
342
- body: await parseErrorBody(output.body, context),
343
- };
344
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
345
- switch (errorCode) {
346
- case "InternalServerException":
347
- case "com.amazonaws.rbin#InternalServerException":
348
- throw await de_InternalServerExceptionRes(parsedOutput, context);
349
- case "ResourceNotFoundException":
350
- case "com.amazonaws.rbin#ResourceNotFoundException":
351
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
352
- case "ValidationException":
353
- case "com.amazonaws.rbin#ValidationException":
354
- throw await de_ValidationExceptionRes(parsedOutput, context);
355
- default:
356
- const parsedBody = parsedOutput.body;
357
- return throwDefaultError({
358
- output,
359
- parsedBody,
360
- errorCode,
361
- });
362
- }
363
- };
364
- const de_LockRuleCommand = async (output, context) => {
365
- if (output.statusCode !== 200 && output.statusCode >= 300) {
366
- return de_LockRuleCommandError(output, context);
367
- }
368
- const contents = (0, smithy_client_1.map)({
369
- $metadata: deserializeMetadata(output),
370
- });
371
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
372
- const doc = (0, smithy_client_1.take)(data, {
373
- Description: smithy_client_1.expectString,
374
- Identifier: smithy_client_1.expectString,
375
- LockConfiguration: smithy_client_1._json,
376
- LockState: smithy_client_1.expectString,
377
- ResourceTags: smithy_client_1._json,
378
- ResourceType: smithy_client_1.expectString,
379
- RetentionPeriod: smithy_client_1._json,
380
- RuleArn: smithy_client_1.expectString,
381
- Status: smithy_client_1.expectString,
382
- });
383
- Object.assign(contents, doc);
384
- return contents;
385
- };
386
- exports.de_LockRuleCommand = de_LockRuleCommand;
387
- const de_LockRuleCommandError = 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 "ConflictException":
395
- case "com.amazonaws.rbin#ConflictException":
396
- throw await de_ConflictExceptionRes(parsedOutput, context);
397
- case "InternalServerException":
398
- case "com.amazonaws.rbin#InternalServerException":
399
- throw await de_InternalServerExceptionRes(parsedOutput, context);
400
- case "ResourceNotFoundException":
401
- case "com.amazonaws.rbin#ResourceNotFoundException":
402
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
403
- case "ValidationException":
404
- case "com.amazonaws.rbin#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_TagResourceCommand = async (output, context) => {
416
- if (output.statusCode !== 201 && output.statusCode >= 300) {
417
- return de_TagResourceCommandError(output, context);
418
- }
419
- const contents = (0, smithy_client_1.map)({
420
- $metadata: deserializeMetadata(output),
421
- });
422
- await (0, smithy_client_1.collectBody)(output.body, context);
423
- return contents;
424
- };
425
- exports.de_TagResourceCommand = de_TagResourceCommand;
426
- const de_TagResourceCommandError = async (output, context) => {
427
- const parsedOutput = {
428
- ...output,
429
- body: await parseErrorBody(output.body, context),
430
- };
431
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
432
- switch (errorCode) {
433
- case "InternalServerException":
434
- case "com.amazonaws.rbin#InternalServerException":
435
- throw await de_InternalServerExceptionRes(parsedOutput, context);
436
- case "ResourceNotFoundException":
437
- case "com.amazonaws.rbin#ResourceNotFoundException":
438
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
439
- case "ServiceQuotaExceededException":
440
- case "com.amazonaws.rbin#ServiceQuotaExceededException":
441
- throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
442
- case "ValidationException":
443
- case "com.amazonaws.rbin#ValidationException":
444
- throw await de_ValidationExceptionRes(parsedOutput, context);
445
- default:
446
- const parsedBody = parsedOutput.body;
447
- return throwDefaultError({
448
- output,
449
- parsedBody,
450
- errorCode,
451
- });
452
- }
453
- };
454
- const de_UnlockRuleCommand = async (output, context) => {
455
- if (output.statusCode !== 200 && output.statusCode >= 300) {
456
- return de_UnlockRuleCommandError(output, context);
457
- }
458
- const contents = (0, smithy_client_1.map)({
459
- $metadata: deserializeMetadata(output),
460
- });
461
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
462
- const doc = (0, smithy_client_1.take)(data, {
463
- Description: smithy_client_1.expectString,
464
- Identifier: smithy_client_1.expectString,
465
- LockConfiguration: smithy_client_1._json,
466
- LockEndTime: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
467
- LockState: smithy_client_1.expectString,
468
- ResourceTags: smithy_client_1._json,
469
- ResourceType: smithy_client_1.expectString,
470
- RetentionPeriod: smithy_client_1._json,
471
- RuleArn: smithy_client_1.expectString,
472
- Status: smithy_client_1.expectString,
473
- });
474
- Object.assign(contents, doc);
475
- return contents;
476
- };
477
- exports.de_UnlockRuleCommand = de_UnlockRuleCommand;
478
- const de_UnlockRuleCommandError = async (output, context) => {
479
- const parsedOutput = {
480
- ...output,
481
- body: await parseErrorBody(output.body, context),
482
- };
483
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
484
- switch (errorCode) {
485
- case "ConflictException":
486
- case "com.amazonaws.rbin#ConflictException":
487
- throw await de_ConflictExceptionRes(parsedOutput, context);
488
- case "InternalServerException":
489
- case "com.amazonaws.rbin#InternalServerException":
490
- throw await de_InternalServerExceptionRes(parsedOutput, context);
491
- case "ResourceNotFoundException":
492
- case "com.amazonaws.rbin#ResourceNotFoundException":
493
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
494
- case "ValidationException":
495
- case "com.amazonaws.rbin#ValidationException":
496
- throw await de_ValidationExceptionRes(parsedOutput, context);
497
- default:
498
- const parsedBody = parsedOutput.body;
499
- return throwDefaultError({
500
- output,
501
- parsedBody,
502
- errorCode,
503
- });
504
- }
505
- };
506
- const de_UntagResourceCommand = async (output, context) => {
507
- if (output.statusCode !== 204 && output.statusCode >= 300) {
508
- return de_UntagResourceCommandError(output, context);
509
- }
510
- const contents = (0, smithy_client_1.map)({
511
- $metadata: deserializeMetadata(output),
512
- });
513
- await (0, smithy_client_1.collectBody)(output.body, context);
514
- return contents;
515
- };
516
- exports.de_UntagResourceCommand = de_UntagResourceCommand;
517
- const de_UntagResourceCommandError = 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 "InternalServerException":
525
- case "com.amazonaws.rbin#InternalServerException":
526
- throw await de_InternalServerExceptionRes(parsedOutput, context);
527
- case "ResourceNotFoundException":
528
- case "com.amazonaws.rbin#ResourceNotFoundException":
529
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
530
- case "ValidationException":
531
- case "com.amazonaws.rbin#ValidationException":
532
- throw await de_ValidationExceptionRes(parsedOutput, context);
533
- default:
534
- const parsedBody = parsedOutput.body;
535
- return throwDefaultError({
536
- output,
537
- parsedBody,
538
- errorCode,
539
- });
540
- }
541
- };
542
- const de_UpdateRuleCommand = async (output, context) => {
543
- if (output.statusCode !== 200 && output.statusCode >= 300) {
544
- return de_UpdateRuleCommandError(output, context);
545
- }
546
- const contents = (0, smithy_client_1.map)({
547
- $metadata: deserializeMetadata(output),
548
- });
549
- const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
550
- const doc = (0, smithy_client_1.take)(data, {
551
- Description: smithy_client_1.expectString,
552
- Identifier: smithy_client_1.expectString,
553
- LockEndTime: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
554
- LockState: smithy_client_1.expectString,
555
- ResourceTags: smithy_client_1._json,
556
- ResourceType: smithy_client_1.expectString,
557
- RetentionPeriod: smithy_client_1._json,
558
- RuleArn: smithy_client_1.expectString,
559
- Status: smithy_client_1.expectString,
560
- });
561
- Object.assign(contents, doc);
562
- return contents;
563
- };
564
- exports.de_UpdateRuleCommand = de_UpdateRuleCommand;
565
- const de_UpdateRuleCommandError = async (output, context) => {
566
- const parsedOutput = {
567
- ...output,
568
- body: await parseErrorBody(output.body, context),
569
- };
570
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
571
- switch (errorCode) {
572
- case "ConflictException":
573
- case "com.amazonaws.rbin#ConflictException":
574
- throw await de_ConflictExceptionRes(parsedOutput, context);
575
- case "InternalServerException":
576
- case "com.amazonaws.rbin#InternalServerException":
577
- throw await de_InternalServerExceptionRes(parsedOutput, context);
578
- case "ResourceNotFoundException":
579
- case "com.amazonaws.rbin#ResourceNotFoundException":
580
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
581
- case "ServiceQuotaExceededException":
582
- case "com.amazonaws.rbin#ServiceQuotaExceededException":
583
- throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
584
- case "ValidationException":
585
- case "com.amazonaws.rbin#ValidationException":
586
- throw await de_ValidationExceptionRes(parsedOutput, context);
587
- default:
588
- const parsedBody = parsedOutput.body;
589
- return throwDefaultError({
590
- output,
591
- parsedBody,
592
- errorCode,
593
- });
594
- }
595
- };
596
- const throwDefaultError = (0, smithy_client_1.withBaseException)(RbinServiceException_1.RbinServiceException);
597
- const de_ConflictExceptionRes = async (parsedOutput, context) => {
598
- const contents = (0, smithy_client_1.map)({});
599
- const data = parsedOutput.body;
600
- const doc = (0, smithy_client_1.take)(data, {
601
- Message: smithy_client_1.expectString,
602
- Reason: smithy_client_1.expectString,
603
- });
604
- Object.assign(contents, doc);
605
- const exception = new models_0_1.ConflictException({
606
- $metadata: deserializeMetadata(parsedOutput),
607
- ...contents,
608
- });
609
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
610
- };
611
- const de_InternalServerExceptionRes = async (parsedOutput, context) => {
612
- const contents = (0, smithy_client_1.map)({});
613
- const data = parsedOutput.body;
614
- const doc = (0, smithy_client_1.take)(data, {
615
- Message: smithy_client_1.expectString,
616
- });
617
- Object.assign(contents, doc);
618
- const exception = new models_0_1.InternalServerException({
619
- $metadata: deserializeMetadata(parsedOutput),
620
- ...contents,
621
- });
622
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
623
- };
624
- const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
625
- const contents = (0, smithy_client_1.map)({});
626
- const data = parsedOutput.body;
627
- const doc = (0, smithy_client_1.take)(data, {
628
- Message: smithy_client_1.expectString,
629
- Reason: smithy_client_1.expectString,
630
- });
631
- Object.assign(contents, doc);
632
- const exception = new models_0_1.ResourceNotFoundException({
633
- $metadata: deserializeMetadata(parsedOutput),
634
- ...contents,
635
- });
636
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
637
- };
638
- const de_ServiceQuotaExceededExceptionRes = async (parsedOutput, context) => {
639
- const contents = (0, smithy_client_1.map)({});
640
- const data = parsedOutput.body;
641
- const doc = (0, smithy_client_1.take)(data, {
642
- Message: smithy_client_1.expectString,
643
- Reason: smithy_client_1.expectString,
644
- });
645
- Object.assign(contents, doc);
646
- const exception = new models_0_1.ServiceQuotaExceededException({
647
- $metadata: deserializeMetadata(parsedOutput),
648
- ...contents,
649
- });
650
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
651
- };
652
- const de_ValidationExceptionRes = async (parsedOutput, context) => {
653
- const contents = (0, smithy_client_1.map)({});
654
- const data = parsedOutput.body;
655
- const doc = (0, smithy_client_1.take)(data, {
656
- Message: smithy_client_1.expectString,
657
- Reason: smithy_client_1.expectString,
658
- });
659
- Object.assign(contents, doc);
660
- const exception = new models_0_1.ValidationException({
661
- $metadata: deserializeMetadata(parsedOutput),
662
- ...contents,
663
- });
664
- return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
665
- };
666
- const deserializeMetadata = (output) => ({
667
- httpStatusCode: output.statusCode,
668
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
669
- extendedRequestId: output.headers["x-amz-id-2"],
670
- cfId: output.headers["x-amz-cf-id"],
671
- });
672
- const collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body));
673
- const isSerializableHeaderValue = (value) => value !== undefined &&
674
- value !== null &&
675
- value !== "" &&
676
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
677
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
678
- const _TK = "TagKeys";
679
- const _tK = "tagKeys";
680
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
681
- if (encoded.length) {
682
- return JSON.parse(encoded);
683
- }
684
- return {};
685
- });
686
- const parseErrorBody = async (errorBody, context) => {
687
- const value = await parseBody(errorBody, context);
688
- value.message = value.message ?? value.Message;
689
- return value;
690
- };
691
- const loadRestJsonErrorCode = (output, data) => {
692
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
693
- const sanitizeErrorCode = (rawValue) => {
694
- let cleanValue = rawValue;
695
- if (typeof cleanValue === "number") {
696
- cleanValue = cleanValue.toString();
697
- }
698
- if (cleanValue.indexOf(",") >= 0) {
699
- cleanValue = cleanValue.split(",")[0];
700
- }
701
- if (cleanValue.indexOf(":") >= 0) {
702
- cleanValue = cleanValue.split(":")[0];
703
- }
704
- if (cleanValue.indexOf("#") >= 0) {
705
- cleanValue = cleanValue.split("#")[1];
706
- }
707
- return cleanValue;
708
- };
709
- const headerKey = findKey(output.headers, "x-amzn-errortype");
710
- if (headerKey !== undefined) {
711
- return sanitizeErrorCode(output.headers[headerKey]);
712
- }
713
- if (data.code !== undefined) {
714
- return sanitizeErrorCode(data.code);
715
- }
716
- if (data["__type"] !== undefined) {
717
- return sanitizeErrorCode(data["__type"]);
718
- }
719
- };
1
+ module.exports = require("../index.js");