@aws-sdk/client-kendra-ranking 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,716 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.de_UpdateRescoreExecutionPlanCommand = exports.de_UntagResourceCommand = exports.de_TagResourceCommand = exports.de_RescoreCommand = exports.de_ListTagsForResourceCommand = exports.de_ListRescoreExecutionPlansCommand = exports.de_DescribeRescoreExecutionPlanCommand = exports.de_DeleteRescoreExecutionPlanCommand = exports.de_CreateRescoreExecutionPlanCommand = exports.se_UpdateRescoreExecutionPlanCommand = exports.se_UntagResourceCommand = exports.se_TagResourceCommand = exports.se_RescoreCommand = exports.se_ListTagsForResourceCommand = exports.se_ListRescoreExecutionPlansCommand = exports.se_DescribeRescoreExecutionPlanCommand = exports.se_DeleteRescoreExecutionPlanCommand = exports.se_CreateRescoreExecutionPlanCommand = void 0;
4
- const protocol_http_1 = require("@smithy/protocol-http");
5
- const smithy_client_1 = require("@smithy/smithy-client");
6
- const uuid_1 = require("uuid");
7
- const KendraRankingServiceException_1 = require("../models/KendraRankingServiceException");
8
- const models_0_1 = require("../models/models_0");
9
- const se_CreateRescoreExecutionPlanCommand = async (input, context) => {
10
- const headers = sharedHeaders("CreateRescoreExecutionPlan");
11
- let body;
12
- body = JSON.stringify(se_CreateRescoreExecutionPlanRequest(input, context));
13
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
14
- };
15
- exports.se_CreateRescoreExecutionPlanCommand = se_CreateRescoreExecutionPlanCommand;
16
- const se_DeleteRescoreExecutionPlanCommand = async (input, context) => {
17
- const headers = sharedHeaders("DeleteRescoreExecutionPlan");
18
- let body;
19
- body = JSON.stringify((0, smithy_client_1._json)(input));
20
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
21
- };
22
- exports.se_DeleteRescoreExecutionPlanCommand = se_DeleteRescoreExecutionPlanCommand;
23
- const se_DescribeRescoreExecutionPlanCommand = async (input, context) => {
24
- const headers = sharedHeaders("DescribeRescoreExecutionPlan");
25
- let body;
26
- body = JSON.stringify((0, smithy_client_1._json)(input));
27
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
28
- };
29
- exports.se_DescribeRescoreExecutionPlanCommand = se_DescribeRescoreExecutionPlanCommand;
30
- const se_ListRescoreExecutionPlansCommand = async (input, context) => {
31
- const headers = sharedHeaders("ListRescoreExecutionPlans");
32
- let body;
33
- body = JSON.stringify((0, smithy_client_1._json)(input));
34
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
35
- };
36
- exports.se_ListRescoreExecutionPlansCommand = se_ListRescoreExecutionPlansCommand;
37
- const se_ListTagsForResourceCommand = async (input, context) => {
38
- const headers = sharedHeaders("ListTagsForResource");
39
- let body;
40
- body = JSON.stringify((0, smithy_client_1._json)(input));
41
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
42
- };
43
- exports.se_ListTagsForResourceCommand = se_ListTagsForResourceCommand;
44
- const se_RescoreCommand = async (input, context) => {
45
- const headers = sharedHeaders("Rescore");
46
- let body;
47
- body = JSON.stringify(se_RescoreRequest(input, context));
48
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
49
- };
50
- exports.se_RescoreCommand = se_RescoreCommand;
51
- const se_TagResourceCommand = async (input, context) => {
52
- const headers = sharedHeaders("TagResource");
53
- let body;
54
- body = JSON.stringify((0, smithy_client_1._json)(input));
55
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
56
- };
57
- exports.se_TagResourceCommand = se_TagResourceCommand;
58
- const se_UntagResourceCommand = async (input, context) => {
59
- const headers = sharedHeaders("UntagResource");
60
- let body;
61
- body = JSON.stringify((0, smithy_client_1._json)(input));
62
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
63
- };
64
- exports.se_UntagResourceCommand = se_UntagResourceCommand;
65
- const se_UpdateRescoreExecutionPlanCommand = async (input, context) => {
66
- const headers = sharedHeaders("UpdateRescoreExecutionPlan");
67
- let body;
68
- body = JSON.stringify((0, smithy_client_1._json)(input));
69
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
70
- };
71
- exports.se_UpdateRescoreExecutionPlanCommand = se_UpdateRescoreExecutionPlanCommand;
72
- const de_CreateRescoreExecutionPlanCommand = async (output, context) => {
73
- if (output.statusCode >= 300) {
74
- return de_CreateRescoreExecutionPlanCommandError(output, context);
75
- }
76
- const data = await parseBody(output.body, context);
77
- let contents = {};
78
- contents = (0, smithy_client_1._json)(data);
79
- const response = {
80
- $metadata: deserializeMetadata(output),
81
- ...contents,
82
- };
83
- return response;
84
- };
85
- exports.de_CreateRescoreExecutionPlanCommand = de_CreateRescoreExecutionPlanCommand;
86
- const de_CreateRescoreExecutionPlanCommandError = async (output, context) => {
87
- const parsedOutput = {
88
- ...output,
89
- body: await parseErrorBody(output.body, context),
90
- };
91
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
92
- switch (errorCode) {
93
- case "AccessDeniedException":
94
- case "com.amazonaws.kendraranking#AccessDeniedException":
95
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
96
- case "ConflictException":
97
- case "com.amazonaws.kendraranking#ConflictException":
98
- throw await de_ConflictExceptionRes(parsedOutput, context);
99
- case "InternalServerException":
100
- case "com.amazonaws.kendraranking#InternalServerException":
101
- throw await de_InternalServerExceptionRes(parsedOutput, context);
102
- case "ServiceQuotaExceededException":
103
- case "com.amazonaws.kendraranking#ServiceQuotaExceededException":
104
- throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
105
- case "ThrottlingException":
106
- case "com.amazonaws.kendraranking#ThrottlingException":
107
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
108
- case "ValidationException":
109
- case "com.amazonaws.kendraranking#ValidationException":
110
- throw await de_ValidationExceptionRes(parsedOutput, context);
111
- default:
112
- const parsedBody = parsedOutput.body;
113
- return throwDefaultError({
114
- output,
115
- parsedBody,
116
- errorCode,
117
- });
118
- }
119
- };
120
- const de_DeleteRescoreExecutionPlanCommand = async (output, context) => {
121
- if (output.statusCode >= 300) {
122
- return de_DeleteRescoreExecutionPlanCommandError(output, context);
123
- }
124
- await (0, smithy_client_1.collectBody)(output.body, context);
125
- const response = {
126
- $metadata: deserializeMetadata(output),
127
- };
128
- return response;
129
- };
130
- exports.de_DeleteRescoreExecutionPlanCommand = de_DeleteRescoreExecutionPlanCommand;
131
- const de_DeleteRescoreExecutionPlanCommandError = async (output, context) => {
132
- const parsedOutput = {
133
- ...output,
134
- body: await parseErrorBody(output.body, context),
135
- };
136
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
137
- switch (errorCode) {
138
- case "AccessDeniedException":
139
- case "com.amazonaws.kendraranking#AccessDeniedException":
140
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
141
- case "ConflictException":
142
- case "com.amazonaws.kendraranking#ConflictException":
143
- throw await de_ConflictExceptionRes(parsedOutput, context);
144
- case "InternalServerException":
145
- case "com.amazonaws.kendraranking#InternalServerException":
146
- throw await de_InternalServerExceptionRes(parsedOutput, context);
147
- case "ResourceNotFoundException":
148
- case "com.amazonaws.kendraranking#ResourceNotFoundException":
149
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
150
- case "ThrottlingException":
151
- case "com.amazonaws.kendraranking#ThrottlingException":
152
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
153
- case "ValidationException":
154
- case "com.amazonaws.kendraranking#ValidationException":
155
- throw await de_ValidationExceptionRes(parsedOutput, context);
156
- default:
157
- const parsedBody = parsedOutput.body;
158
- return throwDefaultError({
159
- output,
160
- parsedBody,
161
- errorCode,
162
- });
163
- }
164
- };
165
- const de_DescribeRescoreExecutionPlanCommand = async (output, context) => {
166
- if (output.statusCode >= 300) {
167
- return de_DescribeRescoreExecutionPlanCommandError(output, context);
168
- }
169
- const data = await parseBody(output.body, context);
170
- let contents = {};
171
- contents = de_DescribeRescoreExecutionPlanResponse(data, context);
172
- const response = {
173
- $metadata: deserializeMetadata(output),
174
- ...contents,
175
- };
176
- return response;
177
- };
178
- exports.de_DescribeRescoreExecutionPlanCommand = de_DescribeRescoreExecutionPlanCommand;
179
- const de_DescribeRescoreExecutionPlanCommandError = async (output, context) => {
180
- const parsedOutput = {
181
- ...output,
182
- body: await parseErrorBody(output.body, context),
183
- };
184
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
185
- switch (errorCode) {
186
- case "AccessDeniedException":
187
- case "com.amazonaws.kendraranking#AccessDeniedException":
188
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
189
- case "InternalServerException":
190
- case "com.amazonaws.kendraranking#InternalServerException":
191
- throw await de_InternalServerExceptionRes(parsedOutput, context);
192
- case "ResourceNotFoundException":
193
- case "com.amazonaws.kendraranking#ResourceNotFoundException":
194
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
195
- case "ThrottlingException":
196
- case "com.amazonaws.kendraranking#ThrottlingException":
197
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
198
- case "ValidationException":
199
- case "com.amazonaws.kendraranking#ValidationException":
200
- throw await de_ValidationExceptionRes(parsedOutput, context);
201
- default:
202
- const parsedBody = parsedOutput.body;
203
- return throwDefaultError({
204
- output,
205
- parsedBody,
206
- errorCode,
207
- });
208
- }
209
- };
210
- const de_ListRescoreExecutionPlansCommand = async (output, context) => {
211
- if (output.statusCode >= 300) {
212
- return de_ListRescoreExecutionPlansCommandError(output, context);
213
- }
214
- const data = await parseBody(output.body, context);
215
- let contents = {};
216
- contents = de_ListRescoreExecutionPlansResponse(data, context);
217
- const response = {
218
- $metadata: deserializeMetadata(output),
219
- ...contents,
220
- };
221
- return response;
222
- };
223
- exports.de_ListRescoreExecutionPlansCommand = de_ListRescoreExecutionPlansCommand;
224
- const de_ListRescoreExecutionPlansCommandError = async (output, context) => {
225
- const parsedOutput = {
226
- ...output,
227
- body: await parseErrorBody(output.body, context),
228
- };
229
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
230
- switch (errorCode) {
231
- case "AccessDeniedException":
232
- case "com.amazonaws.kendraranking#AccessDeniedException":
233
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
234
- case "InternalServerException":
235
- case "com.amazonaws.kendraranking#InternalServerException":
236
- throw await de_InternalServerExceptionRes(parsedOutput, context);
237
- case "ThrottlingException":
238
- case "com.amazonaws.kendraranking#ThrottlingException":
239
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
240
- case "ValidationException":
241
- case "com.amazonaws.kendraranking#ValidationException":
242
- throw await de_ValidationExceptionRes(parsedOutput, context);
243
- default:
244
- const parsedBody = parsedOutput.body;
245
- return throwDefaultError({
246
- output,
247
- parsedBody,
248
- errorCode,
249
- });
250
- }
251
- };
252
- const de_ListTagsForResourceCommand = async (output, context) => {
253
- if (output.statusCode >= 300) {
254
- return de_ListTagsForResourceCommandError(output, context);
255
- }
256
- const data = await parseBody(output.body, context);
257
- let contents = {};
258
- contents = (0, smithy_client_1._json)(data);
259
- const response = {
260
- $metadata: deserializeMetadata(output),
261
- ...contents,
262
- };
263
- return response;
264
- };
265
- exports.de_ListTagsForResourceCommand = de_ListTagsForResourceCommand;
266
- const de_ListTagsForResourceCommandError = async (output, context) => {
267
- const parsedOutput = {
268
- ...output,
269
- body: await parseErrorBody(output.body, context),
270
- };
271
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
272
- switch (errorCode) {
273
- case "AccessDeniedException":
274
- case "com.amazonaws.kendraranking#AccessDeniedException":
275
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
276
- case "InternalServerException":
277
- case "com.amazonaws.kendraranking#InternalServerException":
278
- throw await de_InternalServerExceptionRes(parsedOutput, context);
279
- case "ResourceUnavailableException":
280
- case "com.amazonaws.kendraranking#ResourceUnavailableException":
281
- throw await de_ResourceUnavailableExceptionRes(parsedOutput, context);
282
- case "ThrottlingException":
283
- case "com.amazonaws.kendraranking#ThrottlingException":
284
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
285
- case "ValidationException":
286
- case "com.amazonaws.kendraranking#ValidationException":
287
- throw await de_ValidationExceptionRes(parsedOutput, context);
288
- default:
289
- const parsedBody = parsedOutput.body;
290
- return throwDefaultError({
291
- output,
292
- parsedBody,
293
- errorCode,
294
- });
295
- }
296
- };
297
- const de_RescoreCommand = async (output, context) => {
298
- if (output.statusCode >= 300) {
299
- return de_RescoreCommandError(output, context);
300
- }
301
- const data = await parseBody(output.body, context);
302
- let contents = {};
303
- contents = de_RescoreResult(data, context);
304
- const response = {
305
- $metadata: deserializeMetadata(output),
306
- ...contents,
307
- };
308
- return response;
309
- };
310
- exports.de_RescoreCommand = de_RescoreCommand;
311
- const de_RescoreCommandError = async (output, context) => {
312
- const parsedOutput = {
313
- ...output,
314
- body: await parseErrorBody(output.body, context),
315
- };
316
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
317
- switch (errorCode) {
318
- case "AccessDeniedException":
319
- case "com.amazonaws.kendraranking#AccessDeniedException":
320
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
321
- case "ConflictException":
322
- case "com.amazonaws.kendraranking#ConflictException":
323
- throw await de_ConflictExceptionRes(parsedOutput, context);
324
- case "InternalServerException":
325
- case "com.amazonaws.kendraranking#InternalServerException":
326
- throw await de_InternalServerExceptionRes(parsedOutput, context);
327
- case "ResourceNotFoundException":
328
- case "com.amazonaws.kendraranking#ResourceNotFoundException":
329
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
330
- case "ThrottlingException":
331
- case "com.amazonaws.kendraranking#ThrottlingException":
332
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
333
- case "ValidationException":
334
- case "com.amazonaws.kendraranking#ValidationException":
335
- throw await de_ValidationExceptionRes(parsedOutput, context);
336
- default:
337
- const parsedBody = parsedOutput.body;
338
- return throwDefaultError({
339
- output,
340
- parsedBody,
341
- errorCode,
342
- });
343
- }
344
- };
345
- const de_TagResourceCommand = async (output, context) => {
346
- if (output.statusCode >= 300) {
347
- return de_TagResourceCommandError(output, context);
348
- }
349
- const data = await parseBody(output.body, context);
350
- let contents = {};
351
- contents = (0, smithy_client_1._json)(data);
352
- const response = {
353
- $metadata: deserializeMetadata(output),
354
- ...contents,
355
- };
356
- return response;
357
- };
358
- exports.de_TagResourceCommand = de_TagResourceCommand;
359
- const de_TagResourceCommandError = async (output, context) => {
360
- const parsedOutput = {
361
- ...output,
362
- body: await parseErrorBody(output.body, context),
363
- };
364
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
365
- switch (errorCode) {
366
- case "AccessDeniedException":
367
- case "com.amazonaws.kendraranking#AccessDeniedException":
368
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
369
- case "InternalServerException":
370
- case "com.amazonaws.kendraranking#InternalServerException":
371
- throw await de_InternalServerExceptionRes(parsedOutput, context);
372
- case "ResourceUnavailableException":
373
- case "com.amazonaws.kendraranking#ResourceUnavailableException":
374
- throw await de_ResourceUnavailableExceptionRes(parsedOutput, context);
375
- case "ThrottlingException":
376
- case "com.amazonaws.kendraranking#ThrottlingException":
377
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
378
- case "ValidationException":
379
- case "com.amazonaws.kendraranking#ValidationException":
380
- throw await de_ValidationExceptionRes(parsedOutput, context);
381
- default:
382
- const parsedBody = parsedOutput.body;
383
- return throwDefaultError({
384
- output,
385
- parsedBody,
386
- errorCode,
387
- });
388
- }
389
- };
390
- const de_UntagResourceCommand = async (output, context) => {
391
- if (output.statusCode >= 300) {
392
- return de_UntagResourceCommandError(output, context);
393
- }
394
- const data = await parseBody(output.body, context);
395
- let contents = {};
396
- contents = (0, smithy_client_1._json)(data);
397
- const response = {
398
- $metadata: deserializeMetadata(output),
399
- ...contents,
400
- };
401
- return response;
402
- };
403
- exports.de_UntagResourceCommand = de_UntagResourceCommand;
404
- const de_UntagResourceCommandError = async (output, context) => {
405
- const parsedOutput = {
406
- ...output,
407
- body: await parseErrorBody(output.body, context),
408
- };
409
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
410
- switch (errorCode) {
411
- case "AccessDeniedException":
412
- case "com.amazonaws.kendraranking#AccessDeniedException":
413
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
414
- case "InternalServerException":
415
- case "com.amazonaws.kendraranking#InternalServerException":
416
- throw await de_InternalServerExceptionRes(parsedOutput, context);
417
- case "ResourceUnavailableException":
418
- case "com.amazonaws.kendraranking#ResourceUnavailableException":
419
- throw await de_ResourceUnavailableExceptionRes(parsedOutput, context);
420
- case "ThrottlingException":
421
- case "com.amazonaws.kendraranking#ThrottlingException":
422
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
423
- case "ValidationException":
424
- case "com.amazonaws.kendraranking#ValidationException":
425
- throw await de_ValidationExceptionRes(parsedOutput, context);
426
- default:
427
- const parsedBody = parsedOutput.body;
428
- return throwDefaultError({
429
- output,
430
- parsedBody,
431
- errorCode,
432
- });
433
- }
434
- };
435
- const de_UpdateRescoreExecutionPlanCommand = async (output, context) => {
436
- if (output.statusCode >= 300) {
437
- return de_UpdateRescoreExecutionPlanCommandError(output, context);
438
- }
439
- await (0, smithy_client_1.collectBody)(output.body, context);
440
- const response = {
441
- $metadata: deserializeMetadata(output),
442
- };
443
- return response;
444
- };
445
- exports.de_UpdateRescoreExecutionPlanCommand = de_UpdateRescoreExecutionPlanCommand;
446
- const de_UpdateRescoreExecutionPlanCommandError = async (output, context) => {
447
- const parsedOutput = {
448
- ...output,
449
- body: await parseErrorBody(output.body, context),
450
- };
451
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
452
- switch (errorCode) {
453
- case "AccessDeniedException":
454
- case "com.amazonaws.kendraranking#AccessDeniedException":
455
- throw await de_AccessDeniedExceptionRes(parsedOutput, context);
456
- case "ConflictException":
457
- case "com.amazonaws.kendraranking#ConflictException":
458
- throw await de_ConflictExceptionRes(parsedOutput, context);
459
- case "InternalServerException":
460
- case "com.amazonaws.kendraranking#InternalServerException":
461
- throw await de_InternalServerExceptionRes(parsedOutput, context);
462
- case "ResourceNotFoundException":
463
- case "com.amazonaws.kendraranking#ResourceNotFoundException":
464
- throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
465
- case "ServiceQuotaExceededException":
466
- case "com.amazonaws.kendraranking#ServiceQuotaExceededException":
467
- throw await de_ServiceQuotaExceededExceptionRes(parsedOutput, context);
468
- case "ThrottlingException":
469
- case "com.amazonaws.kendraranking#ThrottlingException":
470
- throw await de_ThrottlingExceptionRes(parsedOutput, context);
471
- case "ValidationException":
472
- case "com.amazonaws.kendraranking#ValidationException":
473
- throw await de_ValidationExceptionRes(parsedOutput, context);
474
- default:
475
- const parsedBody = parsedOutput.body;
476
- return throwDefaultError({
477
- output,
478
- parsedBody,
479
- errorCode,
480
- });
481
- }
482
- };
483
- const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
484
- const body = parsedOutput.body;
485
- const deserialized = (0, smithy_client_1._json)(body);
486
- const exception = new models_0_1.AccessDeniedException({
487
- $metadata: deserializeMetadata(parsedOutput),
488
- ...deserialized,
489
- });
490
- return (0, smithy_client_1.decorateServiceException)(exception, body);
491
- };
492
- const de_ConflictExceptionRes = async (parsedOutput, context) => {
493
- const body = parsedOutput.body;
494
- const deserialized = (0, smithy_client_1._json)(body);
495
- const exception = new models_0_1.ConflictException({
496
- $metadata: deserializeMetadata(parsedOutput),
497
- ...deserialized,
498
- });
499
- return (0, smithy_client_1.decorateServiceException)(exception, body);
500
- };
501
- const de_InternalServerExceptionRes = async (parsedOutput, context) => {
502
- const body = parsedOutput.body;
503
- const deserialized = (0, smithy_client_1._json)(body);
504
- const exception = new models_0_1.InternalServerException({
505
- $metadata: deserializeMetadata(parsedOutput),
506
- ...deserialized,
507
- });
508
- return (0, smithy_client_1.decorateServiceException)(exception, body);
509
- };
510
- const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
511
- const body = parsedOutput.body;
512
- const deserialized = (0, smithy_client_1._json)(body);
513
- const exception = new models_0_1.ResourceNotFoundException({
514
- $metadata: deserializeMetadata(parsedOutput),
515
- ...deserialized,
516
- });
517
- return (0, smithy_client_1.decorateServiceException)(exception, body);
518
- };
519
- const de_ResourceUnavailableExceptionRes = async (parsedOutput, context) => {
520
- const body = parsedOutput.body;
521
- const deserialized = (0, smithy_client_1._json)(body);
522
- const exception = new models_0_1.ResourceUnavailableException({
523
- $metadata: deserializeMetadata(parsedOutput),
524
- ...deserialized,
525
- });
526
- return (0, smithy_client_1.decorateServiceException)(exception, body);
527
- };
528
- const de_ServiceQuotaExceededExceptionRes = async (parsedOutput, context) => {
529
- const body = parsedOutput.body;
530
- const deserialized = (0, smithy_client_1._json)(body);
531
- const exception = new models_0_1.ServiceQuotaExceededException({
532
- $metadata: deserializeMetadata(parsedOutput),
533
- ...deserialized,
534
- });
535
- return (0, smithy_client_1.decorateServiceException)(exception, body);
536
- };
537
- const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
538
- const body = parsedOutput.body;
539
- const deserialized = (0, smithy_client_1._json)(body);
540
- const exception = new models_0_1.ThrottlingException({
541
- $metadata: deserializeMetadata(parsedOutput),
542
- ...deserialized,
543
- });
544
- return (0, smithy_client_1.decorateServiceException)(exception, body);
545
- };
546
- const de_ValidationExceptionRes = async (parsedOutput, context) => {
547
- const body = parsedOutput.body;
548
- const deserialized = (0, smithy_client_1._json)(body);
549
- const exception = new models_0_1.ValidationException({
550
- $metadata: deserializeMetadata(parsedOutput),
551
- ...deserialized,
552
- });
553
- return (0, smithy_client_1.decorateServiceException)(exception, body);
554
- };
555
- const se_CreateRescoreExecutionPlanRequest = (input, context) => {
556
- return (0, smithy_client_1.take)(input, {
557
- CapacityUnits: smithy_client_1._json,
558
- ClientToken: [true, (_) => _ ?? (0, uuid_1.v4)()],
559
- Description: [],
560
- Name: [],
561
- Tags: smithy_client_1._json,
562
- });
563
- };
564
- const se_Document = (input, context) => {
565
- return (0, smithy_client_1.take)(input, {
566
- Body: [],
567
- GroupId: [],
568
- Id: [],
569
- OriginalScore: smithy_client_1.serializeFloat,
570
- Title: [],
571
- TokenizedBody: smithy_client_1._json,
572
- TokenizedTitle: smithy_client_1._json,
573
- });
574
- };
575
- const se_DocumentList = (input, context) => {
576
- return input
577
- .filter((e) => e != null)
578
- .map((entry) => {
579
- return se_Document(entry, context);
580
- });
581
- };
582
- const se_RescoreRequest = (input, context) => {
583
- return (0, smithy_client_1.take)(input, {
584
- Documents: (_) => se_DocumentList(_, context),
585
- RescoreExecutionPlanId: [],
586
- SearchQuery: [],
587
- });
588
- };
589
- const de_DescribeRescoreExecutionPlanResponse = (output, context) => {
590
- return (0, smithy_client_1.take)(output, {
591
- Arn: smithy_client_1.expectString,
592
- CapacityUnits: smithy_client_1._json,
593
- CreatedAt: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
594
- Description: smithy_client_1.expectString,
595
- ErrorMessage: smithy_client_1.expectString,
596
- Id: smithy_client_1.expectString,
597
- Name: smithy_client_1.expectString,
598
- Status: smithy_client_1.expectString,
599
- UpdatedAt: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
600
- });
601
- };
602
- const de_ListRescoreExecutionPlansResponse = (output, context) => {
603
- return (0, smithy_client_1.take)(output, {
604
- NextToken: smithy_client_1.expectString,
605
- SummaryItems: (_) => de_RescoreExecutionPlanSummaryList(_, context),
606
- });
607
- };
608
- const de_RescoreExecutionPlanSummary = (output, context) => {
609
- return (0, smithy_client_1.take)(output, {
610
- CreatedAt: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
611
- Id: smithy_client_1.expectString,
612
- Name: smithy_client_1.expectString,
613
- Status: smithy_client_1.expectString,
614
- UpdatedAt: (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseEpochTimestamp)((0, smithy_client_1.expectNumber)(_))),
615
- });
616
- };
617
- const de_RescoreExecutionPlanSummaryList = (output, context) => {
618
- const retVal = (output || [])
619
- .filter((e) => e != null)
620
- .map((entry) => {
621
- return de_RescoreExecutionPlanSummary(entry, context);
622
- });
623
- return retVal;
624
- };
625
- const de_RescoreResult = (output, context) => {
626
- return (0, smithy_client_1.take)(output, {
627
- RescoreId: smithy_client_1.expectString,
628
- ResultItems: (_) => de_RescoreResultItemList(_, context),
629
- });
630
- };
631
- const de_RescoreResultItem = (output, context) => {
632
- return (0, smithy_client_1.take)(output, {
633
- DocumentId: smithy_client_1.expectString,
634
- Score: smithy_client_1.limitedParseFloat32,
635
- });
636
- };
637
- const de_RescoreResultItemList = (output, context) => {
638
- const retVal = (output || [])
639
- .filter((e) => e != null)
640
- .map((entry) => {
641
- return de_RescoreResultItem(entry, context);
642
- });
643
- return retVal;
644
- };
645
- const deserializeMetadata = (output) => ({
646
- httpStatusCode: output.statusCode,
647
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
648
- extendedRequestId: output.headers["x-amz-id-2"],
649
- cfId: output.headers["x-amz-cf-id"],
650
- });
651
- const collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body));
652
- const throwDefaultError = (0, smithy_client_1.withBaseException)(KendraRankingServiceException_1.KendraRankingServiceException);
653
- const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => {
654
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
655
- const contents = {
656
- protocol,
657
- hostname,
658
- port,
659
- method: "POST",
660
- path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
661
- headers,
662
- };
663
- if (resolvedHostname !== undefined) {
664
- contents.hostname = resolvedHostname;
665
- }
666
- if (body !== undefined) {
667
- contents.body = body;
668
- }
669
- return new protocol_http_1.HttpRequest(contents);
670
- };
671
- function sharedHeaders(operation) {
672
- return {
673
- "content-type": "application/x-amz-json-1.0",
674
- "x-amz-target": `AWSKendraRerankingFrontendService.${operation}`,
675
- };
676
- }
677
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
678
- if (encoded.length) {
679
- return JSON.parse(encoded);
680
- }
681
- return {};
682
- });
683
- const parseErrorBody = async (errorBody, context) => {
684
- const value = await parseBody(errorBody, context);
685
- value.message = value.message ?? value.Message;
686
- return value;
687
- };
688
- const loadRestJsonErrorCode = (output, data) => {
689
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
690
- const sanitizeErrorCode = (rawValue) => {
691
- let cleanValue = rawValue;
692
- if (typeof cleanValue === "number") {
693
- cleanValue = cleanValue.toString();
694
- }
695
- if (cleanValue.indexOf(",") >= 0) {
696
- cleanValue = cleanValue.split(",")[0];
697
- }
698
- if (cleanValue.indexOf(":") >= 0) {
699
- cleanValue = cleanValue.split(":")[0];
700
- }
701
- if (cleanValue.indexOf("#") >= 0) {
702
- cleanValue = cleanValue.split("#")[1];
703
- }
704
- return cleanValue;
705
- };
706
- const headerKey = findKey(output.headers, "x-amzn-errortype");
707
- if (headerKey !== undefined) {
708
- return sanitizeErrorCode(output.headers[headerKey]);
709
- }
710
- if (data.code !== undefined) {
711
- return sanitizeErrorCode(data.code);
712
- }
713
- if (data["__type"] !== undefined) {
714
- return sanitizeErrorCode(data["__type"]);
715
- }
716
- };
1
+ module.exports = require("../index.js");