@aws-sdk/client-comprehend 3.47.2 → 3.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist-cjs/Comprehend.js +60 -0
  3. package/dist-cjs/commands/DeleteResourcePolicyCommand.js +36 -0
  4. package/dist-cjs/commands/DescribeResourcePolicyCommand.js +36 -0
  5. package/dist-cjs/commands/ImportModelCommand.js +36 -0
  6. package/dist-cjs/commands/PutResourcePolicyCommand.js +36 -0
  7. package/dist-cjs/commands/index.js +4 -0
  8. package/dist-cjs/models/models_0.js +52 -4
  9. package/dist-cjs/protocols/Aws_json1_1.js +405 -3
  10. package/dist-es/Comprehend.js +60 -0
  11. package/dist-es/commands/DeleteResourcePolicyCommand.js +39 -0
  12. package/dist-es/commands/DescribeResourcePolicyCommand.js +39 -0
  13. package/dist-es/commands/ImportModelCommand.js +39 -0
  14. package/dist-es/commands/PutResourcePolicyCommand.js +39 -0
  15. package/dist-es/commands/index.js +4 -0
  16. package/dist-es/models/models_0.js +32 -0
  17. package/dist-es/protocols/Aws_json1_1.js +428 -4
  18. package/dist-types/Comprehend.d.ts +37 -2
  19. package/dist-types/ComprehendClient.d.ts +6 -2
  20. package/dist-types/commands/CreateEndpointCommand.d.ts +1 -2
  21. package/dist-types/commands/DeleteResourcePolicyCommand.d.ts +35 -0
  22. package/dist-types/commands/DescribeResourcePolicyCommand.d.ts +36 -0
  23. package/dist-types/commands/ImportModelCommand.d.ts +40 -0
  24. package/dist-types/commands/PutResourcePolicyCommand.d.ts +37 -0
  25. package/dist-types/commands/index.d.ts +4 -0
  26. package/dist-types/models/models_0.d.ts +279 -43
  27. package/dist-types/protocols/Aws_json1_1.d.ts +12 -0
  28. package/dist-types/ts3.4/Comprehend.d.ts +20 -0
  29. package/dist-types/ts3.4/ComprehendClient.d.ts +6 -2
  30. package/dist-types/ts3.4/commands/DeleteResourcePolicyCommand.d.ts +17 -0
  31. package/dist-types/ts3.4/commands/DescribeResourcePolicyCommand.d.ts +17 -0
  32. package/dist-types/ts3.4/commands/ImportModelCommand.d.ts +17 -0
  33. package/dist-types/ts3.4/commands/PutResourcePolicyCommand.d.ts +17 -0
  34. package/dist-types/ts3.4/commands/index.d.ts +4 -0
  35. package/dist-types/ts3.4/models/models_0.d.ts +92 -0
  36. package/dist-types/ts3.4/protocols/Aws_json1_1.d.ts +12 -0
  37. package/package.json +39 -33
@@ -145,6 +145,17 @@ export var serializeAws_json1_1DeleteEntityRecognizerCommand = function (input,
145
145
  return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
146
146
  });
147
147
  }); };
148
+ export var serializeAws_json1_1DeleteResourcePolicyCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
149
+ var headers, body;
150
+ return __generator(this, function (_a) {
151
+ headers = {
152
+ "content-type": "application/x-amz-json-1.1",
153
+ "x-amz-target": "Comprehend_20171127.DeleteResourcePolicy",
154
+ };
155
+ body = JSON.stringify(serializeAws_json1_1DeleteResourcePolicyRequest(input, context));
156
+ return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
157
+ });
158
+ }); };
148
159
  export var serializeAws_json1_1DescribeDocumentClassificationJobCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
149
160
  var headers, body;
150
161
  return __generator(this, function (_a) {
@@ -244,6 +255,17 @@ export var serializeAws_json1_1DescribePiiEntitiesDetectionJobCommand = function
244
255
  return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
245
256
  });
246
257
  }); };
258
+ export var serializeAws_json1_1DescribeResourcePolicyCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
259
+ var headers, body;
260
+ return __generator(this, function (_a) {
261
+ headers = {
262
+ "content-type": "application/x-amz-json-1.1",
263
+ "x-amz-target": "Comprehend_20171127.DescribeResourcePolicy",
264
+ };
265
+ body = JSON.stringify(serializeAws_json1_1DescribeResourcePolicyRequest(input, context));
266
+ return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
267
+ });
268
+ }); };
247
269
  export var serializeAws_json1_1DescribeSentimentDetectionJobCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
248
270
  var headers, body;
