Stops a CloudWatch Logs Insights query that is in progress. If the query has already ended, the operation returns an error indicating that the specified query is not running.
This operation can be used to cancel both interactive queries and individual scheduled query executions. When used with scheduled queries, StopQuery cancels only the specific execution identified by the query ID, not the scheduled query configuration itself.
Parameters:
-
query_id
(QueryId)
–
The ID number of the query to stop. To find this ID number, use DescribeQueries.
Raises:
Source code in docs_src/capo_cloudwatch_logs/_services/cloud_watch_logs.py
| def stop_query(
self,
query_id: "capo_cloudwatch_logs.types.query_id.QueryId",
*,
config_overrides: Optional[CloudWatchLogsClientConfig] = None,
) -> "capo_cloudwatch_logs.types.stop_query_response.StopQueryResponse":
"""<p>Stops a CloudWatch Logs Insights query that is in progress. If the query has already ended, the operation returns an error indicating that the specified query is not running.</p> <p>This operation can be used to cancel both interactive queries and individual scheduled query executions. When used with scheduled queries, <code>StopQuery</code> cancels only the specific execution identified by the query ID, not the scheduled query configuration itself.</p>
Args:
query_id: <p>The ID number of the query to stop. To find this ID number, use <code>DescribeQueries</code>.</p>
Raises:
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.stop_query_request.StopQueryRequest]",
) -> OperationResponse[
"capo_cloudwatch_logs.types.stop_query_response.StopQueryResponse"
]:
import capo_cloudwatch_logs._operations.logs_20140328.stop_query
output, http_response = (
capo_cloudwatch_logs._operations.logs_20140328.stop_query.stop_query(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("StopQuery")
)
input_: capo_cloudwatch_logs.types.stop_query_request.StopQueryRequest = {
"query_id": query_id
}
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|