aws-sdk-iam 1.122.0

AWS SDK for AWS Identity and Access Management
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::acquire_role::_acquire_role_input::AcquireRoleInputBuilder;

pub use crate::operation::acquire_role::_acquire_role_output::AcquireRoleOutputBuilder;

impl crate::operation::acquire_role::builders::AcquireRoleInputBuilder {
    /// Sends a request with this input using the given client.
    pub async fn send_with(
        self,
        client: &crate::Client,
    ) -> ::std::result::Result<
        crate::operation::acquire_role::AcquireRoleOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::acquire_role::AcquireRoleError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let mut fluent_builder = client.acquire_role();
        fluent_builder.inner = self;
        fluent_builder.send().await
    }
}
/// Fluent builder constructing a request to `AcquireRole`.
///
/// <p>Creates an IAM role from the specified role template. The new role takes its configuration—including its name, path, trust policy, inline and managed policies, permissions boundary, tags, and maximum session duration—from the role template version that you specify. For more information about roles, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html">IAM roles</a> in the <i>IAM User Guide</i>.</p>
/// <p>If the template version defines parameters, use the <code>ReplacementValues</code> parameter to supply the values that the service substitutes into the role during creation.</p>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct AcquireRoleFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::acquire_role::builders::AcquireRoleInputBuilder,
    config_override: ::std::option::Option<crate::config::Builder>,
}
impl
    crate::client::customize::internal::CustomizableSend<
        crate::operation::acquire_role::AcquireRoleOutput,
        crate::operation::acquire_role::AcquireRoleError,
    > for AcquireRoleFluentBuilder
{
    fn send(
        self,
        config_override: crate::config::Builder,
    ) -> crate::client::customize::internal::BoxFuture<
        crate::client::customize::internal::SendResult<
            crate::operation::acquire_role::AcquireRoleOutput,
            crate::operation::acquire_role::AcquireRoleError,
        >,
    > {
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
    }
}
impl AcquireRoleFluentBuilder {
    /// Creates a new `AcquireRoleFluentBuilder`.
    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 AcquireRole as a reference.
    pub fn as_input(&self) -> &crate::operation::acquire_role::builders::AcquireRoleInputBuilder {
        &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::acquire_role::AcquireRoleOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::acquire_role::AcquireRoleError,
            ::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::acquire_role::AcquireRole::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            self.config_override,
        );
        crate::operation::acquire_role::AcquireRole::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::acquire_role::AcquireRoleOutput,
        crate::operation::acquire_role::AcquireRoleError,
        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 Amazon Resource Name (ARN) of the role template to create the role from.</p>
    /// <p>For more information about ARNs, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names (ARNs)</a> in the <i>Amazon Web Services General Reference</i>.</p>
    pub fn template_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.template_arn(input.into());
        self
    }
    /// <p>The Amazon Resource Name (ARN) of the role template to create the role from.</p>
    /// <p>For more information about ARNs, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names (ARNs)</a> in the <i>Amazon Web Services General Reference</i>.</p>
    pub fn set_template_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_template_arn(input);
        self
    }
    /// <p>The Amazon Resource Name (ARN) of the role template to create the role from.</p>
    /// <p>For more information about ARNs, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names (ARNs)</a> in the <i>Amazon Web Services General Reference</i>.</p>
    pub fn get_template_arn(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_template_arn()
    }
    /// <p>The minor version of the role template to use. If you do not specify a minor version, the service uses the template's default minor version.</p>
    pub fn template_minor_version(mut self, input: i32) -> Self {
        self.inner = self.inner.template_minor_version(input);
        self
    }
    /// <p>The minor version of the role template to use. If you do not specify a minor version, the service uses the template's default minor version.</p>
    pub fn set_template_minor_version(mut self, input: ::std::option::Option<i32>) -> Self {
        self.inner = self.inner.set_template_minor_version(input);
        self
    }
    /// <p>The minor version of the role template to use. If you do not specify a minor version, the service uses the template's default minor version.</p>
    pub fn get_template_minor_version(&self) -> &::std::option::Option<i32> {
        self.inner.get_template_minor_version()
    }
    ///
    /// Adds a key-value pair to `ReplacementValues`.
    ///
    /// To override the contents of this collection use [`set_replacement_values`](Self::set_replacement_values).
    ///
    /// <p>A map of values to substitute for the parameters that are defined in the role template version. Each key is a parameter name from the template, and each value is a structure that contains the replacement values for that parameter.</p>
    pub fn replacement_values(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::ReplacementValueEntry) -> Self {
        self.inner = self.inner.replacement_values(k.into(), v);
        self
    }
    /// <p>A map of values to substitute for the parameters that are defined in the role template version. Each key is a parameter name from the template, and each value is a structure that contains the replacement values for that parameter.</p>
    pub fn set_replacement_values(
        mut self,
        input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::ReplacementValueEntry>>,
    ) -> Self {
        self.inner = self.inner.set_replacement_values(input);
        self
    }
    /// <p>A map of values to substitute for the parameters that are defined in the role template version. Each key is a parameter name from the template, and each value is a structure that contains the replacement values for that parameter.</p>
    pub fn get_replacement_values(
        &self,
    ) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::ReplacementValueEntry>> {
        self.inner.get_replacement_values()
    }
}