Skip to content

cancel_export_task

cancel_export_task(
    task_id: ExportTaskId,
    *,
    config_overrides: Optional[CloudWatchLogsClientConfig] = None,
) -> None

Cancels the specified export task.

The task must be in the PENDING or RUNNING state.

Parameters:

Raises:

Source code in docs_src/capo_cloudwatch_logs/_services/cloud_watch_logs.py
def cancel_export_task(
    self,
    task_id: "capo_cloudwatch_logs.types.export_task_id.ExportTaskId",
    *,
    config_overrides: Optional[CloudWatchLogsClientConfig] = None,
) -> None:
    """<p>Cancels the specified export task.</p> <p>The task must be in the <code>PENDING</code> or <code>RUNNING</code> state.</p>

    Args:
        task_id: <p>The ID of the export task.</p>

    Raises:
        capo_cloudwatch_logs.errors.invalid_operation_exception.InvalidOperationException: <p>The operation is not valid on the specified resource.</p>
        capo_cloudwatch_logs.errors.invalid_parameter_exception.InvalidParameterException: <p>A parameter is specified incorrectly.</p>
        capo_cloudwatch_logs.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_cloudwatch_logs.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service cannot complete the request.</p>
        capo_cloudwatch_logs.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cloudwatch_logs.types.cancel_export_task_request.CancelExportTaskRequest]",
    ) -> OperationResponse[None]:
        import capo_cloudwatch_logs._operations.logs_20140328.cancel_export_task

        output, http_response = (
            capo_cloudwatch_logs._operations.logs_20140328.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_cloudwatch_logs.types.cancel_export_task_request.CancelExportTaskRequest = {
        "task_id": task_id
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output