Skip to content

get_finding_statistics

get_finding_statistics(
    *,
    config_overrides: Optional[Macie2ClientConfig] = None,
    finding_criteria: Optional[FindingCriteria] = None,
    group_by: Optional[GroupBy] = None,
    size: Optional[__integer] = None,
    sort_criteria: Optional[FindingStatisticsSortCriteria] = None,
) -> GetFindingStatisticsResponse

Retrieves (queries) aggregated statistical data about findings.

Parameters:

  • finding_criteria (Optional[FindingCriteria], default: None ) –

    The criteria to use to filter the query results.

  • group_by (Optional[GroupBy], default: None ) –

    The finding property to use to group the query results. Valid values are:

    • classificationDetails.jobId - The unique identifier for the classification job that produced the finding.

    • resourcesAffected.s3Bucket.name - The name of the S3 bucket that the finding applies to.

    • severity.description - The severity level of the finding, such as High or Medium.

    • type - The type of finding, such as Policy:IAMUser/S3BucketPublic and SensitiveData:S3Object/Personal.

  • size (Optional[__integer], default: None ) –

    The maximum number of items to include in each page of the response.

  • sort_criteria (Optional[FindingStatisticsSortCriteria], default: None ) –

    The criteria to use to sort the query results.

Raises:

  • AccessDeniedException –

    Provides information about an error that occurred due to insufficient access to a specified resource.

  • ConflictException –

    Provides information about an error that occurred due to a versioning conflict for a specified resource.

  • InternalServerException –

    Provides information about an error that occurred due to an unknown internal server error, exception, or failure.

  • ResourceNotFoundException –

    Provides information about an error that occurred because a specified resource wasn't found.

  • ServiceQuotaExceededException –

    Provides information about an error that occurred due to one or more service quotas for an account.

  • ThrottlingException –

    Provides information about an error that occurred because too many requests were sent during a certain amount of time.

  • ValidationException –

    Provides information about an error that occurred due to a syntax error in a request.

  • UnknownServiceError –

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

Source code in docs_src/capo_macie2/_services/macie2.py
def get_finding_statistics(
    self,
    *,
    config_overrides: Optional[Macie2ClientConfig] = None,
    finding_criteria: Optional[
        "capo_macie2.types.finding_criteria.FindingCriteria"
    ] = None,
    group_by: Optional["capo_macie2.types.group_by.GroupBy"] = None,
    size: Optional["capo_macie2.types.__integer.__integer"] = None,
    sort_criteria: Optional[
        "capo_macie2.types.finding_statistics_sort_criteria.FindingStatisticsSortCriteria"
    ] = None,
) -> (
    "capo_macie2.types.get_finding_statistics_response.GetFindingStatisticsResponse"
):
    """<p>Retrieves (queries) aggregated statistical data about findings.</p>

    Args:
        finding_criteria: <p>The criteria to use to filter the query results.</p>
        group_by: <p>The finding property to use to group the query results. Valid values are:</p> <ul><li><p>classificationDetails.jobId - The unique identifier for the classification job that produced the finding.</p></li> <li><p>resourcesAffected.s3Bucket.name - The name of the S3 bucket that the finding applies to.</p></li> <li><p>severity.description - The severity level of the finding, such as High or Medium.</p></li> <li><p>type - The type of finding, such as Policy:IAMUser/S3BucketPublic and SensitiveData:S3Object/Personal.</p></li></ul>
        size: <p>The maximum number of items to include in each page of the response.</p>
        sort_criteria: <p>The criteria to use to sort the query results.</p>

    Raises:
        capo_macie2.errors.access_denied_exception.AccessDeniedException: <p>Provides information about an error that occurred due to insufficient access to a specified resource.</p>
        capo_macie2.errors.conflict_exception.ConflictException: <p>Provides information about an error that occurred due to a versioning conflict for a specified resource.</p>
        capo_macie2.errors.internal_server_exception.InternalServerException: <p>Provides information about an error that occurred due to an unknown internal server error, exception, or failure.</p>
        capo_macie2.errors.resource_not_found_exception.ResourceNotFoundException: <p>Provides information about an error that occurred because a specified resource wasn't found.</p>
        capo_macie2.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>Provides information about an error that occurred due to one or more service quotas for an account.</p>
        capo_macie2.errors.throttling_exception.ThrottlingException: <p>Provides information about an error that occurred because too many requests were sent during a certain amount of time.</p>
        capo_macie2.errors.validation_exception.ValidationException: <p>Provides information about an error that occurred due to a syntax error in a request.</p>
        capo_macie2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_macie2.types.get_finding_statistics_request.GetFindingStatisticsRequest]",
    ) -> OperationResponse[
        "capo_macie2.types.get_finding_statistics_response.GetFindingStatisticsResponse"
    ]:
        import capo_macie2._operations.macie2.get_finding_statistics

        output, http_response = (
            capo_macie2._operations.macie2.get_finding_statistics.get_finding_statistics(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetFindingStatistics")
    )
    input_: capo_macie2.types.get_finding_statistics_request.GetFindingStatisticsRequest = {}
    if finding_criteria is not None:
        input_["finding_criteria"] = finding_criteria
    if group_by is not None:
        input_["group_by"] = group_by
    if size is not None:
        input_["size"] = size
    if sort_criteria is not None:
        input_["sort_criteria"] = sort_criteria

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