249
271
  return __generator(this, function (_a) {
@@ -332,6 +354,17 @@ export var serializeAws_json1_1DetectSyntaxCommand = function (input, context) {
332
354
  return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
333
355
  });
334
356
  }); };
357
+ export var serializeAws_json1_1ImportModelCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
358
+ var headers, body;
359
+ return __generator(this, function (_a) {
360
+ headers = {
361
+ "content-type": "application/x-amz-json-1.1",
362
+ "x-amz-target": "Comprehend_20171127.ImportModel",
363
+ };
364
+ body = JSON.stringify(serializeAws_json1_1ImportModelRequest(input, context));
365
+ return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
366
+ });
367
+ }); };
335
368
  export var serializeAws_json1_1ListDocumentClassificationJobsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
336
369
  var headers, body;
337
370
  return __generator(this, function (_a) {
@@ -486,6 +519,17 @@ export var serializeAws_json1_1ListTopicsDetectionJobsCommand = function (input,
486
519
  return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
487
520
  });
488
521
  }); };
522
+ export var serializeAws_json1_1PutResourcePolicyCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
523
+ var headers, body;
524
+ return __generator(this, function (_a) {
525
+ headers = {
526
+ "content-type": "application/x-amz-json-1.1",
527
+ "x-amz-target": "Comprehend_20171127.PutResourcePolicy",
528
+ };
529
+ body = JSON.stringify(serializeAws_json1_1PutResourcePolicyRequest(input, context));
530
+ return [2, buildHttpRpcRequest(context, headers, "/", undefined, body)];
531
+ });
532
+ }); };
489
533
  export var serializeAws_json1_1StartDocumentClassificationJobCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
490
534
  var headers, body;
491
535
  return __generator(this, function (_a) {
@@ -1903,6 +1947,78 @@ var deserializeAws_json1_1DeleteEntityRecognizerCommandError = function (output,
1903
1947
  }
1904
1948
  });
1905
1949
  }); };
1950
+ export var deserializeAws_json1_1DeleteResourcePolicyCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1951
+ var data, contents, response;
1952
+ return __generator(this, function (_a) {
1953
+ switch (_a.label) {
1954
+ case 0:
1955
+ if (output.statusCode >= 300) {
1956
+ return [2, deserializeAws_json1_1DeleteResourcePolicyCommandError(output, context)];
1957
+ }
1958
+ return [4, parseBody(output.body, context)];
1959
+ case 1:
1960
+ data = _a.sent();
1961
+ contents = {};
1962
+ contents = deserializeAws_json1_1DeleteResourcePolicyResponse(data, context);
1963
+ response = __assign({ $metadata: deserializeMetadata(output) }, contents);
1964
+ return [2, Promise.resolve(response)];
1965
+ }
1966
+ });
1967
+ }); };
1968
+ var deserializeAws_json1_1DeleteResourcePolicyCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1969
+ var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, parsedBody, message;
1970
+ var _f;
1971
+ return __generator(this, function (_g) {
1972
+ switch (_g.label) {
1973
+ case 0:
1974
+ _a = [__assign({}, output)];
1975
+ _f = {};
1976
+ return [4, parseBody(output.body, context)];
1977
+ case 1:
1978
+ parsedOutput = __assign.apply(void 0, _a.concat([(_f.body = _g.sent(), _f)]));
1979
+ errorCode = "UnknownError";
1980
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1981
+ _b = errorCode;
1982
+ switch (_b) {
1983
+ case "InternalServerException": return [3, 2];
1984
+ case "com.amazonaws.comprehend#InternalServerException": return [3, 2];
1985
+ case "InvalidRequestException": return [3, 4];
1986
+ case "com.amazonaws.comprehend#InvalidRequestException": return [3, 4];
1987
+ case "ResourceNotFoundException": return [3, 6];
1988
+ case "com.amazonaws.comprehend#ResourceNotFoundException": return [3, 6];
1989
+ }
1990
+ return [3, 8];
1991
+ case 2:
1992
+ _c = [{}];
1993
+ return [4, deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)];
1994
+ case 3:
1995
+ response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
1996
+ return [3, 9];
1997
+ case 4:
1998
+ _d = [{}];
1999
+ return [4, deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)];
2000
+ case 5:
2001
+ response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
2002
+ return [3, 9];
2003
+ case 6:
2004
+ _e = [{}];
2005
+ return [4, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];
2006
+ case 7:
2007
+ response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
2008
+ return [3, 9];
2009
+ case 8:
2010
+ parsedBody = parsedOutput.body;
2011
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
2012
+ response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
2013
+ _g.label = 9;
2014
+ case 9:
2015
+ message = response.message || response.Message || errorCode;
2016
+ response.message = message;
2017
+ delete response.Message;
2018
+ return [2, Promise.reject(Object.assign(new Error(message), response))];
2019
+ }
2020
+ });
2021
+ }); };
1906
2022
  export var deserializeAws_json1_1DescribeDocumentClassificationJobCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
