aws-sdk-organizations 1.120.0

AWS SDK for AWS Organizations
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::leave_organization::_leave_organization_input::LeaveOrganizationInputBuilder;

pub use crate::operation::leave_organization::_leave_organization_output::LeaveOrganizationOutputBuilder;

impl crate::operation::leave_organization::builders::LeaveOrganizationInputBuilder {
    /// Sends a request with this input using the given client.
    pub async fn send_with(
        self,
        client: &crate::Client,
    ) -> ::std::result::Result<
        crate::operation::leave_organization::LeaveOrganizationOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::leave_organization::LeaveOrganizationError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let mut fluent_builder = client.leave_organization();
        fluent_builder.inner = self;
        fluent_builder.send().await
    }
}
/// Fluent builder constructing a request to `LeaveOrganization`.
///
/// <p>Removes a member account from its parent organization. This version of the operation is performed by the account that wants to leave. To remove a member account as a user in the management account, use <code>RemoveAccountFromOrganization</code> instead.</p>
/// <p>You can only call from operation from a member account.</p>
/// <p>When an account leaves an organization, Organizations logs a membership event in CloudTrail. The event is an <code>AccountDepartedOrganization</code> event with <code>departedMethod:Left</code> and <code>departedTime</code>. This event is available only in the management account's event history.</p><important>
/// <ul>
/// <li>
/// <p>The management account in an organization with all features enabled can set service control policies (SCPs) that can restrict what administrators of member accounts can do. This includes preventing them from successfully calling <code>LeaveOrganization</code> and leaving the organization.</p></li>
/// <li>
/// <p>You can leave an organization as a member account only if the account is configured with the information required to operate as a standalone account. When you create an account in an organization using the Organizations console, API, or CLI commands, the information required of standalone accounts is <i>not</i> automatically collected. For each account that you want to make standalone, you must perform the following steps. If any of the steps are already completed for this account, that step doesn't appear.</p>
/// <ul>
/// <li>
/// <p>Choose a support plan</p></li>
/// <li>
/// <p>Provide and verify the required contact information</p></li>
/// <li>
/// <p>Provide a current payment method</p></li>
/// </ul>
/// <p>Amazon Web Services uses the payment method to charge for any billable (not free tier) Amazon Web Services activity that occurs while the account isn't attached to an organization. For more information, see <a href="https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_account-before-remove.html">Considerations before removing an account from an organization</a> in the <i>Organizations User Guide</i>.</p></li>
/// <li>
/// <p>The account that you want to leave must not be a delegated administrator account for any Amazon Web Services service enabled for your organization. If the account is a delegated administrator, you must first change the delegated administrator account to another account that is remaining in the organization.</p></li>
/// <li>
/// <p>After the account leaves the organization, all tags that were attached to the account object in the organization are deleted. Amazon Web Services accounts outside of an organization do not support tags.</p></li>
/// <li>
/// <p>A newly created account has a waiting period before it can be removed from its organization. You must wait until at least four days after the account was created. Invited accounts aren't subject to this waiting period.</p></li>
/// <li>
/// <p>If you are using an organization principal to call <code>LeaveOrganization</code> across multiple accounts, you can only do this up to 5 accounts per second in a single organization.</p></li>
/// </ul>
/// </important>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct LeaveOrganizationFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::leave_organization::builders::LeaveOrganizationInputBuilder,
    config_override: ::std::option::Option<crate::config::Builder>,
}
impl
    crate::client::customize::internal::CustomizableSend<
        crate::operation::leave_organization::LeaveOrganizationOutput,
        crate::operation::leave_organization::LeaveOrganizationError,
    > for LeaveOrganizationFluentBuilder
{
    fn send(
        self,
        config_override: crate::config::Builder,
    ) -> crate::client::customize::internal::BoxFuture<
        crate::client::customize::internal::SendResult<
            crate::operation::leave_organization::LeaveOrganizationOutput,
            crate::operation::leave_organization::LeaveOrganizationError,
        >,
    > {
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
    }
}
impl LeaveOrganizationFluentBuilder {
    /// Creates a new `LeaveOrganizationFluentBuilder`.
    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 LeaveOrganization as a reference.
    pub fn as_input(&self) -> &crate::operation::leave_organization::builders::LeaveOrganizationInputBuilder {
        &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::leave_organization::LeaveOrganizationOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::leave_organization::LeaveOrganizationError,
            ::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::leave_organization::LeaveOrganization::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            self.config_override,
        );
        crate::operation::leave_organization::LeaveOrganization::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::leave_organization::LeaveOrganizationOutput,
        crate::operation::leave_organization::LeaveOrganizationError,
        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
    }
}