Skip to content

cancel_export_task async

cancel_export_task(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    export_task_id: Optional[ExportVmTaskId] = None,
) -> None

Cancels an active export task. The request removes all artifacts of the export, including any partially-created Amazon S3 objects. If the export task is complete or is in the process of transferring the final disk image, the command fails and returns an error.

Parameters:

  • export_task_id (Optional[ExportVmTaskId], default: None ) –

    The ID of the export task. This is the ID returned by the CreateInstanceExportTask and ExportImage operations.

Raises:

Source code in docs_src/capo_ec2/_services/async_ec2.py
async def cancel_export_task(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    export_task_id: Optional[
        "capo_ec2.types.export_vm_task_id.ExportVmTaskId"
    ] = None,
) -> None:
    """<p>Cancels an active export task. The request removes all artifacts of the export, including any partially-created Amazon S3 objects. If the export task is complete or is in the process of transferring the final disk image, the command fails and returns an error.</p>

    Args:
        export_task_id: <p>The ID of the export task. This is the ID returned by the <code>CreateInstanceExportTask</code> and <code>ExportImage</code> operations.</p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.cancel_export_task_request.CancelExportTaskRequest]",
    ) -> AsyncOperationResponse[None]:
        import capo_ec2._operations.amazon_ec2.cancel_export_task

        (
            output,
            http_response,
        ) = await capo_ec2._operations.amazon_ec2.cancel_export_task.async_cancel_export_task(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CancelExportTask")
    )
    input_: capo_ec2.types.cancel_export_task_request.CancelExportTaskRequest = {}
    if export_task_id is not None:
        input_["export_task_id"] = export_task_id

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