aws-sdk-cloudtrail 1.104.0

AWS SDK for AWS CloudTrail
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::generate_query::_generate_query_input::GenerateQueryInputBuilder;

pub use crate::operation::generate_query::_generate_query_output::GenerateQueryOutputBuilder;

impl crate::operation::generate_query::builders::GenerateQueryInputBuilder {
    /// Sends a request with this input using the given client.
    pub async fn send_with(
        self,
        client: &crate::Client,
    ) -> ::std::result::Result<
        crate::operation::generate_query::GenerateQueryOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::generate_query::GenerateQueryError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let mut fluent_builder = client.generate_query();
        fluent_builder.inner = self;
        fluent_builder.send().await
    }
}
/// Fluent builder constructing a request to `GenerateQuery`.
///
/// <p>Generates a query from a natural language prompt. This operation uses generative artificial intelligence (generative AI) to produce a ready-to-use SQL query from the prompt.</p>
/// <p>The prompt can be a question or a statement about the event data in your event data store. For example, you can enter prompts like "What are my top errors in the past month?" and “Give me a list of users that used SNS.”</p>
/// <p>The prompt must be in English. For information about limitations, permissions, and supported Regions, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/lake-query-generator.html">Create CloudTrail Lake queries from natural language prompts</a> in the <i>CloudTrail </i> user guide.</p><note>
/// <p>Do not include any personally identifying, confidential, or sensitive information in your prompts.</p>
/// <p>This feature uses generative AI large language models (LLMs); we recommend double-checking the LLM response.</p>
/// </note>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct GenerateQueryFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::generate_query::builders::GenerateQueryInputBuilder,
    config_override: ::std::option::Option<crate::config::Builder>,
}
impl
    crate::client::customize::internal::CustomizableSend<
        crate::operation::generate_query::GenerateQueryOutput,
        crate::operation::generate_query::GenerateQueryError,
    > for GenerateQueryFluentBuilder
{
    fn send(
        self,
        config_override: crate::config::Builder,
    ) -> crate::client::customize::internal::BoxFuture<
        crate::client::customize::internal::SendResult<
            crate::operation::generate_query::GenerateQueryOutput,
            crate::operation::generate_query::GenerateQueryError,
        >,
    > {
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
    }
}
impl GenerateQueryFluentBuilder {
    /// Creates a new `GenerateQueryFluentBuilder`.
    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
        Self {
            handle,
            inner: ::std::default::Default::default(),
            config_override: ::std::option::Option::None,
        }
    }
    /// Access the GenerateQuery as a reference.
    pub fn as_input(&self) -> &crate::operation::generate_query::builders::GenerateQueryInputBuilder {
        &self.inner
    }
    /// Sends the request and returns the response.
    ///
    /// If an error occurs, an `SdkError` will be returned with additional details that
    /// can be matched against.
    ///
    /// By default, any retryable failures will be retried twice. Retry behavior
    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
    /// set when configuring the client.
    pub async fn send(
        self,
    ) -> ::std::result::Result<
        crate::operation::generate_query::GenerateQueryOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::generate_query::GenerateQueryError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let input = self
            .inner
            .build()
            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
        let runtime_plugins = crate::operation::generate_query::GenerateQuery::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            self.config_override,
        );
        crate::operation::generate_query::GenerateQuery::orchestrate(&runtime_plugins, input).await
    }

    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
    pub fn customize(
        self,
    ) -> crate::client::customize::CustomizableOperation<
        crate::operation::generate_query::GenerateQueryOutput,
        crate::operation::generate_query::GenerateQueryError,
        Self,
    > {
        crate::client::customize::CustomizableOperation::new(self)
    }
    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
        self.set_config_override(::std::option::Option::Some(config_override.into()));
        self
    }

    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
        self.config_override = config_override;
        self
    }
    ///
    /// Appends an item to `EventDataStores`.
    ///
    /// To override the contents of this collection use [`set_event_data_stores`](Self::set_event_data_stores).
    ///
    /// <p>The ARN (or ID suffix of the ARN) of the event data store that you want to query. You can only specify one event data store.</p>
    pub fn event_data_stores(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.event_data_stores(input.into());
        self
    }
    /// <p>The ARN (or ID suffix of the ARN) of the event data store that you want to query. You can only specify one event data store.</p>
    pub fn set_event_data_stores(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
        self.inner = self.inner.set_event_data_stores(input);
        self
    }
    /// <p>The ARN (or ID suffix of the ARN) of the event data store that you want to query. You can only specify one event data store.</p>
    pub fn get_event_data_stores(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
        self.inner.get_event_data_stores()
    }
    /// <p>The prompt that you want to use to generate the query. The prompt must be in English. For example prompts, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/lake-query-generator.html#lake-query-generator-examples">Example prompts</a> in the <i>CloudTrail </i> user guide.</p>
    pub fn prompt(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.prompt(input.into());
        self
    }
    /// <p>The prompt that you want to use to generate the query. The prompt must be in English. For example prompts, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/lake-query-generator.html#lake-query-generator-examples">Example prompts</a> in the <i>CloudTrail </i> user guide.</p>
    pub fn set_prompt(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_prompt(input);
        self
    }
    /// <p>The prompt that you want to use to generate the query. The prompt must be in English. For example prompts, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/lake-query-generator.html#lake-query-generator-examples">Example prompts</a> in the <i>CloudTrail </i> user guide.</p>
    pub fn get_prompt(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_prompt()
    }
}