Skip to content

delete_workspace_image

delete_workspace_image(
    image_id: WorkspaceImageId,
    *,
    config_overrides: Optional[WorkSpacesClientConfig] = None,
) -> DeleteWorkspaceImageResult

Deletes the specified image from your account. To delete an image, you must first delete any bundles that are associated with the image and unshare the image if it is shared with other accounts.

Parameters:

Raises:

Source code in docs_src/capo_workspaces/_services/work_spaces.py
def delete_workspace_image(
    self,
    image_id: "capo_workspaces.types.workspace_image_id.WorkspaceImageId",
    *,
    config_overrides: Optional[WorkSpacesClientConfig] = None,
) -> (
    "capo_workspaces.types.delete_workspace_image_result.DeleteWorkspaceImageResult"
):
    """<p>Deletes the specified image from your account. To delete an image, you must first delete any bundles that are associated with the image and unshare the image if it is shared with other accounts. </p>

    Args:
        image_id: <p>The identifier of the image.</p>

    Raises:
        capo_workspaces.errors.access_denied_exception.AccessDeniedException: <p>The user is not authorized to access a resource.</p>
        capo_workspaces.errors.invalid_resource_state_exception.InvalidResourceStateException: <p>The state of the resource is not valid for this operation.</p>
        capo_workspaces.errors.resource_associated_exception.ResourceAssociatedException: <p>The resource is associated with a directory.</p>
        capo_workspaces.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_workspaces.types.delete_workspace_image_request.DeleteWorkspaceImageRequest]",
    ) -> OperationResponse[
        "capo_workspaces.types.delete_workspace_image_result.DeleteWorkspaceImageResult"
    ]:
        import capo_workspaces._operations.workspaces_service.delete_workspace_image

        output, http_response = (
            capo_workspaces._operations.workspaces_service.delete_workspace_image.delete_workspace_image(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteWorkspaceImage")
    )
    input_: capo_workspaces.types.delete_workspace_image_request.DeleteWorkspaceImageRequest = {
        "image_id": image_id
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output