Skip to content

Commit

Permalink
feat(client-rds-data): Add support for the automatic pause/resume fea…
Browse files Browse the repository at this point in the history
…ture of Aurora Serverless v2.
  • Loading branch information
awstools committed Nov 18, 2024
1 parent 6dde6f9 commit 2fc76d4
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ export interface BatchExecuteStatementCommandOutput extends BatchExecuteStatemen
* @throws {@link DatabaseNotFoundException} (client fault)
* <p>The DB cluster doesn't have a DB instance.</p>
*
* @throws {@link DatabaseResumingException} (client fault)
* <p>A request was canceled because the Aurora Serverless v2 DB instance was in a paused state.
* The Data API request automatically causes the DB instance to begin resuming. Wait a few seconds and
* try again.</p>
*
* @throws {@link DatabaseUnavailableException} (server fault)
* <p>The writer instance in the DB cluster isn't available.</p>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ export interface BeginTransactionCommandOutput extends BeginTransactionResponse,
* @throws {@link DatabaseNotFoundException} (client fault)
* <p>The DB cluster doesn't have a DB instance.</p>
*
* @throws {@link DatabaseResumingException} (client fault)
* <p>A request was canceled because the Aurora Serverless v2 DB instance was in a paused state.
* The Data API request automatically causes the DB instance to begin resuming. Wait a few seconds and
* try again.</p>
*
* @throws {@link DatabaseUnavailableException} (server fault)
* <p>The writer instance in the DB cluster isn't available.</p>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ export interface ExecuteStatementCommandOutput extends ExecuteStatementResponse,
* @throws {@link DatabaseNotFoundException} (client fault)
* <p>The DB cluster doesn't have a DB instance.</p>
*
* @throws {@link DatabaseResumingException} (client fault)
* <p>A request was canceled because the Aurora Serverless v2 DB instance was in a paused state.
* The Data API request automatically causes the DB instance to begin resuming. Wait a few seconds and
* try again.</p>
*
* @throws {@link DatabaseUnavailableException} (server fault)
* <p>The writer instance in the DB cluster isn't available.</p>
*
Expand Down
22 changes: 22 additions & 0 deletions clients/client-rds-data/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,28 @@ export class DatabaseNotFoundException extends __BaseException {
}
}

/**
* <p>A request was canceled because the Aurora Serverless v2 DB instance was in a paused state.
* The Data API request automatically causes the DB instance to begin resuming. Wait a few seconds and
* try again.</p>
* @public
*/
export class DatabaseResumingException extends __BaseException {
readonly name: "DatabaseResumingException" = "DatabaseResumingException";
readonly $fault: "client" = "client";
/**
* @internal
*/
constructor(opts: __ExceptionOptionType<DatabaseResumingException, __BaseException>) {
super({
name: "DatabaseResumingException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, DatabaseResumingException.prototype);
}
}

/**
* <p>The writer instance in the DB cluster isn't available.</p>
* @public
Expand Down
24 changes: 24 additions & 0 deletions clients/client-rds-data/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import {
BadRequestException,
DatabaseErrorException,
DatabaseNotFoundException,
DatabaseResumingException,
DatabaseUnavailableException,
Field,
ForbiddenException,
Expand Down Expand Up @@ -382,6 +383,9 @@ const de_CommandError = async (output: __HttpResponse, context: __SerdeContext):
case "DatabaseNotFoundException":
case "com.amazonaws.rdsdata#DatabaseNotFoundException":
throw await de_DatabaseNotFoundExceptionRes(parsedOutput, context);
case "DatabaseResumingException":
case "com.amazonaws.rdsdata#DatabaseResumingException":
throw await de_DatabaseResumingExceptionRes(parsedOutput, context);
case "DatabaseUnavailableException":
case "com.amazonaws.rdsdata#DatabaseUnavailableException":
throw await de_DatabaseUnavailableExceptionRes(parsedOutput, context);
Expand Down Expand Up @@ -503,6 +507,26 @@ const de_DatabaseNotFoundExceptionRes = async (
return __decorateServiceException(exception, parsedOutput.body);
};

/**
* deserializeAws_restJson1DatabaseResumingExceptionRes
*/
const de_DatabaseResumingExceptionRes = async (
parsedOutput: any,
context: __SerdeContext
): Promise<DatabaseResumingException> => {
const contents: any = map({});
const data: any = parsedOutput.body;
const doc = take(data, {
message: __expectString,
});
Object.assign(contents, doc);
const exception = new DatabaseResumingException({
$metadata: deserializeMetadata(parsedOutput),
...contents,
});
return __decorateServiceException(exception, parsedOutput.body);
};

/**
* deserializeAws_restJson1DatabaseUnavailableExceptionRes
*/
Expand Down
22 changes: 22 additions & 0 deletions codegen/sdk-codegen/aws-models/rds-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@
{
"target": "com.amazonaws.rdsdata#DatabaseNotFoundException"
},
{
"target": "com.amazonaws.rdsdata#DatabaseResumingException"
},
{
"target": "com.amazonaws.rdsdata#DatabaseUnavailableException"
},
Expand Down Expand Up @@ -238,6 +241,9 @@
{
"target": "com.amazonaws.rdsdata#DatabaseNotFoundException"
},
{
"target": "com.amazonaws.rdsdata#DatabaseResumingException"
},
{
"target": "com.amazonaws.rdsdata#DatabaseUnavailableException"
},
Expand Down Expand Up @@ -587,6 +593,19 @@
"smithy.api#httpError": 404
}
},
"com.amazonaws.rdsdata#DatabaseResumingException": {
"type": "structure",
"members": {
"message": {
"target": "com.amazonaws.rdsdata#ErrorMessage"
}
},
"traits": {
"smithy.api#documentation": "<p>A request was canceled because the Aurora Serverless v2 DB instance was in a paused state.\n The Data API request automatically causes the DB instance to begin resuming. Wait a few seconds and\n try again.</p>",
"smithy.api#error": "client",
"smithy.api#httpError": 400
}
},
"com.amazonaws.rdsdata#DatabaseUnavailableException": {
"type": "structure",
"members": {},
Expand Down Expand Up @@ -745,6 +764,9 @@
{
"target": "com.amazonaws.rdsdata#DatabaseNotFoundException"
},
{
"target": "com.amazonaws.rdsdata#DatabaseResumingException"
},
{
"target": "com.amazonaws.rdsdata#DatabaseUnavailableException"
},
Expand Down

0 comments on commit 2fc76d4

Please sign in to comment.