Skip to content

delete_resource async

delete_resource(
    organization_id: OrganizationId,
    resource_id: EntityIdentifier,
    *,
    config_overrides: Optional[AsyncWorkMailClientConfig] = None,
) -> DeleteResourceResponse

Deletes the specified resource.

Parameters:

  • organization_id (OrganizationId) –

    The identifier associated with the organization from which the resource is deleted.

  • resource_id (EntityIdentifier) –

    The identifier of the resource to be deleted.

    The identifier can accept ResourceId, or Resourcename. The following identity formats are available:

    • Resource ID: r-0123456789a0123456789b0123456789

    • Resource name: resource

Raises:

Source code in docs_src/capo_workmail/_services/async_work_mail.py
async def delete_resource(
    self,
    organization_id: "capo_workmail.types.organization_id.OrganizationId",
    resource_id: "capo_workmail.types.entity_identifier.EntityIdentifier",
    *,
    config_overrides: Optional[AsyncWorkMailClientConfig] = None,
) -> "capo_workmail.types.delete_resource_response.DeleteResourceResponse":
    """<p>Deletes the specified resource.</p>

    Args:
        organization_id: <p>The identifier associated with the organization from which the resource is deleted.</p>
        resource_id: <p>The identifier of the resource to be deleted.</p> <p>The identifier can accept <i>ResourceId</i>, or <i>Resourcename</i>. The following identity formats are available:</p> <ul> <li> <p>Resource ID: r-0123456789a0123456789b0123456789</p> </li> <li> <p>Resource name: resource</p> </li> </ul>

    Raises:
        capo_workmail.errors.entity_state_exception.EntityStateException: <p>You are performing an operation on a user, group, or resource that isn't in the expected state, such as trying to delete an active user.</p>
        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.unsupported_operation_exception.UnsupportedOperationException: <p>You can't perform a write operation against a read-only directory.</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_resource_request.DeleteResourceRequest]",
    ) -> AsyncOperationResponse[
        "capo_workmail.types.delete_resource_response.DeleteResourceResponse"
    ]:
        import capo_workmail._operations.work_mail_service.delete_resource

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteResource")
    )
    input_: capo_workmail.types.delete_resource_request.DeleteResourceRequest = {
        "organization_id": organization_id,
        "resource_id": resource_id,
    }

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