From e7333b8cdfa1688be226d395ba8aec30ffa7b542 Mon Sep 17 00:00:00 2001 From: awstools Date: Fri, 25 Aug 2023 18:12:51 +0000 Subject: [PATCH] feat(client-cloudtrail): Add ThrottlingException with error code 429 to handle CloudTrail Delegated Admin request rate exceeded on organization resources. --- .../src/commands/CreateTrailCommand.ts | 5 +++ .../src/commands/DeleteTrailCommand.ts | 5 +++ .../commands/GetInsightSelectorsCommand.ts | 5 +++ .../src/commands/PutEventSelectorsCommand.ts | 5 +++ .../commands/PutInsightSelectorsCommand.ts | 5 +++ .../src/commands/StartLoggingCommand.ts | 5 +++ .../src/commands/StopLoggingCommand.ts | 5 +++ .../src/commands/UpdateTrailCommand.ts | 5 +++ .../client-cloudtrail/src/models/models_0.ts | 28 ++++++++++++ .../src/protocols/Aws_json1_1.ts | 40 +++++++++++++++++ .../sdk-codegen/aws-models/cloudtrail.json | 44 +++++++++++++++++++ 11 files changed, 152 insertions(+) diff --git a/clients/client-cloudtrail/src/commands/CreateTrailCommand.ts b/clients/client-cloudtrail/src/commands/CreateTrailCommand.ts index fbd8ceeae61c..3d256de8fffe 100644 --- a/clients/client-cloudtrail/src/commands/CreateTrailCommand.ts +++ b/clients/client-cloudtrail/src/commands/CreateTrailCommand.ts @@ -216,6 +216,11 @@ export interface CreateTrailCommandOutput extends CreateTrailResponse, __Metadat *

The number of tags per trail, event data store, or channel has exceeded the permitted amount. Currently, the limit is * 50.

* + * @throws {@link ThrottlingException} (client fault) + *

+ * This exception is thrown when the request rate exceeds the limit. + *

+ * * @throws {@link TrailAlreadyExistsException} (client fault) *

This exception is thrown when the specified trail already exists.

* diff --git a/clients/client-cloudtrail/src/commands/DeleteTrailCommand.ts b/clients/client-cloudtrail/src/commands/DeleteTrailCommand.ts index 22420c748508..a54353c08860 100644 --- a/clients/client-cloudtrail/src/commands/DeleteTrailCommand.ts +++ b/clients/client-cloudtrail/src/commands/DeleteTrailCommand.ts @@ -124,6 +124,11 @@ export interface DeleteTrailCommandOutput extends DeleteTrailResponse, __Metadat * @throws {@link OperationNotPermittedException} (client fault) *

This exception is thrown when the requested operation is not permitted.

* + * @throws {@link ThrottlingException} (client fault) + *

+ * This exception is thrown when the request rate exceeds the limit. + *

+ * * @throws {@link TrailNotFoundException} (client fault) *

This exception is thrown when the trail with the given name is not found.

* diff --git a/clients/client-cloudtrail/src/commands/GetInsightSelectorsCommand.ts b/clients/client-cloudtrail/src/commands/GetInsightSelectorsCommand.ts index 6adf34d7b3d9..3d6537f20074 100644 --- a/clients/client-cloudtrail/src/commands/GetInsightSelectorsCommand.ts +++ b/clients/client-cloudtrail/src/commands/GetInsightSelectorsCommand.ts @@ -120,6 +120,11 @@ export interface GetInsightSelectorsCommandOutput extends GetInsightSelectorsRes * @throws {@link OperationNotPermittedException} (client fault) *

This exception is thrown when the requested operation is not permitted.

* + * @throws {@link ThrottlingException} (client fault) + *

+ * This exception is thrown when the request rate exceeds the limit. + *

+ * * @throws {@link TrailNotFoundException} (client fault) *

This exception is thrown when the trail with the given name is not found.

