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/async_work_spaces.py
| async def delete_workspace_image(
self,
image_id: "capo_workspaces.types.workspace_image_id.WorkspaceImageId",
*,
config_overrides: Optional[AsyncWorkSpacesClientConfig] = 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.
"""
async def _handler(
req: "AsyncOperationRequest[capo_workspaces.types.delete_workspace_image_request.DeleteWorkspaceImageRequest]",
) -> AsyncOperationResponse[
"capo_workspaces.types.delete_workspace_image_result.DeleteWorkspaceImageResult"
]:
import capo_workspaces._operations.workspaces_service.delete_workspace_image
(
output,
http_response,
) = await capo_workspaces._operations.workspaces_service.delete_workspace_image.async_delete_workspace_image(
req.options, req.input
)
return AsyncOperationResponse(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 = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|