|
| 1 | +// smithy-typescript generated code |
| 2 | +import { getEndpointPlugin } from "@smithy/middleware-endpoint"; |
| 3 | +import { getSerdePlugin } from "@smithy/middleware-serde"; |
| 4 | +import { Command as $Command } from "@smithy/smithy-client"; |
| 5 | +import { MetadataBearer as __MetadataBearer } from "@smithy/types"; |
| 6 | + |
| 7 | +import { |
| 8 | + BedrockAgentRuntimeClientResolvedConfig, |
| 9 | + ServiceInputTypes, |
| 10 | + ServiceOutputTypes, |
| 11 | +} from "../BedrockAgentRuntimeClient"; |
| 12 | +import { commonParams } from "../endpoint/EndpointParameters"; |
| 13 | +import { |
| 14 | + GenerateQueryRequest, |
| 15 | + GenerateQueryRequestFilterSensitiveLog, |
| 16 | + GenerateQueryResponse, |
| 17 | + GenerateQueryResponseFilterSensitiveLog, |
| 18 | +} from "../models/models_0"; |
| 19 | +import { de_GenerateQueryCommand, se_GenerateQueryCommand } from "../protocols/Aws_restJson1"; |
| 20 | + |
| 21 | +/** |
| 22 | + * @public |
| 23 | + */ |
| 24 | +export type { __MetadataBearer }; |
| 25 | +export { $Command }; |
| 26 | +/** |
| 27 | + * @public |
| 28 | + * |
| 29 | + * The input for {@link GenerateQueryCommand}. |
| 30 | + */ |
| 31 | +export interface GenerateQueryCommandInput extends GenerateQueryRequest {} |
| 32 | +/** |
| 33 | + * @public |
| 34 | + * |
| 35 | + * The output of {@link GenerateQueryCommand}. |
| 36 | + */ |
| 37 | +export interface GenerateQueryCommandOutput extends GenerateQueryResponse, __MetadataBearer {} |
| 38 | + |
| 39 | +/** |
| 40 | + * <p>Generates an SQL query from a natural language query. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-generate-query.html">Generate a query for structured data</a> in the Amazon Bedrock User Guide.</p> |
| 41 | + * @example |
| 42 | + * Use a bare-bones client and the command you need to make an API call. |
| 43 | + * ```javascript |
| 44 | + * import { BedrockAgentRuntimeClient, GenerateQueryCommand } from "@aws-sdk/client-bedrock-agent-runtime"; // ES Modules import |
| 45 | + * // const { BedrockAgentRuntimeClient, GenerateQueryCommand } = require("@aws-sdk/client-bedrock-agent-runtime"); // CommonJS import |
| 46 | + * const client = new BedrockAgentRuntimeClient(config); |
| 47 | + * const input = { // GenerateQueryRequest |
| 48 | + * queryGenerationInput: { // QueryGenerationInput |
| 49 | + * type: "TEXT", // required |
| 50 | + * text: "STRING_VALUE", // required |
| 51 | + * }, |
| 52 | + * transformationConfiguration: { // TransformationConfiguration |
| 53 | + * mode: "TEXT_TO_SQL", // required |
| 54 | + * textToSqlConfiguration: { // TextToSqlConfiguration |
| 55 | + * type: "KNOWLEDGE_BASE", // required |
| 56 | + * knowledgeBaseConfiguration: { // TextToSqlKnowledgeBaseConfiguration |
| 57 | + * knowledgeBaseArn: "STRING_VALUE", // required |
| 58 | + * }, |
| 59 | + * }, |
| 60 | + * }, |
| 61 | + * }; |
| 62 | + * const command = new GenerateQueryCommand(input); |
| 63 | + * const response = await client.send(command); |
| 64 | + * // { // GenerateQueryResponse |
| 65 | + * // queries: [ // GeneratedQueries |
| 66 | + * // { // GeneratedQuery |
| 67 | + * // type: "REDSHIFT_SQL", |
| 68 | + * // sql: "STRING_VALUE", |
| 69 | + * // }, |
| 70 | + * // ], |
| 71 | + * // }; |
| 72 | + * |
| 73 | + * ``` |
| 74 | + * |
| 75 | + * @param GenerateQueryCommandInput - {@link GenerateQueryCommandInput} |
| 76 | + * @returns {@link GenerateQueryCommandOutput} |
| 77 | + * @see {@link GenerateQueryCommandInput} for command's `input` shape. |
| 78 | + * @see {@link GenerateQueryCommandOutput} for command's `response` shape. |
| 79 | + * @see {@link BedrockAgentRuntimeClientResolvedConfig | config} for BedrockAgentRuntimeClient's `config` shape. |
| 80 | + * |
| 81 | + * @throws {@link AccessDeniedException} (client fault) |
| 82 | + * <p>The request is denied because of missing access permissions. Check your permissions and retry your request.</p> |
| 83 | + * |
| 84 | + * @throws {@link BadGatewayException} (server fault) |
| 85 | + * <p>There was an issue with a dependency due to a server issue. Retry your request.</p> |
| 86 | + * |
| 87 | + * @throws {@link ConflictException} (client fault) |
| 88 | + * <p>There was a conflict performing an operation. Resolve the conflict and retry your request.</p> |
| 89 | + * |
| 90 | + * @throws {@link DependencyFailedException} (client fault) |
| 91 | + * <p>There was an issue with a dependency. Check the resource configurations and retry the request.</p> |
| 92 | + * |
| 93 | + * @throws {@link InternalServerException} (server fault) |
| 94 | + * <p>An internal server error occurred. Retry your request.</p> |
| 95 | + * |
| 96 | + * @throws {@link ResourceNotFoundException} (client fault) |
| 97 | + * <p>The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.</p> |
| 98 | + * |
| 99 | + * @throws {@link ServiceQuotaExceededException} (client fault) |
| 100 | + * <p>The number of requests exceeds the service quota. Resubmit your request later.</p> |
| 101 | + * |
| 102 | + * @throws {@link ThrottlingException} (client fault) |
| 103 | + * <p>The number of requests exceeds the limit. Resubmit your request later.</p> |
| 104 | + * |
| 105 | + * @throws {@link ValidationException} (client fault) |
| 106 | + * <p>Input validation failed. Check your request parameters and retry the request.</p> |
| 107 | + * |
| 108 | + * @throws {@link BedrockAgentRuntimeServiceException} |
| 109 | + * <p>Base exception class for all service exceptions from BedrockAgentRuntime service.</p> |
| 110 | + * |
| 111 | + * @public |
| 112 | + */ |
| 113 | +export class GenerateQueryCommand extends $Command |
| 114 | + .classBuilder< |
| 115 | + GenerateQueryCommandInput, |
| 116 | + GenerateQueryCommandOutput, |
| 117 | + BedrockAgentRuntimeClientResolvedConfig, |
| 118 | + ServiceInputTypes, |
| 119 | + ServiceOutputTypes |
| 120 | + >() |
| 121 | + .ep(commonParams) |
| 122 | + .m(function (this: any, Command: any, cs: any, config: BedrockAgentRuntimeClientResolvedConfig, o: any) { |
| 123 | + return [ |
| 124 | + getSerdePlugin(config, this.serialize, this.deserialize), |
| 125 | + getEndpointPlugin(config, Command.getEndpointParameterInstructions()), |
| 126 | + ]; |
| 127 | + }) |
| 128 | + .s("AmazonBedrockAgentRunTimeService", "GenerateQuery", {}) |
| 129 | + .n("BedrockAgentRuntimeClient", "GenerateQueryCommand") |
| 130 | + .f(GenerateQueryRequestFilterSensitiveLog, GenerateQueryResponseFilterSensitiveLog) |
| 131 | + .ser(se_GenerateQueryCommand) |
| 132 | + .de(de_GenerateQueryCommand) |
| 133 | + .build() { |
| 134 | + /** @internal type navigation helper, not in runtime. */ |
| 135 | + protected declare static __types: { |
| 136 | + api: { |
| 137 | + input: GenerateQueryRequest; |
| 138 | + output: GenerateQueryResponse; |
| 139 | + }; |
| 140 | + sdk: { |
| 141 | + input: GenerateQueryCommandInput; |
| 142 | + output: GenerateQueryCommandOutput; |
| 143 | + }; |
| 144 | + }; |
| 145 | +} |
0 commit comments