Skip to content

update_insight

update_insight(
    insight_arn: NonEmptyString,
    *,
    config_overrides: Optional[SecurityHubClientConfig] = None,
    name: Optional[NonEmptyString] = None,
    filters: Optional[AwsSecurityFindingFilters] = None,
    group_by_attribute: Optional[NonEmptyString] = None,
) -> UpdateInsightResponse

Updates the Security Hub CSPM insight identified by the specified insight ARN.

Parameters:

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 update an insight The following example updates the specified Security Hub insight.

>>> client.update_insight(insight_arn='arn:aws:securityhub:us-west-1:123456789012:insight/123456789012/custom/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111', name='High severity role findings', filters={'ResourceType': [{'Comparison': 'EQUALS', 'Value': 'AwsIamRole'}], 'SeverityLabel': [{'Comparison': 'EQUALS', 'Value': 'HIGH'}]})
Source code in docs_src/capo_securityhub/_services/security_hub.py
def update_insight(
    self,
    insight_arn: "capo_securityhub.types.non_empty_string.NonEmptyString",
    *,
    config_overrides: Optional[SecurityHubClientConfig] = None,
    name: Optional["capo_securityhub.types.non_empty_string.NonEmptyString"] = None,
    filters: Optional[
        "capo_securityhub.types.aws_security_finding_filters.AwsSecurityFindingFilters"
    ] = None,
    group_by_attribute: Optional[
        "capo_securityhub.types.non_empty_string.NonEmptyString"
    ] = None,
) -> "capo_securityhub.types.update_insight_response.UpdateInsightResponse":
    """<p>Updates the Security Hub CSPM insight identified by the specified insight ARN.</p>

    Args:
        insight_arn: <p>The ARN of the insight that you want to update.</p>
        name: <p>The updated name for the insight.</p>
        filters: <p>The updated filters that define this insight.</p>
        group_by_attribute: <p>The updated <code>GroupBy</code> attribute that defines this insight.</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 update an insight
        The following example updates the specified Security Hub insight.

        >>> client.update_insight(insight_arn='arn:aws:securityhub:us-west-1:123456789012:insight/123456789012/custom/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111', name='High severity role findings', filters={'ResourceType': [{'Comparison': 'EQUALS', 'Value': 'AwsIamRole'}], 'SeverityLabel': [{'Comparison': 'EQUALS', 'Value': 'HIGH'}]})
    """

    def _handler(
        req: "OperationRequest[capo_securityhub.types.update_insight_request.UpdateInsightRequest]",
    ) -> OperationResponse[
        "capo_securityhub.types.update_insight_response.UpdateInsightResponse"
    ]:
        import capo_securityhub._operations.security_hub_api_service.update_insight

        output, http_response = (
            capo_securityhub._operations.security_hub_api_service.update_insight.update_insight(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateInsight")
    )
    input_: capo_securityhub.types.update_insight_request.UpdateInsightRequest = {
        "insight_arn": insight_arn
    }
    if name is not None:
        input_["name"] = name
    if filters is not None:
        input_["filters"] = filters
    if group_by_attribute is not None:
        input_["group_by_attribute"] = group_by_attribute

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