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/ec2.py
| def cancel_export_task(
self,
*,
config_overrides: Optional[EC2ClientConfig] = 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.
"""
def _handler(
req: "OperationRequest[capo_ec2.types.cancel_export_task_request.CancelExportTaskRequest]",
) -> OperationResponse[None]:
import capo_ec2._operations.amazon_ec2.cancel_export_task
output, http_response = (
capo_ec2._operations.amazon_ec2.cancel_export_task.cancel_export_task(
req.options, req.input
)
)
return OperationResponse(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 = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|