Skip to content

describe_query_definitions

describe_query_definitions(
    *,
    config_overrides: Optional[CloudWatchLogsClientConfig] = None,
    query_language: Optional[QueryLanguage] = None,
    query_definition_name_prefix: Optional[QueryDefinitionName] = None,
    max_results: Optional[QueryListMaxResults] = None,
    next_token: Optional[NextToken] = None,
) -> DescribeQueryDefinitionsResponse

This operation returns a paginated list of your saved CloudWatch Logs Insights query definitions. You can retrieve query definitions from the current account or from a source account that is linked to the current account.

You can use the queryDefinitionNamePrefix parameter to limit the results to only the query definitions that have names that start with a certain string.

Parameters:

  • query_language (Optional[QueryLanguage], default: None ) –

    The query language used for this query. For more information about the query languages that CloudWatch Logs supports, see Supported query languages.

  • query_definition_name_prefix (Optional[QueryDefinitionName], default: None ) –

    Use this parameter to filter your results to only the query definitions that have names that start with the prefix you specify.

  • max_results (Optional[QueryListMaxResults], default: None ) –

    Limits the number of returned query definitions to the specified number.

Raises:

Source code in docs_src/capo_cloudwatch_logs/_services/cloud_watch_logs.py
def describe_query_definitions(
    self,
    *,
    config_overrides: Optional[CloudWatchLogsClientConfig] = None,
    query_language: Optional[
        "capo_cloudwatch_logs.types.query_language.QueryLanguage"
    ] = None,
    query_definition_name_prefix: Optional[
        "capo_cloudwatch_logs.types.query_definition_name.QueryDefinitionName"
    ] = None,
    max_results: Optional[
        "capo_cloudwatch_logs.types.query_list_max_results.QueryListMaxResults"
    ] = None,
    next_token: Optional["capo_cloudwatch_logs.types.next_token.NextToken"] = None,
) -> "capo_cloudwatch_logs.types.describe_query_definitions_response.DescribeQueryDefinitionsResponse":
    """<p>This operation returns a paginated list of your saved CloudWatch Logs Insights query definitions. You can retrieve query definitions from the current account or from a source account that is linked to the current account.</p> <p>You can use the <code>queryDefinitionNamePrefix</code> parameter to limit the results to only the query definitions that have names that start with a certain string.</p>

    Args:
        query_language: <p>The query language used for this query. For more information about the query languages that CloudWatch Logs supports, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_AnalyzeLogData_Languages.html">Supported query languages</a>.</p>
        query_definition_name_prefix: <p>Use this parameter to filter your results to only the query definitions that have names that start with the prefix you specify.</p>
        max_results: <p>Limits the number of returned query definitions to the specified number.</p>

    Raises:
        capo_cloudwatch_logs.errors.invalid_parameter_exception.InvalidParameterException: <p>A parameter is specified incorrectly.</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.describe_query_definitions_request.DescribeQueryDefinitionsRequest]",
    ) -> OperationResponse[
        "capo_cloudwatch_logs.types.describe_query_definitions_response.DescribeQueryDefinitionsResponse"
    ]:
        import capo_cloudwatch_logs._operations.logs_20140328.describe_query_definitions

        output, http_response = (
            capo_cloudwatch_logs._operations.logs_20140328.describe_query_definitions.describe_query_definitions(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeQueryDefinitions")
    )
    input_: capo_cloudwatch_logs.types.describe_query_definitions_request.DescribeQueryDefinitionsRequest = {}
    if query_language is not None:
        input_["query_language"] = query_language
    if query_definition_name_prefix is not None:
        input_["query_definition_name_prefix"] = query_definition_name_prefix
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

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