Skip to content

list_insights async

list_insights(
    entity: InsightEntity,
    *,
    config_overrides: Optional[AsyncOpenSearchClientConfig] = None,
    time_range: Optional[InsightTimeRange] = None,
    sort_order: Optional[InsightSortOrder] = None,
    max_results: Optional[InsightPageSize] = None,
    next_token: Optional[String] = None,
) -> ListInsightsResponse

Lists insights for an Amazon OpenSearch Service domain or Amazon Web Services account. Returns a paginated list of insights based on the specified entity, filters, time range, and sort order.

Parameters:

  • entity (InsightEntity) –

    The entity for which to list insights. Specifies the type and value of the entity, such as a domain name or Amazon Web Services account ID.

  • time_range (Optional[InsightTimeRange], default: None ) –

    The time range for filtering insights, specified as epoch millisecond timestamps.

  • sort_order (Optional[InsightSortOrder], default: None ) –

    The sort order for the results. Possible values are ASC (ascending) and DESC (descending).

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

    An optional parameter that specifies the maximum number of results to return. You can use NextToken to get the next page of results. Valid values are 1 to 500.

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

    If your initial ListInsights operation returns a NextToken, include the returned NextToken in subsequent ListInsights operations to retrieve the next page of results.

Raises:

Source code in docs_src/capo_opensearch/_services/async_open_search.py
async def list_insights(
    self,
    entity: "capo_opensearch.types.insight_entity.InsightEntity",
    *,
    config_overrides: Optional[AsyncOpenSearchClientConfig] = None,
    time_range: Optional[
        "capo_opensearch.types.insight_time_range.InsightTimeRange"
    ] = None,
    sort_order: Optional[
        "capo_opensearch.types.insight_sort_order.InsightSortOrder"
    ] = None,
    max_results: Optional[
        "capo_opensearch.types.insight_page_size.InsightPageSize"
    ] = None,
    next_token: Optional["capo_opensearch.types.string.String"] = None,
) -> "capo_opensearch.types.list_insights_response.ListInsightsResponse":
    """<p>Lists insights for an Amazon OpenSearch Service domain or Amazon Web Services account. Returns a paginated list of insights based on the specified entity, filters, time range, and sort order.</p>

    Args:
        entity: <p>The entity for which to list insights. Specifies the type and value of the entity, such as a domain name or Amazon Web Services account ID.</p>
        time_range: <p>The time range for filtering insights, specified as epoch millisecond timestamps.</p>
        sort_order: <p>The sort order for the results. Possible values are <code>ASC</code> (ascending) and <code>DESC</code> (descending).</p>
        max_results: <p>An optional parameter that specifies the maximum number of results to return. You can use <code>NextToken</code> to get the next page of results. Valid values are 1 to 500.</p>
        next_token: <p>If your initial <code>ListInsights</code> operation returns a <code>NextToken</code>, include the returned <code>NextToken</code> in subsequent <code>ListInsights</code> operations to retrieve the next page of results.</p>

    Raises:
        capo_opensearch.errors.base_exception.BaseException: <p>An error occurred while processing the request.</p>
        capo_opensearch.errors.disabled_operation_exception.DisabledOperationException: <p>An error occured because the client wanted to access an unsupported operation.</p>
        capo_opensearch.errors.internal_exception.InternalException: <p>Request processing failed because of an unknown error, exception, or internal failure.</p>
        capo_opensearch.errors.limit_exceeded_exception.LimitExceededException: <p>An exception for trying to create more than the allowed number of resources or sub-resources.</p>
        capo_opensearch.errors.resource_not_found_exception.ResourceNotFoundException: <p>An exception for accessing or deleting a resource that doesn't exist.</p>
        capo_opensearch.errors.validation_exception.ValidationException: <p>An exception for accessing or deleting a resource that doesn't exist.</p>
        capo_opensearch.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_opensearch.types.list_insights_request.ListInsightsRequest]",
    ) -> AsyncOperationResponse[
        "capo_opensearch.types.list_insights_response.ListInsightsResponse"
    ]:
        import capo_opensearch._operations.amazon_open_search_service.list_insights

        (
            output,
            http_response,
        ) = await capo_opensearch._operations.amazon_open_search_service.list_insights.async_list_insights(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListInsights")
    )
    input_: capo_opensearch.types.list_insights_request.ListInsightsRequest = {
        "entity": entity
    }
    if time_range is not None:
        input_["time_range"] = time_range
    if sort_order is not None:
        input_["sort_order"] = sort_order
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

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