Skip to content

Commit 5aceef8

Browse files
author
awstools
committed
feat(client-athena): This release introduces the DeleteCapacityReservation API and the ability to manage capacity reservations using CloudFormation
1 parent 4d78994 commit 5aceef8

File tree

9 files changed

+325
-4
lines changed

9 files changed

+325
-4
lines changed

clients/client-athena/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,14 @@ CreateWorkGroup
303303

304304
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-athena/classes/createworkgroupcommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-athena/interfaces/createworkgroupcommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-athena/interfaces/createworkgroupcommandoutput.html)
305305

306+
</details>
307+
<details>
308+
<summary>
309+
DeleteCapacityReservation
310+
</summary>
311+
312+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-athena/classes/deletecapacityreservationcommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-athena/interfaces/deletecapacityreservationcommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-athena/interfaces/deletecapacityreservationcommandoutput.html)
313+
306314
</details>
307315
<details>
308316
<summary>

clients/client-athena/src/Athena.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ import {
5858
CreateWorkGroupCommandInput,
5959
CreateWorkGroupCommandOutput,
6060
} from "./commands/CreateWorkGroupCommand";
61+
import {
62+
DeleteCapacityReservationCommand,
63+
DeleteCapacityReservationCommandInput,
64+
DeleteCapacityReservationCommandOutput,
65+
} from "./commands/DeleteCapacityReservationCommand";
6166
import {
6267
DeleteDataCatalogCommand,
6368
DeleteDataCatalogCommandInput,
@@ -339,6 +344,7 @@ const commands = {
339344
CreatePreparedStatementCommand,
340345
CreatePresignedNotebookUrlCommand,
341346
CreateWorkGroupCommand,
347+
DeleteCapacityReservationCommand,
342348
DeleteDataCatalogCommand,
343349
DeleteNamedQueryCommand,
344350
DeleteNotebookCommand,
@@ -579,6 +585,23 @@ export interface Athena {
579585
cb: (err: any, data?: CreateWorkGroupCommandOutput) => void
580586
): void;
581587

588+
/**
589+
* @see {@link DeleteCapacityReservationCommand}
590+
*/
591+
deleteCapacityReservation(
592+
args: DeleteCapacityReservationCommandInput,
593+
options?: __HttpHandlerOptions
594+
): Promise<DeleteCapacityReservationCommandOutput>;
595+
deleteCapacityReservation(
596+
args: DeleteCapacityReservationCommandInput,
597+
cb: (err: any, data?: DeleteCapacityReservationCommandOutput) => void
598+
): void;
599+
deleteCapacityReservation(
600+
args: DeleteCapacityReservationCommandInput,
601+
options: __HttpHandlerOptions,
602+
cb: (err: any, data?: DeleteCapacityReservationCommandOutput) => void
603+
): void;
604+
582605
/**
583606
* @see {@link DeleteDataCatalogCommand}
584607
*/

clients/client-athena/src/AthenaClient.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ import {
8080
CreatePresignedNotebookUrlCommandOutput,
8181
} from "./commands/CreatePresignedNotebookUrlCommand";
8282
import { CreateWorkGroupCommandInput, CreateWorkGroupCommandOutput } from "./commands/CreateWorkGroupCommand";
83+
import {
84+
DeleteCapacityReservationCommandInput,
85+
DeleteCapacityReservationCommandOutput,
86+
} from "./commands/DeleteCapacityReservationCommand";
8387
import { DeleteDataCatalogCommandInput, DeleteDataCatalogCommandOutput } from "./commands/DeleteDataCatalogCommand";
8488
import { DeleteNamedQueryCommandInput, DeleteNamedQueryCommandOutput } from "./commands/DeleteNamedQueryCommand";
8589
import { DeleteNotebookCommandInput, DeleteNotebookCommandOutput } from "./commands/DeleteNotebookCommand";
@@ -233,6 +237,7 @@ export type ServiceInputTypes =
233237
| CreatePreparedStatementCommandInput
234238
| CreatePresignedNotebookUrlCommandInput
235239
| CreateWorkGroupCommandInput
240+
| DeleteCapacityReservationCommandInput
236241
| DeleteDataCatalogCommandInput
237242
| DeleteNamedQueryCommandInput
238243
| DeleteNotebookCommandInput
@@ -305,6 +310,7 @@ export type ServiceOutputTypes =
305310
| CreatePreparedStatementCommandOutput
306311
| CreatePresignedNotebookUrlCommandOutput
307312
| CreateWorkGroupCommandOutput
313+
| DeleteCapacityReservationCommandOutput
308314
| DeleteDataCatalogCommandOutput
309315
| DeleteNamedQueryCommandOutput
310316
| DeleteNotebookCommandOutput

clients/client-athena/src/commands/CancelCapacityReservationCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export interface CancelCapacityReservationCommandOutput extends CancelCapacityRe
3636

3737
/**
3838
* @public
39-
* <p>Cancels the capacity reservation with the specified name.</p>
39+
* <p>Cancels the capacity reservation with the specified name. Cancelled reservations remain in your account and will be deleted 45 days after cancellation. During the 45 days, you cannot re-purpose or reuse a reservation that has been cancelled, but you can refer to its tags and view it for historical reference. </p>
4040
* @example
4141
* Use a bare-bones client and the command you need to make an API call.
4242
* ```javascript
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
// smithy-typescript generated code
2+
import { EndpointParameterInstructions, getEndpointPlugin } from "@aws-sdk/middleware-endpoint";
3+
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
4+
import { Command as $Command } from "@aws-sdk/smithy-client";
5+
import {
6+
FinalizeHandlerArguments,
7+
Handler,
8+
HandlerExecutionContext,
9+
HttpHandlerOptions as __HttpHandlerOptions,
10+
MetadataBearer as __MetadataBearer,
11+
MiddlewareStack,
12+
} from "@aws-sdk/types";
13+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http";
14+
import { SerdeContext as __SerdeContext } from "@smithy/types";
15+
16+
import { AthenaClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../AthenaClient";
17+
import { DeleteCapacityReservationInput, DeleteCapacityReservationOutput } from "../models/models_0";
18+
import { de_DeleteCapacityReservationCommand, se_DeleteCapacityReservationCommand } from "../protocols/Aws_json1_1";
19+
20+
/**
21+
* @public
22+
*/
23+
export { __MetadataBearer, $Command };
24+
/**
25+
* @public
26+
*
27+
* The input for {@link DeleteCapacityReservationCommand}.
28+
*/
29+
export interface DeleteCapacityReservationCommandInput extends DeleteCapacityReservationInput {}
30+
/**
31+
* @public
32+
*
33+
* The output of {@link DeleteCapacityReservationCommand}.
34+
*/
35+
export interface DeleteCapacityReservationCommandOutput extends DeleteCapacityReservationOutput, __MetadataBearer {}
36+
37+
/**
38+
* @public
39+
* <p>Deletes a cancelled capacity reservation. A reservation must be cancelled before it can be deleted. A deleted reservation is immediately removed from your account and can no longer be referenced, including by its ARN. A deleted reservation cannot be called by <code>GetCapacityReservation</code>, and deleted reservations do not appear in the output of <code>ListCapacityReservations</code>.</p>
40+
* @example
41+
* Use a bare-bones client and the command you need to make an API call.
42+
* ```javascript
43+
* import { AthenaClient, DeleteCapacityReservationCommand } from "@aws-sdk/client-athena"; // ES Modules import
44+
* // const { AthenaClient, DeleteCapacityReservationCommand } = require("@aws-sdk/client-athena"); // CommonJS import
45+
* const client = new AthenaClient(config);
46+
* const input = { // DeleteCapacityReservationInput
47+
* Name: "STRING_VALUE", // required
48+
* };
49+
* const command = new DeleteCapacityReservationCommand(input);
50+
* const response = await client.send(command);
51+
* // {};
52+
*
53+
* ```
54+
*
55+
* @param DeleteCapacityReservationCommandInput - {@link DeleteCapacityReservationCommandInput}
56+
* @returns {@link DeleteCapacityReservationCommandOutput}
57+
* @see {@link DeleteCapacityReservationCommandInput} for command's `input` shape.
58+
* @see {@link DeleteCapacityReservationCommandOutput} for command's `response` shape.
59+
* @see {@link AthenaClientResolvedConfig | config} for AthenaClient's `config` shape.
60+
*
61+
* @throws {@link InternalServerException} (server fault)
62+
* <p>Indicates a platform issue, which may be due to a transient condition or
63+
* outage.</p>
64+
*
65+
* @throws {@link InvalidRequestException} (client fault)
66+
* <p>Indicates that something is wrong with the input to the request. For example, a
67+
* required parameter may be missing or out of range.</p>
68+
*
69+
* @throws {@link AthenaServiceException}
70+
* <p>Base exception class for all service exceptions from Athena service.</p>
71+
*
72+
*/
73+
export class DeleteCapacityReservationCommand extends $Command<
74+
DeleteCapacityReservationCommandInput,
75+
DeleteCapacityReservationCommandOutput,
76+
AthenaClientResolvedConfig
77+
> {
78+
// Start section: command_properties
79+
// End section: command_properties
80+
81+
public static getEndpointParameterInstructions(): EndpointParameterInstructions {
82+
return {
83+
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
84+
Endpoint: { type: "builtInParams", name: "endpoint" },
85+
Region: { type: "builtInParams", name: "region" },
86+
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
87+
};
88+
}
89+
90+
/**
91+
* @public
92+
*/
93+
constructor(readonly input: DeleteCapacityReservationCommandInput) {
94+
// Start section: command_constructor
95+
super();
96+
// End section: command_constructor
97+
}
98+
99+
/**
100+
* @internal
101+
*/
102+
resolveMiddleware(
103+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
104+
configuration: AthenaClientResolvedConfig,
105+
options?: __HttpHandlerOptions
106+
): Handler<DeleteCapacityReservationCommandInput, DeleteCapacityReservationCommandOutput> {
107+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
108+
this.middlewareStack.use(
109+
getEndpointPlugin(configuration, DeleteCapacityReservationCommand.getEndpointParameterInstructions())
110+
);
111+
112+
const stack = clientStack.concat(this.middlewareStack);
113+
114+
const { logger } = configuration;
115+
const clientName = "AthenaClient";
116+
const commandName = "DeleteCapacityReservationCommand";
117+
const handlerExecutionContext: HandlerExecutionContext = {
118+
logger,
119+
clientName,
120+
commandName,
121+
inputFilterSensitiveLog: (_: any) => _,
122+
outputFilterSensitiveLog: (_: any) => _,
123+
};
124+
const { requestHandler } = configuration;
125+
return stack.resolve(
126+
(request: FinalizeHandlerArguments<any>) =>
127+
requestHandler.handle(request.request as __HttpRequest, options || {}),
128+
handlerExecutionContext
129+
);
130+
}
131+
132+
/**
133+
* @internal
134+
*/
135+
private serialize(input: DeleteCapacityReservationCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
136+
return se_DeleteCapacityReservationCommand(input, context);
137+
}
138+
139+
/**
140+
* @internal
141+
*/
142+
private deserialize(
143+
output: __HttpResponse,
144+
context: __SerdeContext
145+
): Promise<DeleteCapacityReservationCommandOutput> {
146+
return de_DeleteCapacityReservationCommand(output, context);
147+
}
148+
149+
// Start section: command_body_extra
150+
// End section: command_body_extra
151+
}

clients/client-athena/src/commands/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export * from "./CreateNotebookCommand";
1010
export * from "./CreatePreparedStatementCommand";
1111
export * from "./CreatePresignedNotebookUrlCommand";
1212
export * from "./CreateWorkGroupCommand";
13+
export * from "./DeleteCapacityReservationCommand";
1314
export * from "./DeleteDataCatalogCommand";
1415
export * from "./DeleteNamedQueryCommand";
1516
export * from "./DeleteNotebookCommand";

clients/client-athena/src/models/models_0.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ export interface QueryExecution {
705705

706706
/**
707707
* <p>A list of values for the parameters in a query. The values are applied sequentially to
708-
* the parameters in the query in the order in which the parameters occur.</p>
708+
* the parameters in the query in the order in which the parameters occur. The list of parameters is not returned in the response.</p>
709709
*/
710710
ExecutionParameters?: string[];
711711

@@ -1293,6 +1293,21 @@ export interface CreateWorkGroupInput {
12931293
*/
12941294
export interface CreateWorkGroupOutput {}
12951295

1296+
/**
1297+
* @public
1298+
*/
1299+
export interface DeleteCapacityReservationInput {
1300+
/**
1301+
* <p>The name of the capacity reservation to delete.</p>
1302+
*/
1303+
Name: string | undefined;
1304+
}
1305+
1306+
/**
1307+
* @public
1308+
*/
1309+
export interface DeleteCapacityReservationOutput {}
1310+
12961311
/**
12971312
* @public
12981313
*/

clients/client-athena/src/protocols/Aws_json1_1.ts

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ import {
4545
CreatePresignedNotebookUrlCommandOutput,
4646
} from "../commands/CreatePresignedNotebookUrlCommand";
4747
import { CreateWorkGroupCommandInput, CreateWorkGroupCommandOutput } from "../commands/CreateWorkGroupCommand";
48+
import {
49+
DeleteCapacityReservationCommandInput,
50+
DeleteCapacityReservationCommandOutput,
51+
} from "../commands/DeleteCapacityReservationCommand";
4852
import { DeleteDataCatalogCommandInput, DeleteDataCatalogCommandOutput } from "../commands/DeleteDataCatalogCommand";
4953
import { DeleteNamedQueryCommandInput, DeleteNamedQueryCommandOutput } from "../commands/DeleteNamedQueryCommand";
5054
import { DeleteNotebookCommandInput, DeleteNotebookCommandOutput } from "../commands/DeleteNotebookCommand";
@@ -196,6 +200,7 @@ import {
196200
CreatePresignedNotebookUrlRequest,
197201
CreateWorkGroupInput,
198202
CustomerContentEncryptionConfiguration,
203+
DeleteCapacityReservationInput,
199204
DeleteDataCatalogInput,
200205
DeleteNamedQueryInput,
201206
DeleteNotebookInput,
@@ -449,6 +454,19 @@ export const se_CreateWorkGroupCommand = async (
449454
return buildHttpRpcRequest(context, headers, "/", undefined, body);
450455
};
451456

457+
/**
458+
* serializeAws_json1_1DeleteCapacityReservationCommand
459+
*/
460+
export const se_DeleteCapacityReservationCommand = async (
461+
input: DeleteCapacityReservationCommandInput,
462+
context: __SerdeContext
463+
): Promise<__HttpRequest> => {
464+
const headers: __HeaderBag = sharedHeaders("DeleteCapacityReservation");
465+
let body: any;
466+
body = JSON.stringify(_json(input));
467+
return buildHttpRpcRequest(context, headers, "/", undefined, body);
468+
};
469+
452470
/**
453471
* serializeAws_json1_1DeleteDataCatalogCommand
454472
*/
@@ -1722,6 +1740,55 @@ const de_CreateWorkGroupCommandError = async (
17221740
}
17231741
};
17241742

1743+
/**
1744+
* deserializeAws_json1_1DeleteCapacityReservationCommand
1745+
*/
1746+
export const de_DeleteCapacityReservationCommand = async (
1747+
output: __HttpResponse,
1748+
context: __SerdeContext
1749+
): Promise<DeleteCapacityReservationCommandOutput> => {
1750+
if (output.statusCode >= 300) {
1751+
return de_DeleteCapacityReservationCommandError(output, context);
1752+
}
1753+
const data: any = await parseBody(output.body, context);
1754+
let contents: any = {};
1755+
contents = _json(data);
1756+
const response: DeleteCapacityReservationCommandOutput = {
1757+
$metadata: deserializeMetadata(output),
1758+
...contents,
1759+
};
1760+
return response;
1761+
};
1762+
1763+
/**
1764+
* deserializeAws_json1_1DeleteCapacityReservationCommandError
1765+
*/
1766+
const de_DeleteCapacityReservationCommandError = async (
1767+
output: __HttpResponse,
1768+
context: __SerdeContext
1769+
): Promise<DeleteCapacityReservationCommandOutput> => {
1770+
const parsedOutput: any = {
1771+
...output,
1772+
body: await parseErrorBody(output.body, context),
1773+
};
1774+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
1775+
switch (errorCode) {
1776+
case "InternalServerException":
1777+
case "com.amazonaws.athena#InternalServerException":
1778+
throw await de_InternalServerExceptionRes(parsedOutput, context);
1779+
case "InvalidRequestException":
1780+
case "com.amazonaws.athena#InvalidRequestException":
1781+
throw await de_InvalidRequestExceptionRes(parsedOutput, context);
1782+
default:
1783+
const parsedBody = parsedOutput.body;
1784+
return throwDefaultError({
1785+
output,
1786+
parsedBody,
1787+
errorCode,
1788+
});
1789+
}
1790+
};
1791+
17251792
/**
17261793
* deserializeAws_json1_1DeleteDataCatalogCommand
17271794
*/
@@ -4708,6 +4775,8 @@ const se_CreateNamedQueryInput = (input: CreateNamedQueryInput, context: __Serde
47084775

47094776
// se_CustomerContentEncryptionConfiguration omitted.
47104777

4778+
// se_DeleteCapacityReservationInput omitted.
4779+
47114780
// se_DeleteDataCatalogInput omitted.
47124781

47134782
/**
@@ -5041,6 +5110,8 @@ const de_CapacityReservationsList = (output: any, context: __SerdeContext): Capa
50415110

50425111
// de_datumList omitted.
50435112

5113+
// de_DeleteCapacityReservationOutput omitted.
5114+
50445115
// de_DeleteDataCatalogOutput omitted.
50455116

50465117
// de_DeleteNamedQueryOutput omitted.

0 commit comments

Comments
 (0)