Skip to content

get_insights async

get_insights(
    *,
    config_overrides: Optional[AsyncSecurityHubClientConfig] = None,
    insight_arns: Optional[ArnList] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResults] = None,
) -> GetInsightsResponse

Lists and describes insights for the specified insight ARNs.

Parameters:

  • insight_arns (Optional[ArnList], default: None ) –

    The ARNs of the insights to describe. If you don't provide any insight ARNs, then GetInsights returns all of your custom insights. It does not return any managed insights.

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

    The token that is required for pagination. On your first call to the GetInsights operation, set the value of this parameter to NULL.

    For subsequent calls to the operation, to continue listing data, set the value of this parameter to the value returned from the previous response.

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

    The maximum number of items to return in the response.

Raises:

  • InternalException –

    Internal server error.

  • InvalidAccessException –

    The account doesn't have permission to perform this action.

  • InvalidInputException –

    The request was rejected because you supplied an invalid or out-of-range value for an input parameter.

  • LimitExceededException –

    The request was rejected because it attempted to create resources beyond the current Amazon Web Services account or throttling limits. The error code describes the limit exceeded.

  • ResourceNotFoundException –

    The request was rejected because we can't find the specified resource.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

To get details of a Security Hub insight The following example returns details of the Security Hub insight with the specified ARN.

>>> await client.get_insights(insight_arns=['arn:aws:securityhub:us-west-1:123456789012:insight/123456789012/custom/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111'])
Source code in docs_src/capo_securityhub/_services/async_security_hub.py
async def get_insights(
    self,
    *,
    config_overrides: Optional[AsyncSecurityHubClientConfig] = None,
    insight_arns: Optional["capo_securityhub.types.arn_list.ArnList"] = None,
    next_token: Optional["capo_securityhub.types.next_token.NextToken"] = None,
    max_results: Optional["capo_securityhub.types.max_results.MaxResults"] = None,
) -> "capo_securityhub.types.get_insights_response.GetInsightsResponse":
    """<p>Lists and describes insights for the specified insight ARNs.</p>

    Args:
        insight_arns: <p>The ARNs of the insights to describe. If you don't provide any insight ARNs, then <code>GetInsights</code> returns all of your custom insights. It does not return any managed insights.</p>
        next_token: <p>The token that is required for pagination. On your first call to the <code>GetInsights</code> operation, set the value of this parameter to <code>NULL</code>.</p> <p>For subsequent calls to the operation, to continue listing data, set the value of this parameter to the value returned from the previous response.</p>
        max_results: <p>The maximum number of items to return in the response.</p>

    Raises:
        capo_securityhub.errors.internal_exception.InternalException: <p>Internal server error.</p>
        capo_securityhub.errors.invalid_access_exception.InvalidAccessException: <p>The account doesn't have permission to perform this action.</p>
        capo_securityhub.errors.invalid_input_exception.InvalidInputException: <p>The request was rejected because you supplied an invalid or out-of-range value for an input parameter.</p>
        capo_securityhub.errors.limit_exceeded_exception.LimitExceededException: <p>The request was rejected because it attempted to create resources beyond the current Amazon Web Services account or throttling limits. The error code describes the limit exceeded.</p>
        capo_securityhub.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request was rejected because we can't find the specified resource.</p>
        capo_securityhub.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To get details of a Security Hub insight
        The following example returns details of the Security Hub insight with the specified ARN.

        >>> await client.get_insights(insight_arns=['arn:aws:securityhub:us-west-1:123456789012:insight/123456789012/custom/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111'])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_securityhub.types.get_insights_request.GetInsightsRequest]",
    ) -> AsyncOperationResponse[
        "capo_securityhub.types.get_insights_response.GetInsightsResponse"
    ]:
        import capo_securityhub._operations.security_hub_api_service.get_insights

        (
            output,
            http_response,
        ) = await capo_securityhub._operations.security_hub_api_service.get_insights.async_get_insights(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetInsights")
    )
    input_: capo_securityhub.types.get_insights_request.GetInsightsRequest = {}
    if insight_arns is not None:
        input_["insight_arns"] = insight_arns
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

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