From 549616d002860ce9b3c3a8b9741a23ec2e094a73 Mon Sep 17 00:00:00 2001 From: awstools Date: Mon, 22 Jan 2024 19:19:35 +0000 Subject: [PATCH] feat(client-rds): Introduced support for the InsufficientDBInstanceCapacityFault error in the RDS CreateDBCluster API method. This provides enhanced error handling, ensuring a more robust experience when creating database clusters with insufficient instance capacity. --- .../src/commands/CreateDBClusterCommand.ts | 4 + clients/client-rds/src/models/models_0.ts | 42 ++++----- clients/client-rds/src/protocols/Aws_query.ts | 3 + codegen/sdk-codegen/aws-models/rds.json | 91 +++++++++++++++++++ 4 files changed, 119 insertions(+), 21 deletions(-) diff --git a/clients/client-rds/src/commands/CreateDBClusterCommand.ts b/clients/client-rds/src/commands/CreateDBClusterCommand.ts index 16632814532e9..f9d78ba139601 100644 --- a/clients/client-rds/src/commands/CreateDBClusterCommand.ts +++ b/clients/client-rds/src/commands/CreateDBClusterCommand.ts @@ -347,6 +347,10 @@ export interface CreateDBClusterCommandOutput extends CreateDBClusterResult, __M * @throws {@link GlobalClusterNotFoundFault} (client fault) *

The GlobalClusterIdentifier doesn't refer to an existing global database cluster.

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

The specified DB instance class isn't available in the specified Availability + * Zone.

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