1907
2023
  var data, contents, response;
1908
2024
  return __generator(this, function (_a) {
@@ -2623,6 +2739,78 @@ var deserializeAws_json1_1DescribePiiEntitiesDetectionJobCommandError = function
2623
2739
  }
2624
2740
  });
2625
2741
  }); };
2742
+ export var deserializeAws_json1_1DescribeResourcePolicyCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
2743
+ var data, contents, response;
2744
+ return __generator(this, function (_a) {
2745
+ switch (_a.label) {
2746
+ case 0:
2747
+ if (output.statusCode >= 300) {
2748
+ return [2, deserializeAws_json1_1DescribeResourcePolicyCommandError(output, context)];
2749
+ }
2750
+ return [4, parseBody(output.body, context)];
2751
+ case 1:
2752
+ data = _a.sent();
2753
+ contents = {};
2754
+ contents = deserializeAws_json1_1DescribeResourcePolicyResponse(data, context);
2755
+ response = __assign({ $metadata: deserializeMetadata(output) }, contents);
2756
+ return [2, Promise.resolve(response)];
2757
+ }
2758
+ });
2759
+ }); };
2760
+ var deserializeAws_json1_1DescribeResourcePolicyCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
2761
+ var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, parsedBody, message;
2762
+ var _f;
2763
+ return __generator(this, function (_g) {
2764
+ switch (_g.label) {
2765
+ case 0:
2766
+ _a = [__assign({}, output)];
2767
+ _f = {};
2768
+ return [4, parseBody(output.body, context)];
2769
+ case 1:
2770
+ parsedOutput = __assign.apply(void 0, _a.concat([(_f.body = _g.sent(), _f)]));
2771
+ errorCode = "UnknownError";
2772
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
2773
+ _b = errorCode;
2774
+ switch (_b) {
2775
+ case "InternalServerException": return [3, 2];
2776
+ case "com.amazonaws.comprehend#InternalServerException": return [3, 2];
2777
+ case "InvalidRequestException": return [3, 4];
2778
+ case "com.amazonaws.comprehend#InvalidRequestException": return [3, 4];
2779
+ case "ResourceNotFoundException": return [3, 6];
2780
+ case "com.amazonaws.comprehend#ResourceNotFoundException": return [3, 6];
2781
+ }
2782
+ return [3, 8];
2783
+ case 2:
2784
+ _c = [{}];
2785
+ return [4, deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)];
2786
+ case 3:
2787
+ response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
2788
+ return [3, 9];
2789
+ case 4:
2790
+ _d = [{}];
2791
+ return [4, deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)];
2792
+ case 5:
2793
+ response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
2794
+ return [3, 9];
2795
+ case 6:
2796
+ _e = [{}];
2797
+ return [4, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];
2798
+ case 7:
2799
+ response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
2800
+ return [3, 9];
2801
+ case 8:
2802
+ parsedBody = parsedOutput.body;
2803
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
2804
+ response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
2805
+ _g.label = 9;
2806
+ case 9:
2807
+ message = response.message || response.Message || errorCode;
2808
+ response.message = message;
2809
+ delete response.Message;
2810
+ return [2, Promise.reject(Object.assign(new Error(message), response))];
2811
+ }
2812
+ });
2813
+ }); };
2626
2814
  export var deserializeAws_json1_1DescribeSentimentDetectionJobCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
2627
2815
  var data, contents, response;
2628
2816
  return __generator(this, function (_a) {
@@ -3263,6 +3451,126 @@ var deserializeAws_json1_1DetectSyntaxCommandError = function (output, context)
3263
3451
  }
3264
3452
  });
3265
3453
  }); };
