Skip to content

cancel_job async

cancel_job(
    job_id: JobId, *, config_overrides: Optional[AsyncSnowballClientConfig] = None
) -> CancelJobResult

Cancels the specified job. You can only cancel a job before its JobState value changes to PreparingAppliance. Requesting the ListJobs or DescribeJob action returns a job's JobState as part of the response element data returned.

Parameters:

  • job_id (JobId) –

    The 39-character job ID for the job that you want to cancel, for example JID123e4567-e89b-12d3-a456-426655440000.

Raises:

Examples:

To cancel a job for a Snowball device This operation cancels a job. You can only cancel a job before its JobState value changes to PreparingAppliance.

>>> await client.cancel_job(job_id='JID123e4567-e89b-12d3-a456-426655440000')
Source code in docs_src/capo_snowball/_services/async_snowball.py
async def cancel_job(
    self,
    job_id: "capo_snowball.types.job_id.JobId",
    *,
    config_overrides: Optional[AsyncSnowballClientConfig] = None,
) -> "capo_snowball.types.cancel_job_result.CancelJobResult":
    """<p>Cancels the specified job. You can only cancel a job before its <code>JobState</code> value changes to <code>PreparingAppliance</code>. Requesting the <code>ListJobs</code> or <code>DescribeJob</code> action returns a job's <code>JobState</code> as part of the response element data returned.</p>

    Args:
        job_id: <p>The 39-character job ID for the job that you want to cancel, for example <code>JID123e4567-e89b-12d3-a456-426655440000</code>.</p>

    Raises:
        capo_snowball.errors.invalid_job_state_exception.InvalidJobStateException: <p>The action can't be performed because the job's current state doesn't allow that action to be performed.</p>
        capo_snowball.errors.invalid_resource_exception.InvalidResourceException: <p>The specified resource can't be found. Check the information you provided in your last request, and try again.</p>
        capo_snowball.errors.kms_request_failed_exception.KMSRequestFailedException: <p>The provided Key Management Service key lacks the permissions to perform the specified <a>CreateJob</a> or <a>UpdateJob</a> action.</p>
        capo_snowball.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To cancel a job for a Snowball device
        This operation cancels a job. You can only cancel a job before its JobState value changes to PreparingAppliance.

        >>> await client.cancel_job(job_id='JID123e4567-e89b-12d3-a456-426655440000')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_snowball.types.cancel_job_request.CancelJobRequest]",
    ) -> AsyncOperationResponse[
        "capo_snowball.types.cancel_job_result.CancelJobResult"
    ]:
        import capo_snowball._operations.awsie_snowball_job_management_service.cancel_job

        (
            output,
            http_response,
        ) = await capo_snowball._operations.awsie_snowball_job_management_service.cancel_job.async_cancel_job(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CancelJob")
    )
    input_: capo_snowball.types.cancel_job_request.CancelJobRequest = {
        "job_id": job_id
    }

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