Macie2 / Client / get_usage_statistics

get_usage_statistics#

Macie2.Client.get_usage_statistics(**kwargs)#

Retrieves (queries) quotas and aggregated usage data for one or more accounts.

See also: AWS API Documentation

Request Syntax

response = client.get_usage_statistics(
    filterBy=[
        {
            'comparator': 'GT'|'GTE'|'LT'|'LTE'|'EQ'|'NE'|'CONTAINS',
            'key': 'accountId'|'serviceLimit'|'freeTrialStartDate'|'total',
            'values': [
                'string',
            ]
        },
    ],
    maxResults=123,
    nextToken='string',
    sortBy={
        'key': 'accountId'|'total'|'serviceLimitValue'|'freeTrialStartDate',
        'orderBy': 'ASC'|'DESC'
    },
    timeRange='MONTH_TO_DATE'|'PAST_30_DAYS'
)
Parameters:
  • filterBy (list) –

    An array of objects, one for each condition to use to filter the query results. If you specify more than one condition, Amazon Macie uses an AND operator to join the conditions.

    • (dict) –

      Specifies a condition for filtering the results of a query for quota and usage data for one or more Amazon Macie accounts.

      • comparator (string) –

        The operator to use in the condition. If the value for the key property is accountId, this value must be CONTAINS. If the value for the key property is any other supported field, this value can be EQ, GT, GTE, LT, LTE, or NE.

      • key (string) –

        The field to use in the condition.

      • values (list) –

        An array that lists values to use in the condition, based on the value for the field specified by the key property. If the value for the key property is accountId, this array can specify multiple values. Otherwise, this array can specify only one value.

        Valid values for each supported field are:

        • accountId - The unique identifier for an Amazon Web Services account.

        • freeTrialStartDate - The date and time, in UTC and extended ISO 8601 format, when the Amazon Macie free trial started for an account.

        • serviceLimit - A Boolean (true or false) value that indicates whether an account has reached its monthly quota.

        • total - A string that represents the current estimated cost for an account.

        • (string) –

  • maxResults (integer) – The maximum number of items to include in each page of the response.

  • nextToken (string) – The nextToken string that specifies which page of results to return in a paginated response.

  • sortBy (dict) –

    The criteria to use to sort the query results.

    • key (string) –

      The field to sort the results by.

    • orderBy (string) –

      The sort order to apply to the results, based on the value for the field specified by the key property. Valid values are: ASC, sort the results in ascending order; and, DESC, sort the results in descending order.

  • timeRange (string) – The inclusive time period to query usage data for. Valid values are: MONTH_TO_DATE, for the current calendar month to date; and, PAST_30_DAYS, for the preceding 30 days. If you don’t specify a value, Amazon Macie provides usage data for the preceding 30 days.

Return type:

dict

Returns:

Response Syntax

{
    'nextToken': 'string',
    'records': [
        {
            'accountId': 'string',
            'automatedDiscoveryFreeTrialStartDate': datetime(2015, 1, 1),
            'freeTrialStartDate': datetime(2015, 1, 1),
            'usage': [
                {
                    'currency': 'USD',
                    'estimatedCost': 'string',
                    'serviceLimit': {
                        'isServiceLimited': True|False,
                        'unit': 'TERABYTES',
                        'value': 123
                    },
                    'type': 'DATA_INVENTORY_EVALUATION'|'SENSITIVE_DATA_DISCOVERY'|'AUTOMATED_SENSITIVE_DATA_DISCOVERY'|'AUTOMATED_OBJECT_MONITORING'
                },
            ]
        },
    ],
    'timeRange': 'MONTH_TO_DATE'|'PAST_30_DAYS'
}

Response Structure

  • (dict) –

    The request succeeded.

    • nextToken (string) –

      The string to use in a subsequent request to get the next page of results in a paginated response. This value is null if there are no additional pages.

    • records (list) –

      An array of objects that contains the results of the query. Each object contains the data for an account that matches the filter criteria specified in the request.

      • (dict) –

        Provides quota and aggregated usage data for an Amazon Macie account.

        • accountId (string) –

          The unique identifier for the Amazon Web Services account that the data applies to.

        • automatedDiscoveryFreeTrialStartDate (datetime) –

          The date and time, in UTC and extended ISO 8601 format, when the free trial of automated sensitive data discovery started for the account. This value is null if automated sensitive data discovery hasn’t been enabled for the account.

        • freeTrialStartDate (datetime) –

          The date and time, in UTC and extended ISO 8601 format, when the Amazon Macie free trial started for the account.

        • usage (list) –

          An array of objects that contains usage data and quotas for the account. Each object contains the data for a specific usage metric and the corresponding quota.

          • (dict) –

            Provides data for a specific usage metric and the corresponding quota for an Amazon Macie account.

            • currency (string) –

              The type of currency that the value for the metric (estimatedCost) is reported in.

            • estimatedCost (string) –

              The estimated value for the metric.

            • serviceLimit (dict) –

              The current value for the quota that corresponds to the metric specified by the type field.

              • isServiceLimited (boolean) –

                Specifies whether the account has met the quota that corresponds to the metric specified by the UsageByAccount.type field in the response.

              • unit (string) –

                The unit of measurement for the value specified by the value field.

              • value (integer) –

                The value for the metric specified by the UsageByAccount.type field in the response.

            • type (string) –

              The name of the metric. Possible values are: AUTOMATED_OBJECT_MONITORING, to monitor S3 objects for automated sensitive data discovery; AUTOMATED_SENSITIVE_DATA_DISCOVERY, to analyze S3 objects for automated sensitive data discovery; DATA_INVENTORY_EVALUATION, to monitor S3 buckets; and, SENSITIVE_DATA_DISCOVERY, to run classification jobs.

    • timeRange (string) –

      The inclusive time period that the usage data applies to. Possible values are: MONTH_TO_DATE, for the current calendar month to date; and, PAST_30_DAYS, for the preceding 30 days.

Exceptions