Skip to content

describe_query async

describe_query(
    *,
    config_overrides: Optional[AsyncCloudTrailClientConfig] = None,
    event_data_store: Optional[EventDataStoreArn] = None,
    query_id: Optional[UUID] = None,
    query_alias: Optional[QueryAlias] = None,
    refresh_id: Optional[RefreshId] = None,
    event_data_store_owner_account_id: Optional[AccountId] = None,
) -> DescribeQueryResponse

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.

Returns metadata about a query, including query run time in milliseconds, number of events scanned and matched, and query status. If the query results were delivered to an S3 bucket, the response also provides the S3 URI and the delivery status.

You must specify either QueryId or QueryAlias. Specifying the QueryAlias parameter returns information about the last query run for the alias. You can provide RefreshId along with QueryAlias to view the query results of a dashboard query for the specified RefreshId.

Parameters:

  • event_data_store (Optional[EventDataStoreArn], default: None ) –

    The ARN (or the ID suffix of the ARN) of an event data store on which the specified query was run.

  • query_id (Optional[UUID], default: None ) –

    The query ID.

  • query_alias (Optional[QueryAlias], default: None ) –

    The alias that identifies a query template.

  • refresh_id (Optional[RefreshId], default: None ) –

    The ID of the dashboard refresh.

  • event_data_store_owner_account_id (Optional[AccountId], default: None ) –

    The account ID of the event data store owner.

Raises:

Source code in docs_src/capo_cloudtrail/_services/async_cloud_trail.py
async def describe_query(
    self,
    *,
    config_overrides: Optional[AsyncCloudTrailClientConfig] = None,
    event_data_store: Optional[
        "capo_cloudtrail.types.event_data_store_arn.EventDataStoreArn"
    ] = None,
    query_id: Optional["capo_cloudtrail.types.uuid.UUID"] = None,
    query_alias: Optional["capo_cloudtrail.types.query_alias.QueryAlias"] = None,
    refresh_id: Optional["capo_cloudtrail.types.refresh_id.RefreshId"] = None,
    event_data_store_owner_account_id: Optional[
        "capo_cloudtrail.types.account_id.AccountId"
    ] = None,
) -> "capo_cloudtrail.types.describe_query_response.DescribeQueryResponse":
    """<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>Returns metadata about a query, including query run time in milliseconds, number of events scanned and matched, and query status. If the query results were delivered to an S3 bucket, the response also provides the S3 URI and the delivery status.</p> <p>You must specify either <code>QueryId</code> or <code>QueryAlias</code>. Specifying the <code>QueryAlias</code> parameter returns information about the last query run for the alias. You can provide <code>RefreshId</code> along with <code>QueryAlias</code> to view the query results of a dashboard query for the specified <code>RefreshId</code>.</p>

    Args:
        event_data_store: <p>The ARN (or the ID suffix of the ARN) of an event data store on which the specified query was run.</p>
        query_id: <p>The query ID.</p>
        query_alias: <p> The alias that identifies a query template. </p>
        refresh_id: <p> The ID of the dashboard refresh. </p>
        event_data_store_owner_account_id: <p> The account ID of the event data store owner. </p>

    Raises:
        capo_cloudtrail.errors.event_data_store_arn_invalid_exception.EventDataStoreARNInvalidException: <p>The specified event data store ARN is not valid or does not map to an event data store in your account.</p>
        capo_cloudtrail.errors.event_data_store_not_found_exception.EventDataStoreNotFoundException: <p>The specified event data store was not found.</p>
        capo_cloudtrail.errors.inactive_event_data_store_exception.InactiveEventDataStoreException: <p>The event data store is inactive.</p>
        capo_cloudtrail.errors.invalid_parameter_exception.InvalidParameterException: <p>The request includes a parameter that is not valid.</p>
        capo_cloudtrail.errors.no_management_account_slr_exists_exception.NoManagementAccountSLRExistsException: <p> This exception is thrown when the management account does not have a service-linked role. </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.query_id_not_found_exception.QueryIdNotFoundException: <p>The query ID does not exist or does not map to a query.</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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudtrail.types.describe_query_request.DescribeQueryRequest]",
    ) -> AsyncOperationResponse[
        "capo_cloudtrail.types.describe_query_response.DescribeQueryResponse"
    ]:
        import capo_cloudtrail._operations.cloud_trail_20131101.describe_query

        (
            output,
            http_response,
        ) = await capo_cloudtrail._operations.cloud_trail_20131101.describe_query.async_describe_query(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeQuery")
    )
    input_: capo_cloudtrail.types.describe_query_request.DescribeQueryRequest = {}
    if event_data_store is not None:
        input_["event_data_store"] = event_data_store
    if query_id is not None:
        input_["query_id"] = query_id
    if query_alias is not None:
        input_["query_alias"] = query_alias
    if refresh_id is not None:
        input_["refresh_id"] = refresh_id
    if event_data_store_owner_account_id is not None:
        input_["event_data_store_owner_account_id"] = (
            event_data_store_owner_account_id
        )

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