Skip to content

delete_organization async

delete_organization(
    organization_id: OrganizationId,
    delete_directory: Boolean,
    *,
    config_overrides: Optional[AsyncWorkMailClientConfig] = None,
    client_token: Optional[IdempotencyClientToken] = None,
    force_delete: Optional[Boolean] = None,
    delete_identity_center_application: Optional[Boolean] = None,
) -> DeleteOrganizationResponse

Deletes an WorkMail organization and all underlying AWS resources managed by WorkMail as part of the organization. You can choose whether to delete the associated directory. For more information, see Removing an organization in the WorkMail Administrator Guide.

Parameters:

  • client_token (Optional[IdempotencyClientToken], default: None ) –

    The idempotency token associated with the request.

  • organization_id (OrganizationId) –

    The organization ID.

  • delete_directory (Boolean) –

    If true, deletes the AWS Directory Service directory associated with the organization.

  • force_delete (Optional[Boolean], default: None ) –

    Deletes a WorkMail organization even if the organization has enabled users.

  • delete_identity_center_application (Optional[Boolean], default: None ) –

    Deletes IAM Identity Center application for WorkMail. This action does not affect authentication settings for any organization.

Raises:

Source code in docs_src/capo_workmail/_services/async_work_mail.py
async def delete_organization(
    self,
    organization_id: "capo_workmail.types.organization_id.OrganizationId",
    delete_directory: "capo_workmail.types.boolean.Boolean",
    *,
    config_overrides: Optional[AsyncWorkMailClientConfig] = None,
    client_token: Optional[
        "capo_workmail.types.idempotency_client_token.IdempotencyClientToken"
    ] = None,
    force_delete: Optional["capo_workmail.types.boolean.Boolean"] = None,
    delete_identity_center_application: Optional[
        "capo_workmail.types.boolean.Boolean"
    ] = None,
) -> "capo_workmail.types.delete_organization_response.DeleteOrganizationResponse":
    """<p>Deletes an WorkMail organization and all underlying AWS resources managed by WorkMail as part of the organization. You can choose whether to delete the associated directory. For more information, see <a href="https://docs.aws.amazon.com/workmail/latest/adminguide/remove_organization.html">Removing an organization</a> in the <i>WorkMail Administrator Guide</i>.</p>

    Args:
        client_token: <p>The idempotency token associated with the request.</p>
        organization_id: <p>The organization ID.</p>
        delete_directory: <p>If true, deletes the AWS Directory Service directory associated with the organization.</p>
        force_delete: <p>Deletes a WorkMail organization even if the organization has enabled users.</p>
        delete_identity_center_application: <p>Deletes IAM Identity Center application for WorkMail. This action does not affect authentication settings for any organization.</p>

    Raises:
        capo_workmail.errors.invalid_parameter_exception.InvalidParameterException: <p>One or more of the input parameters don't match the service's restrictions.</p>
        capo_workmail.errors.organization_not_found_exception.OrganizationNotFoundException: <p>An operation received a valid organization identifier that either doesn't belong or exist in the system.</p>
        capo_workmail.errors.organization_state_exception.OrganizationStateException: <p>The organization must have a valid state to perform certain operations on the organization or its members.</p>
        capo_workmail.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_workmail.types.delete_organization_request.DeleteOrganizationRequest]",
    ) -> AsyncOperationResponse[
        "capo_workmail.types.delete_organization_response.DeleteOrganizationResponse"
    ]:
        import capo_workmail._operations.work_mail_service.delete_organization

        (
            output,
            http_response,
        ) = await capo_workmail._operations.work_mail_service.delete_organization.async_delete_organization(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteOrganization")
    )
    input_: capo_workmail.types.delete_organization_request.DeleteOrganizationRequest = {
        "organization_id": organization_id,
        "delete_directory": delete_directory,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if force_delete is not None:
        input_["force_delete"] = force_delete
    if delete_identity_center_application is not None:
        input_["delete_identity_center_application"] = (
            delete_identity_center_application
        )

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output