3454
+ export var deserializeAws_json1_1ImportModelCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
3455
+ var data, contents, response;
3456
+ return __generator(this, function (_a) {
3457
+ switch (_a.label) {
3458
+ case 0:
3459
+ if (output.statusCode >= 300) {
3460
+ return [2, deserializeAws_json1_1ImportModelCommandError(output, context)];
3461
+ }
3462
+ return [4, parseBody(output.body, context)];
3463
+ case 1:
3464
+ data = _a.sent();
3465
+ contents = {};
3466
+ contents = deserializeAws_json1_1ImportModelResponse(data, context);
3467
+ response = __assign({ $metadata: deserializeMetadata(output) }, contents);
3468
+ return [2, Promise.resolve(response)];
3469
+ }
3470
+ });
3471
+ }); };
3472
+ var deserializeAws_json1_1ImportModelCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
3473
+ var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, parsedBody, message;
3474
+ var _m;
3475
+ return __generator(this, function (_o) {
3476
+ switch (_o.label) {
3477
+ case 0:
3478
+ _a = [__assign({}, output)];
3479
+ _m = {};
3480
+ return [4, parseBody(output.body, context)];
3481
+ case 1:
3482
+ parsedOutput = __assign.apply(void 0, _a.concat([(_m.body = _o.sent(), _m)]));
3483
+ errorCode = "UnknownError";
3484
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
3485
+ _b = errorCode;
3486
+ switch (_b) {
3487
+ case "InternalServerException": return [3, 2];
3488
+ case "com.amazonaws.comprehend#InternalServerException": return [3, 2];
3489
+ case "InvalidRequestException": return [3, 4];
3490
+ case "com.amazonaws.comprehend#InvalidRequestException": return [3, 4];
3491
+ case "KmsKeyValidationException": return [3, 6];
3492
+ case "com.amazonaws.comprehend#KmsKeyValidationException": return [3, 6];
3493
+ case "ResourceInUseException": return [3, 8];
3494
+ case "com.amazonaws.comprehend#ResourceInUseException": return [3, 8];
3495
+ case "ResourceLimitExceededException": return [3, 10];
3496
+ case "com.amazonaws.comprehend#ResourceLimitExceededException": return [3, 10];
3497
+ case "ResourceNotFoundException": return [3, 12];
3498
+ case "com.amazonaws.comprehend#ResourceNotFoundException": return [3, 12];
3499
+ case "ResourceUnavailableException": return [3, 14];
3500
+ case "com.amazonaws.comprehend#ResourceUnavailableException": return [3, 14];
3501
+ case "TooManyRequestsException": return [3, 16];
3502
+ case "com.amazonaws.comprehend#TooManyRequestsException": return [3, 16];
3503
+ case "TooManyTagsException": return [3, 18];
3504
+ case "com.amazonaws.comprehend#TooManyTagsException": return [3, 18];
3505
+ }
3506
+ return [3, 20];
3507
+ case 2:
3508
+ _c = [{}];
3509
+ return [4, deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)];
3510
+ case 3:
3511
+ response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
3512
+ return [3, 21];
3513
+ case 4:
3514
+ _d = [{}];
3515
+ return [4, deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)];
3516
+ case 5:
3517
+ response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
3518
+ return [3, 21];
3519
+ case 6:
3520
+ _e = [{}];
3521
+ return [4, deserializeAws_json1_1KmsKeyValidationExceptionResponse(parsedOutput, context)];
3522
+ case 7:
3523
+ response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
3524
+ return [3, 21];
3525
+ case 8:
3526
+ _f = [{}];
3527
+ return [4, deserializeAws_json1_1ResourceInUseExceptionResponse(parsedOutput, context)];
3528
+ case 9:
3529
+ response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
3530
+ return [3, 21];
3531
+ case 10:
3532
+ _g = [{}];
3533
+ return [4, deserializeAws_json1_1ResourceLimitExceededExceptionResponse(parsedOutput, context)];
3534
+ case 11:
3535
+ response = __assign.apply(void 0, [__assign.apply(void 0, _g.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
3536
+ return [3, 21];
3537
+ case 12:
3538
+ _h = [{}];
3539
+ return [4, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];
3540
+ case 13:
3541
+ response = __assign.apply(void 0, [__assign.apply(void 0, _h.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
3542
+ return [3, 21];
3543
+ case 14:
3544
+ _j = [{}];
3545
+ return [4, deserializeAws_json1_1ResourceUnavailableExceptionResponse(parsedOutput, context)];
3546
+ case 15:
3547
+ response = __assign.apply(void 0, [__assign.apply(void 0, _j.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
3548
+ return [3, 21];
3549
+ case 16:
3550
+ _k = [{}];
3551
+ return [4, deserializeAws_json1_1TooManyRequestsExceptionResponse(parsedOutput, context)];
3552
+ case 17:
3553
+ response = __assign.apply(void 0, [__assign.apply(void 0, _k.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
3554
+ return [3, 21];
3555
+ case 18:
3556
+ _l = [{}];
3557
+ return [4, deserializeAws_json1_1TooManyTagsExceptionResponse(parsedOutput, context)];
3558
+ case 19:
3559
+ response = __assign.apply(void 0, [__assign.apply(void 0, _l.concat([(_o.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
3560
+ return [3, 21];
3561
+ case 20:
3562
+ parsedBody = parsedOutput.body;
3563
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
3564
+ response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
3565
+ _o.label = 21;
3566
+ case 21:
3567
+ message = response.message || response.Message || errorCode;
3568
+ response.message = message;
3569
+ delete response.Message;
3570
+ return [2, Promise.reject(Object.assign(new Error(message), response))];
3571
+ }
3572
+ });
3573
+ }); };
3266
3574
  export var deserializeAws_json1_1ListDocumentClassificationJobsCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
3267
3575
  var data, contents, response;
3268
3576
  return __generator(this, function (_a) {
@@ -4351,6 +4659,78 @@ var deserializeAws_json1_1ListTopicsDetectionJobsCommandError = function (output
4351
4659
  }
4352
4660
  });
4353
4661
  }); };
4662
+ export var deserializeAws_json1_1PutResourcePolicyCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
4663
+ var data, contents, response;
4664
+ return __generator(this, function (_a) {
4665
+ switch (_a.label) {
4666
+ case 0:
4667
+ if (output.statusCode >= 300) {
4668
+ return [2, deserializeAws_json1_1PutResourcePolicyCommandError(output, context)];
4669
+ }
4670
+ return [4, parseBody(output.body, context)];
4671
+ case 1:
4672
+ data = _a.sent();
4673
+ contents = {};
4674
+ contents = deserializeAws_json1_1PutResourcePolicyResponse(data, context);
4675
+ response = __assign({ $metadata: deserializeMetadata(output) }, contents);
4676
+ return [2, Promise.resolve(response)];
4677
+ }
4678
+ });
4679
+ }); };
4680
+ var deserializeAws_json1_1PutResourcePolicyCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
4681
+ var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, parsedBody, message;
4682
+ var _f;
4683
+ return __generator(this, function (_g) {
4684
+ switch (_g.label) {
4685
+ case 0:
4686
+ _a = [__assign({}, output)];
4687
+ _f = {};
4688
+ return [4, parseBody(output.body, context)];
4689
+ case 1:
4690
+ parsedOutput = __assign.apply(void 0, _a.concat([(_f.body = _g.sent(), _f)]));
4691
+ errorCode = "UnknownError";
4692
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
4693
+ _b = errorCode;
4694
+ switch (_b) {
4695
+ case "InternalServerException": return [3, 2];
4696
+ case "com.amazonaws.comprehend#InternalServerException": return [3, 2];
4697
+ case "InvalidRequestException": return [3, 4];
4698
+ case "com.amazonaws.comprehend#InvalidRequestException": return [3, 4];
4699
+ case "ResourceNotFoundException": return [3, 6];
4700
+ case "com.amazonaws.comprehend#ResourceNotFoundException": return [3, 6];
4701
+ }
4702
+ return [3, 8];
4703
+ case 2:
4704
+ _c = [{}];
4705
+ return [4, deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context)];
4706
+ case 3:
4707
+ response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
4708
+ return [3, 9];
4709
+ case 4:
4710
+ _d = [{}];
4711
+ return [4, deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context)];
4712
+ case 5:
4713
+ response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
4714
+ return [3, 9];
4715
+ case 6:
4716
+ _e = [{}];
4717
+ return [4, deserializeAws_json1_1ResourceNotFoundExceptionResponse(parsedOutput, context)];
4718
+ case 7:
4719
+ response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
4720
+ return [3, 9];
4721
+ case 8:
4722
+ parsedBody = parsedOutput.body;
4723
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
4724
+ response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
4725
+ _g.label = 9;
4726
+ case 9:
4727
+ message = response.message || response.Message || errorCode;
4728
+ response.message = message;
4729
+ delete response.Message;
4730
+ return [2, Promise.reject(Object.assign(new Error(message), response))];
4731
+ }
4732
+ });
4733
+ }); };
4354
4734
  export var deserializeAws_json1_1StartDocumentClassificationJobCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
4355
4735
  var data, contents, response;
4356
4736
  return __generator(this, function (_a) {
@@ -6149,12 +6529,12 @@ var serializeAws_json1_1ContainsPiiEntitiesRequest = function (input, context) {
6149
6529
  };
6150
6530
  var serializeAws_json1_1CreateDocumentClassifierRequest = function (input, context) {
6151
6531
  var _a;
6152
- return __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({ ClientRequestToken: (_a = input.ClientRequestToken) !== null && _a !== void 0 ? _a : generateIdempotencyToken() }, (input.DataAccessRoleArn !== undefined &&
6532
+ return __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({ ClientRequestToken: (_a = input.ClientRequestToken) !== null && _a !== void 0 ? _a : generateIdempotencyToken() }, (input.DataAccessRoleArn !== undefined &&
6153
6533
  input.DataAccessRoleArn !== null && { DataAccessRoleArn: input.DataAccessRoleArn })), (input.DocumentClassifierName !== undefined &&
6154
6534
  input.DocumentClassifierName !== null && { DocumentClassifierName: input.DocumentClassifierName })), (input.InputDataConfig !== undefined &&
6155
6535
  input.InputDataConfig !== null && {
6156
6536
  InputDataConfig: serializeAws_json1_1DocumentClassifierInputDataConfig(input.InputDataConfig, context),
6157
- })), (input.LanguageCode !== undefined && input.LanguageCode !== null && { LanguageCode: input.LanguageCode })), (input.Mode !== undefined && input.Mode !== null && { Mode: input.Mode })), (input.ModelKmsKeyId !== undefined && input.ModelKmsKeyId !== null && { ModelKmsKeyId: input.ModelKmsKeyId })), (input.OutputDataConfig !== undefined &&
6537
+ })), (input.LanguageCode !== undefined && input.LanguageCode !== null && { LanguageCode: input.LanguageCode })), (input.Mode !== undefined && input.Mode !== null && { Mode: input.Mode })), (input.ModelKmsKeyId !== undefined && input.ModelKmsKeyId !== null && { ModelKmsKeyId: input.ModelKmsKeyId })), (input.ModelPolicy !== undefined && input.ModelPolicy !== null && { ModelPolicy: input.ModelPolicy })), (input.OutputDataConfig !== undefined &&
6158
6538
  input.OutputDataConfig !== null && {
6159
6539
  OutputDataConfig: serializeAws_json1_1DocumentClassifierOutputDataConfig(input.OutputDataConfig, context),
6160
6540
  })), (input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_json1_1TagList(input.Tags, context) })), (input.VersionName !== undefined && input.VersionName !== null && { VersionName: input.VersionName })), (input.VolumeKmsKeyId !== undefined &&
@@ -6169,11 +6549,11 @@ var serializeAws_json1_1CreateEndpointRequest = function (input, context) {
6169
6549
  };
6170
6550
  var serializeAws_json1_1CreateEntityRecognizerRequest = function (input, context) {
6171
6551
  var _a;
6172
- return __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({ ClientRequestToken: (_a = input.ClientRequestToken) !== null && _a !== void 0 ? _a : generateIdempotencyToken() }, (input.DataAccessRoleArn !== undefined &&
6552
+ return __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({ ClientRequestToken: (_a = input.ClientRequestToken) !== null && _a !== void 0 ? _a : generateIdempotencyToken() }, (input.DataAccessRoleArn !== undefined &&
6173
6553
  input.DataAccessRoleArn !== null && { DataAccessRoleArn: input.DataAccessRoleArn })), (input.InputDataConfig !== undefined &&
6174
6554
  input.InputDataConfig !== null && {
6175
6555
  InputDataConfig: serializeAws_json1_1EntityRecognizerInputDataConfig(input.InputDataConfig, context),
6176
- })), (input.LanguageCode !== undefined && input.LanguageCode !== null && { LanguageCode: input.LanguageCode })), (input.ModelKmsKeyId !== undefined && input.ModelKmsKeyId !== null && { ModelKmsKeyId: input.ModelKmsKeyId })), (input.RecognizerName !== undefined &&
6556
+ })), (input.LanguageCode !== undefined && input.LanguageCode !== null && { LanguageCode: input.LanguageCode })), (input.ModelKmsKeyId !== undefined && input.ModelKmsKeyId !== null && { ModelKmsKeyId: input.ModelKmsKeyId })), (input.ModelPolicy !== undefined && input.ModelPolicy !== null && { ModelPolicy: input.ModelPolicy })), (input.RecognizerName !== undefined &&
6177
6557
  input.RecognizerName !== null && { RecognizerName: input.RecognizerName })), (input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_json1_1TagList(input.Tags, context) })), (input.VersionName !== undefined && input.VersionName !== null && { VersionName: input.VersionName })), (input.VolumeKmsKeyId !== undefined &&
6178
6558
  input.VolumeKmsKeyId !== null && { VolumeKmsKeyId: input.VolumeKmsKeyId })), (input.VpcConfig !== undefined &&
6179
6559
  input.VpcConfig !== null && { VpcConfig: serializeAws_json1_1VpcConfig(input.VpcConfig, context) }));
