|
| 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 { CloudTrailClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../CloudTrailClient"; |
| 8 | +import { commonParams } from "../endpoint/EndpointParameters"; |
| 9 | +import { GenerateQueryRequest, GenerateQueryResponse } from "../models/models_0"; |
| 10 | +import { de_GenerateQueryCommand, se_GenerateQueryCommand } from "../protocols/Aws_json1_1"; |
| 11 | + |
| 12 | +/** |
| 13 | + * @public |
| 14 | + */ |
| 15 | +export type { __MetadataBearer }; |
| 16 | +export { $Command }; |
| 17 | +/** |
| 18 | + * @public |
| 19 | + * |
| 20 | + * The input for {@link GenerateQueryCommand}. |
| 21 | + */ |
| 22 | +export interface GenerateQueryCommandInput extends GenerateQueryRequest {} |
| 23 | +/** |
| 24 | + * @public |
| 25 | + * |
| 26 | + * The output of {@link GenerateQueryCommand}. |
| 27 | + */ |
| 28 | +export interface GenerateQueryCommandOutput extends GenerateQueryResponse, __MetadataBearer {} |
| 29 | + |
| 30 | +/** |
| 31 | + * <p> |
| 32 | + * Generates a query from a natural language prompt. This operation uses generative artificial intelligence |
| 33 | + * (generative AI) to produce a ready-to-use SQL query from the prompt. |
| 34 | + * </p> |
| 35 | + * <p>The prompt can be a question or a statement about the event data |
| 36 | + * in your event data store. For example, you can enter prompts like "What are my |
| 37 | + * top errors in the past month?" and “Give me a list of users that used SNS.”</p> |
| 38 | + * <p>The prompt must be in English. For information about limitations, permissions, and supported Regions, see |
| 39 | + * <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/lake-query-generator.html">Create CloudTrail Lake queries from natural language prompts</a> |
| 40 | + * in the <i>CloudTrail </i> user guide.</p> |
| 41 | + * <note> |
| 42 | + * <p>Do not include any personally identifying, confidential, or sensitive information |
| 43 | + * in your prompts.</p> |
| 44 | + * <p>This feature uses generative AI large language models (LLMs); we recommend double-checking the |
| 45 | + * LLM response.</p> |
| 46 | + * </note> |
| 47 | + * @example |
| 48 | + * Use a bare-bones client and the command you need to make an API call. |
| 49 | + * ```javascript |
| 50 | + * import { CloudTrailClient, GenerateQueryCommand } from "@aws-sdk/client-cloudtrail"; // ES Modules import |
| 51 | + * // const { CloudTrailClient, GenerateQueryCommand } = require("@aws-sdk/client-cloudtrail"); // CommonJS import |
| 52 | + * const client = new CloudTrailClient(config); |
| 53 | + * const input = { // GenerateQueryRequest |
| 54 | + * EventDataStores: [ // EventDataStoreList // required |
| 55 | + * "STRING_VALUE", |
| 56 | + * ], |
| 57 | + * Prompt: "STRING_VALUE", // required |
| 58 | + * }; |
| 59 | + * const command = new GenerateQueryCommand(input); |
| 60 | + * const response = await client.send(command); |
| 61 | + * // { // GenerateQueryResponse |
| 62 | + * // QueryStatement: "STRING_VALUE", |
| 63 | + * // QueryAlias: "STRING_VALUE", |
| 64 | + * // }; |
| 65 | + * |
| 66 | + * ``` |
| 67 | + * |
| 68 | + * @param GenerateQueryCommandInput - {@link GenerateQueryCommandInput} |
| 69 | + * @returns {@link GenerateQueryCommandOutput} |
| 70 | + * @see {@link GenerateQueryCommandInput} for command's `input` shape. |
| 71 | + * @see {@link GenerateQueryCommandOutput} for command's `response` shape. |
| 72 | + * @see {@link CloudTrailClientResolvedConfig | config} for CloudTrailClient's `config` shape. |
| 73 | + * |
| 74 | + * @throws {@link EventDataStoreARNInvalidException} (client fault) |
| 75 | + * <p>The specified event data store ARN is not valid or does not map to an event data store |
| 76 | + * in your account.</p> |
| 77 | + * |
| 78 | + * @throws {@link EventDataStoreNotFoundException} (client fault) |
| 79 | + * <p>The specified event data store was not found.</p> |
| 80 | + * |
| 81 | + * @throws {@link GenerateResponseException} (client fault) |
| 82 | + * <p> |
| 83 | + * This exception is thrown when a valid query could not be generated for the provided prompt. |
| 84 | + * </p> |
| 85 | + * |
| 86 | + * @throws {@link InactiveEventDataStoreException} (client fault) |
| 87 | + * <p>The event data store is inactive.</p> |
| 88 | + * |
| 89 | + * @throws {@link InvalidParameterException} (client fault) |
| 90 | + * <p>The request includes a parameter that is not valid.</p> |
| 91 | + * |
| 92 | + * @throws {@link NoManagementAccountSLRExistsException} (client fault) |
| 93 | + * <p> This exception is thrown when the management account does not have a service-linked |
| 94 | + * role. </p> |
| 95 | + * |
| 96 | + * @throws {@link OperationNotPermittedException} (client fault) |
| 97 | + * <p>This exception is thrown when the requested operation is not permitted.</p> |
| 98 | + * |
| 99 | + * @throws {@link UnsupportedOperationException} (client fault) |
| 100 | + * <p>This exception is thrown when the requested operation is not supported.</p> |
| 101 | + * |
| 102 | + * @throws {@link CloudTrailServiceException} |
| 103 | + * <p>Base exception class for all service exceptions from CloudTrail service.</p> |
| 104 | + * |
| 105 | + * @public |
| 106 | + */ |
| 107 | +export class GenerateQueryCommand extends $Command |
| 108 | + .classBuilder< |
| 109 | + GenerateQueryCommandInput, |
| 110 | + GenerateQueryCommandOutput, |
| 111 | + CloudTrailClientResolvedConfig, |
| 112 | + ServiceInputTypes, |
| 113 | + ServiceOutputTypes |
| 114 | + >() |
| 115 | + .ep(commonParams) |
| 116 | + .m(function (this: any, Command: any, cs: any, config: CloudTrailClientResolvedConfig, o: any) { |
| 117 | + return [ |
| 118 | + getSerdePlugin(config, this.serialize, this.deserialize), |
| 119 | + getEndpointPlugin(config, Command.getEndpointParameterInstructions()), |
| 120 | + ]; |
| 121 | + }) |
| 122 | + .s("CloudTrail_20131101", "GenerateQuery", {}) |
| 123 | + .n("CloudTrailClient", "GenerateQueryCommand") |
| 124 | + .f(void 0, void 0) |
| 125 | + .ser(se_GenerateQueryCommand) |
| 126 | + .de(de_GenerateQueryCommand) |
| 127 | + .build() { |
| 128 | + /** @internal type navigation helper, not in runtime. */ |
| 129 | + protected declare static __types: { |
| 130 | + api: { |
| 131 | + input: GenerateQueryRequest; |
| 132 | + output: GenerateQueryResponse; |
| 133 | + }; |
| 134 | + sdk: { |
| 135 | + input: GenerateQueryCommandInput; |
| 136 | + output: GenerateQueryCommandOutput; |
| 137 | + }; |
| 138 | + }; |
| 139 | +} |
0 commit comments