aws-sdk-opensearchmemory 1.2.0

AWS SDK for Amazon OpenSearch Memory
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub struct SearchEventsInput {
    /// <p>The space whose events to search. Use <code>actorId</code> and <code>sessionIds</code> to narrow the search within it.</p>
    pub space_id: ::std::option::Option<::std::string::String>,
    /// <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 actor_id: ::std::option::Option<::std::string::String>,
    /// <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 session_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    /// <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 query: ::std::option::Option<::aws_smithy_types::Document>,
    /// <p>The sort order (see <code>SearchSort</code>). Omit to return the most relevant events first.</p>
    pub sort: ::std::option::Option<::aws_smithy_types::Document>,
    /// <p>The maximum number of events to return, from 1 to 100. The default is 20.</p>
    pub max_results: ::std::option::Option<i32>,
    /// <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 next_token: ::std::option::Option<::std::string::String>,
}
impl SearchEventsInput {
    /// <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(&self) -> ::std::option::Option<&str> {
        self.space_id.as_deref()
    }
    /// <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(&self) -> ::std::option::Option<&str> {
        self.actor_id.as_deref()
    }
    /// <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>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.session_ids.is_none()`.
    pub fn session_ids(&self) -> &[::std::string::String] {
        self.session_ids.as_deref().unwrap_or_default()
    }
    /// <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(&self) -> ::std::option::Option<&::aws_smithy_types::Document> {
        self.query.as_ref()
    }
    /// <p>The sort order (see <code>SearchSort</code>). Omit to return the most relevant events first.</p>
    pub fn sort(&self) -> ::std::option::Option<&::aws_smithy_types::Document> {
        self.sort.as_ref()
    }
    /// <p>The maximum number of events to return, from 1 to 100. The default is 20.</p>
    pub fn max_results(&self) -> ::std::option::Option<i32> {
        self.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(&self) -> ::std::option::Option<&str> {
        self.next_token.as_deref()
    }
}
impl ::std::fmt::Debug for SearchEventsInput {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("SearchEventsInput");
        formatter.field("space_id", &self.space_id);
        formatter.field("actor_id", &self.actor_id);
        formatter.field("session_ids", &self.session_ids);
        formatter.field("query", &"*** Sensitive Data Redacted ***");
        formatter.field("sort", &"*** Sensitive Data Redacted ***");
        formatter.field("max_results", &self.max_results);
        formatter.field("next_token", &self.next_token);
        formatter.finish()
    }
}
impl SearchEventsInput {
    /// Creates a new builder-style object to manufacture [`SearchEventsInput`](crate::operation::search_events::SearchEventsInput).
    pub fn builder() -> crate::operation::search_events::builders::SearchEventsInputBuilder {
        crate::operation::search_events::builders::SearchEventsInputBuilder::default()
    }
}

/// A builder for [`SearchEventsInput`](crate::operation::search_events::SearchEventsInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
#[non_exhaustive]
pub struct SearchEventsInputBuilder {
    pub(crate) space_id: ::std::option::Option<::std::string::String>,
    pub(crate) actor_id: ::std::option::Option<::std::string::String>,
    pub(crate) session_ids: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
    pub(crate) query: ::std::option::Option<::aws_smithy_types::Document>,
    pub(crate) sort: ::std::option::Option<::aws_smithy_types::Document>,
    pub(crate) max_results: ::std::option::Option<i32>,
    pub(crate) next_token: ::std::option::Option<::std::string::String>,
}
impl SearchEventsInputBuilder {
    /// <p>The space whose events to search. Use <code>actorId</code> and <code>sessionIds</code> to narrow the search within it.</p>
    /// This field is required.
    pub fn space_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.space_id = ::std::option::Option::Some(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.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.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>
    /// This field is required.
    pub fn actor_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.actor_id = ::std::option::Option::Some(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.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.actor_id
    }
    /// Appends an item to `session_ids`.
    ///
    /// 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 {
        let mut v = self.session_ids.unwrap_or_default();
        v.push(input.into());
        self.session_ids = ::std::option::Option::Some(v);
        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.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.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>
    /// This field is required.
    pub fn query(mut self, input: ::aws_smithy_types::Document) -> Self {
        self.query = ::std::option::Option::Some(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.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.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.sort = ::std::option::Option::Some(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.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.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.max_results = ::std::option::Option::Some(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.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.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.next_token = ::std::option::Option::Some(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.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.next_token
    }
    /// Consumes the builder and constructs a [`SearchEventsInput`](crate::operation::search_events::SearchEventsInput).
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::search_events::SearchEventsInput, ::aws_smithy_types::error::operation::BuildError> {
        ::std::result::Result::Ok(crate::operation::search_events::SearchEventsInput {
            space_id: self.space_id,
            actor_id: self.actor_id,
            session_ids: self.session_ids,
            query: self.query,
            sort: self.sort,
            max_results: self.max_results,
            next_token: self.next_token,
        })
    }
}
impl ::std::fmt::Debug for SearchEventsInputBuilder {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("SearchEventsInputBuilder");
        formatter.field("space_id", &self.space_id);
        formatter.field("actor_id", &self.actor_id);
        formatter.field("session_ids", &self.session_ids);
        formatter.field("query", &"*** Sensitive Data Redacted ***");
        formatter.field("sort", &"*** Sensitive Data Redacted ***");
        formatter.field("max_results", &self.max_results);
        formatter.field("next_token", &self.next_token);
        formatter.finish()
    }
}