From 52a77f529a90406620037b7d3e02427582c39823 Mon Sep 17 00:00:00 2001 From: awstools Date: Thu, 30 Jun 2022 20:20:33 +0000 Subject: [PATCH] feat(client-athena): This feature introduces the API support for Athena's parameterized query and BatchGetPreparedStatement API. --- clients/client-athena/src/Athena.ts | 39 +++- clients/client-athena/src/AthenaClient.ts | 6 + .../BatchGetPreparedStatementCommand.ts | 99 ++++++++++ .../commands/ListPreparedStatementsCommand.ts | 2 +- clients/client-athena/src/commands/index.ts | 1 + clients/client-athena/src/models/models_0.ts | 180 ++++++++++++++---- .../src/protocols/Aws_json1_1.ts | 179 +++++++++++++++++ codegen/sdk-codegen/aws-models/athena.json | 142 +++++++++++++- 8 files changed, 605 insertions(+), 43 deletions(-) create mode 100644 clients/client-athena/src/commands/BatchGetPreparedStatementCommand.ts diff --git a/clients/client-athena/src/Athena.ts b/clients/client-athena/src/Athena.ts index c3faf75eb690..3cb12228fb92 100644 --- a/clients/client-athena/src/Athena.ts +++ b/clients/client-athena/src/Athena.ts @@ -7,6 +7,11 @@ import { BatchGetNamedQueryCommandInput, BatchGetNamedQueryCommandOutput, } from "./commands/BatchGetNamedQueryCommand"; +import { + BatchGetPreparedStatementCommand, + BatchGetPreparedStatementCommandInput, + BatchGetPreparedStatementCommandOutput, +} from "./commands/BatchGetPreparedStatementCommand"; import { BatchGetQueryExecutionCommand, BatchGetQueryExecutionCommandInput, @@ -227,6 +232,38 @@ export class Athena extends AthenaClient { } } + /** + *

Returns the details of a single prepared statement or a list of up to 256 prepared statements for the array of prepared statement names that you provide. Requires you to have access to the workgroup to which the prepared statements belong. If a prepared statement cannot be retrieved for the name specified, the statement is listed in UnprocessedPreparedStatementNames.