There is insufficient storage available for the current action. You might be able to * resolve this error by updating your subnet group to use different Availability Zones diff --git a/clients/client-rds/src/models/models_0.ts b/clients/client-rds/src/models/models_0.ts index 0c42f0d1740ad..10444b99619b4 100644 --- a/clients/client-rds/src/models/models_0.ts +++ b/clients/client-rds/src/models/models_0.ts @@ -6244,6 +6244,27 @@ export class GlobalClusterNotFoundFault extends __BaseException { } } +/** + * @public + *

The specified DB instance class isn't available in the specified Availability + * Zone.

+ */ +export class InsufficientDBInstanceCapacityFault extends __BaseException { + readonly name: "InsufficientDBInstanceCapacityFault" = "InsufficientDBInstanceCapacityFault"; + readonly $fault: "client" = "client"; + /** + * @internal + */ + constructor(opts: __ExceptionOptionType) { + super({ + name: "InsufficientDBInstanceCapacityFault", + $fault: "client", + ...opts, + }); + Object.setPrototypeOf(this, InsufficientDBInstanceCapacityFault.prototype); + } +} + /** * @public *

There is insufficient storage available for the current action. You might be able to @@ -9422,27 +9443,6 @@ export class DBInstanceAlreadyExistsFault extends __BaseException { } } -/** - * @public - *

The specified DB instance class isn't available in the specified Availability - * Zone.

- */ -export class InsufficientDBInstanceCapacityFault extends __BaseException { - readonly name: "InsufficientDBInstanceCapacityFault" = "InsufficientDBInstanceCapacityFault"; - readonly $fault: "client" = "client"; - /** - * @internal - */ - constructor(opts: __ExceptionOptionType) { - super({ - name: "InsufficientDBInstanceCapacityFault", - $fault: "client", - ...opts, - }); - Object.setPrototypeOf(this, InsufficientDBInstanceCapacityFault.prototype); - } -} - /** * @public *

The network type is invalid for the DB instance. Valid nework type values are IPV4 and DUAL.

diff --git a/clients/client-rds/src/protocols/Aws_query.ts b/clients/client-rds/src/protocols/Aws_query.ts index d06cd1f49555c..88ad49004028a 100644 --- a/clients/client-rds/src/protocols/Aws_query.ts +++ b/clients/client-rds/src/protocols/Aws_query.ts @@ -4631,6 +4631,9 @@ const de_CreateDBClusterCommandError = async ( case "GlobalClusterNotFoundFault": case "com.amazonaws.rds#GlobalClusterNotFoundFault": throw await de_GlobalClusterNotFoundFaultRes(parsedOutput, context); + case "InsufficientDBInstanceCapacity": + case "com.amazonaws.rds#InsufficientDBInstanceCapacityFault": + throw await de_InsufficientDBInstanceCapacityFaultRes(parsedOutput, context); case "InsufficientStorageClusterCapacity": case "com.amazonaws.rds#InsufficientStorageClusterCapacityFault": throw await de_InsufficientStorageClusterCapacityFaultRes(parsedOutput, context); diff --git a/codegen/sdk-codegen/aws-models/rds.json b/codegen/sdk-codegen/aws-models/rds.json index e4a87109b567f..61d7eccd6465a 100644 --- a/codegen/sdk-codegen/aws-models/rds.json +++ b/codegen/sdk-codegen/aws-models/rds.json @@ -3870,6 +3870,9 @@ { "target": "com.amazonaws.rds#GlobalClusterNotFoundFault" }, + { + "target": "com.amazonaws.rds#InsufficientDBInstanceCapacityFault" + }, { "target": "com.amazonaws.rds#InsufficientStorageClusterCapacityFault" }, @@ -3958,6 +3961,57 @@ "CopyTagsToSnapshot": false } } + }, + { + "title": "To create a PostgreSQL-compatible DB cluster", + "documentation": "The following example creates a PostgreSQL-compatible Aurora DB cluster.", + "input": { + "DBClusterIdentifier": "sample-pg-cluster", + "Engine": "aurora-postgresql", + "MasterUsername": "admin", + "MasterUserPassword": "mypassword", + "VpcSecurityGroupIds": ["sg-0b91305example"], + "DBSubnetGroupName": "default" + }, + "output": { + "DBCluster": { + "Endpoint": "sample-pg-cluster.cluster-cnpexample.us-east-1.rds.amazonaws.com", + "HttpEndpointEnabled": false, + "DBClusterMembers": [], + "EngineMode": "provisioned", + "CopyTagsToSnapshot": false, + "HostedZoneId": "Z2R2ITUGPM61AM", + "IAMDatabaseAuthenticationEnabled": false, + "AllocatedStorage": 1, + "VpcSecurityGroups": [ + { + "VpcSecurityGroupId": "sg-0b91305example", + "Status": "active" + } + ], + "DeletionProtection": false, + "StorageEncrypted": false, + "BackupRetentionPeriod": 1, + "PreferredBackupWindow": "09:56-10:26", + "ClusterCreateTime": "2019-06-07T23:26:08.371Z", + "DBClusterParameterGroup": "default.aurora-postgresql9.6", + "EngineVersion": "9.6.9", + "Engine": "aurora-postgresql", + "Status": "creating", + "DBClusterIdentifier": "sample-pg-cluster", + "MultiAZ": false, + "Port": 5432, + "DBClusterArn": "arn:aws:rds:us-east-1:123456789012:cluster:sample-pg-cluster", + "AssociatedRoles": [], + "DbClusterResourceId": "cluster-ANPAJ4AE5446DAEXAMPLE", + "PreferredMaintenanceWindow": "wed:03:33-wed:04:03", + "ReaderEndpoint": "sample-pg-cluster.cluster-ro-cnpexample.us-east-1.rds.amazonaws.com", + "MasterUsername": "master", + "AvailabilityZones": ["us-east-1a", "us-east-1b", "us-east-1c"], + "ReadReplicaIdentifiers": [], + "DBSubnetGroup": "default" + } + } } ] } @@ -13167,6 +13221,23 @@ } ] } + }, + { + "title": "To describe DB cluster endpoints of a single DB cluster", + "documentation": "The following example retrieves details for the DB cluster endpoints of a single specified DB cluster. Aurora Serverless clusters have only a single endpoint with a type of WRITER.", + "input": { + "DBClusterIdentifier": "serverless-cluster" + }, + "output": { + "DBClusterEndpoints": [ + { + "Status": "available", + "Endpoint": "serverless-cluster.cluster-cnpexample.us-east-1.rds.amazonaws.com", + "DBClusterIdentifier": "serverless-cluster", + "EndpointType": "WRITER" + } + ] + } } ], "smithy.api#paginated": { @@ -22060,6 +22131,26 @@ ] } } + }, + { + "title": "To prevent an AWS account from restoring a DB snapshot", + "documentation": "The following example removes permission from the AWS account with the identifier 444455556666 to restore the DB snapshot named mydbsnapshot.", + "input": { + "DBSnapshotIdentifier": "mydbsnapshot", + "AttributeName": "restore", + "ValuesToRemove": ["444455556666"] + }, + "output": { + "DBSnapshotAttributesResult": { + "DBSnapshotIdentifier": "mydbsnapshot", + "DBSnapshotAttributes": [ + { + "AttributeName": "restore", + "AttributeValues": ["111122223333"] + } + ] + } + } } ] }