aws-sdk-bedrockagentcore 1.11.0

AWS SDK for Amazon Bedrock AgentCore Data Plane Fronting Layer
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::invoke_code_interpreter::_invoke_code_interpreter_output::InvokeCodeInterpreterOutputBuilder;

pub use crate::operation::invoke_code_interpreter::_invoke_code_interpreter_input::InvokeCodeInterpreterInputBuilder;

impl crate::operation::invoke_code_interpreter::builders::InvokeCodeInterpreterInputBuilder {
    /// Sends a request with this input using the given client.
    pub async fn send_with(
        self,
        client: &crate::Client,
    ) -> ::std::result::Result<
        crate::operation::invoke_code_interpreter::InvokeCodeInterpreterOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::invoke_code_interpreter::InvokeCodeInterpreterError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let mut fluent_builder = client.invoke_code_interpreter();
        fluent_builder.inner = self;
        fluent_builder.send().await
    }
}
/// Fluent builder constructing a request to `InvokeCodeInterpreter`.
///
/// <p>Executes code within an active code interpreter session in Amazon Bedrock. This operation processes the provided code, runs it in a secure environment, and returns the execution results including output, errors, and generated visualizations.</p>
/// <p>To execute code, you must specify the code interpreter identifier, session ID, and the code to run in the arguments parameter. The operation returns a stream containing the execution results, which can include text output, error messages, and data visualizations.</p>
/// <p>This operation is subject to request rate limiting based on your account's service quotas.</p>
/// <p>The following operations are related to <code>InvokeCodeInterpreter</code>:</p>
/// <ul>
/// <li>
/// <p><a href="https://docs.aws.amazon.com/API_StartCodeInterpreterSession.html">StartCodeInterpreterSession</a></p></li>
/// <li>
/// <p><a href="https://docs.aws.amazon.com/API_GetCodeInterpreterSession.html">GetCodeInterpreterSession</a></p></li>
/// </ul>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct InvokeCodeInterpreterFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::invoke_code_interpreter::builders::InvokeCodeInterpreterInputBuilder,
    config_override: ::std::option::Option<crate::config::Builder>,
}
impl
    crate::client::customize::internal::CustomizableSend<
        crate::operation::invoke_code_interpreter::InvokeCodeInterpreterOutput,
        crate::operation::invoke_code_interpreter::InvokeCodeInterpreterError,
    > for InvokeCodeInterpreterFluentBuilder
{
    fn send(
        self,
        config_override: crate::config::Builder,
    ) -> crate::client::customize::internal::BoxFuture<
        crate::client::customize::internal::SendResult<
            crate::operation::invoke_code_interpreter::InvokeCodeInterpreterOutput,
            crate::operation::invoke_code_interpreter::InvokeCodeInterpreterError,
        >,
    > {
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
    }
}
impl InvokeCodeInterpreterFluentBuilder {
    /// Creates a new `InvokeCodeInterpreterFluentBuilder`.
    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 InvokeCodeInterpreter as a reference.
    pub fn as_input(&self) -> &crate::operation::invoke_code_interpreter::builders::InvokeCodeInterpreterInputBuilder {
        &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::invoke_code_interpreter::InvokeCodeInterpreterOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::invoke_code_interpreter::InvokeCodeInterpreterError,
            ::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::invoke_code_interpreter::InvokeCodeInterpreter::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            self.config_override,
        );
        crate::operation::invoke_code_interpreter::InvokeCodeInterpreter::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::invoke_code_interpreter::InvokeCodeInterpreterOutput,
        crate::operation::invoke_code_interpreter::InvokeCodeInterpreterError,
        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 unique identifier of the code interpreter associated with the session. This must match the identifier used when creating the session with <code>StartCodeInterpreterSession</code>.</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 associated with the session. This must match the identifier used when creating the session with <code>StartCodeInterpreterSession</code>.</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 associated with the session. This must match the identifier used when creating the session with <code>StartCodeInterpreterSession</code>.</p>
    pub fn get_code_interpreter_identifier(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_code_interpreter_identifier()
    }
    /// <p>The unique identifier of the code interpreter session to use. This must be an active session created with <code>StartCodeInterpreterSession</code>. If the session has expired or been stopped, the request will fail.</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 unique identifier of the code interpreter session to use. This must be an active session created with <code>StartCodeInterpreterSession</code>. If the session has expired or been stopped, the request will fail.</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 unique identifier of the code interpreter session to use. This must be an active session created with <code>StartCodeInterpreterSession</code>. If the session has expired or been stopped, the request will fail.</p>
    pub fn get_session_id(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_session_id()
    }
    /// <p>The name of the code interpreter to invoke.</p>
    pub fn name(mut self, input: crate::types::ToolName) -> Self {
        self.inner = self.inner.name(input);
        self
    }
    /// <p>The name of the code interpreter to invoke.</p>
    pub fn set_name(mut self, input: ::std::option::Option<crate::types::ToolName>) -> Self {
        self.inner = self.inner.set_name(input);
        self
    }
    /// <p>The name of the code interpreter to invoke.</p>
    pub fn get_name(&self) -> &::std::option::Option<crate::types::ToolName> {
        self.inner.get_name()
    }
    /// <p>The arguments for the code interpreter. This includes the code to execute and any additional parameters such as the programming language, whether to clear the execution context, and other execution options. The structure of this parameter depends on the specific code interpreter being used.</p>
    pub fn arguments(mut self, input: crate::types::ToolArguments) -> Self {
        self.inner = self.inner.arguments(input);
        self
    }
    /// <p>The arguments for the code interpreter. This includes the code to execute and any additional parameters such as the programming language, whether to clear the execution context, and other execution options. The structure of this parameter depends on the specific code interpreter being used.</p>
    pub fn set_arguments(mut self, input: ::std::option::Option<crate::types::ToolArguments>) -> Self {
        self.inner = self.inner.set_arguments(input);
        self
    }
    /// <p>The arguments for the code interpreter. This includes the code to execute and any additional parameters such as the programming language, whether to clear the execution context, and other execution options. The structure of this parameter depends on the specific code interpreter being used.</p>
    pub fn get_arguments(&self) -> &::std::option::Option<crate::types::ToolArguments> {
        self.inner.get_arguments()
    }
}