+ */ + public batchGetPreparedStatement( + args: BatchGetPreparedStatementCommandInput, + options?: __HttpHandlerOptions + ): Promise; + public batchGetPreparedStatement( + args: BatchGetPreparedStatementCommandInput, + cb: (err: any, data?: BatchGetPreparedStatementCommandOutput) => void + ): void; + public batchGetPreparedStatement( + args: BatchGetPreparedStatementCommandInput, + options: __HttpHandlerOptions, + cb: (err: any, data?: BatchGetPreparedStatementCommandOutput) => void + ): void; + public batchGetPreparedStatement( + args: BatchGetPreparedStatementCommandInput, + optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: BatchGetPreparedStatementCommandOutput) => void), + cb?: (err: any, data?: BatchGetPreparedStatementCommandOutput) => void + ): Promise | void { + const command = new BatchGetPreparedStatementCommand(args); + if (typeof optionsOrCb === "function") { + this.send(command, optionsOrCb); + } else if (typeof cb === "function") { + if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`); + this.send(command, optionsOrCb || {}, cb); + } else { + return this.send(command, optionsOrCb); + } + } + /** *

Returns the details of a single query execution or a list of up to 50 query * executions, which you provide as an array of query execution ID strings. Requires you to @@ -931,7 +968,7 @@ export class Athena extends AthenaClient { } /** - *

Lists the prepared statements in the specfied workgroup.

+ *

Lists the prepared statements in the specified workgroup.

*/ public listPreparedStatements( args: ListPreparedStatementsCommandInput, diff --git a/clients/client-athena/src/AthenaClient.ts b/clients/client-athena/src/AthenaClient.ts index 89f79eb1f6d9..00fe431ef2d1 100644 --- a/clients/client-athena/src/AthenaClient.ts +++ b/clients/client-athena/src/AthenaClient.ts @@ -54,6 +54,10 @@ import { } from "@aws-sdk/types"; import { BatchGetNamedQueryCommandInput, BatchGetNamedQueryCommandOutput } from "./commands/BatchGetNamedQueryCommand"; +import { + BatchGetPreparedStatementCommandInput, + BatchGetPreparedStatementCommandOutput, +} from "./commands/BatchGetPreparedStatementCommand"; import { BatchGetQueryExecutionCommandInput, BatchGetQueryExecutionCommandOutput, @@ -119,6 +123,7 @@ import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig"; export type ServiceInputTypes = | BatchGetNamedQueryCommandInput + | BatchGetPreparedStatementCommandInput | BatchGetQueryExecutionCommandInput | CreateDataCatalogCommandInput | CreateNamedQueryCommandInput @@ -156,6 +161,7 @@ export type ServiceInputTypes = export type ServiceOutputTypes = | BatchGetNamedQueryCommandOutput + | BatchGetPreparedStatementCommandOutput | BatchGetQueryExecutionCommandOutput | CreateDataCatalogCommandOutput | CreateNamedQueryCommandOutput diff --git a/clients/client-athena/src/commands/BatchGetPreparedStatementCommand.ts b/clients/client-athena/src/commands/BatchGetPreparedStatementCommand.ts new file mode 100644 index 000000000000..28affa169647 --- /dev/null +++ b/clients/client-athena/src/commands/BatchGetPreparedStatementCommand.ts @@ -0,0 +1,99 @@ +// smithy-typescript generated code +import { getSerdePlugin } from "@aws-sdk/middleware-serde"; +import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http"; +import { Command as $Command } from "@aws-sdk/smithy-client"; +import { + FinalizeHandlerArguments, + Handler, + HandlerExecutionContext, + HttpHandlerOptions as __HttpHandlerOptions, + MetadataBearer as __MetadataBearer, + MiddlewareStack, + SerdeContext as __SerdeContext, +} from "@aws-sdk/types"; + +import { AthenaClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../AthenaClient"; +import { BatchGetPreparedStatementInput, BatchGetPreparedStatementOutput } from "../models/models_0"; +import { + deserializeAws_json1_1BatchGetPreparedStatementCommand, + serializeAws_json1_1BatchGetPreparedStatementCommand, +} from "../protocols/Aws_json1_1"; + +export interface BatchGetPreparedStatementCommandInput extends BatchGetPreparedStatementInput {} +export interface BatchGetPreparedStatementCommandOutput extends BatchGetPreparedStatementOutput, __MetadataBearer {} + +/** + *

Returns the details of a single prepared statement or a list of up to 256 prepared statements for the array of prepared statement names that you provide. Requires you to have access to the workgroup to which the prepared statements belong. If a prepared statement cannot be retrieved for the name specified, the statement is listed in UnprocessedPreparedStatementNames.

+ * @example + * Use a bare-bones client and the command you need to make an API call. + * ```javascript + * import { AthenaClient, BatchGetPreparedStatementCommand } from "@aws-sdk/client-athena"; // ES Modules import + * // const { AthenaClient, BatchGetPreparedStatementCommand } = require("@aws-sdk/client-athena"); // CommonJS import + * const client = new AthenaClient(config); + * const command = new BatchGetPreparedStatementCommand(input); + * const response = await client.send(command); + * ``` + * + * @see {@link BatchGetPreparedStatementCommandInput} for command's `input` shape. + * @see {@link BatchGetPreparedStatementCommandOutput} for command's `response` shape. + * @see {@link AthenaClientResolvedConfig | config} for AthenaClient's `config` shape. + * + */ +export class BatchGetPreparedStatementCommand extends $Command< + BatchGetPreparedStatementCommandInput, + BatchGetPreparedStatementCommandOutput, + AthenaClientResolvedConfig +> { + // Start section: command_properties + // End section: command_properties + + constructor(readonly input: BatchGetPreparedStatementCommandInput) { + // Start section: command_constructor + super(); + // End section: command_constructor + } + + /** + * @internal + */ + resolveMiddleware( + clientStack: MiddlewareStack, + configuration: AthenaClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize)); + + const stack = clientStack.concat(this.middlewareStack); + + const { logger } = configuration; + const clientName = "AthenaClient"; + const commandName = "BatchGetPreparedStatementCommand"; + const handlerExecutionContext: HandlerExecutionContext = { + logger, + clientName, + commandName, + inputFilterSensitiveLog: BatchGetPreparedStatementInput.filterSensitiveLog, + outputFilterSensitiveLog: BatchGetPreparedStatementOutput.filterSensitiveLog, + }; + const { requestHandler } = configuration; + return stack.resolve( + (request: FinalizeHandlerArguments) => + requestHandler.handle(request.request as __HttpRequest, options || {}), + handlerExecutionContext + ); + } + + private serialize(input: BatchGetPreparedStatementCommandInput, context: __SerdeContext): Promise<__HttpRequest> { + return serializeAws_json1_1BatchGetPreparedStatementCommand(input, context); + } + + private deserialize( + output: __HttpResponse, + context: __SerdeContext + ): Promise { + return deserializeAws_json1_1BatchGetPreparedStatementCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/clients/client-athena/src/commands/ListPreparedStatementsCommand.ts b/clients/client-athena/src/commands/ListPreparedStatementsCommand.ts index e85a12a30b67..9157c9f0d220 100644 --- a/clients/client-athena/src/commands/ListPreparedStatementsCommand.ts +++ b/clients/client-athena/src/commands/ListPreparedStatementsCommand.ts @@ -23,7 +23,7 @@ export interface ListPreparedStatementsCommandInput extends ListPreparedStatemen export interface ListPreparedStatementsCommandOutput extends ListPreparedStatementsOutput, __MetadataBearer {} /** - *

Lists the prepared statements in the specfied workgroup.

+ *

Lists the prepared statements in the specified workgroup.

* @example * Use a bare-bones client and the command you need to make an API call. * ```javascript diff --git a/clients/client-athena/src/commands/index.ts b/clients/client-athena/src/commands/index.ts index e881ce443950..ff12196434bb 100644 --- a/clients/client-athena/src/commands/index.ts +++ b/clients/client-athena/src/commands/index.ts @@ -1,5 +1,6 @@ // smithy-typescript generated code export * from "./BatchGetNamedQueryCommand"; +export * from "./BatchGetPreparedStatementCommand"; export * from "./BatchGetQueryExecutionCommand"; export * from "./CreateDataCatalogCommand"; export * from "./CreateNamedQueryCommand"; diff --git a/clients/client-athena/src/models/models_0.ts b/clients/client-athena/src/models/models_0.ts index 53e7a171b5f7..fa7c766f314a 100644 --- a/clients/client-athena/src/models/models_0.ts +++ b/clients/client-athena/src/models/models_0.ts @@ -199,6 +199,134 @@ export class InvalidRequestException extends __BaseException { } } +export interface BatchGetPreparedStatementInput { + /** + *

A list of prepared statement names to return.

+ */ + PreparedStatementNames: string[] | undefined; + + /** + *

The name of the workgroup to which the prepared statements belong.

+ */ + WorkGroup: string | undefined; +} + +export namespace BatchGetPreparedStatementInput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: BatchGetPreparedStatementInput): any => ({ + ...obj, + }); +} + +/** + *

A prepared SQL statement for use with Athena.

+ */ +export interface PreparedStatement { + /** + *

The name of the prepared statement.

+ */ + StatementName?: string; + + /** + *

The query string for the prepared statement.

+ */ + QueryStatement?: string; + + /** + *

The name of the workgroup to which the prepared statement belongs.

+ */ + WorkGroupName?: string; + + /** + *

The description of the prepared statement.

+ */ + Description?: string; + + /** + *

The last modified time of the prepared statement.

+ */ + LastModifiedTime?: Date; +} + +export namespace PreparedStatement { + /** + * @internal + */ + export const filterSensitiveLog = (obj: PreparedStatement): any => ({ + ...obj, + }); +} + +/** + *

The name of a prepared statement that could not be returned.

+ */ +export interface UnprocessedPreparedStatementName { + /** + *

The name of a prepared statement that could not be returned due to an error.

+ */ + StatementName?: string; + + /** + *

The error code returned when the request for the prepared statement failed.

+ */ + ErrorCode?: string; + + /** + *

The error message containing the reason why the prepared statement could not be returned. + * The following error messages are possible:

+ *
    + *
  • + *

    + * INVALID_INPUT - The name of the prepared statement that was + * provided is not valid (for example, the name is too long).

    + *
  • + *
  • + *

    + * STATEMENT_NOT_FOUND - A prepared statement with the name provided + * could not be found.

    + *
  • + *
  • + *

    + * UNAUTHORIZED - The requester does not have permission to access + * the workgroup that contains the prepared statement.

    + *
  • + *
+ */ + ErrorMessage?: string; +} + +export namespace UnprocessedPreparedStatementName { + /** + * @internal + */ + export const filterSensitiveLog = (obj: UnprocessedPreparedStatementName): any => ({ + ...obj, + }); +} + +export interface BatchGetPreparedStatementOutput { + /** + *

The list of prepared statements returned.

+ */ + PreparedStatements?: PreparedStatement[]; + + /** + *

A list of one or more prepared statements that were requested but could not be returned.

+ */ + UnprocessedPreparedStatementNames?: UnprocessedPreparedStatementName[]; +} + +export namespace BatchGetPreparedStatementOutput { + /** + * @internal + */ + export const filterSensitiveLog = (obj: BatchGetPreparedStatementOutput): any => ({ + ...obj, + }); +} + export interface BatchGetQueryExecutionInput { /** *

An array of query execution IDs.

@@ -603,6 +731,11 @@ export interface QueryExecution { *

The engine version that executed the query.

*/ EngineVersion?: EngineVersion; + + /** + *

A list of values for the parameters in a query. The values are applied sequentially to the parameters in the query in the order in which the parameters occur.

+ */ + ExecutionParameters?: string[]; } export namespace QueryExecution { @@ -1143,6 +1276,9 @@ export class ResourceNotFoundException extends __BaseException { readonly name: "ResourceNotFoundException" = "ResourceNotFoundException"; readonly $fault: "client" = "client"; Message?: string; + /** + *

The name of the Amazon resource.

+ */ ResourceName?: string; /** * @internal @@ -1470,45 +1606,6 @@ export namespace GetPreparedStatementInput { }); } -/** - *

A prepared SQL statement for use with Athena.

- */ -export interface PreparedStatement { - /** - *

The name of the prepared statement.

- */ - StatementName?: string; - - /** - *

The query string for the prepared statement.

- */ - QueryStatement?: string; - - /** - *

The name of the workgroup to which the prepared statement belongs.

- */ - WorkGroupName?: string; - - /** - *

The description of the prepared statement.

- */ - Description?: string; - - /** - *

The last modified time of the prepared statement.

- */ - LastModifiedTime?: Date; -} - -export namespace PreparedStatement { - /** - * @internal - */ - export const filterSensitiveLog = (obj: PreparedStatement): any => ({ - ...obj, - }); -} - export interface GetPreparedStatementOutput { /** *

The name of the prepared statement that was retrieved.

@@ -2567,6 +2664,11 @@ export interface StartQueryExecutionInput { *

The name of the workgroup in which the query is being started.

*/ WorkGroup?: string; + + /** + *

A list of values for the parameters in a query. The values are applied sequentially to the parameters in the query in the order in which the parameters occur.

+ */ + ExecutionParameters?: string[]; } export namespace StartQueryExecutionInput { diff --git a/clients/client-athena/src/protocols/Aws_json1_1.ts b/clients/client-athena/src/protocols/Aws_json1_1.ts index d0fbdc4fdd02..68624b8ed15a 100644 --- a/clients/client-athena/src/protocols/Aws_json1_1.ts +++ b/clients/client-athena/src/protocols/Aws_json1_1.ts @@ -19,6 +19,10 @@ import { import { v4 as generateIdempotencyToken } from "uuid"; import { BatchGetNamedQueryCommandInput, BatchGetNamedQueryCommandOutput } from "../commands/BatchGetNamedQueryCommand"; +import { + BatchGetPreparedStatementCommandInput, + BatchGetPreparedStatementCommandOutput, +} from "../commands/BatchGetPreparedStatementCommand"; import { BatchGetQueryExecutionCommandInput, BatchGetQueryExecutionCommandOutput, @@ -86,6 +90,8 @@ import { AthenaError, BatchGetNamedQueryInput, BatchGetNamedQueryOutput, + BatchGetPreparedStatementInput, + BatchGetPreparedStatementOutput, BatchGetQueryExecutionInput, BatchGetQueryExecutionOutput, Column, @@ -172,6 +178,7 @@ import { TagResourceOutput, TooManyRequestsException, UnprocessedNamedQueryId, + UnprocessedPreparedStatementName, UnprocessedQueryExecutionId, UntagResourceInput, UntagResourceOutput, @@ -202,6 +209,19 @@ export const serializeAws_json1_1BatchGetNamedQueryCommand = async ( return buildHttpRpcRequest(context, headers, "/", undefined, body); }; +export const serializeAws_json1_1BatchGetPreparedStatementCommand = async ( + input: BatchGetPreparedStatementCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = { + "content-type": "application/x-amz-json-1.1", + "x-amz-target": "AmazonAthena.BatchGetPreparedStatement", + }; + let body: any; + body = JSON.stringify(serializeAws_json1_1BatchGetPreparedStatementInput(input, context)); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + export const serializeAws_json1_1BatchGetQueryExecutionCommand = async ( input: BatchGetQueryExecutionCommandInput, context: __SerdeContext @@ -691,6 +711,53 @@ const deserializeAws_json1_1BatchGetNamedQueryCommandError = async ( } }; +export const deserializeAws_json1_1BatchGetPreparedStatementCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return deserializeAws_json1_1BatchGetPreparedStatementCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = deserializeAws_json1_1BatchGetPreparedStatementOutput(data, context); + const response: BatchGetPreparedStatementCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return Promise.resolve(response); +}; + +const deserializeAws_json1_1BatchGetPreparedStatementCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseBody(output.body, context), + }; + let response: __BaseException; + const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + case "InternalServerException": + case "com.amazonaws.athena#InternalServerException": + throw await deserializeAws_json1_1InternalServerExceptionResponse(parsedOutput, context); + case "InvalidRequestException": + case "com.amazonaws.athena#InvalidRequestException": + throw await deserializeAws_json1_1InvalidRequestExceptionResponse(parsedOutput, context); + default: + const parsedBody = parsedOutput.body; + const $metadata = deserializeMetadata(output); + const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined; + response = new __BaseException({ + name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError", + $fault: "client", + $metadata, + }); + throw __decorateServiceException(response, parsedBody); + } +}; + export const deserializeAws_json1_1BatchGetQueryExecutionCommand = async ( output: __HttpResponse, context: __SerdeContext @@ -2402,6 +2469,19 @@ const serializeAws_json1_1BatchGetNamedQueryInput = (input: BatchGetNamedQueryIn }; }; +const serializeAws_json1_1BatchGetPreparedStatementInput = ( + input: BatchGetPreparedStatementInput, + context: __SerdeContext +): any => { + return { + ...(input.PreparedStatementNames !== undefined && + input.PreparedStatementNames !== null && { + PreparedStatementNames: serializeAws_json1_1PreparedStatementNameList(input.PreparedStatementNames, context), + }), + ...(input.WorkGroup !== undefined && input.WorkGroup !== null && { WorkGroup: input.WorkGroup }), + }; +}; + const serializeAws_json1_1BatchGetQueryExecutionInput = ( input: BatchGetQueryExecutionInput, context: __SerdeContext @@ -2508,6 +2588,17 @@ const serializeAws_json1_1EngineVersion = (input: EngineVersion, context: __Serd }; }; +const serializeAws_json1_1ExecutionParameters = (input: string[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + return entry; + }); +}; + const serializeAws_json1_1GetDatabaseInput = (input: GetDatabaseInput, context: __SerdeContext): any => { return { ...(input.CatalogName !== undefined && input.CatalogName !== null && { CatalogName: input.CatalogName }), @@ -2670,6 +2761,17 @@ const serializeAws_json1_1ParametersMap = (input: Record, contex }, {}); }; +const serializeAws_json1_1PreparedStatementNameList = (input: string[], context: __SerdeContext): any => { + return input + .filter((e: any) => e != null) + .map((entry) => { + if (entry === null) { + return null as any; + } + return entry; + }); +}; + const serializeAws_json1_1QueryExecutionContext = (input: QueryExecutionContext, context: __SerdeContext): any => { return { ...(input.Catalog !== undefined && input.Catalog !== null && { Catalog: input.Catalog }), @@ -2741,6 +2843,10 @@ const serializeAws_json1_1StartQueryExecutionInput = ( ): any => { return { ClientRequestToken: input.ClientRequestToken ?? generateIdempotencyToken(), + ...(input.ExecutionParameters !== undefined && + input.ExecutionParameters !== null && { + ExecutionParameters: serializeAws_json1_1ExecutionParameters(input.ExecutionParameters, context), + }), ...(input.QueryExecutionContext !== undefined && input.QueryExecutionContext !== null && { QueryExecutionContext: serializeAws_json1_1QueryExecutionContext(input.QueryExecutionContext, context), @@ -2939,6 +3045,22 @@ const deserializeAws_json1_1BatchGetNamedQueryOutput = ( } as any; }; +const deserializeAws_json1_1BatchGetPreparedStatementOutput = ( + output: any, + context: __SerdeContext +): BatchGetPreparedStatementOutput => { + return { + PreparedStatements: + output.PreparedStatements !== undefined && output.PreparedStatements !== null + ? deserializeAws_json1_1PreparedStatementDetailsList(output.PreparedStatements, context) + : undefined, + UnprocessedPreparedStatementNames: + output.UnprocessedPreparedStatementNames !== undefined && output.UnprocessedPreparedStatementNames !== null + ? deserializeAws_json1_1UnprocessedPreparedStatementNameList(output.UnprocessedPreparedStatementNames, context) + : undefined, + } as any; +}; + const deserializeAws_json1_1BatchGetQueryExecutionOutput = ( output: any, context: __SerdeContext @@ -3149,6 +3271,18 @@ const deserializeAws_json1_1EngineVersionsList = (output: any, context: __SerdeC return retVal; }; +const deserializeAws_json1_1ExecutionParameters = (output: any, context: __SerdeContext): string[] => { + const retVal = (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return __expectString(entry) as any; + }); + return retVal; +}; + const deserializeAws_json1_1GetDatabaseOutput = (output: any, context: __SerdeContext): GetDatabaseOutput => { return { Database: @@ -3419,6 +3553,21 @@ const deserializeAws_json1_1PreparedStatement = (output: any, context: __SerdeCo } as any; }; +const deserializeAws_json1_1PreparedStatementDetailsList = ( + output: any, + context: __SerdeContext +): PreparedStatement[] => { + const retVal = (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return deserializeAws_json1_1PreparedStatement(entry, context); + }); + return retVal; +}; + const deserializeAws_json1_1PreparedStatementsList = ( output: any, context: __SerdeContext @@ -3453,6 +3602,10 @@ const deserializeAws_json1_1QueryExecution = (output: any, context: __SerdeConte output.EngineVersion !== undefined && output.EngineVersion !== null ? deserializeAws_json1_1EngineVersion(output.EngineVersion, context) : undefined, + ExecutionParameters: + output.ExecutionParameters !== undefined && output.ExecutionParameters !== null + ? deserializeAws_json1_1ExecutionParameters(output.ExecutionParameters, context) + : undefined, Query: __expectString(output.Query), QueryExecutionContext: output.QueryExecutionContext !== undefined && output.QueryExecutionContext !== null @@ -3723,6 +3876,32 @@ const deserializeAws_json1_1UnprocessedNamedQueryIdList = ( return retVal; }; +const deserializeAws_json1_1UnprocessedPreparedStatementName = ( + output: any, + context: __SerdeContext +): UnprocessedPreparedStatementName => { + return { + ErrorCode: __expectString(output.ErrorCode), + ErrorMessage: __expectString(output.ErrorMessage), + StatementName: __expectString(output.StatementName), + } as any; +}; + +const deserializeAws_json1_1UnprocessedPreparedStatementNameList = ( + output: any, + context: __SerdeContext +): UnprocessedPreparedStatementName[] => { + const retVal = (output || []) + .filter((e: any) => e != null) + .map((entry: any) => { + if (entry === null) { + return null as any; + } + return deserializeAws_json1_1UnprocessedPreparedStatementName(entry, context); + }); + return retVal; +}; + const deserializeAws_json1_1UnprocessedQueryExecutionId = ( output: any, context: __SerdeContext diff --git a/codegen/sdk-codegen/aws-models/athena.json b/codegen/sdk-codegen/aws-models/athena.json index e8dd1fbc0475..5091999acfea 100644 --- a/codegen/sdk-codegen/aws-models/athena.json +++ b/codegen/sdk-codegen/aws-models/athena.json @@ -66,6 +66,9 @@ { "target": "com.amazonaws.athena#BatchGetNamedQuery" }, + { + "target": "com.amazonaws.athena#BatchGetPreparedStatement" + }, { "target": "com.amazonaws.athena#BatchGetQueryExecution" }, @@ -260,6 +263,62 @@ } } }, + "com.amazonaws.athena#BatchGetPreparedStatement": { + "type": "operation", + "input": { + "target": "com.amazonaws.athena#BatchGetPreparedStatementInput" + }, + "output": { + "target": "com.amazonaws.athena#BatchGetPreparedStatementOutput" + }, + "errors": [ + { + "target": "com.amazonaws.athena#InternalServerException" + }, + { + "target": "com.amazonaws.athena#InvalidRequestException" + } + ], + "traits": { + "smithy.api#documentation": "

Returns the details of a single prepared statement or a list of up to 256 prepared statements for the array of prepared statement names that you provide. Requires you to have access to the workgroup to which the prepared statements belong. If a prepared statement cannot be retrieved for the name specified, the statement is listed in UnprocessedPreparedStatementNames.

" + } + }, + "com.amazonaws.athena#BatchGetPreparedStatementInput": { + "type": "structure", + "members": { + "PreparedStatementNames": { + "target": "com.amazonaws.athena#PreparedStatementNameList", + "traits": { + "smithy.api#documentation": "

A list of prepared statement names to return.

", + "smithy.api#required": {} + } + }, + "WorkGroup": { + "target": "com.amazonaws.athena#WorkGroupName", + "traits": { + "smithy.api#documentation": "

The name of the workgroup to which the prepared statements belong.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.athena#BatchGetPreparedStatementOutput": { + "type": "structure", + "members": { + "PreparedStatements": { + "target": "com.amazonaws.athena#PreparedStatementDetailsList", + "traits": { + "smithy.api#documentation": "

The list of prepared statements returned.

" + } + }, + "UnprocessedPreparedStatementNames": { + "target": "com.amazonaws.athena#UnprocessedPreparedStatementNameList", + "traits": { + "smithy.api#documentation": "

A list of one or more prepared statements that were requested but could not be returned.

" + } + } + } + }, "com.amazonaws.athena#BatchGetQueryExecution": { "type": "operation", "input": { @@ -1138,6 +1197,26 @@ } } }, + "com.amazonaws.athena#ExecutionParameter": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 1024 + } + } + }, + "com.amazonaws.athena#ExecutionParameters": { + "type": "list", + "member": { + "target": "com.amazonaws.athena#ExecutionParameter" + }, + "traits": { + "smithy.api#length": { + "min": 1 + } + } + }, "com.amazonaws.athena#ExpressionString": { "type": "string", "traits": { @@ -1872,7 +1951,7 @@ } ], "traits": { - "smithy.api#documentation": "

Lists the prepared statements in the specfied workgroup.

", + "smithy.api#documentation": "

Lists the prepared statements in the specified workgroup.

", "smithy.api#paginated": { "inputToken": "NextToken", "outputToken": "NextToken", @@ -2457,6 +2536,18 @@ "smithy.api#documentation": "

A prepared SQL statement for use with Athena.

" } }, + "com.amazonaws.athena#PreparedStatementDetailsList": { + "type": "list", + "member": { + "target": "com.amazonaws.athena#PreparedStatement" + } + }, + "com.amazonaws.athena#PreparedStatementNameList": { + "type": "list", + "member": { + "target": "com.amazonaws.athena#StatementName" + } + }, "com.amazonaws.athena#PreparedStatementSummary": { "type": "structure", "members": { @@ -2545,6 +2636,12 @@ "traits": { "smithy.api#documentation": "

The engine version that executed the query.

" } + }, + "ExecutionParameters": { + "target": "com.amazonaws.athena#ExecutionParameters", + "traits": { + "smithy.api#documentation": "

A list of values for the parameters in a query. The values are applied sequentially to the parameters in the query in the order in which the parameters occur.

" + } } }, "traits": { @@ -2723,7 +2820,10 @@ "target": "com.amazonaws.athena#ErrorMessage" }, "ResourceName": { - "target": "com.amazonaws.athena#AmazonResourceName" + "target": "com.amazonaws.athena#AmazonResourceName", + "traits": { + "smithy.api#documentation": "

The name of the Amazon resource.

" + } } }, "traits": { @@ -2942,6 +3042,12 @@ "traits": { "smithy.api#documentation": "

The name of the workgroup in which the query is being started.

" } + }, + "ExecutionParameters": { + "target": "com.amazonaws.athena#ExecutionParameters", + "traits": { + "smithy.api#documentation": "

A list of values for the parameters in a query. The values are applied sequentially to the parameters in the query in the order in which the parameters occur.

" + } } } }, @@ -3269,6 +3375,38 @@ "target": "com.amazonaws.athena#UnprocessedNamedQueryId" } }, + "com.amazonaws.athena#UnprocessedPreparedStatementName": { + "type": "structure", + "members": { + "StatementName": { + "target": "com.amazonaws.athena#StatementName", + "traits": { + "smithy.api#documentation": "

The name of a prepared statement that could not be returned due to an error.

" + } + }, + "ErrorCode": { + "target": "com.amazonaws.athena#ErrorCode", + "traits": { + "smithy.api#documentation": "

The error code returned when the request for the prepared statement failed.

" + } + }, + "ErrorMessage": { + "target": "com.amazonaws.athena#ErrorMessage", + "traits": { + "smithy.api#documentation": "

The error message containing the reason why the prepared statement could not be returned.\n The following error messages are possible:

\n
    \n
  • \n

    \n INVALID_INPUT - The name of the prepared statement that was\n provided is not valid (for example, the name is too long).

    \n
  • \n
  • \n

    \n STATEMENT_NOT_FOUND - A prepared statement with the name provided\n could not be found.

    \n
  • \n
  • \n

    \n UNAUTHORIZED - The requester does not have permission to access\n the workgroup that contains the prepared statement.

    \n
  • \n
" + } + } + }, + "traits": { + "smithy.api#documentation": "

The name of a prepared statement that could not be returned.

" + } + }, + "com.amazonaws.athena#UnprocessedPreparedStatementNameList": { + "type": "list", + "member": { + "target": "com.amazonaws.athena#UnprocessedPreparedStatementName" + } + }, "com.amazonaws.athena#UnprocessedQueryExecutionId": { "type": "structure", "members": {