Skip to content

cancel_conversion_task

cancel_conversion_task(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    dry_run: Optional[Boolean] = None,
    conversion_task_id: Optional[ConversionTaskId] = None,
    reason_message: Optional[String] = None,
) -> None

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/ec2.py
def cancel_conversion_task(
    self,
    *,
    config_overrides: Optional[EC2ClientConfig] = 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.
    """

    def _handler(
        req: "OperationRequest[capo_ec2.types.cancel_conversion_request.CancelConversionRequest]",
    ) -> OperationResponse[None]:
        import capo_ec2._operations.amazon_ec2.cancel_conversion_task

        output, http_response = (
            capo_ec2._operations.amazon_ec2.cancel_conversion_task.cancel_conversion_task(
                req.options, req.input
            )
        )
        return OperationResponse(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 = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output