@@ -6199,6 +6579,10 @@ var serializeAws_json1_1DeleteEntityRecognizerRequest = function (input, context
6199
6579
  return __assign({}, (input.EntityRecognizerArn !== undefined &&
6200
6580
  input.EntityRecognizerArn !== null && { EntityRecognizerArn: input.EntityRecognizerArn }));
6201
6581
  };
6582
+ var serializeAws_json1_1DeleteResourcePolicyRequest = function (input, context) {
6583
+ return __assign(__assign({}, (input.PolicyRevisionId !== undefined &&
6584
+ input.PolicyRevisionId !== null && { PolicyRevisionId: input.PolicyRevisionId })), (input.ResourceArn !== undefined && input.ResourceArn !== null && { ResourceArn: input.ResourceArn }));
6585
+ };
6202
6586
  var serializeAws_json1_1DescribeDocumentClassificationJobRequest = function (input, context) {
6203
6587
  return __assign({}, (input.JobId !== undefined && input.JobId !== null && { JobId: input.JobId }));
6204
6588
  };
@@ -6228,6 +6612,9 @@ var serializeAws_json1_1DescribeKeyPhrasesDetectionJobRequest = function (input,
6228
6612
  var serializeAws_json1_1DescribePiiEntitiesDetectionJobRequest = function (input, context) {
6229
6613
  return __assign({}, (input.JobId !== undefined && input.JobId !== null && { JobId: input.JobId }));
6230
6614
  };
6615
+ var serializeAws_json1_1DescribeResourcePolicyRequest = function (input, context) {
6616
+ return __assign({}, (input.ResourceArn !== undefined && input.ResourceArn !== null && { ResourceArn: input.ResourceArn }));
6617
+ };
6231
6618
  var serializeAws_json1_1DescribeSentimentDetectionJobRequest = function (input, context) {
6232
6619
  return __assign({}, (input.JobId !== undefined && input.JobId !== null && { JobId: input.JobId }));
6233
6620
  };
@@ -6367,6 +6754,11 @@ var serializeAws_json1_1EventsDetectionJobFilter = function (input, context) {
6367
6754
  input.SubmitTimeAfter !== null && { SubmitTimeAfter: Math.round(input.SubmitTimeAfter.getTime() / 1000) })), (input.SubmitTimeBefore !== undefined &&
6368
6755
  input.SubmitTimeBefore !== null && { SubmitTimeBefore: Math.round(input.SubmitTimeBefore.getTime() / 1000) }));
