aws-sdk-opsworks 0.27.0

AWS SDK for AWS OpsWorks
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::set_permission::_set_permission_output::SetPermissionOutputBuilder;

pub use crate::operation::set_permission::_set_permission_input::SetPermissionInputBuilder;

/// Fluent builder constructing a request to `SetPermission`.
///
/// <p>Specifies a user's permissions. For more information, see <a href="https://docs.aws.amazon.com/opsworks/latest/userguide/workingsecurity.html">Security and Permissions</a>.</p>
/// <p> <b>Required Permissions</b>: To use this action, an IAM user must have a Manage permissions level for the stack, or an attached policy that explicitly grants permissions. For more information on user permissions, see <a href="https://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-users.html">Managing User Permissions</a>.</p>
#[derive(std::clone::Clone, std::fmt::Debug)]
pub struct SetPermissionFluentBuilder {
    handle: std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::set_permission::builders::SetPermissionInputBuilder,
}
impl SetPermissionFluentBuilder {
    /// Creates a new `SetPermission`.
    pub(crate) fn new(handle: std::sync::Arc<crate::client::Handle>) -> Self {
        Self {
            handle,
            inner: Default::default(),
        }
    }
    /// Consume this builder, creating a customizable operation that can be modified before being
    /// sent. The operation's inner [http::Request] can be modified as well.
    pub async fn customize(
        self,
    ) -> std::result::Result<
        crate::client::customize::CustomizableOperation<
            crate::operation::set_permission::SetPermission,
            aws_http::retry::AwsResponseRetryClassifier,
        >,
        aws_smithy_http::result::SdkError<crate::operation::set_permission::SetPermissionError>,
    > {
        let handle = self.handle.clone();
        let operation = self
            .inner
            .build()
            .map_err(aws_smithy_http::result::SdkError::construction_failure)?
            .make_operation(&handle.conf)
            .await
            .map_err(aws_smithy_http::result::SdkError::construction_failure)?;
        Ok(crate::client::customize::CustomizableOperation { handle, operation })
    }

    /// 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::set_permission::SetPermissionOutput,
        aws_smithy_http::result::SdkError<crate::operation::set_permission::SetPermissionError>,
    > {
        let op = self
            .inner
            .build()
            .map_err(aws_smithy_http::result::SdkError::construction_failure)?
            .make_operation(&self.handle.conf)
            .await
            .map_err(aws_smithy_http::result::SdkError::construction_failure)?;
        self.handle.client.call(op).await
    }
    /// <p>The stack ID.</p>
    pub fn stack_id(mut self, input: impl Into<std::string::String>) -> Self {
        self.inner = self.inner.stack_id(input.into());
        self
    }
    /// <p>The stack ID.</p>
    pub fn set_stack_id(mut self, input: std::option::Option<std::string::String>) -> Self {
        self.inner = self.inner.set_stack_id(input);
        self
    }
    /// <p>The user's IAM ARN. This can also be a federated user's ARN.</p>
    pub fn iam_user_arn(mut self, input: impl Into<std::string::String>) -> Self {
        self.inner = self.inner.iam_user_arn(input.into());
        self
    }
    /// <p>The user's IAM ARN. This can also be a federated user's ARN.</p>
    pub fn set_iam_user_arn(mut self, input: std::option::Option<std::string::String>) -> Self {
        self.inner = self.inner.set_iam_user_arn(input);
        self
    }
    /// <p>The user is allowed to use SSH to communicate with the instance.</p>
    pub fn allow_ssh(mut self, input: bool) -> Self {
        self.inner = self.inner.allow_ssh(input);
        self
    }
    /// <p>The user is allowed to use SSH to communicate with the instance.</p>
    pub fn set_allow_ssh(mut self, input: std::option::Option<bool>) -> Self {
        self.inner = self.inner.set_allow_ssh(input);
        self
    }
    /// <p>The user is allowed to use <b>sudo</b> to elevate privileges.</p>
    pub fn allow_sudo(mut self, input: bool) -> Self {
        self.inner = self.inner.allow_sudo(input);
        self
    }
    /// <p>The user is allowed to use <b>sudo</b> to elevate privileges.</p>
    pub fn set_allow_sudo(mut self, input: std::option::Option<bool>) -> Self {
        self.inner = self.inner.set_allow_sudo(input);
        self
    }
    /// <p>The user's permission level, which must be set to one of the following strings. You cannot set your own permissions level.</p>
    /// <ul>
    /// <li> <p> <code>deny</code> </p> </li>
    /// <li> <p> <code>show</code> </p> </li>
    /// <li> <p> <code>deploy</code> </p> </li>
    /// <li> <p> <code>manage</code> </p> </li>
    /// <li> <p> <code>iam_only</code> </p> </li>
    /// </ul>
    /// <p>For more information about the permissions associated with these levels, see <a href="https://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-users.html">Managing User Permissions</a>.</p>
    pub fn level(mut self, input: impl Into<std::string::String>) -> Self {
        self.inner = self.inner.level(input.into());
        self
    }
    /// <p>The user's permission level, which must be set to one of the following strings. You cannot set your own permissions level.</p>
    /// <ul>
    /// <li> <p> <code>deny</code> </p> </li>
    /// <li> <p> <code>show</code> </p> </li>
    /// <li> <p> <code>deploy</code> </p> </li>
    /// <li> <p> <code>manage</code> </p> </li>
    /// <li> <p> <code>iam_only</code> </p> </li>
    /// </ul>
    /// <p>For more information about the permissions associated with these levels, see <a href="https://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-users.html">Managing User Permissions</a>.</p>
    pub fn set_level(mut self, input: std::option::Option<std::string::String>) -> Self {
        self.inner = self.inner.set_level(input);
        self
    }
}