aws-sdk-dynamodb 1.120.0

AWS SDK for Amazon DynamoDB
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, ::std::fmt::Debug)]
pub struct SearchVectorsOutput {
    /// <p>The capacity units consumed by the <code>SearchVectors</code> operation. Contains <code>VectorSearchRequestBytes</code>, which represents the vector search capacity consumed.</p>
    pub consumed_capacity: ::std::option::Option<crate::types::VectorCapacity>,
    /// <p>A list of items returned by the vector similarity search, sorted by similarity with the most similar item first. Each item contains the projected attributes and a similarity score.</p>
    pub search_results: ::std::option::Option<::std::vec::Vec<crate::types::SearchResultItem>>,
    _request_id: Option<String>,
}
impl SearchVectorsOutput {
    /// <p>The capacity units consumed by the <code>SearchVectors</code> operation. Contains <code>VectorSearchRequestBytes</code>, which represents the vector search capacity consumed.</p>
    pub fn consumed_capacity(&self) -> ::std::option::Option<&crate::types::VectorCapacity> {
        self.consumed_capacity.as_ref()
    }
    /// <p>A list of items returned by the vector similarity search, sorted by similarity with the most similar item first. Each item contains the projected attributes and a similarity score.</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 `.search_results.is_none()`.
    pub fn search_results(&self) -> &[crate::types::SearchResultItem] {
        self.search_results.as_deref().unwrap_or_default()
    }
}
impl ::aws_types::request_id::RequestId for SearchVectorsOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl SearchVectorsOutput {
    /// Creates a new builder-style object to manufacture [`SearchVectorsOutput`](crate::operation::search_vectors::SearchVectorsOutput).
    pub fn builder() -> crate::operation::search_vectors::builders::SearchVectorsOutputBuilder {
        crate::operation::search_vectors::builders::SearchVectorsOutputBuilder::default()
    }
}

/// A builder for [`SearchVectorsOutput`](crate::operation::search_vectors::SearchVectorsOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct SearchVectorsOutputBuilder {
    pub(crate) consumed_capacity: ::std::option::Option<crate::types::VectorCapacity>,
    pub(crate) search_results: ::std::option::Option<::std::vec::Vec<crate::types::SearchResultItem>>,
    _request_id: Option<String>,
}
impl SearchVectorsOutputBuilder {
    /// <p>The capacity units consumed by the <code>SearchVectors</code> operation. Contains <code>VectorSearchRequestBytes</code>, which represents the vector search capacity consumed.</p>
    pub fn consumed_capacity(mut self, input: crate::types::VectorCapacity) -> Self {
        self.consumed_capacity = ::std::option::Option::Some(input);
        self
    }
    /// <p>The capacity units consumed by the <code>SearchVectors</code> operation. Contains <code>VectorSearchRequestBytes</code>, which represents the vector search capacity consumed.</p>
    pub fn set_consumed_capacity(mut self, input: ::std::option::Option<crate::types::VectorCapacity>) -> Self {
        self.consumed_capacity = input;
        self
    }
    /// <p>The capacity units consumed by the <code>SearchVectors</code> operation. Contains <code>VectorSearchRequestBytes</code>, which represents the vector search capacity consumed.</p>
    pub fn get_consumed_capacity(&self) -> &::std::option::Option<crate::types::VectorCapacity> {
        &self.consumed_capacity
    }
    /// Appends an item to `search_results`.
    ///
    /// To override the contents of this collection use [`set_search_results`](Self::set_search_results).
    ///
    /// <p>A list of items returned by the vector similarity search, sorted by similarity with the most similar item first. Each item contains the projected attributes and a similarity score.</p>
    pub fn search_results(mut self, input: crate::types::SearchResultItem) -> Self {
        let mut v = self.search_results.unwrap_or_default();
        v.push(input);
        self.search_results = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of items returned by the vector similarity search, sorted by similarity with the most similar item first. Each item contains the projected attributes and a similarity score.</p>
    pub fn set_search_results(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SearchResultItem>>) -> Self {
        self.search_results = input;
        self
    }
    /// <p>A list of items returned by the vector similarity search, sorted by similarity with the most similar item first. Each item contains the projected attributes and a similarity score.</p>
    pub fn get_search_results(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SearchResultItem>> {
        &self.search_results
    }
    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
        self._request_id = Some(request_id.into());
        self
    }

    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
        self._request_id = request_id;
        self
    }
    /// Consumes the builder and constructs a [`SearchVectorsOutput`](crate::operation::search_vectors::SearchVectorsOutput).
    pub fn build(self) -> crate::operation::search_vectors::SearchVectorsOutput {
        crate::operation::search_vectors::SearchVectorsOutput {
            consumed_capacity: self.consumed_capacity,
            search_results: self.search_results,
            _request_id: self._request_id,
        }
    }
}