6369
6756
  };
6757
+ var serializeAws_json1_1ImportModelRequest = function (input, context) {
6758
+ return __assign(__assign(__assign(__assign(__assign(__assign({}, (input.DataAccessRoleArn !== undefined &&
6759
+ input.DataAccessRoleArn !== null && { DataAccessRoleArn: input.DataAccessRoleArn })), (input.ModelKmsKeyId !== undefined && input.ModelKmsKeyId !== null && { ModelKmsKeyId: input.ModelKmsKeyId })), (input.ModelName !== undefined && input.ModelName !== null && { ModelName: input.ModelName })), (input.SourceModelArn !== undefined &&
6760
+ input.SourceModelArn !== null && { SourceModelArn: input.SourceModelArn })), (input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_json1_1TagList(input.Tags, context) })), (input.VersionName !== undefined && input.VersionName !== null && { VersionName: input.VersionName }));
6761
+ };
6370
6762
  var serializeAws_json1_1InputDataConfig = function (input, context) {
6371
6763
  return __assign(__assign(__assign({}, (input.DocumentReaderConfig !== undefined &&
6372
6764
  input.DocumentReaderConfig !== null && {
@@ -6461,6 +6853,11 @@ var serializeAws_json1_1PiiEntitiesDetectionJobFilter = function (input, context
6461
6853
  input.SubmitTimeAfter !== null && { SubmitTimeAfter: Math.round(input.SubmitTimeAfter.getTime() / 1000) })), (input.SubmitTimeBefore !== undefined &&
6462
6854
  input.SubmitTimeBefore !== null && { SubmitTimeBefore: Math.round(input.SubmitTimeBefore.getTime() / 1000) }));
6463
6855
  };
6856
+ var serializeAws_json1_1PutResourcePolicyRequest = function (input, context) {
6857
+ return __assign(__assign(__assign({}, (input.PolicyRevisionId !== undefined &&
6858
+ input.PolicyRevisionId !== null && { PolicyRevisionId: input.PolicyRevisionId })), (input.ResourceArn !== undefined && input.ResourceArn !== null && { ResourceArn: input.ResourceArn })), (input.ResourcePolicy !== undefined &&
6859
+ input.ResourcePolicy !== null && { ResourcePolicy: input.ResourcePolicy }));
6860
+ };
6464
6861
  var serializeAws_json1_1RedactionConfig = function (input, context) {
6465
6862
  return __assign(__assign(__assign({}, (input.MaskCharacter !== undefined && input.MaskCharacter !== null && { MaskCharacter: input.MaskCharacter })), (input.MaskMode !== undefined && input.MaskMode !== null && { MaskMode: input.MaskMode })), (input.PiiEntityTypes !== undefined &&
6466
6863
  input.PiiEntityTypes !== null && {
@@ -6888,6 +7285,9 @@ var deserializeAws_json1_1DeleteEndpointResponse = function (output, context) {
6888
7285
  var deserializeAws_json1_1DeleteEntityRecognizerResponse = function (output, context) {
6889
7286
  return {};
6890
7287
  };
7288
+ var deserializeAws_json1_1DeleteResourcePolicyResponse = function (output, context) {
7289
+ return {};
7290
+ };
6891
7291
  var deserializeAws_json1_1DescribeDocumentClassificationJobResponse = function (output, context) {
6892
7292
  return {
6893
7293
  DocumentClassificationJobProperties: output.DocumentClassificationJobProperties !== undefined && output.DocumentClassificationJobProperties !== null
@@ -6952,6 +7352,18 @@ var deserializeAws_json1_1DescribePiiEntitiesDetectionJobResponse = function (ou
6952
7352
  : undefined,
6953
7353
  };
6954
7354
  };
7355
+ var deserializeAws_json1_1DescribeResourcePolicyResponse = function (output, context) {
7356
+ return {
7357
+ CreationTime: output.CreationTime !== undefined && output.CreationTime !== null
7358
+ ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.CreationTime)))
7359
+ : undefined,
7360
+ LastModifiedTime: output.LastModifiedTime !== undefined && output.LastModifiedTime !== null
7361
+ ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.LastModifiedTime)))
7362
+ : undefined,
7363
+ PolicyRevisionId: __expectString(output.PolicyRevisionId),
7364
+ ResourcePolicy: __expectString(output.ResourcePolicy),
7365
+ };
7366
+ };
6955
7367
  var deserializeAws_json1_1DescribeSentimentDetectionJobResponse = function (output, context) {
6956
7368
  return {
6957
7369
  SentimentDetectionJobProperties: output.SentimentDetectionJobProperties !== undefined && output.SentimentDetectionJobProperties !== null
@@ -7099,6 +7511,7 @@ var deserializeAws_json1_1DocumentClassifierProperties = function (output, conte
7099
7511
  OutputDataConfig: output.OutputDataConfig !== undefined && output.OutputDataConfig !== null
7100
7512
  ? deserializeAws_json1_1DocumentClassifierOutputDataConfig(output.OutputDataConfig, context)
7101
7513
  : undefined,
7514
+ SourceModelArn: __expectString(output.SourceModelArn),
7102
7515
  Status: __expectString(output.Status),
7103
7516
  SubmitTime: output.SubmitTime !== undefined && output.SubmitTime !== null
7104
7517
  ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.SubmitTime)))
@@ -7388,6 +7801,7 @@ var deserializeAws_json1_1EntityRecognizerProperties = function (output, context
7388
7801
  RecognizerMetadata: output.RecognizerMetadata !== undefined && output.RecognizerMetadata !== null
7389
7802
  ? deserializeAws_json1_1EntityRecognizerMetadata(output.RecognizerMetadata, context)
7390
7803
  : undefined,
7804
+ SourceModelArn: __expectString(output.SourceModelArn),
7391
7805
  Status: __expectString(output.Status),
7392
7806
  SubmitTime: output.SubmitTime !== undefined && output.SubmitTime !== null
7393
7807
  ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.SubmitTime)))
@@ -7494,6 +7908,11 @@ var deserializeAws_json1_1EventsDetectionJobPropertiesList = function (output, c
7494
7908
  return deserializeAws_json1_1EventsDetectionJobProperties(entry, context);
7495
7909
  });
7496
7910
  };
7911
+ var deserializeAws_json1_1ImportModelResponse = function (output, context) {
7912
+ return {
7913
+ ModelArn: __expectString(output.ModelArn),
7914
+ };
7915
+ };
7497
7916
  var deserializeAws_json1_1InputDataConfig = function (output, context) {
7498
7917
  return {
7499
7918
  DocumentReaderConfig: output.DocumentReaderConfig !== undefined && output.DocumentReaderConfig !== null
@@ -7901,6 +8320,11 @@ var deserializeAws_json1_1PiiOutputDataConfig = function (output, context) {
7901
8320
  S3Uri: __expectString(output.S3Uri),
7902
8321
  };
7903
8322
  };
8323
+ var deserializeAws_json1_1PutResourcePolicyResponse = function (output, context) {
8324
+ return {
8325
+ PolicyRevisionId: __expectString(output.PolicyRevisionId),
8326
+ };
8327
+ };
7904
8328
  var deserializeAws_json1_1RedactionConfig = function (output, context) {
7905
8329
  return {
7906
8330
  MaskCharacter: __expectString(output.MaskCharacter),