* diff --git a/clients/client-cloudtrail/src/commands/PutEventSelectorsCommand.ts b/clients/client-cloudtrail/src/commands/PutEventSelectorsCommand.ts index df4497fb7e48..3da501c29170 100644 --- a/clients/client-cloudtrail/src/commands/PutEventSelectorsCommand.ts +++ b/clients/client-cloudtrail/src/commands/PutEventSelectorsCommand.ts @@ -284,6 +284,11 @@ export interface PutEventSelectorsCommandOutput extends PutEventSelectorsRespons * @throws {@link OperationNotPermittedException} (client fault) *

This exception is thrown when the requested operation is not permitted.

* + * @throws {@link ThrottlingException} (client fault) + *

+ * This exception is thrown when the request rate exceeds the limit. + *

+ * * @throws {@link TrailNotFoundException} (client fault) *

This exception is thrown when the trail with the given name is not found.

* diff --git a/clients/client-cloudtrail/src/commands/PutInsightSelectorsCommand.ts b/clients/client-cloudtrail/src/commands/PutInsightSelectorsCommand.ts index 8dd28b0ea32a..eb6149793271 100644 --- a/clients/client-cloudtrail/src/commands/PutInsightSelectorsCommand.ts +++ b/clients/client-cloudtrail/src/commands/PutInsightSelectorsCommand.ts @@ -152,6 +152,11 @@ export interface PutInsightSelectorsCommandOutput extends PutInsightSelectorsRes * @throws {@link S3BucketDoesNotExistException} (client fault) *

This exception is thrown when the specified S3 bucket does not exist.

* + * @throws {@link ThrottlingException} (client fault) + *

+ * This exception is thrown when the request rate exceeds the limit. + *

+ * * @throws {@link TrailNotFoundException} (client fault) *

This exception is thrown when the trail with the given name is not found.

* diff --git a/clients/client-cloudtrail/src/commands/StartLoggingCommand.ts b/clients/client-cloudtrail/src/commands/StartLoggingCommand.ts index df27bff52286..1078eea1c100 100644 --- a/clients/client-cloudtrail/src/commands/StartLoggingCommand.ts +++ b/clients/client-cloudtrail/src/commands/StartLoggingCommand.ts @@ -125,6 +125,11 @@ export interface StartLoggingCommandOutput extends StartLoggingResponse, __Metad * @throws {@link OperationNotPermittedException} (client fault) *

This exception is thrown when the requested operation is not permitted.

* + * @throws {@link ThrottlingException} (client fault) + *

+ * This exception is thrown when the request rate exceeds the limit. + *

+ * * @throws {@link TrailNotFoundException} (client fault) *

This exception is thrown when the trail with the given name is not found.

* diff --git a/clients/client-cloudtrail/src/commands/StopLoggingCommand.ts b/clients/client-cloudtrail/src/commands/StopLoggingCommand.ts index 534f69024467..57c55a50bfc8 100644 --- a/clients/client-cloudtrail/src/commands/StopLoggingCommand.ts +++ b/clients/client-cloudtrail/src/commands/StopLoggingCommand.ts @@ -128,6 +128,11 @@ export interface StopLoggingCommandOutput extends StopLoggingResponse, __Metadat * @throws {@link OperationNotPermittedException} (client fault) *

This exception is thrown when the requested operation is not permitted.

* + * @throws {@link ThrottlingException} (client fault) + *

+ * This exception is thrown when the request rate exceeds the limit. + *

+ * * @throws {@link TrailNotFoundException} (client fault) *

This exception is thrown when the trail with the given name is not found.

