aws-sdk-bedrockagentcore 1.45.0

AWS SDK for Amazon Bedrock AgentCore
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::start_code_interpreter_session::_start_code_interpreter_session_input::StartCodeInterpreterSessionInputBuilder;

pub use crate::operation::start_code_interpreter_session::_start_code_interpreter_session_output::StartCodeInterpreterSessionOutputBuilder;

impl crate::operation::start_code_interpreter_session::builders::StartCodeInterpreterSessionInputBuilder {
    /// Sends a request with this input using the given client.
    pub async fn send_with(
        self,
        client: &crate::Client,
    ) -> ::std::result::Result<
        crate::operation::start_code_interpreter_session::StartCodeInterpreterSessionOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::start_code_interpreter_session::StartCodeInterpreterSessionError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let mut fluent_builder = client.start_code_interpreter_session();
        fluent_builder.inner = self;
        fluent_builder.send().await
    }
}
/// Fluent builder constructing a request to `StartCodeInterpreterSession`.
///
/// <p>Creates and initializes a code interpreter session in Amazon Bedrock AgentCore. The session enables agents to execute code as part of their response generation, supporting programming languages such as Python for data analysis, visualization, and computation tasks.</p>
/// <p>To create a session, you must specify a code interpreter identifier and a name. The session remains active until it times out or you explicitly stop it using the <code>StopCodeInterpreterSession</code> operation.</p>
/// <p>The following operations are related to <code>StartCodeInterpreterSession</code>:</p>
/// <ul>
/// <li>
/// <p><a href="https://docs.aws.amazon.com/bedrock-agentcore/latest/APIReference/API_InvokeCodeInterpreter.html">InvokeCodeInterpreter</a></p></li>
/// <li>
/// <p><a href="https://docs.aws.amazon.com/bedrock-agentcore/latest/APIReference/API_GetCodeInterpreterSession.html">GetCodeInterpreterSession</a></p></li>
/// <li>
/// <p><a href="https://docs.aws.amazon.com/bedrock-agentcore/latest/APIReference/API_StopCodeInterpreterSession.html">StopCodeInterpreterSession</a></p></li>
/// </ul>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct StartCodeInterpreterSessionFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::start_code_interpreter_session::builders::StartCodeInterpreterSessionInputBuilder,
    config_override: ::std::option::Option<crate::config::Builder>,
}
impl
    crate::client::customize::internal::CustomizableSend<
        crate::operation::start_code_interpreter_session::StartCodeInterpreterSessionOutput,
        crate::operation::start_code_interpreter_session::StartCodeInterpreterSessionError,
    > for StartCodeInterpreterSessionFluentBuilder
{
    fn send(
        self,
        config_override: crate::config::Builder,
    ) -> crate::client::customize::internal::BoxFuture<
        crate::client::customize::internal::SendResult<
            crate::operation::start_code_interpreter_session::StartCodeInterpreterSessionOutput,
            crate::operation::start_code_interpreter_session::StartCodeInterpreterSessionError,
        >,
    > {
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
    }
}
impl StartCodeInterpreterSessionFluentBuilder {
    /// Creates a new `StartCodeInterpreterSessionFluentBuilder`.
    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 StartCodeInterpreterSession as a reference.
    pub fn as_input(&self) -> &crate::operation::start_code_interpreter_session::builders::StartCodeInterpreterSessionInputBuilder {
        &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::start_code_interpreter_session::StartCodeInterpreterSessionOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::start_code_interpreter_session::StartCodeInterpreterSessionError,
            ::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::start_code_interpreter_session::StartCodeInterpreterSession::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            self.config_override,
        );
        crate::operation::start_code_interpreter_session::StartCodeInterpreterSession::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::start_code_interpreter_session::StartCodeInterpreterSessionOutput,
        crate::operation::start_code_interpreter_session::StartCodeInterpreterSessionError,
        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 trace identifier for request tracking.</p>
    pub fn trace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.trace_id(input.into());
        self
    }
    /// <p>The trace identifier for request tracking.</p>
    pub fn set_trace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_trace_id(input);
        self
    }
    /// <p>The trace identifier for request tracking.</p>
    pub fn get_trace_id(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_trace_id()
    }
    /// <p>The parent trace information for distributed tracing.</p>
    pub fn trace_parent(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.trace_parent(input.into());
        self
    }
    /// <p>The parent trace information for distributed tracing.</p>
    pub fn set_trace_parent(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_trace_parent(input);
        self
    }
    /// <p>The parent trace information for distributed tracing.</p>
    pub fn get_trace_parent(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_trace_parent()
    }
    /// <p>The unique identifier of the code interpreter to use for this session. This identifier specifies which code interpreter environment to initialize for the session.</p>
    pub fn code_interpreter_identifier(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.code_interpreter_identifier(input.into());
        self
    }
    /// <p>The unique identifier of the code interpreter to use for this session. This identifier specifies which code interpreter environment to initialize for the session.</p>
    pub fn set_code_interpreter_identifier(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_code_interpreter_identifier(input);
        self
    }
    /// <p>The unique identifier of the code interpreter to use for this session. This identifier specifies which code interpreter environment to initialize for the session.</p>
    pub fn get_code_interpreter_identifier(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_code_interpreter_identifier()
    }
    /// <p>The name of the code interpreter session. This name helps you identify and manage the session. The name does not need to be unique.</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 code interpreter session. This name helps you identify and manage the session. The name does not need to be unique.</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 code interpreter session. This name helps you identify and manage the session. The name does not need to be unique.</p>
    pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_name()
    }
    /// <p>The duration in seconds (time-to-live) after which the session automatically terminates, regardless of ongoing activity. Defaults to 900 seconds (15 minutes). Recommended minimum: 60 seconds. Maximum allowed: 28,800 seconds (8 hours).</p>
    pub fn session_timeout_seconds(mut self, input: i32) -> Self {
        self.inner = self.inner.session_timeout_seconds(input);
        self
    }
    /// <p>The duration in seconds (time-to-live) after which the session automatically terminates, regardless of ongoing activity. Defaults to 900 seconds (15 minutes). Recommended minimum: 60 seconds. Maximum allowed: 28,800 seconds (8 hours).</p>
    pub fn set_session_timeout_seconds(mut self, input: ::std::option::Option<i32>) -> Self {
        self.inner = self.inner.set_session_timeout_seconds(input);
        self
    }
    /// <p>The duration in seconds (time-to-live) after which the session automatically terminates, regardless of ongoing activity. Defaults to 900 seconds (15 minutes). Recommended minimum: 60 seconds. Maximum allowed: 28,800 seconds (8 hours).</p>
    pub fn get_session_timeout_seconds(&self) -> &::std::option::Option<i32> {
        self.inner.get_session_timeout_seconds()
    }
    ///
    /// Appends an item to `certificates`.
    ///
    /// To override the contents of this collection use [`set_certificates`](Self::set_certificates).
    ///
    /// <p>A list of certificates to install in the code interpreter session.</p>
    pub fn certificates(mut self, input: crate::types::Certificate) -> Self {
        self.inner = self.inner.certificates(input);
        self
    }
    /// <p>A list of certificates to install in the code interpreter session.</p>
    pub fn set_certificates(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Certificate>>) -> Self {
        self.inner = self.inner.set_certificates(input);
        self
    }
    /// <p>A list of certificates to install in the code interpreter session.</p>
    pub fn get_certificates(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Certificate>> {
        self.inner.get_certificates()
    }
    /// <p>A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock AgentCore ignores the request, but does not return an error. This parameter helps prevent the creation of duplicate sessions if there are temporary network issues.</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 to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock AgentCore ignores the request, but does not return an error. This parameter helps prevent the creation of duplicate sessions if there are temporary network issues.</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 to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock AgentCore ignores the request, but does not return an error. This parameter helps prevent the creation of duplicate sessions if there are temporary network issues.</p>
    pub fn get_client_token(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_client_token()
    }
}