// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::search_events::_search_events_input::SearchEventsInputBuilder;
pub use crate::operation::search_events::_search_events_output::SearchEventsOutputBuilder;
impl crate::operation::search_events::builders::SearchEventsInputBuilder {
/// Sends a request with this input using the given client.
pub async fn send_with(
self,
client: &crate::Client,
) -> ::std::result::Result<
crate::operation::search_events::SearchEventsOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::search_events::SearchEventsError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
> {
let mut fluent_builder = client.search_events();
fluent_builder.inner = self;
fluent_builder.send().await
}
}
/// Fluent builder constructing a request to `SearchEvents`.
///
/// <p>Searches a space's events by relevance. It works like <code>SearchMemories</code> without the memory type and strategy selector. The query is a subset of the OpenSearch Query DSL. The service validates it, limits the search to the actor in <code>actorId</code> and the sessions in <code>sessionIds</code>, and returns ranked results. Each result is the matching chunk of an event, not the whole event. You can page through only a limited number of results. A request past that limit fails with <code>ValidationException</code> (reason <code>invalidNextToken</code>), and the message gives the limit.</p>
/// <p>If the results are larger than 5 MiB, the request fails with <code>ValidationException</code> (reason <code>queryBodyTooLarge</code>). Lower <code>maxResults</code>.</p>
/// <p>If the request would exceed the service's rate for embedding requests, it fails with <code>ThrottlingException</code>. Retry with exponential backoff.</p>
/// <p>If the space uses a customer managed AWS KMS key, the call can also fail because of the key. It fails with <code>AccessDeniedException</code> if you aren't allowed to use the key, and with <code>ThrottlingException</code> if AWS KMS throttles the request. It fails with <code>ValidationException</code> if the key is disabled, pending deletion, or deleted.</p>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct SearchEventsFluentBuilder {
handle: ::std::sync::Arc<crate::client::Handle>,
inner: crate::operation::search_events::builders::SearchEventsInputBuilder,
config_override: ::std::option::Option<crate::config::Builder>,
}
impl
crate::client::customize::internal::CustomizableSend<
crate::operation::search_events::SearchEventsOutput,
crate::operation::search_events::SearchEventsError,
> for SearchEventsFluentBuilder
{
fn send(
self,
config_override: crate::config::Builder,
) -> crate::client::customize::internal::BoxFuture<
crate::client::customize::internal::SendResult<
crate::operation::search_events::SearchEventsOutput,
crate::operation::search_events::SearchEventsError,
>,
> {
::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
}
}
impl SearchEventsFluentBuilder {
/// Creates a new `SearchEventsFluentBuilder`.
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 SearchEvents as a reference.
pub fn as_input(&self) -> &crate::operation::search_events::builders::SearchEventsInputBuilder {
&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::search_events::SearchEventsOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::search_events::SearchEventsError,
::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::search_events::SearchEvents::operation_runtime_plugins(
self.handle.runtime_plugins.clone(),
&self.handle.conf,
self.config_override,
);
crate::operation::search_events::SearchEvents::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::search_events::SearchEventsOutput,
crate::operation::search_events::SearchEventsError,
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
}
/// Create a paginator for this request
///
/// Paginators are used by calling [`send().await`](crate::operation::search_events::paginator::SearchEventsPaginator::send) which returns a [`PaginationStream`](aws_smithy_async::future::pagination_stream::PaginationStream).
pub fn into_paginator(self) -> crate::operation::search_events::paginator::SearchEventsPaginator {
crate::operation::search_events::paginator::SearchEventsPaginator::new(self.handle, self.inner)
}
/// <p>The space whose events to search. Use <code>actorId</code> and <code>sessionIds</code> to narrow the search within it.</p>
pub fn space_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.space_id(input.into());
self
}
/// <p>The space whose events to search. Use <code>actorId</code> and <code>sessionIds</code> to narrow the search within it.</p>
pub fn set_space_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_space_id(input);
self
}
/// <p>The space whose events to search. Use <code>actorId</code> and <code>sessionIds</code> to narrow the search within it.</p>
pub fn get_space_id(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_space_id()
}
/// <p>The actor whose events to search (exact match). Required: every search covers exactly one actor, and an event stored without an actor is never returned. Narrow the search further with <code>sessionIds</code>, combined by AND. This is the only way to filter by actor: a query that references <code>system_metadata.actor_id</code> fails with <code>ValidationException</code> (reason <code>nonFilterableField</code>).</p>
pub fn actor_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.actor_id(input.into());
self
}
/// <p>The actor whose events to search (exact match). Required: every search covers exactly one actor, and an event stored without an actor is never returned. Narrow the search further with <code>sessionIds</code>, combined by AND. This is the only way to filter by actor: a query that references <code>system_metadata.actor_id</code> fails with <code>ValidationException</code> (reason <code>nonFilterableField</code>).</p>
pub fn set_actor_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_actor_id(input);
self
}
/// <p>The actor whose events to search (exact match). Required: every search covers exactly one actor, and an event stored without an actor is never returned. Narrow the search further with <code>sessionIds</code>, combined by AND. This is the only way to filter by actor: a query that references <code>system_metadata.actor_id</code> fails with <code>ValidationException</code> (reason <code>nonFilterableField</code>).</p>
pub fn get_actor_id(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_actor_id()
}
///
/// Appends an item to `sessionIds`.
///
/// To override the contents of this collection use [`set_session_ids`](Self::set_session_ids).
///
/// <p>Returns only events from one of these sessions (exact match). Combined with <code>actorId</code> by AND. Omit for no session filter. An empty list fails validation. An event stored without a session never matches a session filter. This is the only way to filter by session: a query that references <code>system_metadata.session_id</code> fails with <code>ValidationException</code> (reason <code>nonFilterableField</code>).</p>
pub fn session_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.session_ids(input.into());
self
}
/// <p>Returns only events from one of these sessions (exact match). Combined with <code>actorId</code> by AND. Omit for no session filter. An empty list fails validation. An event stored without a session never matches a session filter. This is the only way to filter by session: a query that references <code>system_metadata.session_id</code> fails with <code>ValidationException</code> (reason <code>nonFilterableField</code>).</p>
pub fn set_session_ids(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
self.inner = self.inner.set_session_ids(input);
self
}
/// <p>Returns only events from one of these sessions (exact match). Combined with <code>actorId</code> by AND. Omit for no session filter. An empty list fails validation. An event stored without a session never matches a session filter. This is the only way to filter by session: a query that references <code>system_metadata.session_id</code> fails with <code>ValidationException</code> (reason <code>nonFilterableField</code>).</p>
pub fn get_session_ids(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
self.inner.get_session_ids()
}
/// <p>The query: a subset of the OpenSearch Query DSL (see <code>SearchQuery</code>), validated by the same rules as on <code>SearchMemories</code>. Query event text as <code>text</code> and embeddings as <code>vector</code>. A search covers both conversation turns and chunks of documents submitted as a <code>blob</code>. You can't use actor and session fields here. Use the top-level <code>actorId</code> and <code>sessionIds</code>.</p>
/// <p>To search only the content of particular events, filter on <code>event_ids</code> with <code>term</code> or <code>terms</code>, for example with the <code>sourceEventIds</code> that a <code>SearchMemories</code> result returns. A <code>terms</code> clause on <code>event_ids</code> can list up to 10 event IDs. More IDs fail with <code>ValidationException</code> (reason <code>queryBodyTooLarge</code>). You can use <code>event_ids</code> only in <code>term</code>, <code>terms</code>, and <code>exists</code> queries.</p>
pub fn query(mut self, input: ::aws_smithy_types::Document) -> Self {
self.inner = self.inner.query(input);
self
}
/// <p>The query: a subset of the OpenSearch Query DSL (see <code>SearchQuery</code>), validated by the same rules as on <code>SearchMemories</code>. Query event text as <code>text</code> and embeddings as <code>vector</code>. A search covers both conversation turns and chunks of documents submitted as a <code>blob</code>. You can't use actor and session fields here. Use the top-level <code>actorId</code> and <code>sessionIds</code>.</p>
/// <p>To search only the content of particular events, filter on <code>event_ids</code> with <code>term</code> or <code>terms</code>, for example with the <code>sourceEventIds</code> that a <code>SearchMemories</code> result returns. A <code>terms</code> clause on <code>event_ids</code> can list up to 10 event IDs. More IDs fail with <code>ValidationException</code> (reason <code>queryBodyTooLarge</code>). You can use <code>event_ids</code> only in <code>term</code>, <code>terms</code>, and <code>exists</code> queries.</p>
pub fn set_query(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self {
self.inner = self.inner.set_query(input);
self
}
/// <p>The query: a subset of the OpenSearch Query DSL (see <code>SearchQuery</code>), validated by the same rules as on <code>SearchMemories</code>. Query event text as <code>text</code> and embeddings as <code>vector</code>. A search covers both conversation turns and chunks of documents submitted as a <code>blob</code>. You can't use actor and session fields here. Use the top-level <code>actorId</code> and <code>sessionIds</code>.</p>
/// <p>To search only the content of particular events, filter on <code>event_ids</code> with <code>term</code> or <code>terms</code>, for example with the <code>sourceEventIds</code> that a <code>SearchMemories</code> result returns. A <code>terms</code> clause on <code>event_ids</code> can list up to 10 event IDs. More IDs fail with <code>ValidationException</code> (reason <code>queryBodyTooLarge</code>). You can use <code>event_ids</code> only in <code>term</code>, <code>terms</code>, and <code>exists</code> queries.</p>
pub fn get_query(&self) -> &::std::option::Option<::aws_smithy_types::Document> {
self.inner.get_query()
}
/// <p>The sort order (see <code>SearchSort</code>). Omit to return the most relevant events first.</p>
pub fn sort(mut self, input: ::aws_smithy_types::Document) -> Self {
self.inner = self.inner.sort(input);
self
}
/// <p>The sort order (see <code>SearchSort</code>). Omit to return the most relevant events first.</p>
pub fn set_sort(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self {
self.inner = self.inner.set_sort(input);
self
}
/// <p>The sort order (see <code>SearchSort</code>). Omit to return the most relevant events first.</p>
pub fn get_sort(&self) -> &::std::option::Option<::aws_smithy_types::Document> {
self.inner.get_sort()
}
/// <p>The maximum number of events to return, from 1 to 100. The default is 20.</p>
pub fn max_results(mut self, input: i32) -> Self {
self.inner = self.inner.max_results(input);
self
}
/// <p>The maximum number of events to return, from 1 to 100. The default is 20.</p>
pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
self.inner = self.inner.set_max_results(input);
self
}
/// <p>The maximum number of events to return, from 1 to 100. The default is 20.</p>
pub fn get_max_results(&self) -> &::std::option::Option<i32> {
self.inner.get_max_results()
}
/// <p>The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.</p>
pub fn next_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.next_token(input.into());
self
}
/// <p>The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.</p>
pub fn set_next_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_next_token(input);
self
}
/// <p>The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.</p>
pub fn get_next_token(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_next_token()
}
}