Skip to content

search_sample_queries

search_sample_queries(
    search_phrase: SearchSampleQueriesSearchPhrase,
    *,
    config_overrides: Optional[CloudTrailClientConfig] = None,
    max_results: Optional[SearchSampleQueriesMaxResults] = None,
    next_token: Optional[PaginationToken] = None,
) -> SearchSampleQueriesResponse

CloudTrail Lake will no longer be open to new customers starting May 31, 2026. If you would like to use CloudTrail Lake, sign up prior to that date. Existing customers can continue to use the service as normal. For more information, see CloudTrail Lake availability change.

Searches sample queries and returns a list of sample queries that are sorted by relevance. To search for sample queries, provide a natural language SearchPhrase in English.

Parameters:

  • search_phrase (SearchSampleQueriesSearchPhrase) –

    The natural language phrase to use for the semantic search. The phrase must be in English. The length constraint is in characters, not words.

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

    The maximum number of results to return on a single page. The default value is 10.

  • next_token (Optional[PaginationToken], default: None ) –

    A token you can use to get the next page of results. The length constraint is in characters, not words.

Raises:

Source code in docs_src/capo_cloudtrail/_services/cloud_trail.py
def search_sample_queries(
    self,
    search_phrase: "capo_cloudtrail.types.search_sample_queries_search_phrase.SearchSampleQueriesSearchPhrase",
    *,
    config_overrides: Optional[CloudTrailClientConfig] = None,
    max_results: Optional[
        "capo_cloudtrail.types.search_sample_queries_max_results.SearchSampleQueriesMaxResults"
    ] = None,
    next_token: Optional[
        "capo_cloudtrail.types.pagination_token.PaginationToken"
    ] = None,
) -> "capo_cloudtrail.types.search_sample_queries_response.SearchSampleQueriesResponse":
    """<important> <p>CloudTrail Lake will no longer be open to new customers starting May 31, 2026. If you would like to use CloudTrail Lake, sign up prior to that date. Existing customers can continue to use the service as normal. For more information, see <a href="https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-lake-service-availability-change.html">CloudTrail Lake availability change</a>.</p> </important> <p> Searches sample queries and returns a list of sample queries that are sorted by relevance. To search for sample queries, provide a natural language <code>SearchPhrase</code> in English. </p>

    Args:
        search_phrase: <p> The natural language phrase to use for the semantic search. The phrase must be in English. The length constraint is in characters, not words.</p>
        max_results: <p> The maximum number of results to return on a single page. The default value is 10. </p>
        next_token: <p> A token you can use to get the next page of results. The length constraint is in characters, not words. </p>

    Raises:
        capo_cloudtrail.errors.invalid_parameter_exception.InvalidParameterException: <p>The request includes a parameter that is not valid.</p>
        capo_cloudtrail.errors.operation_not_permitted_exception.OperationNotPermittedException: <p>This exception is thrown when the requested operation is not permitted.</p>
        capo_cloudtrail.errors.unsupported_operation_exception.UnsupportedOperationException: <p>This exception is thrown when the requested operation is not supported.</p>
        capo_cloudtrail.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cloudtrail.types.search_sample_queries_request.SearchSampleQueriesRequest]",
    ) -> OperationResponse[
        "capo_cloudtrail.types.search_sample_queries_response.SearchSampleQueriesResponse"
    ]:
        import capo_cloudtrail._operations.cloud_trail_20131101.search_sample_queries

        output, http_response = (
            capo_cloudtrail._operations.cloud_trail_20131101.search_sample_queries.search_sample_queries(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("SearchSampleQueries")
    )
    input_: capo_cloudtrail.types.search_sample_queries_request.SearchSampleQueriesRequest = {
        "search_phrase": search_phrase
    }
    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