Cancels an active conversion task. The task can be the import of an instance or volume. The action removes all artifacts of the conversion, including a partially uploaded volume or instance. If the conversion is complete or is in the process of transferring the final disk image, the command fails and returns an exception.
Parameters:
-
dry_run
(Optional[Boolean], default:
None
)
–
Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.
-
conversion_task_id
(Optional[ConversionTaskId], default:
None
)
–
The ID of the conversion task.
-
reason_message
(Optional[String], default:
None
)
–
The reason for canceling the conversion task.
Raises:
Source code in docs_src/capo_ec2/_services/async_ec2.py
| async def cancel_conversion_task(
self,
*,
config_overrides: Optional[AsyncEC2ClientConfig] = None,
dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
conversion_task_id: Optional[
"capo_ec2.types.conversion_task_id.ConversionTaskId"
] = None,
reason_message: Optional["capo_ec2.types.string.String"] = None,
) -> None:
"""<p>Cancels an active conversion task. The task can be the import of an instance or volume. The action removes all artifacts of the conversion, including a partially uploaded volume or instance. If the conversion is complete or is in the process of transferring the final disk image, the command fails and returns an exception.</p>
Args:
dry_run: <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
conversion_task_id: <p>The ID of the conversion task.</p>
reason_message: <p>The reason for canceling the conversion task.</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_conversion_request.CancelConversionRequest]",
) -> AsyncOperationResponse[None]:
import capo_ec2._operations.amazon_ec2.cancel_conversion_task
(
output,
http_response,
) = await capo_ec2._operations.amazon_ec2.cancel_conversion_task.async_cancel_conversion_task(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("CancelConversionTask")
)
input_: capo_ec2.types.cancel_conversion_request.CancelConversionRequest = {}
if dry_run is not None:
input_["dry_run"] = dry_run
if conversion_task_id is not None:
input_["conversion_task_id"] = conversion_task_id
if reason_message is not None:
input_["reason_message"] = reason_message
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|