list_insights_metric_data
async
¶
list_insights_metric_data(
event_source: EventSource,
event_name: EventName,
insight_type: InsightType,
*,
config_overrides: Optional[AsyncCloudTrailClientConfig] = None,
trail_name: Optional[String] = None,
error_code: Optional[ErrorCode] = None,
start_time: Optional[Date] = None,
end_time: Optional[Date] = None,
period: Optional[InsightsMetricPeriod] = None,
data_type: Optional[InsightsMetricDataType] = None,
max_results: Optional[InsightsMetricMaxResults] = None,
next_token: Optional[InsightsMetricNextToken] = None,
) -> ListInsightsMetricDataResponse
Returns Insights metrics data for trails that have enabled Insights. The request must include the EventSource, EventName, and InsightType parameters.
If the InsightType is set to ApiErrorRateInsight, the request must also include the ErrorCode parameter.
The following are the available time periods for ListInsightsMetricData. Each cutoff is inclusive.
-
Data points with a period of 60 seconds (1-minute) are available for 15 days.
-
Data points with a period of 300 seconds (5-minute) are available for 63 days.
-
Data points with a period of 3600 seconds (1 hour) are available for 90 days.
To use ListInsightsMetricData operation, you must have the following permissions:
-
If
ListInsightsMetricDatais invoked withTrailNameparameter, access to theListInsightsMetricDataAPI operation is linked to thecloudtrail:LookupEventsaction andcloudtrail:ListInsightsData. To use this operation, you must have permissions to perform thecloudtrail:LookupEventsandcloudtrail:ListInsightsDataaction on the specific trail. -
If
ListInsightsMetricDatais invoked withoutTrailNameparameter, access to theListInsightsMetricDataAPI operation is linked to thecloudtrail:LookupEventsaction only. To use this operation, you must have permissions to perform thecloudtrail:LookupEventsaction.
For data event Insights on organization trails, only the management account and delegated administrator accounts can call ListInsightsMetricData. For these callers, the API returns Insights metrics only for the caller's own account. Member accounts cannot call this API on organization trails.
Parameters:
-
trail_name(Optional[String], default:None) –The Amazon Resource Name(ARN) or name of the trail for which you want to retrieve Insights metrics data. This parameter should only be provided to fetch Insights metrics data generated on trails logging data events. This parameter is not required for Insights metric data generated on trails logging management events.
-
event_source(EventSource) –The Amazon Web Services service to which the request was made, such as
iam.amazonaws.comors3.amazonaws.com. -
event_name(EventName) –The name of the event, typically the Amazon Web Services API on which unusual levels of activity were recorded.
-
insight_type(InsightType) –The type of CloudTrail Insights event, which is either
ApiCallRateInsightorApiErrorRateInsight. TheApiCallRateInsightInsights type analyzes write-only management API calls that are aggregated per minute against a baseline API call volume. TheApiErrorRateInsightInsights type analyzes management API calls that result in error codes. -
error_code(Optional[ErrorCode], default:None) –Conditionally required if the
InsightTypeparameter is set toApiErrorRateInsight.If returning metrics for the
ApiErrorRateInsightInsights type, this is the error to retrieve data for. For example,AccessDenied. -
start_time(Optional[Date], default:None) –Specifies, in UTC, the start time for time-series data. The value specified is inclusive; results include data points with the specified time stamp.
The default is 90 days before the time of request.
-
end_time(Optional[Date], default:None) –Specifies, in UTC, the end time for time-series data. The value specified is exclusive; results include data points up to the specified time stamp.
The default is the time of request.
-
period(Optional[InsightsMetricPeriod], default:None) –Granularity of data to retrieve, in seconds. Valid values are
60,300, and3600. If you specify any other value, you will get an error. The default is 3600 seconds. -
data_type(Optional[InsightsMetricDataType], default:None) –Type of data points to return. Valid values are
NonZeroDataandFillWithZeros. The default isNonZeroData. -
max_results(Optional[InsightsMetricMaxResults], default:None) –The maximum number of data points to return. Valid values are integers from 1 to 21600. The default value is 21600.
-
next_token(Optional[InsightsMetricNextToken], default:None) –Returned if all datapoints can't be returned in a single call. For example, due to reaching
MaxResults.Add this parameter to the request to continue retrieving results starting from the last evaluated point.
Raises:
-
InvalidParameterException–The request includes a parameter that is not valid.
-
InvalidTrailNameException–This exception is thrown when the provided trail name is not valid. Trail names must meet the following requirements:
-
Contain only ASCII letters (a-z, A-Z), numbers (0-9), periods (.), underscores (_), or dashes (-)
-
Start with a letter or number, and end with a letter or number
-
Be between 3 and 128 characters
-
Have no adjacent periods, underscores or dashes. Names like
my-_namespaceandmy--namespaceare not valid. -
Not be in IP address format (for example, 192.168.5.4)
-
-
OperationNotPermittedException–This exception is thrown when the requested operation is not permitted.
-
UnsupportedOperationException–This exception is thrown when the requested operation is not supported.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_cloudtrail/_services/async_cloud_trail.py
2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 | |