* diff --git a/clients/client-cloudtrail/src/commands/UpdateTrailCommand.ts b/clients/client-cloudtrail/src/commands/UpdateTrailCommand.ts index 2d18f235a83b..04efaefcf9dd 100644 --- a/clients/client-cloudtrail/src/commands/UpdateTrailCommand.ts +++ b/clients/client-cloudtrail/src/commands/UpdateTrailCommand.ts @@ -254,6 +254,11 @@ export interface UpdateTrailCommandOutput extends UpdateTrailResponse, __Metadat * @throws {@link S3BucketDoesNotExistException} (client fault) *

This exception is thrown when the specified S3 bucket does not exist.

* + * @throws {@link ThrottlingException} (client fault) + *

+ * This exception is thrown when the request rate exceeds the limit. + *

+ * * @throws {@link TrailNotFoundException} (client fault) *

This exception is thrown when the trail with the given name is not found.

* diff --git a/clients/client-cloudtrail/src/models/models_0.ts b/clients/client-cloudtrail/src/models/models_0.ts index d6ddda050dfa..3e88390fd30a 100644 --- a/clients/client-cloudtrail/src/models/models_0.ts +++ b/clients/client-cloudtrail/src/models/models_0.ts @@ -2747,6 +2747,34 @@ export class S3BucketDoesNotExistException extends __BaseException { } } +/** + * @public + *

+ * This exception is thrown when the request rate exceeds the limit. + *

+ */ +export class ThrottlingException extends __BaseException { + readonly name: "ThrottlingException" = "ThrottlingException"; + readonly $fault: "client" = "client"; + /** + * @public + *

Brief description of the exception returned by the request.

+ */ + Message?: string; + /** + * @internal + */ + constructor(opts: __ExceptionOptionType) { + super({ + name: "ThrottlingException", + $fault: "client", + ...opts, + }); + Object.setPrototypeOf(this, ThrottlingException.prototype); + this.Message = opts.Message; + } +} + /** * @public *

This exception is thrown when the specified trail already exists.

diff --git a/clients/client-cloudtrail/src/protocols/Aws_json1_1.ts b/clients/client-cloudtrail/src/protocols/Aws_json1_1.ts index 69278dadd1c0..d14c4d47b4e6 100644 --- a/clients/client-cloudtrail/src/protocols/Aws_json1_1.ts +++ b/clients/client-cloudtrail/src/protocols/Aws_json1_1.ts @@ -256,6 +256,7 @@ import { StopLoggingRequest, Tag, TagsLimitExceededException, + ThrottlingException, TrailAlreadyExistsException, TrailNotFoundException, TrailNotProvidedException, @@ -1321,6 +1322,9 @@ const de_CreateTrailCommandError = async ( case "TagsLimitExceededException": case "com.amazonaws.cloudtrail#TagsLimitExceededException": throw await de_TagsLimitExceededExceptionRes(parsedOutput, context); + case "ThrottlingException": + case "com.amazonaws.cloudtrail#ThrottlingException": + throw await de_ThrottlingExceptionRes(parsedOutput, context); case "TrailAlreadyExistsException": case "com.amazonaws.cloudtrail#TrailAlreadyExistsException": throw await de_TrailAlreadyExistsExceptionRes(parsedOutput, context); @@ -1592,6 +1596,9 @@ const de_DeleteTrailCommandError = async ( case "OperationNotPermittedException": case "com.amazonaws.cloudtrail#OperationNotPermittedException": throw await de_OperationNotPermittedExceptionRes(parsedOutput, context); + case "ThrottlingException": + case "com.amazonaws.cloudtrail#ThrottlingException": + throw await de_ThrottlingExceptionRes(parsedOutput, context); case "TrailNotFoundException": case "com.amazonaws.cloudtrail#TrailNotFoundException": throw await de_TrailNotFoundExceptionRes(parsedOutput, context); @@ -2086,6 +2093,9 @@ const de_GetInsightSelectorsCommandError = async ( case "OperationNotPermittedException": case "com.amazonaws.cloudtrail#OperationNotPermittedException": throw await de_OperationNotPermittedExceptionRes(parsedOutput, context); + case "ThrottlingException": + case "com.amazonaws.cloudtrail#ThrottlingException": + throw await de_ThrottlingExceptionRes(parsedOutput, context); case "TrailNotFoundException": case "com.amazonaws.cloudtrail#TrailNotFoundException": throw await de_TrailNotFoundExceptionRes(parsedOutput, context); @@ -2958,6 +2968,9 @@ const de_PutEventSelectorsCommandError = async ( case "OperationNotPermittedException": case "com.amazonaws.cloudtrail#OperationNotPermittedException": throw await de_OperationNotPermittedExceptionRes(parsedOutput, context); + case "ThrottlingException": + case "com.amazonaws.cloudtrail#ThrottlingException": + throw await de_ThrottlingExceptionRes(parsedOutput, context); case "TrailNotFoundException": case "com.amazonaws.cloudtrail#TrailNotFoundException": throw await de_TrailNotFoundExceptionRes(parsedOutput, context); @@ -3040,6 +3053,9 @@ const de_PutInsightSelectorsCommandError = async ( case "S3BucketDoesNotExistException": case "com.amazonaws.cloudtrail#S3BucketDoesNotExistException": throw await de_S3BucketDoesNotExistExceptionRes(parsedOutput, context); + case "ThrottlingException": + case "com.amazonaws.cloudtrail#ThrottlingException": + throw await de_ThrottlingExceptionRes(parsedOutput, context); case "TrailNotFoundException": case "com.amazonaws.cloudtrail#TrailNotFoundException": throw await de_TrailNotFoundExceptionRes(parsedOutput, context); @@ -3575,6 +3591,9 @@ const de_StartLoggingCommandError = async ( case "OperationNotPermittedException": case "com.amazonaws.cloudtrail#OperationNotPermittedException": throw await de_OperationNotPermittedExceptionRes(parsedOutput, context); + case "ThrottlingException": + case "com.amazonaws.cloudtrail#ThrottlingException": + throw await de_ThrottlingExceptionRes(parsedOutput, context); case "TrailNotFoundException": case "com.amazonaws.cloudtrail#TrailNotFoundException": throw await de_TrailNotFoundExceptionRes(parsedOutput, context); @@ -3861,6 +3880,9 @@ const de_StopLoggingCommandError = async ( case "OperationNotPermittedException": case "com.amazonaws.cloudtrail#OperationNotPermittedException": throw await de_OperationNotPermittedExceptionRes(parsedOutput, context); + case "ThrottlingException": + case "com.amazonaws.cloudtrail#ThrottlingException": + throw await de_ThrottlingExceptionRes(parsedOutput, context); case "TrailNotFoundException": case "com.amazonaws.cloudtrail#TrailNotFoundException": throw await de_TrailNotFoundExceptionRes(parsedOutput, context); @@ -4170,6 +4192,9 @@ const de_UpdateTrailCommandError = async ( case "S3BucketDoesNotExistException": case "com.amazonaws.cloudtrail#S3BucketDoesNotExistException": throw await de_S3BucketDoesNotExistExceptionRes(parsedOutput, context); + case "ThrottlingException": + case "com.amazonaws.cloudtrail#ThrottlingException": + throw await de_ThrottlingExceptionRes(parsedOutput, context); case "TrailNotFoundException": case "com.amazonaws.cloudtrail#TrailNotFoundException": throw await de_TrailNotFoundExceptionRes(parsedOutput, context); @@ -5383,6 +5408,19 @@ const de_TagsLimitExceededExceptionRes = async ( return __decorateServiceException(exception, body); }; +/** + * deserializeAws_json1_1ThrottlingExceptionRes + */ +const de_ThrottlingExceptionRes = async (parsedOutput: any, context: __SerdeContext): Promise => { + const body = parsedOutput.body; + const deserialized: any = _json(body); + const exception = new ThrottlingException({ + $metadata: deserializeMetadata(parsedOutput), + ...deserialized, + }); + return __decorateServiceException(exception, body); +}; + /** * deserializeAws_json1_1TrailAlreadyExistsExceptionRes */ @@ -6307,6 +6345,8 @@ const de_StopImportResponse = (output: any, context: __SerdeContext): StopImport // de_TagsList omitted. +// de_ThrottlingException omitted. + // de_Trail omitted. // de_TrailAlreadyExistsException omitted. diff --git a/codegen/sdk-codegen/aws-models/cloudtrail.json b/codegen/sdk-codegen/aws-models/cloudtrail.json index df4cd9439d09..9c00538f2579 100644 --- a/codegen/sdk-codegen/aws-models/cloudtrail.json +++ b/codegen/sdk-codegen/aws-models/cloudtrail.json @@ -2272,6 +2272,9 @@ { "target": "com.amazonaws.cloudtrail#TagsLimitExceededException" }, + { + "target": "com.amazonaws.cloudtrail#ThrottlingException" + }, { "target": "com.amazonaws.cloudtrail#TrailAlreadyExistsException" }, @@ -2718,6 +2721,9 @@ { "target": "com.amazonaws.cloudtrail#OperationNotPermittedException" }, + { + "target": "com.amazonaws.cloudtrail#ThrottlingException" + }, { "target": "com.amazonaws.cloudtrail#TrailNotFoundException" }, @@ -3958,6 +3964,9 @@ { "target": "com.amazonaws.cloudtrail#OperationNotPermittedException" }, + { + "target": "com.amazonaws.cloudtrail#ThrottlingException" + }, { "target": "com.amazonaws.cloudtrail#TrailNotFoundException" }, @@ -6649,6 +6658,9 @@ { "target": "com.amazonaws.cloudtrail#OperationNotPermittedException" }, + { + "target": "com.amazonaws.cloudtrail#ThrottlingException" + }, { "target": "com.amazonaws.cloudtrail#TrailNotFoundException" }, @@ -6756,6 +6768,9 @@ { "target": "com.amazonaws.cloudtrail#S3BucketDoesNotExistException" }, + { + "target": "com.amazonaws.cloudtrail#ThrottlingException" + }, { "target": "com.amazonaws.cloudtrail#TrailNotFoundException" }, @@ -7973,6 +7988,9 @@ { "target": "com.amazonaws.cloudtrail#OperationNotPermittedException" }, + { + "target": "com.amazonaws.cloudtrail#ThrottlingException" + }, { "target": "com.amazonaws.cloudtrail#TrailNotFoundException" }, @@ -8314,6 +8332,9 @@ { "target": "com.amazonaws.cloudtrail#OperationNotPermittedException" }, + { + "target": "com.amazonaws.cloudtrail#ThrottlingException" + }, { "target": "com.amazonaws.cloudtrail#TrailNotFoundException" }, @@ -8428,6 +8449,26 @@ "com.amazonaws.cloudtrail#TerminationProtectionEnabled": { "type": "boolean" }, + "com.amazonaws.cloudtrail#ThrottlingException": { + "type": "structure", + "members": { + "Message": { + "target": "com.amazonaws.cloudtrail#ErrorMessage", + "traits": { + "smithy.api#documentation": "

Brief description of the exception returned by the request.

" + } + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "ThrottlingException", + "httpResponseCode": 429 + }, + "smithy.api#documentation": "

\n This exception is thrown when the request rate exceeds the limit. \n

", + "smithy.api#error": "client", + "smithy.api#httpError": 429 + } + }, "com.amazonaws.cloudtrail#Trail": { "type": "structure", "members": { @@ -9070,6 +9111,9 @@ { "target": "com.amazonaws.cloudtrail#S3BucketDoesNotExistException" }, + { + "target": "com.amazonaws.cloudtrail#ThrottlingException" + }, { "target": "com.amazonaws.cloudtrail#TrailNotFoundException" },