aws-sdk-opensearchmemory 1.0.0

AWS SDK for Amazon OpenSearch Memory
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::search_memories::_search_memories_input::SearchMemoriesInputBuilder;

pub use crate::operation::search_memories::_search_memories_output::SearchMemoriesOutputBuilder;

impl crate::operation::search_memories::builders::SearchMemoriesInputBuilder {
    /// 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_memories::SearchMemoriesOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::search_memories::SearchMemoriesError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let mut fluent_builder = client.search_memories();
        fluent_builder.inner = self;
        fluent_builder.send().await
    }
}
/// Fluent builder constructing a request to `SearchMemories`.
///
/// <p>Searches a space's memories by relevance. The query is a subset of the OpenSearch Query DSL. The service validates it, limits the search to the requested strategies and to the actor in <code>actorId</code>, and returns one ranked list of memories. 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>Memories past their expiry (set from the space's <code>memoryExpiryDays</code> when each memory is written) are left out of the results. Only current memories are returned: a memory that consolidation has superseded (an older version of a fact that a newer memory replaced) is left out.</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 SearchMemoriesFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::search_memories::builders::SearchMemoriesInputBuilder,
    config_override: ::std::option::Option<crate::config::Builder>,
}
impl
    crate::client::customize::internal::CustomizableSend<
        crate::operation::search_memories::SearchMemoriesOutput,
        crate::operation::search_memories::SearchMemoriesError,
    > for SearchMemoriesFluentBuilder
{
    fn send(
        self,
        config_override: crate::config::Builder,
    ) -> crate::client::customize::internal::BoxFuture<
        crate::client::customize::internal::SendResult<
            crate::operation::search_memories::SearchMemoriesOutput,
            crate::operation::search_memories::SearchMemoriesError,
        >,
    > {
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
    }
}
impl SearchMemoriesFluentBuilder {
    /// Creates a new `SearchMemoriesFluentBuilder`.
    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 SearchMemories as a reference.
    pub fn as_input(&self) -> &crate::operation::search_memories::builders::SearchMemoriesInputBuilder {
        &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_memories::SearchMemoriesOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::search_memories::SearchMemoriesError,
            ::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_memories::SearchMemories::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            self.config_override,
        );
        crate::operation::search_memories::SearchMemories::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_memories::SearchMemoriesOutput,
        crate::operation::search_memories::SearchMemoriesError,
        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_memories::paginator::SearchMemoriesPaginator::send) which returns a [`PaginationStream`](aws_smithy_async::future::pagination_stream::PaginationStream).
    pub fn into_paginator(self) -> crate::operation::search_memories::paginator::SearchMemoriesPaginator {
        crate::operation::search_memories::paginator::SearchMemoriesPaginator::new(self.handle, self.inner)
    }
    /// <p>The space to search. Use <code>actorId</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 to search. Use <code>actorId</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 to search. Use <code>actorId</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()
    }
    ///
    /// Appends an item to `memoryStrategies`.
    ///
    /// To override the contents of this collection use [`set_memory_strategies`](Self::set_memory_strategies).
    ///
    /// <p>The strategies to search, as a list of selectors. Each selector names a memory type and, optionally, specific strategy names of that type. A space can hold several strategies of the same type. A selector without <code>memoryStrategyNames</code> searches every strategy of its type, and omitting <code>memoryStrategies</code> searches every strategy in the space. A name that is not a declared strategy of that type fails with <code>ValidationException</code>.</p>
    pub fn memory_strategies(mut self, input: crate::types::StrategySelector) -> Self {
        self.inner = self.inner.memory_strategies(input);
        self
    }
    /// <p>The strategies to search, as a list of selectors. Each selector names a memory type and, optionally, specific strategy names of that type. A space can hold several strategies of the same type. A selector without <code>memoryStrategyNames</code> searches every strategy of its type, and omitting <code>memoryStrategies</code> searches every strategy in the space. A name that is not a declared strategy of that type fails with <code>ValidationException</code>.</p>
    pub fn set_memory_strategies(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::StrategySelector>>) -> Self {
        self.inner = self.inner.set_memory_strategies(input);
        self
    }
    /// <p>The strategies to search, as a list of selectors. Each selector names a memory type and, optionally, specific strategy names of that type. A space can hold several strategies of the same type. A selector without <code>memoryStrategyNames</code> searches every strategy of its type, and omitting <code>memoryStrategies</code> searches every strategy in the space. A name that is not a declared strategy of that type fails with <code>ValidationException</code>.</p>
    pub fn get_memory_strategies(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::StrategySelector>> {
        self.inner.get_memory_strategies()
    }
    /// <p>The actor whose memories to search (exact match). Required: every search covers exactly one actor, and a memory stored without an actor is never returned. 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 memories to search (exact match). Required: every search covers exactly one actor, and a memory stored without an actor is never returned. 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 memories to search (exact match). Required: every search covers exactly one actor, and a memory stored without an actor is never returned. 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()
    }
    /// <p>The query: a subset of the OpenSearch Query DSL (see <code>SearchQuery</code>). You can't use the actor and session fields <code>system_metadata.actor_id</code> and <code>system_metadata.session_id</code> here. Use the top-level <code>actorId</code> to filter by actor. Searching memories doesn't filter by session.</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>). You can't use the actor and session fields <code>system_metadata.actor_id</code> and <code>system_metadata.session_id</code> here. Use the top-level <code>actorId</code> to filter by actor. Searching memories doesn't filter by session.</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>). You can't use the actor and session fields <code>system_metadata.actor_id</code> and <code>system_metadata.session_id</code> here. Use the top-level <code>actorId</code> to filter by actor. Searching memories doesn't filter by session.</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 memories 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 memories 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 memories first.</p>
    pub fn get_sort(&self) -> &::std::option::Option<::aws_smithy_types::Document> {
        self.inner.get_sort()
    }
    /// <p>The maximum number of memories 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 memories 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 memories 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()
    }
}