// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::create_memory::_create_memory_input::CreateMemoryInputBuilder;
pub use crate::operation::create_memory::_create_memory_output::CreateMemoryOutputBuilder;
impl crate::operation::create_memory::builders::CreateMemoryInputBuilder {
/// Sends a request with this input using the given client.
pub async fn send_with(
self,
client: &crate::Client,
) -> ::std::result::Result<
crate::operation::create_memory::CreateMemoryOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::create_memory::CreateMemoryError,
::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
>,
> {
let mut fluent_builder = client.create_memory();
fluent_builder.inner = self;
fluent_builder.send().await
}
}
/// Fluent builder constructing a request to `CreateMemory`.
///
/// <p>Writes a memory that you have already formed, without extracting it from events. The service embeds the text as given and stores it as a memory of the named strategy. To have the service extract memories from conversation turns, use <code>CreateEvent</code> instead.</p>
/// <p>The operation returns before the memory is searchable. The returned <code>memoryId</code> is final, but until the memory is indexed, <code>GetMemory</code>, <code>UpdateMemory</code>, and <code>DeleteMemory</code> return <code>ResourceNotFoundException</code> for it.</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 CreateMemoryFluentBuilder {
handle: ::std::sync::Arc<crate::client::Handle>,
inner: crate::operation::create_memory::builders::CreateMemoryInputBuilder,
config_override: ::std::option::Option<crate::config::Builder>,
}
impl
crate::client::customize::internal::CustomizableSend<
crate::operation::create_memory::CreateMemoryOutput,
crate::operation::create_memory::CreateMemoryError,
> for CreateMemoryFluentBuilder
{
fn send(
self,
config_override: crate::config::Builder,
) -> crate::client::customize::internal::BoxFuture<
crate::client::customize::internal::SendResult<
crate::operation::create_memory::CreateMemoryOutput,
crate::operation::create_memory::CreateMemoryError,
>,
> {
::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
}
}
impl CreateMemoryFluentBuilder {
/// Creates a new `CreateMemoryFluentBuilder`.
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 CreateMemory as a reference.
pub fn as_input(&self) -> &crate::operation::create_memory::builders::CreateMemoryInputBuilder {
&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::create_memory::CreateMemoryOutput,
::aws_smithy_runtime_api::client::result::SdkError<
crate::operation::create_memory::CreateMemoryError,
::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::create_memory::CreateMemory::operation_runtime_plugins(
self.handle.runtime_plugins.clone(),
&self.handle.conf,
self.config_override,
);
crate::operation::create_memory::CreateMemory::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::create_memory::CreateMemoryOutput,
crate::operation::create_memory::CreateMemoryError,
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
}
/// <p>The ID of the space that owns the memory, for example <code>sp-02864597b164</code>.</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 ID of the space that owns the memory, for example <code>sp-02864597b164</code>.</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 ID of the space that owns the memory, for example <code>sp-02864597b164</code>.</p>
pub fn get_space_id(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_space_id()
}
/// <p>The name of the strategy that the memory belongs to. The space must already declare the strategy, and the memory's type comes from that strategy. The name must be 1 to 64 characters: letters, digits, periods, hyphens, and underscores, starting with a letter or digit.</p>
pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.name(input.into());
self
}
/// <p>The name of the strategy that the memory belongs to. The space must already declare the strategy, and the memory's type comes from that strategy. The name must be 1 to 64 characters: letters, digits, periods, hyphens, and underscores, starting with a letter or digit.</p>
pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_name(input);
self
}
/// <p>The name of the strategy that the memory belongs to. The space must already declare the strategy, and the memory's type comes from that strategy. The name must be 1 to 64 characters: letters, digits, periods, hyphens, and underscores, starting with a letter or digit.</p>
pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_name()
}
/// <p>The memory text, stored and embedded as provided.</p>
pub fn content(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.content(input.into());
self
}
/// <p>The memory text, stored and embedded as provided.</p>
pub fn set_content(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_content(input);
self
}
/// <p>The memory text, stored and embedded as provided.</p>
pub fn get_content(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_content()
}
/// <p>The actor (end user or agent) that owns the memory.</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 (end user or agent) that owns the memory.</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 (end user or agent) that owns the memory.</p>
pub fn get_actor_id(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_actor_id()
}
/// <p>The session that the memory belongs to. If you omit it, the service generates a session ID and returns it.</p>
pub fn session_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.session_id(input.into());
self
}
/// <p>The session that the memory belongs to. If you omit it, the service generates a session ID and returns it.</p>
pub fn set_session_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_session_id(input);
self
}
/// <p>The session that the memory belongs to. If you omit it, the service generates a session ID and returns it.</p>
pub fn get_session_id(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_session_id()
}
///
/// Adds a key-value pair to `metadata`.
///
/// To override the contents of this collection use [`set_metadata`](Self::set_metadata).
///
/// <p>Metadata tags to store with the memory. Keys that begin with <code>x-amz-</code>, the key <code>documentS3Source</code>, and other keys that the service uses internally are reserved: a request that sets one fails with <code>ValidationException</code>, and the message names the key.</p>
/// <p>A space can use at most 50 distinct metadata keys across all of its events and memories. A request that would add a key beyond that fails with <code>ValidationException</code>. Reuse an existing key instead.</p>
pub fn metadata(mut self, k: impl ::std::convert::Into<::std::string::String>, v: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.metadata(k.into(), v.into());
self
}
/// <p>Metadata tags to store with the memory. Keys that begin with <code>x-amz-</code>, the key <code>documentS3Source</code>, and other keys that the service uses internally are reserved: a request that sets one fails with <code>ValidationException</code>, and the message names the key.</p>
/// <p>A space can use at most 50 distinct metadata keys across all of its events and memories. A request that would add a key beyond that fails with <code>ValidationException</code>. Reuse an existing key instead.</p>
pub fn set_metadata(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>>) -> Self {
self.inner = self.inner.set_metadata(input);
self
}
/// <p>Metadata tags to store with the memory. Keys that begin with <code>x-amz-</code>, the key <code>documentS3Source</code>, and other keys that the service uses internally are reserved: a request that sets one fails with <code>ValidationException</code>, and the message names the key.</p>
/// <p>A space can use at most 50 distinct metadata keys across all of its events and memories. A request that would add a key beyond that fails with <code>ValidationException</code>. Reuse an existing key instead.</p>
pub fn get_metadata(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> {
self.inner.get_metadata()
}
/// <p>A unique, case-sensitive identifier that makes the request idempotent. Within 2 hours of the first request, a retry with the same token returns the same <code>memoryId</code> instead of creating a second memory. Reusing the token with a different <code>name</code>, <code>content</code>, <code>metadata</code>, <code>actorId</code>, or <code>sessionId</code> fails with <code>ConflictException</code>. If you omit <code>sessionId</code>, a retry with the same token gets the same session. If you omit the token, each call creates a new memory.</p>
pub fn client_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.inner = self.inner.client_token(input.into());
self
}
/// <p>A unique, case-sensitive identifier that makes the request idempotent. Within 2 hours of the first request, a retry with the same token returns the same <code>memoryId</code> instead of creating a second memory. Reusing the token with a different <code>name</code>, <code>content</code>, <code>metadata</code>, <code>actorId</code>, or <code>sessionId</code> fails with <code>ConflictException</code>. If you omit <code>sessionId</code>, a retry with the same token gets the same session. If you omit the token, each call creates a new memory.</p>
pub fn set_client_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.inner = self.inner.set_client_token(input);
self
}
/// <p>A unique, case-sensitive identifier that makes the request idempotent. Within 2 hours of the first request, a retry with the same token returns the same <code>memoryId</code> instead of creating a second memory. Reusing the token with a different <code>name</code>, <code>content</code>, <code>metadata</code>, <code>actorId</code>, or <code>sessionId</code> fails with <code>ConflictException</code>. If you omit <code>sessionId</code>, a retry with the same token gets the same session. If you omit the token, each call creates a new memory.</p>
pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
self.inner.get_client_token()
}
}