CloudTrail ********** Client ====== class CloudTrail.Client A low-level client representing AWS CloudTrail This is the CloudTrail API Reference. It provides descriptions of actions, data types, common parameters, and common errors for CloudTrail. CloudTrail is a web service that records Amazon Web Services API calls for your Amazon Web Services account and delivers log files to an Amazon S3 bucket. The recorded information includes the identity of the user, the start time of the Amazon Web Services API call, the source IP address, the request parameters, and the response elements returned by the service. Note: As an alternative to the API, you can use one of the Amazon Web Services SDKs, which consist of libraries and sample code for various programming languages and platforms (Java, Ruby, .NET, iOS, Android, etc.). The SDKs provide programmatic access to CloudTrail. For example, the SDKs handle cryptographically signing requests, managing errors, and retrying requests automatically. For more information about the Amazon Web Services SDKs, including how to download and install them, see Tools to Build on Amazon Web Services. See the CloudTrail User Guide for information about the data that is included with each Amazon Web Services API call listed in the log files. import boto3 client = boto3.client('cloudtrail') These are the available methods: * add_tags * can_paginate * cancel_query * close * create_channel * create_dashboard * create_event_data_store * create_trail * delete_channel * delete_dashboard * delete_event_data_store * delete_resource_policy * delete_trail * deregister_organization_delegated_admin * describe_query * describe_trails * disable_federation * enable_federation * generate_query * get_channel * get_dashboard * get_event_configuration * get_event_data_store * get_event_selectors * get_import * get_insight_selectors * get_paginator * get_query_results * get_resource_policy * get_trail * get_trail_status * get_waiter * list_channels * list_dashboards * list_event_data_stores * list_import_failures * list_imports * list_insights_metric_data * list_public_keys * list_queries * list_tags * list_trails * lookup_events * put_event_configuration * put_event_selectors * put_insight_selectors * put_resource_policy * register_organization_delegated_admin * remove_tags * restore_event_data_store * search_sample_queries * start_dashboard_refresh * start_event_data_store_ingestion * start_import * start_logging * start_query * stop_event_data_store_ingestion * stop_import * stop_logging * update_channel * update_dashboard * update_event_data_store * update_trail Paginators ========== Paginators are available on a client instance via the "get_paginator" method. For more detailed instructions and examples on the usage of paginators, see the paginators user guide. The available paginators are: * ListImportFailures * ListImports * ListPublicKeys * ListTags * ListTrails * LookupEvents CloudTrail / Paginator / LookupEvents LookupEvents ************ class CloudTrail.Paginator.LookupEvents paginator = client.get_paginator('lookup_events') paginate(**kwargs) Creates an iterator that will paginate through responses from "CloudTrail.Client.lookup_events()". See also: AWS API Documentation **Request Syntax** response_iterator = paginator.paginate( LookupAttributes=[ { 'AttributeKey': 'EventId'|'EventName'|'ReadOnly'|'Username'|'ResourceType'|'ResourceName'|'EventSource'|'AccessKeyId', 'AttributeValue': 'string' }, ], StartTime=datetime(2015, 1, 1), EndTime=datetime(2015, 1, 1), EventCategory='insight', PaginationConfig={ 'MaxItems': 123, 'PageSize': 123, 'StartingToken': 'string' } ) Parameters: * **LookupAttributes** (*list*) -- Contains a list of lookup attributes. Currently the list can contain only one item. * *(dict) --* Specifies an attribute and value that filter the events returned. * **AttributeKey** *(string) --* **[REQUIRED]** Specifies an attribute on which to filter the events returned. * **AttributeValue** *(string) --* **[REQUIRED]** Specifies a value for the specified "AttributeKey". The maximum length for the "AttributeValue" is 2000 characters. The following characters (' "_"', ' `` "', ' ``,"', ' "\\n"') count as two characters towards the 2000 character limit. * **StartTime** (*datetime*) -- Specifies that only events that occur after or at the specified time are returned. If the specified start time is after the specified end time, an error is returned. * **EndTime** (*datetime*) -- Specifies that only events that occur before or at the specified time are returned. If the specified end time is before the specified start time, an error is returned. * **EventCategory** (*string*) -- Specifies the event category. If you do not specify an event category, events of the category are not returned in the response. For example, if you do not specify "insight" as the value of "EventCategory", no Insights events are returned. * **PaginationConfig** (*dict*) -- A dictionary that provides parameters to control pagination. * **MaxItems** *(integer) --* The total number of items to return. If the total number of items available is more than the value specified in max-items then a "NextToken" will be provided in the output that you can use to resume pagination. * **PageSize** *(integer) --* The size of each page. * **StartingToken** *(string) --* A token to specify where to start paginating. This is the "NextToken" from a previous response. Return type: dict Returns: **Response Syntax** { 'Events': [ { 'EventId': 'string', 'EventName': 'string', 'ReadOnly': 'string', 'AccessKeyId': 'string', 'EventTime': datetime(2015, 1, 1), 'EventSource': 'string', 'Username': 'string', 'Resources': [ { 'ResourceType': 'string', 'ResourceName': 'string' }, ], 'CloudTrailEvent': 'string' }, ], } **Response Structure** * *(dict) --* Contains a response to a LookupEvents action. * **Events** *(list) --* A list of events returned based on the lookup attributes specified and the CloudTrail event. The events list is sorted by time. The most recent event is listed first. * *(dict) --* Contains information about an event that was returned by a lookup request. The result includes a representation of a CloudTrail event. * **EventId** *(string) --* The CloudTrail ID of the event returned. * **EventName** *(string) --* The name of the event returned. * **ReadOnly** *(string) --* Information about whether the event is a write event or a read event. * **AccessKeyId** *(string) --* The Amazon Web Services access key ID that was used to sign the request. If the request was made with temporary security credentials, this is the access key ID of the temporary credentials. * **EventTime** *(datetime) --* The date and time of the event returned. * **EventSource** *(string) --* The Amazon Web Services service to which the request was made. * **Username** *(string) --* A user name or role name of the requester that called the API in the event returned. * **Resources** *(list) --* A list of resources referenced by the event returned. * *(dict) --* Specifies the type and name of a resource referenced by an event. * **ResourceType** *(string) --* The type of a resource referenced by the event returned. When the resource type cannot be determined, null is returned. Some examples of resource types are: **Instance** for EC2, **Trail** for CloudTrail, **DBInstance** for Amazon RDS, and **AccessKey** for IAM. To learn more about how to look up and filter events by the resource types supported for a service, see Filtering CloudTrail Events. * **ResourceName** *(string) --* The name of the resource referenced by the event returned. These are user-created names whose values will depend on the environment. For example, the resource name might be "auto- scaling-test-group" for an Auto Scaling Group or "i-1234567" for an EC2 Instance. * **CloudTrailEvent** *(string) --* A JSON string that contains a representation of the event returned. CloudTrail / Paginator / ListImports ListImports *********** class CloudTrail.Paginator.ListImports paginator = client.get_paginator('list_imports') paginate(**kwargs) Creates an iterator that will paginate through responses from "CloudTrail.Client.list_imports()". See also: AWS API Documentation **Request Syntax** response_iterator = paginator.paginate( Destination='string', ImportStatus='INITIALIZING'|'IN_PROGRESS'|'FAILED'|'STOPPED'|'COMPLETED', PaginationConfig={ 'MaxItems': 123, 'PageSize': 123, 'StartingToken': 'string' } ) Parameters: * **Destination** (*string*) -- The ARN of the destination event data store. * **ImportStatus** (*string*) -- The status of the import. * **PaginationConfig** (*dict*) -- A dictionary that provides parameters to control pagination. * **MaxItems** *(integer) --* The total number of items to return. If the total number of items available is more than the value specified in max-items then a "NextToken" will be provided in the output that you can use to resume pagination. * **PageSize** *(integer) --* The size of each page. * **StartingToken** *(string) --* A token to specify where to start paginating. This is the "NextToken" from a previous response. Return type: dict Returns: **Response Syntax** { 'Imports': [ { 'ImportId': 'string', 'ImportStatus': 'INITIALIZING'|'IN_PROGRESS'|'FAILED'|'STOPPED'|'COMPLETED', 'Destinations': [ 'string', ], 'CreatedTimestamp': datetime(2015, 1, 1), 'UpdatedTimestamp': datetime(2015, 1, 1) }, ], } **Response Structure** * *(dict) --* * **Imports** *(list) --* The list of returned imports. * *(dict) --* Contains information about an import that was returned by a lookup request. * **ImportId** *(string) --* The ID of the import. * **ImportStatus** *(string) --* The status of the import. * **Destinations** *(list) --* The ARN of the destination event data store. * *(string) --* * **CreatedTimestamp** *(datetime) --* The timestamp of the import's creation. * **UpdatedTimestamp** *(datetime) --* The timestamp of the import's last update. CloudTrail / Paginator / ListTrails ListTrails ********** class CloudTrail.Paginator.ListTrails paginator = client.get_paginator('list_trails') paginate(**kwargs) Creates an iterator that will paginate through responses from "CloudTrail.Client.list_trails()". See also: AWS API Documentation **Request Syntax** response_iterator = paginator.paginate( PaginationConfig={ 'MaxItems': 123, 'StartingToken': 'string' } ) Parameters: **PaginationConfig** (*dict*) -- A dictionary that provides parameters to control pagination. * **MaxItems** *(integer) --* The total number of items to return. If the total number of items available is more than the value specified in max- items then a "NextToken" will be provided in the output that you can use to resume pagination. * **StartingToken** *(string) --* A token to specify where to start paginating. This is the "NextToken" from a previous response. Return type: dict Returns: **Response Syntax** { 'Trails': [ { 'TrailARN': 'string', 'Name': 'string', 'HomeRegion': 'string' }, ], } **Response Structure** * *(dict) --* * **Trails** *(list) --* Returns the name, ARN, and home Region of trails in the current account. * *(dict) --* Information about a CloudTrail trail, including the trail's name, home Region, and Amazon Resource Name (ARN). * **TrailARN** *(string) --* The ARN of a trail. * **Name** *(string) --* The name of a trail. * **HomeRegion** *(string) --* The Amazon Web Services Region in which a trail was created. CloudTrail / Paginator / ListImportFailures ListImportFailures ****************** class CloudTrail.Paginator.ListImportFailures paginator = client.get_paginator('list_import_failures') paginate(**kwargs) Creates an iterator that will paginate through responses from "CloudTrail.Client.list_import_failures()". See also: AWS API Documentation **Request Syntax** response_iterator = paginator.paginate( ImportId='string', PaginationConfig={ 'MaxItems': 123, 'PageSize': 123, 'StartingToken': 'string' } ) Parameters: * **ImportId** (*string*) -- **[REQUIRED]** The ID of the import. * **PaginationConfig** (*dict*) -- A dictionary that provides parameters to control pagination. * **MaxItems** *(integer) --* The total number of items to return. If the total number of items available is more than the value specified in max-items then a "NextToken" will be provided in the output that you can use to resume pagination. * **PageSize** *(integer) --* The size of each page. * **StartingToken** *(string) --* A token to specify where to start paginating. This is the "NextToken" from a previous response. Return type: dict Returns: **Response Syntax** { 'Failures': [ { 'Location': 'string', 'Status': 'FAILED'|'RETRY'|'SUCCEEDED', 'ErrorType': 'string', 'ErrorMessage': 'string', 'LastUpdatedTime': datetime(2015, 1, 1) }, ], } **Response Structure** * *(dict) --* * **Failures** *(list) --* Contains information about the import failures. * *(dict) --* Provides information about an import failure. * **Location** *(string) --* The location of the failure in the S3 bucket. * **Status** *(string) --* The status of the import. * **ErrorType** *(string) --* The type of import error. * **ErrorMessage** *(string) --* Provides the reason the import failed. * **LastUpdatedTime** *(datetime) --* When the import was last updated. CloudTrail / Paginator / ListPublicKeys ListPublicKeys ************** class CloudTrail.Paginator.ListPublicKeys paginator = client.get_paginator('list_public_keys') paginate(**kwargs) Creates an iterator that will paginate through responses from "CloudTrail.Client.list_public_keys()". See also: AWS API Documentation **Request Syntax** response_iterator = paginator.paginate( StartTime=datetime(2015, 1, 1), EndTime=datetime(2015, 1, 1), PaginationConfig={ 'MaxItems': 123, 'StartingToken': 'string' } ) Parameters: * **StartTime** (*datetime*) -- Optionally specifies, in UTC, the start of the time range to look up public keys for CloudTrail digest files. If not specified, the current time is used, and the current public key is returned. * **EndTime** (*datetime*) -- Optionally specifies, in UTC, the end of the time range to look up public keys for CloudTrail digest files. If not specified, the current time is used. * **PaginationConfig** (*dict*) -- A dictionary that provides parameters to control pagination. * **MaxItems** *(integer) --* The total number of items to return. If the total number of items available is more than the value specified in max-items then a "NextToken" will be provided in the output that you can use to resume pagination. * **StartingToken** *(string) --* A token to specify where to start paginating. This is the "NextToken" from a previous response. Return type: dict Returns: **Response Syntax** { 'PublicKeyList': [ { 'Value': b'bytes', 'ValidityStartTime': datetime(2015, 1, 1), 'ValidityEndTime': datetime(2015, 1, 1), 'Fingerprint': 'string' }, ], } **Response Structure** * *(dict) --* Returns the objects or data listed below if successful. Otherwise, returns an error. * **PublicKeyList** *(list) --* Contains an array of PublicKey objects. Note: The returned public keys may have validity time ranges that overlap. * *(dict) --* Contains information about a returned public key. * **Value** *(bytes) --* The DER encoded public key value in PKCS#1 format. * **ValidityStartTime** *(datetime) --* The starting time of validity of the public key. * **ValidityEndTime** *(datetime) --* The ending time of validity of the public key. * **Fingerprint** *(string) --* The fingerprint of the public key. CloudTrail / Paginator / ListTags ListTags ******** class CloudTrail.Paginator.ListTags paginator = client.get_paginator('list_tags') paginate(**kwargs) Creates an iterator that will paginate through responses from "CloudTrail.Client.list_tags()". See also: AWS API Documentation **Request Syntax** response_iterator = paginator.paginate( ResourceIdList=[ 'string', ], PaginationConfig={ 'MaxItems': 123, 'StartingToken': 'string' } ) Parameters: * **ResourceIdList** (*list*) -- **[REQUIRED]** Specifies a list of trail, event data store, dashboard, or channel ARNs whose tags will be listed. The list has a limit of 20 ARNs. Example trail ARN format: "arn:aws:cloudtrail:us- east-2:123456789012:trail/MyTrail" Example event data store ARN format: "arn:aws:cloudtrail :us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f- 8bd1-bcf6cEXAMPLE" Example dashboard ARN format: "arn:aws:cloudtrail:us- east-1:123456789012:dashboard/exampleDash" Example channel ARN format: "arn:aws:cloudtrail:us- east-2:123456789012:channel/01234567890" * *(string) --* * **PaginationConfig** (*dict*) -- A dictionary that provides parameters to control pagination. * **MaxItems** *(integer) --* The total number of items to return. If the total number of items available is more than the value specified in max-items then a "NextToken" will be provided in the output that you can use to resume pagination. * **StartingToken** *(string) --* A token to specify where to start paginating. This is the "NextToken" from a previous response. Return type: dict Returns: **Response Syntax** { 'ResourceTagList': [ { 'ResourceId': 'string', 'TagsList': [ { 'Key': 'string', 'Value': 'string' }, ] }, ], } **Response Structure** * *(dict) --* Returns the objects or data listed below if successful. Otherwise, returns an error. * **ResourceTagList** *(list) --* A list of resource tags. * *(dict) --* A resource tag. * **ResourceId** *(string) --* Specifies the ARN of the resource. * **TagsList** *(list) --* A list of tags. * *(dict) --* A custom key-value pair associated with a resource such as a CloudTrail trail, event data store, dashboard, or channel. * **Key** *(string) --* The key in a key-value pair. The key must be must be no longer than 128 Unicode characters. The key must be unique for the resource to which it applies. * **Value** *(string) --* The value in a key-value pair of a tag. The value must be no longer than 256 Unicode characters. CloudTrail / Client / delete_event_data_store delete_event_data_store *********************** CloudTrail.Client.delete_event_data_store(**kwargs) Disables the event data store specified by "EventDataStore", which accepts an event data store ARN. After you run "DeleteEventDataStore", the event data store enters a "PENDING_DELETION" state, and is automatically deleted after a wait period of seven days. "TerminationProtectionEnabled" must be set to "False" on the event data store and the "FederationStatus" must be "DISABLED". You cannot delete an event data store if "TerminationProtectionEnabled" is "True" or the "FederationStatus" is "ENABLED". After you run "DeleteEventDataStore" on an event data store, you cannot run "ListQueries", "DescribeQuery", or "GetQueryResults" on queries that are using an event data store in a "PENDING_DELETION" state. An event data store in the "PENDING_DELETION" state does not incur costs. See also: AWS API Documentation **Request Syntax** response = client.delete_event_data_store( EventDataStore='string' ) Parameters: **EventDataStore** (*string*) -- **[REQUIRED]** The ARN (or the ID suffix of the ARN) of the event data store to delete. Return type: dict Returns: **Response Syntax** {} **Response Structure** * *(dict) --* **Exceptions** * "CloudTrail.Client.exceptions.EventDataStoreARNInvalidException" * "CloudTrail.Client.exceptions.EventDataStoreNotFoundException" * "CloudTrail.Client.exceptions.EventDataStoreTerminationProtected Exception" * "CloudTrail.Client.exceptions.EventDataStoreHasOngoingImportExce ption" * "CloudTrail.Client.exceptions.InactiveEventDataStoreException" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.NotOrganizationMasterAccountExcept ion" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" * "CloudTrail.Client.exceptions.ChannelExistsForEDSException" * "CloudTrail.Client.exceptions.InsufficientDependencyServiceAcces sPermissionException" * "CloudTrail.Client.exceptions.ConflictException" * "CloudTrail.Client.exceptions.EventDataStoreFederationEnabledExc eption" CloudTrail / Client / list_import_failures list_import_failures ******************** CloudTrail.Client.list_import_failures(**kwargs) Returns a list of failures for the specified import. See also: AWS API Documentation **Request Syntax** response = client.list_import_failures( ImportId='string', MaxResults=123, NextToken='string' ) Parameters: * **ImportId** (*string*) -- **[REQUIRED]** The ID of the import. * **MaxResults** (*integer*) -- The maximum number of failures to display on a single page. * **NextToken** (*string*) -- A token you can use to get the next page of import failures. Return type: dict Returns: **Response Syntax** { 'Failures': [ { 'Location': 'string', 'Status': 'FAILED'|'RETRY'|'SUCCEEDED', 'ErrorType': 'string', 'ErrorMessage': 'string', 'LastUpdatedTime': datetime(2015, 1, 1) }, ], 'NextToken': 'string' } **Response Structure** * *(dict) --* * **Failures** *(list) --* Contains information about the import failures. * *(dict) --* Provides information about an import failure. * **Location** *(string) --* The location of the failure in the S3 bucket. * **Status** *(string) --* The status of the import. * **ErrorType** *(string) --* The type of import error. * **ErrorMessage** *(string) --* Provides the reason the import failed. * **LastUpdatedTime** *(datetime) --* When the import was last updated. * **NextToken** *(string) --* A token you can use to get the next page of results. **Exceptions** * "CloudTrail.Client.exceptions.InvalidNextTokenException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.InvalidParameterException" CloudTrail / Client / list_trails list_trails *********** CloudTrail.Client.list_trails(**kwargs) Lists trails that are in the current account. See also: AWS API Documentation **Request Syntax** response = client.list_trails( NextToken='string' ) Parameters: **NextToken** (*string*) -- The token to use to get the next page of results after a previous API call. This token must be passed in with the same parameters that were specified in the original call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters. Return type: dict Returns: **Response Syntax** { 'Trails': [ { 'TrailARN': 'string', 'Name': 'string', 'HomeRegion': 'string' }, ], 'NextToken': 'string' } **Response Structure** * *(dict) --* * **Trails** *(list) --* Returns the name, ARN, and home Region of trails in the current account. * *(dict) --* Information about a CloudTrail trail, including the trail's name, home Region, and Amazon Resource Name (ARN). * **TrailARN** *(string) --* The ARN of a trail. * **Name** *(string) --* The name of a trail. * **HomeRegion** *(string) --* The Amazon Web Services Region in which a trail was created. * **NextToken** *(string) --* The token to use to get the next page of results after a previous API call. If the token does not appear, there are no more results to return. The token must be passed in with the same parameters as the previous call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters. **Exceptions** * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" CloudTrail / Client / start_dashboard_refresh start_dashboard_refresh *********************** CloudTrail.Client.start_dashboard_refresh(**kwargs) Starts a refresh of the specified dashboard. Each time a dashboard is refreshed, CloudTrail runs queries to populate the dashboard's widgets. CloudTrail must be granted permissions to run the "StartQuery" operation on your behalf. To provide permissions, run the "PutResourcePolicy" operation to attach a resource-based policy to each event data store. For more information, see Example: Allow CloudTrail to run queries to populate a dashboard in the *CloudTrail User Guide*. See also: AWS API Documentation **Request Syntax** response = client.start_dashboard_refresh( DashboardId='string', QueryParameterValues={ 'string': 'string' } ) Parameters: * **DashboardId** (*string*) -- **[REQUIRED]** The name or ARN of the dashboard. * **QueryParameterValues** (*dict*) -- The query parameter values for the dashboard For custom dashboards, the following query parameters are valid: "$StartTime$", "$EndTime$", and "$Period$". For managed dashboards, the following query parameters are valid: "$StartTime$", "$EndTime$", "$Period$", and "$EventDataStoreId$". The "$EventDataStoreId$" query parameter is required. * *(string) --* * *(string) --* Return type: dict Returns: **Response Syntax** { 'RefreshId': 'string' } **Response Structure** * *(dict) --* * **RefreshId** *(string) --* The refresh ID for the dashboard. **Exceptions** * "CloudTrail.Client.exceptions.ResourceNotFoundException" * "CloudTrail.Client.exceptions.EventDataStoreNotFoundException" * "CloudTrail.Client.exceptions.InactiveEventDataStoreException" * "CloudTrail.Client.exceptions.ServiceQuotaExceededException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" CloudTrail / Client / get_paginator get_paginator ************* CloudTrail.Client.get_paginator(operation_name) Create a paginator for an operation. Parameters: **operation_name** (*string*) -- The operation name. This is the same name as the method name on the client. For example, if the method name is "create_foo", and you'd normally invoke the operation as "client.create_foo(**kwargs)", if the "create_foo" operation can be paginated, you can use the call "client.get_paginator("create_foo")". Raises: **OperationNotPageableError** -- Raised if the operation is not pageable. You can use the "client.can_paginate" method to check if an operation is pageable. Return type: "botocore.paginate.Paginator" Returns: A paginator object. CloudTrail / Client / get_event_selectors get_event_selectors ******************* CloudTrail.Client.get_event_selectors(**kwargs) Describes the settings for the event selectors that you configured for your trail. The information returned for your event selectors includes the following: * If your event selector includes read-only events, write-only events, or all events. This applies to management events, data events, and network activity events. * If your event selector includes management events. * If your event selector includes network activity events, the event sources for which you are logging network activity events. * If your event selector includes data events, the resources on which you are logging data events. For more information about logging management, data, and network activity events, see the following topics in the *CloudTrail User Guide*: * Logging management events * Logging data events * Logging network activity events See also: AWS API Documentation **Request Syntax** response = client.get_event_selectors( TrailName='string' ) Parameters: **TrailName** (*string*) -- **[REQUIRED]** Specifies the name of the trail or trail ARN. If you specify a trail name, the string 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-_namespace" and "my--namespace" are not valid. * Not be in IP address format (for example, 192.168.5.4) If you specify a trail ARN, it must be in the format: "arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail" Return type: dict Returns: **Response Syntax** { 'TrailARN': 'string', 'EventSelectors': [ { 'ReadWriteType': 'ReadOnly'|'WriteOnly'|'All', 'IncludeManagementEvents': True|False, 'DataResources': [ { 'Type': 'string', 'Values': [ 'string', ] }, ], 'ExcludeManagementEventSources': [ 'string', ] }, ], 'AdvancedEventSelectors': [ { 'Name': 'string', 'FieldSelectors': [ { 'Field': 'string', 'Equals': [ 'string', ], 'StartsWith': [ 'string', ], 'EndsWith': [ 'string', ], 'NotEquals': [ 'string', ], 'NotStartsWith': [ 'string', ], 'NotEndsWith': [ 'string', ] }, ] }, ] } **Response Structure** * *(dict) --* * **TrailARN** *(string) --* The specified trail ARN that has the event selectors. * **EventSelectors** *(list) --* The event selectors that are configured for the trail. * *(dict) --* Use event selectors to further specify the management and data event settings for your trail. By default, trails created without specific event selectors will be configured to log all read and write management events, and no data events. When an event occurs in your account, CloudTrail evaluates the event selector for all trails. For each trail, if the event matches any event selector, the trail processes and logs the event. If the event doesn't match any event selector, the trail doesn't log the event. You can configure up to five event selectors for a trail. You cannot apply both event selectors and advanced event selectors to a trail. * **ReadWriteType** *(string) --* Specify if you want your trail to log read-only events, write-only events, or all. For example, the EC2 "GetConsoleOutput" is a read-only API operation and "RunInstances" is a write-only API operation. By default, the value is "All". * **IncludeManagementEvents** *(boolean) --* Specify if you want your event selector to include management events for your trail. For more information, see Management Events in the *CloudTrail User Guide*. By default, the value is "true". The first copy of management events is free. You are charged for additional copies of management events that you are logging on any subsequent trail in the same Region. For more information about CloudTrail pricing, see CloudTrail Pricing. * **DataResources** *(list) --* CloudTrail supports data event logging for Amazon S3 objects in standard S3 buckets, Lambda functions, and Amazon DynamoDB tables with basic event selectors. You can specify up to 250 resources for an individual event selector, but the total number of data resources cannot exceed 250 across all event selectors in a trail. This limit does not apply if you configure resource logging for all data events. For more information, see Data Events and Limits in CloudTrail in the *CloudTrail User Guide*. Note: To log data events for all other resource types including objects stored in directory buckets, you must use AdvancedEventSelectors. You must also use "AdvancedEventSelectors" if you want to filter on the "eventName" field. * *(dict) --* You can configure the "DataResource" in an "EventSelector" to log data events for the following three resource types: * "AWS::DynamoDB::Table" * "AWS::Lambda::Function" * "AWS::S3::Object" To log data events for all other resource types including objects stored in directory buckets, you must use AdvancedEventSelectors. You must also use "AdvancedEventSelectors" if you want to filter on the "eventName" field. Configure the "DataResource" to specify the resource type and resource ARNs for which you want to log data events. Note: The total number of allowed data resources is 250. This number can be distributed between 1 and 5 event selectors, but the total cannot exceed 250 across all selectors for the trail. The following example demonstrates how logging works when you configure logging of all data events for a general purpose bucket named "amzn-s3-demo-bucket1". In this example, the CloudTrail user specified an empty prefix, and the option to log both "Read" and "Write" data events. * A user uploads an image file to "amzn-s3-demo- bucket1". * The "PutObject" API operation is an Amazon S3 object-level API. It is recorded as a data event in CloudTrail. Because the CloudTrail user specified an S3 bucket with an empty prefix, events that occur on any object in that bucket are logged. The trail processes and logs the event. * A user uploads an object to an Amazon S3 bucket named "arn:aws:s3:::amzn-s3-demo-bucket1". * The "PutObject" API operation occurred for an object in an S3 bucket that the CloudTrail user didn't specify for the trail. The trail doesn’t log the event. The following example demonstrates how logging works when you configure logging of Lambda data events for a Lambda function named *MyLambdaFunction*, but not for all Lambda functions. * A user runs a script that includes a call to the *MyLambdaFunction* function and the *MyOtherLambdaFunction* function. * The "Invoke" API operation on *MyLambdaFunction* is an Lambda API. It is recorded as a data event in CloudTrail. Because the CloudTrail user specified logging data events for *MyLambdaFunction*, any invocations of that function are logged. The trail processes and logs the event. * The "Invoke" API operation on *MyOtherLambdaFunction* is an Lambda API. Because the CloudTrail user did not specify logging data events for all Lambda functions, the "Invoke" operation for *MyOtherLambdaFunction* does not match the function specified for the trail. The trail doesn’t log the event. * **Type** *(string) --* The resource type in which you want to log data events. You can specify the following *basic* event selector resource types: * "AWS::DynamoDB::Table" * "AWS::Lambda::Function" * "AWS::S3::Object" Additional resource types are available through *advanced* event selectors. For more information, see AdvancedEventSelector. * **Values** *(list) --* An array of Amazon Resource Name (ARN) strings or partial ARN strings for the specified resource type. * To log data events for all objects in all S3 buckets in your Amazon Web Services account, specify the prefix as "arn:aws:s3". Note: This also enables logging of data event activity performed by any user or role in your Amazon Web Services account, even if that activity is performed on a bucket that belongs to another Amazon Web Services account. * To log data events for all objects in an S3 bucket, specify the bucket and an empty object prefix such as "arn:aws:s3:::amzn-s3-demo- bucket1/". The trail logs data events for all objects in this S3 bucket. * To log data events for specific objects, specify the S3 bucket and object prefix such as "arn:aws:s3:::amzn-s3-demo-bucket1/example- images". The trail logs data events for objects in this S3 bucket that match the prefix. * To log data events for all Lambda functions in your Amazon Web Services account, specify the prefix as "arn:aws:lambda". Note: This also enables logging of "Invoke" activity performed by any user or role in your Amazon Web Services account, even if that activity is performed on a function that belongs to another Amazon Web Services account. * To log data events for a specific Lambda function, specify the function ARN. Note: Lambda function ARNs are exact. For example, if you specify a function ARN *arn:aws:lambda:us- west-2:111111111111:function:helloworld*, data events will only be logged for *arn:aws:lambda:us- west-2:111111111111:function:helloworld*. They will not be logged for *arn:aws:lambda:us- west-2:111111111111:function:helloworld2*. * To log data events for all DynamoDB tables in your Amazon Web Services account, specify the prefix as "arn:aws:dynamodb". * *(string) --* * **ExcludeManagementEventSources** *(list) --* An optional list of service event sources from which you do not want management events to be logged on your trail. In this release, the list can be empty (disables the filter), or it can filter out Key Management Service or Amazon RDS Data API events by containing "kms.amazonaws.com" or "rdsdata.amazonaws.com". By default, "ExcludeManagementEventSources" is empty, and KMS and Amazon RDS Data API events are logged to your trail. You can exclude management event sources only in Regions that support the event source. * *(string) --* * **AdvancedEventSelectors** *(list) --* The advanced event selectors that are configured for the trail. * *(dict) --* Advanced event selectors let you create fine-grained selectors for CloudTrail management, data, and network activity events. They help you control costs by logging only those events that are important to you. For more information about configuring advanced event selectors, see the Logging data events, Logging network activity events, and Logging management events topics in the *CloudTrail User Guide*. You cannot apply both event selectors and advanced event selectors to a trail. For information about configurable advanced event selector fields, see AdvancedEventSelector in the *CloudTrail API Reference*. * **Name** *(string) --* An optional, descriptive name for an advanced event selector, such as "Log data events for only two S3 buckets". * **FieldSelectors** *(list) --* Contains all selector statements in an advanced event selector. * *(dict) --* A single selector statement in an advanced event selector. * **Field** *(string) --* A field in a CloudTrail event record on which to filter events to be logged. For event data stores for CloudTrail Insights events, Config configuration items, Audit Manager evidence, or events outside of Amazon Web Services, the field is used only for selecting events as filtering is not supported. For more information, see AdvancedFieldSelector in the *CloudTrail API Reference*. Note: Selectors don't support the use of wildcards like "*" . To match multiple values with a single condition, you may use "StartsWith", "EndsWith", "NotStartsWith", or "NotEndsWith" to explicitly match the beginning or end of the event field. * **Equals** *(list) --* An operator that includes events that match the exact value of the event record field specified as the value of "Field". This is the only valid operator that you can use with the "readOnly", "eventCategory", and "resources.type" fields. * *(string) --* * **StartsWith** *(list) --* An operator that includes events that match the first few characters of the event record field specified as the value of "Field". * *(string) --* * **EndsWith** *(list) --* An operator that includes events that match the last few characters of the event record field specified as the value of "Field". * *(string) --* * **NotEquals** *(list) --* An operator that excludes events that match the exact value of the event record field specified as the value of "Field". * *(string) --* * **NotStartsWith** *(list) --* An operator that excludes events that match the first few characters of the event record field specified as the value of "Field". * *(string) --* * **NotEndsWith** *(list) --* An operator that excludes events that match the last few characters of the event record field specified as the value of "Field". * *(string) --* **Exceptions** * "CloudTrail.Client.exceptions.TrailNotFoundException" * "CloudTrail.Client.exceptions.InvalidTrailNameException" * "CloudTrail.Client.exceptions.CloudTrailARNInvalidException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" CloudTrail / Client / put_event_selectors put_event_selectors ******************* CloudTrail.Client.put_event_selectors(**kwargs) Configures event selectors (also referred to as *basic event selectors*) or advanced event selectors for your trail. You can use either "AdvancedEventSelectors" or "EventSelectors", but not both. If you apply "AdvancedEventSelectors" to a trail, any existing "EventSelectors" are overwritten. You can use "AdvancedEventSelectors" to log management events, data events for all resource types, and network activity events. You can use "EventSelectors" to log management events and data events for the following resource types: * "AWS::DynamoDB::Table" * "AWS::Lambda::Function" * "AWS::S3::Object" You can't use "EventSelectors" to log network activity events. If you want your trail to log Insights events, be sure the event selector or advanced event selector enables logging of the Insights event types you want configured for your trail. For more information about logging Insights events, see Working with CloudTrail Insights in the *CloudTrail User Guide*. By default, trails created without specific event selectors are configured to log all read and write management events, and no data events or network activity events. When an event occurs in your account, CloudTrail evaluates the event selectors or advanced event selectors in all trails. For each trail, if the event matches any event selector, the trail processes and logs the event. If the event doesn't match any event selector, the trail doesn't log the event. Example * You create an event selector for a trail and specify that you want to log write-only events. * The EC2 "GetConsoleOutput" and "RunInstances" API operations occur in your account. * CloudTrail evaluates whether the events match your event selectors. * The "RunInstances" is a write-only event and it matches your event selector. The trail logs the event. * The "GetConsoleOutput" is a read-only event that doesn't match your event selector. The trail doesn't log the event. The "PutEventSelectors" operation must be called from the Region in which the trail was created; otherwise, an "InvalidHomeRegionException" exception is thrown. You can configure up to five event selectors for each trail. You can add advanced event selectors, and conditions for your advanced event selectors, up to a maximum of 500 values for all conditions and selectors on a trail. For more information, see Logging management events, Logging data events, Logging network activity events, and Quotas in CloudTrail in the *CloudTrail User Guide*. See also: AWS API Documentation **Request Syntax** response = client.put_event_selectors( TrailName='string', EventSelectors=[ { 'ReadWriteType': 'ReadOnly'|'WriteOnly'|'All', 'IncludeManagementEvents': True|False, 'DataResources': [ { 'Type': 'string', 'Values': [ 'string', ] }, ], 'ExcludeManagementEventSources': [ 'string', ] }, ], AdvancedEventSelectors=[ { 'Name': 'string', 'FieldSelectors': [ { 'Field': 'string', 'Equals': [ 'string', ], 'StartsWith': [ 'string', ], 'EndsWith': [ 'string', ], 'NotEquals': [ 'string', ], 'NotStartsWith': [ 'string', ], 'NotEndsWith': [ 'string', ] }, ] }, ] ) Parameters: * **TrailName** (*string*) -- **[REQUIRED]** Specifies the name of the trail or trail ARN. If you specify a trail name, the string 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-_namespace" and "my--namespace" are not valid. * Not be in IP address format (for example, 192.168.5.4) If you specify a trail ARN, it must be in the following format. "arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail" * **EventSelectors** (*list*) -- Specifies the settings for your event selectors. You can use event selectors to log management events and data events for the following resource types: * "AWS::DynamoDB::Table" * "AWS::Lambda::Function" * "AWS::S3::Object" You can't use event selectors to log network activity events. You can configure up to five event selectors for a trail. You can use either "EventSelectors" or "AdvancedEventSelectors" in a "PutEventSelectors" request, but not both. If you apply "EventSelectors" to a trail, any existing "AdvancedEventSelectors" are overwritten. * *(dict) --* Use event selectors to further specify the management and data event settings for your trail. By default, trails created without specific event selectors will be configured to log all read and write management events, and no data events. When an event occurs in your account, CloudTrail evaluates the event selector for all trails. For each trail, if the event matches any event selector, the trail processes and logs the event. If the event doesn't match any event selector, the trail doesn't log the event. You can configure up to five event selectors for a trail. You cannot apply both event selectors and advanced event selectors to a trail. * **ReadWriteType** *(string) --* Specify if you want your trail to log read-only events, write-only events, or all. For example, the EC2 "GetConsoleOutput" is a read-only API operation and "RunInstances" is a write-only API operation. By default, the value is "All". * **IncludeManagementEvents** *(boolean) --* Specify if you want your event selector to include management events for your trail. For more information, see Management Events in the *CloudTrail User Guide*. By default, the value is "true". The first copy of management events is free. You are charged for additional copies of management events that you are logging on any subsequent trail in the same Region. For more information about CloudTrail pricing, see CloudTrail Pricing. * **DataResources** *(list) --* CloudTrail supports data event logging for Amazon S3 objects in standard S3 buckets, Lambda functions, and Amazon DynamoDB tables with basic event selectors. You can specify up to 250 resources for an individual event selector, but the total number of data resources cannot exceed 250 across all event selectors in a trail. This limit does not apply if you configure resource logging for all data events. For more information, see Data Events and Limits in CloudTrail in the *CloudTrail User Guide*. Note: To log data events for all other resource types including objects stored in directory buckets, you must use AdvancedEventSelectors. You must also use "AdvancedEventSelectors" if you want to filter on the "eventName" field. * *(dict) --* You can configure the "DataResource" in an "EventSelector" to log data events for the following three resource types: * "AWS::DynamoDB::Table" * "AWS::Lambda::Function" * "AWS::S3::Object" To log data events for all other resource types including objects stored in directory buckets, you must use AdvancedEventSelectors. You must also use "AdvancedEventSelectors" if you want to filter on the "eventName" field. Configure the "DataResource" to specify the resource type and resource ARNs for which you want to log data events. Note: The total number of allowed data resources is 250. This number can be distributed between 1 and 5 event selectors, but the total cannot exceed 250 across all selectors for the trail. The following example demonstrates how logging works when you configure logging of all data events for a general purpose bucket named "amzn-s3-demo-bucket1". In this example, the CloudTrail user specified an empty prefix, and the option to log both "Read" and "Write" data events. * A user uploads an image file to "amzn-s3-demo- bucket1". * The "PutObject" API operation is an Amazon S3 object- level API. It is recorded as a data event in CloudTrail. Because the CloudTrail user specified an S3 bucket with an empty prefix, events that occur on any object in that bucket are logged. The trail processes and logs the event. * A user uploads an object to an Amazon S3 bucket named "arn:aws:s3:::amzn-s3-demo-bucket1". * The "PutObject" API operation occurred for an object in an S3 bucket that the CloudTrail user didn't specify for the trail. The trail doesn’t log the event. The following example demonstrates how logging works when you configure logging of Lambda data events for a Lambda function named *MyLambdaFunction*, but not for all Lambda functions. * A user runs a script that includes a call to the *MyLambdaFunction* function and the *MyOtherLambdaFunction* function. * The "Invoke" API operation on *MyLambdaFunction* is an Lambda API. It is recorded as a data event in CloudTrail. Because the CloudTrail user specified logging data events for *MyLambdaFunction*, any invocations of that function are logged. The trail processes and logs the event. * The "Invoke" API operation on *MyOtherLambdaFunction* is an Lambda API. Because the CloudTrail user did not specify logging data events for all Lambda functions, the "Invoke" operation for *MyOtherLambdaFunction* does not match the function specified for the trail. The trail doesn’t log the event. * **Type** *(string) --* The resource type in which you want to log data events. You can specify the following *basic* event selector resource types: * "AWS::DynamoDB::Table" * "AWS::Lambda::Function" * "AWS::S3::Object" Additional resource types are available through *advanced* event selectors. For more information, see AdvancedEventSelector. * **Values** *(list) --* An array of Amazon Resource Name (ARN) strings or partial ARN strings for the specified resource type. * To log data events for all objects in all S3 buckets in your Amazon Web Services account, specify the prefix as "arn:aws:s3". Note: This also enables logging of data event activity performed by any user or role in your Amazon Web Services account, even if that activity is performed on a bucket that belongs to another Amazon Web Services account. * To log data events for all objects in an S3 bucket, specify the bucket and an empty object prefix such as "arn:aws:s3:::amzn-s3-demo-bucket1/". The trail logs data events for all objects in this S3 bucket. * To log data events for specific objects, specify the S3 bucket and object prefix such as "arn:aws:s3:::amzn-s3-demo-bucket1/example-images". The trail logs data events for objects in this S3 bucket that match the prefix. * To log data events for all Lambda functions in your Amazon Web Services account, specify the prefix as "arn:aws:lambda". Note: This also enables logging of "Invoke" activity performed by any user or role in your Amazon Web Services account, even if that activity is performed on a function that belongs to another Amazon Web Services account. * To log data events for a specific Lambda function, specify the function ARN. Note: Lambda function ARNs are exact. For example, if you specify a function ARN *arn:aws:lambda:us- west-2:111111111111:function:helloworld*, data events will only be logged for *arn:aws:lambda:us- west-2:111111111111:function:helloworld*. They will not be logged for *arn:aws:lambda:us- west-2:111111111111:function:helloworld2*. * To log data events for all DynamoDB tables in your Amazon Web Services account, specify the prefix as "arn:aws:dynamodb". * *(string) --* * **ExcludeManagementEventSources** *(list) --* An optional list of service event sources from which you do not want management events to be logged on your trail. In this release, the list can be empty (disables the filter), or it can filter out Key Management Service or Amazon RDS Data API events by containing "kms.amazonaws.com" or "rdsdata.amazonaws.com". By default, "ExcludeManagementEventSources" is empty, and KMS and Amazon RDS Data API events are logged to your trail. You can exclude management event sources only in Regions that support the event source. * *(string) --* * **AdvancedEventSelectors** (*list*) -- Specifies the settings for advanced event selectors. You can use advanced event selectors to log management events, data events for all resource types, and network activity events. You can add advanced event selectors, and conditions for your advanced event selectors, up to a maximum of 500 values for all conditions and selectors on a trail. You can use either "AdvancedEventSelectors" or "EventSelectors", but not both. If you apply "AdvancedEventSelectors" to a trail, any existing "EventSelectors" are overwritten. For more information about advanced event selectors, see Logging data events and Logging network activity events in the *CloudTrail User Guide*. * *(dict) --* Advanced event selectors let you create fine-grained selectors for CloudTrail management, data, and network activity events. They help you control costs by logging only those events that are important to you. For more information about configuring advanced event selectors, see the Logging data events, Logging network activity events, and Logging management events topics in the *CloudTrail User Guide*. You cannot apply both event selectors and advanced event selectors to a trail. For information about configurable advanced event selector fields, see AdvancedEventSelector in the *CloudTrail API Reference*. * **Name** *(string) --* An optional, descriptive name for an advanced event selector, such as "Log data events for only two S3 buckets". * **FieldSelectors** *(list) --* **[REQUIRED]** Contains all selector statements in an advanced event selector. * *(dict) --* A single selector statement in an advanced event selector. * **Field** *(string) --* **[REQUIRED]** A field in a CloudTrail event record on which to filter events to be logged. For event data stores for CloudTrail Insights events, Config configuration items, Audit Manager evidence, or events outside of Amazon Web Services, the field is used only for selecting events as filtering is not supported. For more information, see AdvancedFieldSelector in the *CloudTrail API Reference*. Note: Selectors don't support the use of wildcards like "*" . To match multiple values with a single condition, you may use "StartsWith", "EndsWith", "NotStartsWith", or "NotEndsWith" to explicitly match the beginning or end of the event field. * **Equals** *(list) --* An operator that includes events that match the exact value of the event record field specified as the value of "Field". This is the only valid operator that you can use with the "readOnly", "eventCategory", and "resources.type" fields. * *(string) --* * **StartsWith** *(list) --* An operator that includes events that match the first few characters of the event record field specified as the value of "Field". * *(string) --* * **EndsWith** *(list) --* An operator that includes events that match the last few characters of the event record field specified as the value of "Field". * *(string) --* * **NotEquals** *(list) --* An operator that excludes events that match the exact value of the event record field specified as the value of "Field". * *(string) --* * **NotStartsWith** *(list) --* An operator that excludes events that match the first few characters of the event record field specified as the value of "Field". * *(string) --* * **NotEndsWith** *(list) --* An operator that excludes events that match the last few characters of the event record field specified as the value of "Field". * *(string) --* Return type: dict Returns: **Response Syntax** { 'TrailARN': 'string', 'EventSelectors': [ { 'ReadWriteType': 'ReadOnly'|'WriteOnly'|'All', 'IncludeManagementEvents': True|False, 'DataResources': [ { 'Type': 'string', 'Values': [ 'string', ] }, ], 'ExcludeManagementEventSources': [ 'string', ] }, ], 'AdvancedEventSelectors': [ { 'Name': 'string', 'FieldSelectors': [ { 'Field': 'string', 'Equals': [ 'string', ], 'StartsWith': [ 'string', ], 'EndsWith': [ 'string', ], 'NotEquals': [ 'string', ], 'NotStartsWith': [ 'string', ], 'NotEndsWith': [ 'string', ] }, ] }, ] } **Response Structure** * *(dict) --* * **TrailARN** *(string) --* Specifies the ARN of the trail that was updated with event selectors. The following is the format of a trail ARN. "arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail" * **EventSelectors** *(list) --* Specifies the event selectors configured for your trail. * *(dict) --* Use event selectors to further specify the management and data event settings for your trail. By default, trails created without specific event selectors will be configured to log all read and write management events, and no data events. When an event occurs in your account, CloudTrail evaluates the event selector for all trails. For each trail, if the event matches any event selector, the trail processes and logs the event. If the event doesn't match any event selector, the trail doesn't log the event. You can configure up to five event selectors for a trail. You cannot apply both event selectors and advanced event selectors to a trail. * **ReadWriteType** *(string) --* Specify if you want your trail to log read-only events, write-only events, or all. For example, the EC2 "GetConsoleOutput" is a read-only API operation and "RunInstances" is a write-only API operation. By default, the value is "All". * **IncludeManagementEvents** *(boolean) --* Specify if you want your event selector to include management events for your trail. For more information, see Management Events in the *CloudTrail User Guide*. By default, the value is "true". The first copy of management events is free. You are charged for additional copies of management events that you are logging on any subsequent trail in the same Region. For more information about CloudTrail pricing, see CloudTrail Pricing. * **DataResources** *(list) --* CloudTrail supports data event logging for Amazon S3 objects in standard S3 buckets, Lambda functions, and Amazon DynamoDB tables with basic event selectors. You can specify up to 250 resources for an individual event selector, but the total number of data resources cannot exceed 250 across all event selectors in a trail. This limit does not apply if you configure resource logging for all data events. For more information, see Data Events and Limits in CloudTrail in the *CloudTrail User Guide*. Note: To log data events for all other resource types including objects stored in directory buckets, you must use AdvancedEventSelectors. You must also use "AdvancedEventSelectors" if you want to filter on the "eventName" field. * *(dict) --* You can configure the "DataResource" in an "EventSelector" to log data events for the following three resource types: * "AWS::DynamoDB::Table" * "AWS::Lambda::Function" * "AWS::S3::Object" To log data events for all other resource types including objects stored in directory buckets, you must use AdvancedEventSelectors. You must also use "AdvancedEventSelectors" if you want to filter on the "eventName" field. Configure the "DataResource" to specify the resource type and resource ARNs for which you want to log data events. Note: The total number of allowed data resources is 250. This number can be distributed between 1 and 5 event selectors, but the total cannot exceed 250 across all selectors for the trail. The following example demonstrates how logging works when you configure logging of all data events for a general purpose bucket named "amzn-s3-demo-bucket1". In this example, the CloudTrail user specified an empty prefix, and the option to log both "Read" and "Write" data events. * A user uploads an image file to "amzn-s3-demo- bucket1". * The "PutObject" API operation is an Amazon S3 object-level API. It is recorded as a data event in CloudTrail. Because the CloudTrail user specified an S3 bucket with an empty prefix, events that occur on any object in that bucket are logged. The trail processes and logs the event. * A user uploads an object to an Amazon S3 bucket named "arn:aws:s3:::amzn-s3-demo-bucket1". * The "PutObject" API operation occurred for an object in an S3 bucket that the CloudTrail user didn't specify for the trail. The trail doesn’t log the event. The following example demonstrates how logging works when you configure logging of Lambda data events for a Lambda function named *MyLambdaFunction*, but not for all Lambda functions. * A user runs a script that includes a call to the *MyLambdaFunction* function and the *MyOtherLambdaFunction* function. * The "Invoke" API operation on *MyLambdaFunction* is an Lambda API. It is recorded as a data event in CloudTrail. Because the CloudTrail user specified logging data events for *MyLambdaFunction*, any invocations of that function are logged. The trail processes and logs the event. * The "Invoke" API operation on *MyOtherLambdaFunction* is an Lambda API. Because the CloudTrail user did not specify logging data events for all Lambda functions, the "Invoke" operation for *MyOtherLambdaFunction* does not match the function specified for the trail. The trail doesn’t log the event. * **Type** *(string) --* The resource type in which you want to log data events. You can specify the following *basic* event selector resource types: * "AWS::DynamoDB::Table" * "AWS::Lambda::Function" * "AWS::S3::Object" Additional resource types are available through *advanced* event selectors. For more information, see AdvancedEventSelector. * **Values** *(list) --* An array of Amazon Resource Name (ARN) strings or partial ARN strings for the specified resource type. * To log data events for all objects in all S3 buckets in your Amazon Web Services account, specify the prefix as "arn:aws:s3". Note: This also enables logging of data event activity performed by any user or role in your Amazon Web Services account, even if that activity is performed on a bucket that belongs to another Amazon Web Services account. * To log data events for all objects in an S3 bucket, specify the bucket and an empty object prefix such as "arn:aws:s3:::amzn-s3-demo- bucket1/". The trail logs data events for all objects in this S3 bucket. * To log data events for specific objects, specify the S3 bucket and object prefix such as "arn:aws:s3:::amzn-s3-demo-bucket1/example- images". The trail logs data events for objects in this S3 bucket that match the prefix. * To log data events for all Lambda functions in your Amazon Web Services account, specify the prefix as "arn:aws:lambda". Note: This also enables logging of "Invoke" activity performed by any user or role in your Amazon Web Services account, even if that activity is performed on a function that belongs to another Amazon Web Services account. * To log data events for a specific Lambda function, specify the function ARN. Note: Lambda function ARNs are exact. For example, if you specify a function ARN *arn:aws:lambda:us- west-2:111111111111:function:helloworld*, data events will only be logged for *arn:aws:lambda:us- west-2:111111111111:function:helloworld*. They will not be logged for *arn:aws:lambda:us- west-2:111111111111:function:helloworld2*. * To log data events for all DynamoDB tables in your Amazon Web Services account, specify the prefix as "arn:aws:dynamodb". * *(string) --* * **ExcludeManagementEventSources** *(list) --* An optional list of service event sources from which you do not want management events to be logged on your trail. In this release, the list can be empty (disables the filter), or it can filter out Key Management Service or Amazon RDS Data API events by containing "kms.amazonaws.com" or "rdsdata.amazonaws.com". By default, "ExcludeManagementEventSources" is empty, and KMS and Amazon RDS Data API events are logged to your trail. You can exclude management event sources only in Regions that support the event source. * *(string) --* * **AdvancedEventSelectors** *(list) --* Specifies the advanced event selectors configured for your trail. * *(dict) --* Advanced event selectors let you create fine-grained selectors for CloudTrail management, data, and network activity events. They help you control costs by logging only those events that are important to you. For more information about configuring advanced event selectors, see the Logging data events, Logging network activity events, and Logging management events topics in the *CloudTrail User Guide*. You cannot apply both event selectors and advanced event selectors to a trail. For information about configurable advanced event selector fields, see AdvancedEventSelector in the *CloudTrail API Reference*. * **Name** *(string) --* An optional, descriptive name for an advanced event selector, such as "Log data events for only two S3 buckets". * **FieldSelectors** *(list) --* Contains all selector statements in an advanced event selector. * *(dict) --* A single selector statement in an advanced event selector. * **Field** *(string) --* A field in a CloudTrail event record on which to filter events to be logged. For event data stores for CloudTrail Insights events, Config configuration items, Audit Manager evidence, or events outside of Amazon Web Services, the field is used only for selecting events as filtering is not supported. For more information, see AdvancedFieldSelector in the *CloudTrail API Reference*. Note: Selectors don't support the use of wildcards like "*" . To match multiple values with a single condition, you may use "StartsWith", "EndsWith", "NotStartsWith", or "NotEndsWith" to explicitly match the beginning or end of the event field. * **Equals** *(list) --* An operator that includes events that match the exact value of the event record field specified as the value of "Field". This is the only valid operator that you can use with the "readOnly", "eventCategory", and "resources.type" fields. * *(string) --* * **StartsWith** *(list) --* An operator that includes events that match the first few characters of the event record field specified as the value of "Field". * *(string) --* * **EndsWith** *(list) --* An operator that includes events that match the last few characters of the event record field specified as the value of "Field". * *(string) --* * **NotEquals** *(list) --* An operator that excludes events that match the exact value of the event record field specified as the value of "Field". * *(string) --* * **NotStartsWith** *(list) --* An operator that excludes events that match the first few characters of the event record field specified as the value of "Field". * *(string) --* * **NotEndsWith** *(list) --* An operator that excludes events that match the last few characters of the event record field specified as the value of "Field". * *(string) --* **Exceptions** * "CloudTrail.Client.exceptions.TrailNotFoundException" * "CloudTrail.Client.exceptions.InvalidTrailNameException" * "CloudTrail.Client.exceptions.CloudTrailARNInvalidException" * "CloudTrail.Client.exceptions.InvalidHomeRegionException" * "CloudTrail.Client.exceptions.InvalidEventSelectorsException" * "CloudTrail.Client.exceptions.ConflictException" * "CloudTrail.Client.exceptions.ThrottlingException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.NotOrganizationMasterAccountExcept ion" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" * "CloudTrail.Client.exceptions.InsufficientDependencyServiceAcces sPermissionException" CloudTrail / Client / start_event_data_store_ingestion start_event_data_store_ingestion ******************************** CloudTrail.Client.start_event_data_store_ingestion(**kwargs) Starts the ingestion of live events on an event data store specified as either an ARN or the ID portion of the ARN. To start ingestion, the event data store "Status" must be "STOPPED_INGESTION" and the "eventCategory" must be "Management", "Data", "NetworkActivity", or "ConfigurationItem". See also: AWS API Documentation **Request Syntax** response = client.start_event_data_store_ingestion( EventDataStore='string' ) Parameters: **EventDataStore** (*string*) -- **[REQUIRED]** The ARN (or ID suffix of the ARN) of the event data store for which you want to start ingestion. Return type: dict Returns: **Response Syntax** {} **Response Structure** * *(dict) --* **Exceptions** * "CloudTrail.Client.exceptions.EventDataStoreARNInvalidException" * "CloudTrail.Client.exceptions.EventDataStoreNotFoundException" * "CloudTrail.Client.exceptions.InvalidEventDataStoreStatusExcepti on" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.InvalidEventDataStoreCategoryExcep tion" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.NotOrganizationMasterAccountExcept ion" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" * "CloudTrail.Client.exceptions.InsufficientDependencyServiceAcces sPermissionException" * "CloudTrail.Client.exceptions.ConflictException" CloudTrail / Client / list_dashboards list_dashboards *************** CloudTrail.Client.list_dashboards(**kwargs) Returns information about all dashboards in the account, in the current Region. See also: AWS API Documentation **Request Syntax** response = client.list_dashboards( NamePrefix='string', Type='MANAGED'|'CUSTOM', NextToken='string', MaxResults=123 ) Parameters: * **NamePrefix** (*string*) -- Specify a name prefix to filter on. * **Type** (*string*) -- Specify a dashboard type to filter on: "CUSTOM" or "MANAGED". * **NextToken** (*string*) -- A token you can use to get the next page of dashboard results. * **MaxResults** (*integer*) -- The maximum number of dashboards to display on a single page. Return type: dict Returns: **Response Syntax** { 'Dashboards': [ { 'DashboardArn': 'string', 'Type': 'MANAGED'|'CUSTOM' }, ], 'NextToken': 'string' } **Response Structure** * *(dict) --* * **Dashboards** *(list) --* Contains information about dashboards in the account, in the current Region that match the applied filters. * *(dict) --* Provides information about a CloudTrail Lake dashboard. * **DashboardArn** *(string) --* The ARN for the dashboard. * **Type** *(string) --* The type of dashboard. * **NextToken** *(string) --* A token you can use to get the next page of dashboard results. **Exceptions** * "CloudTrail.Client.exceptions.UnsupportedOperationException" CloudTrail / Client / get_event_configuration get_event_configuration *********************** CloudTrail.Client.get_event_configuration(**kwargs) Retrieves the current event configuration settings for the specified event data store, including details about maximum event size and context key selectors configured for the event data store. See also: AWS API Documentation **Request Syntax** response = client.get_event_configuration( EventDataStore='string' ) Parameters: **EventDataStore** (*string*) -- The Amazon Resource Name (ARN) or ID suffix of the ARN of the event data store for which you want to retrieve event configuration settings. Return type: dict Returns: **Response Syntax** { 'EventDataStoreArn': 'string', 'MaxEventSize': 'Standard'|'Large', 'ContextKeySelectors': [ { 'Type': 'TagContext'|'RequestContext', 'Equals': [ 'string', ] }, ] } **Response Structure** * *(dict) --* * **EventDataStoreArn** *(string) --* The Amazon Resource Name (ARN) or ID suffix of the ARN of the event data store for which the event configuration settings are returned. * **MaxEventSize** *(string) --* The maximum allowed size for events stored in the specified event data store. * **ContextKeySelectors** *(list) --* The list of context key selectors that are configured for the event data store. * *(dict) --* An object that contains information types to be included in CloudTrail enriched events. * **Type** *(string) --* Specifies the type of the event record field in ContextKeySelector. Valid values include RequestContext, TagContext. * **Equals** *(list) --* A list of keys defined by Type to be included in CloudTrail enriched events. * *(string) --* **Exceptions** * "CloudTrail.Client.exceptions.CloudTrailARNInvalidException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.EventDataStoreARNInvalidException" * "CloudTrail.Client.exceptions.EventDataStoreNotFoundException" * "CloudTrail.Client.exceptions.InvalidEventDataStoreStatusExcepti on" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.InvalidEventDataStoreCategoryExcep tion" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" * "CloudTrail.Client.exceptions.InvalidParameterCombinationExcepti on" CloudTrail / Client / update_dashboard update_dashboard **************** CloudTrail.Client.update_dashboard(**kwargs) Updates the specified dashboard. To set a refresh schedule, CloudTrail must be granted permissions to run the "StartDashboardRefresh" operation to refresh the dashboard on your behalf. To provide permissions, run the "PutResourcePolicy" operation to attach a resource-based policy to the dashboard. For more information, see Resource-based policy example for a dashboard in the *CloudTrail User Guide*. CloudTrail runs queries to populate the dashboard's widgets during a manual or scheduled refresh. CloudTrail must be granted permissions to run the "StartQuery" operation on your behalf. To provide permissions, run the "PutResourcePolicy" operation to attach a resource-based policy to each event data store. For more information, see Example: Allow CloudTrail to run queries to populate a dashboard in the *CloudTrail User Guide*. See also: AWS API Documentation **Request Syntax** response = client.update_dashboard( DashboardId='string', Widgets=[ { 'QueryStatement': 'string', 'QueryParameters': [ 'string', ], 'ViewProperties': { 'string': 'string' } }, ], RefreshSchedule={ 'Frequency': { 'Unit': 'HOURS'|'DAYS', 'Value': 123 }, 'Status': 'ENABLED'|'DISABLED', 'TimeOfDay': 'string' }, TerminationProtectionEnabled=True|False ) Parameters: * **DashboardId** (*string*) -- **[REQUIRED]** The name or ARN of the dashboard. * **Widgets** (*list*) -- An array of widgets for the dashboard. A custom dashboard can have a maximum of 10 widgets. To add new widgets, pass in an array that includes the existing widgets along with any new widgets. Run the "GetDashboard" operation to get the list of widgets for the dashboard. To remove widgets, pass in an array that includes the existing widgets minus the widgets you want removed. * *(dict) --* Contains information about a widget on a CloudTrail Lake dashboard. * **QueryStatement** *(string) --* **[REQUIRED]** The query statement for the widget. For custom dashboard widgets, you can query across multiple event data stores as long as all event data stores exist in your account. Note: When a query uses "?" with "eventTime", "?" must be surrounded by single quotes as follows: "'?'". * **QueryParameters** *(list) --* The optional query parameters. The following query parameters are valid: "$StartTime$", "$EndTime$", and "$Period$". * *(string) --* * **ViewProperties** *(dict) --* **[REQUIRED]** The view properties for the widget. For more information about view properties, see View properties for widgets in the *CloudTrail User Guide*. * *(string) --* * *(string) --* * **RefreshSchedule** (*dict*) -- The refresh schedule configuration for the dashboard. * **Frequency** *(dict) --* The frequency at which you want the dashboard refreshed. * **Unit** *(string) --* The unit to use for the refresh. For custom dashboards, the unit can be "HOURS" or "DAYS". For the Highlights dashboard, the "Unit" must be "HOURS". * **Value** *(integer) --* The value for the refresh schedule. For custom dashboards, the following values are valid when the unit is "HOURS": "1", "6", "12", "24" For custom dashboards, the only valid value when the unit is "DAYS" is "1". For the Highlights dashboard, the "Value" must be "6". * **Status** *(string) --* Specifies whether the refresh schedule is enabled. Set the value to "ENABLED" to enable the refresh schedule, or to "DISABLED" to turn off the refresh schedule. * **TimeOfDay** *(string) --* The time of day in UTC to run the schedule; for hourly only refer to minutes; default is 00:00. * **TerminationProtectionEnabled** (*boolean*) -- Specifies whether termination protection is enabled for the dashboard. If termination protection is enabled, you cannot delete the dashboard until termination protection is disabled. Return type: dict Returns: **Response Syntax** { 'DashboardArn': 'string', 'Name': 'string', 'Type': 'MANAGED'|'CUSTOM', 'Widgets': [ { 'QueryAlias': 'string', 'QueryStatement': 'string', 'QueryParameters': [ 'string', ], 'ViewProperties': { 'string': 'string' } }, ], 'RefreshSchedule': { 'Frequency': { 'Unit': 'HOURS'|'DAYS', 'Value': 123 }, 'Status': 'ENABLED'|'DISABLED', 'TimeOfDay': 'string' }, 'TerminationProtectionEnabled': True|False, 'CreatedTimestamp': datetime(2015, 1, 1), 'UpdatedTimestamp': datetime(2015, 1, 1) } **Response Structure** * *(dict) --* * **DashboardArn** *(string) --* The ARN for the dashboard. * **Name** *(string) --* The name for the dashboard. * **Type** *(string) --* The type of dashboard. * **Widgets** *(list) --* An array of widgets for the dashboard. * *(dict) --* A widget on a CloudTrail Lake dashboard. * **QueryAlias** *(string) --* The query alias used to identify the query for the widget. * **QueryStatement** *(string) --* The SQL query statement for the widget. * **QueryParameters** *(list) --* The query parameters for the widget. * *(string) --* * **ViewProperties** *(dict) --* The view properties for the widget. For more information about view properties, see View properties for widgets in the *CloudTrail User Guide*.. * *(string) --* * *(string) --* * **RefreshSchedule** *(dict) --* The refresh schedule for the dashboard, if configured. * **Frequency** *(dict) --* The frequency at which you want the dashboard refreshed. * **Unit** *(string) --* The unit to use for the refresh. For custom dashboards, the unit can be "HOURS" or "DAYS". For the Highlights dashboard, the "Unit" must be "HOURS". * **Value** *(integer) --* The value for the refresh schedule. For custom dashboards, the following values are valid when the unit is "HOURS": "1", "6", "12", "24" For custom dashboards, the only valid value when the unit is "DAYS" is "1". For the Highlights dashboard, the "Value" must be "6". * **Status** *(string) --* Specifies whether the refresh schedule is enabled. Set the value to "ENABLED" to enable the refresh schedule, or to "DISABLED" to turn off the refresh schedule. * **TimeOfDay** *(string) --* The time of day in UTC to run the schedule; for hourly only refer to minutes; default is 00:00. * **TerminationProtectionEnabled** *(boolean) --* Indicates whether termination protection is enabled for the dashboard. * **CreatedTimestamp** *(datetime) --* The timestamp that shows when the dashboard was created. * **UpdatedTimestamp** *(datetime) --* The timestamp that shows when the dashboard was updated. **Exceptions** * "CloudTrail.Client.exceptions.ConflictException" * "CloudTrail.Client.exceptions.ResourceNotFoundException" * "CloudTrail.Client.exceptions.EventDataStoreNotFoundException" * "CloudTrail.Client.exceptions.InactiveEventDataStoreException" * "CloudTrail.Client.exceptions.InsufficientEncryptionPolicyExcept ion" * "CloudTrail.Client.exceptions.InvalidQueryStatementException" * "CloudTrail.Client.exceptions.ServiceQuotaExceededException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" CloudTrail / Client / list_channels list_channels ************* CloudTrail.Client.list_channels(**kwargs) Lists the channels in the current account, and their source names. See also: AWS API Documentation **Request Syntax** response = client.list_channels( MaxResults=123, NextToken='string' ) Parameters: * **MaxResults** (*integer*) -- The maximum number of CloudTrail channels to display on a single page. * **NextToken** (*string*) -- The token to use to get the next page of results after a previous API call. This token must be passed in with the same parameters that were specified in the original call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters. Return type: dict Returns: **Response Syntax** { 'Channels': [ { 'ChannelArn': 'string', 'Name': 'string' }, ], 'NextToken': 'string' } **Response Structure** * *(dict) --* * **Channels** *(list) --* The list of channels in the account. * *(dict) --* Contains information about a returned CloudTrail channel. * **ChannelArn** *(string) --* The Amazon Resource Name (ARN) of a channel. * **Name** *(string) --* The name of the CloudTrail channel. For service-linked channels, the name is "aws-service-channel/service-name /custom-suffix" where "service-name" represents the name of the Amazon Web Services service that created the channel and "custom-suffix" represents the suffix created by the Amazon Web Services service. * **NextToken** *(string) --* The token to use to get the next page of results after a previous API call. **Exceptions** * "CloudTrail.Client.exceptions.InvalidNextTokenException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" CloudTrail / Client / get_event_data_store get_event_data_store ******************** CloudTrail.Client.get_event_data_store(**kwargs) Returns information about an event data store specified as either an ARN or the ID portion of the ARN. See also: AWS API Documentation **Request Syntax** response = client.get_event_data_store( EventDataStore='string' ) Parameters: **EventDataStore** (*string*) -- **[REQUIRED]** The ARN (or ID suffix of the ARN) of the event data store about which you want information. Return type: dict Returns: **Response Syntax** { 'EventDataStoreArn': 'string', 'Name': 'string', 'Status': 'CREATED'|'ENABLED'|'PENDING_DELETION'|'STARTING_INGESTION'|'STOPPING_INGESTION'|'STOPPED_INGESTION', 'AdvancedEventSelectors': [ { 'Name': 'string', 'FieldSelectors': [ { 'Field': 'string', 'Equals': [ 'string', ], 'StartsWith': [ 'string', ], 'EndsWith': [ 'string', ], 'NotEquals': [ 'string', ], 'NotStartsWith': [ 'string', ], 'NotEndsWith': [ 'string', ] }, ] }, ], 'MultiRegionEnabled': True|False, 'OrganizationEnabled': True|False, 'RetentionPeriod': 123, 'TerminationProtectionEnabled': True|False, 'CreatedTimestamp': datetime(2015, 1, 1), 'UpdatedTimestamp': datetime(2015, 1, 1), 'KmsKeyId': 'string', 'BillingMode': 'EXTENDABLE_RETENTION_PRICING'|'FIXED_RETENTION_PRICING', 'FederationStatus': 'ENABLING'|'ENABLED'|'DISABLING'|'DISABLED', 'FederationRoleArn': 'string', 'PartitionKeys': [ { 'Name': 'string', 'Type': 'string' }, ] } **Response Structure** * *(dict) --* * **EventDataStoreArn** *(string) --* The event data store Amazon Resource Number (ARN). * **Name** *(string) --* The name of the event data store. * **Status** *(string) --* The status of an event data store. * **AdvancedEventSelectors** *(list) --* The advanced event selectors used to select events for the data store. * *(dict) --* Advanced event selectors let you create fine-grained selectors for CloudTrail management, data, and network activity events. They help you control costs by logging only those events that are important to you. For more information about configuring advanced event selectors, see the Logging data events, Logging network activity events, and Logging management events topics in the *CloudTrail User Guide*. You cannot apply both event selectors and advanced event selectors to a trail. For information about configurable advanced event selector fields, see AdvancedEventSelector in the *CloudTrail API Reference*. * **Name** *(string) --* An optional, descriptive name for an advanced event selector, such as "Log data events for only two S3 buckets". * **FieldSelectors** *(list) --* Contains all selector statements in an advanced event selector. * *(dict) --* A single selector statement in an advanced event selector. * **Field** *(string) --* A field in a CloudTrail event record on which to filter events to be logged. For event data stores for CloudTrail Insights events, Config configuration items, Audit Manager evidence, or events outside of Amazon Web Services, the field is used only for selecting events as filtering is not supported. For more information, see AdvancedFieldSelector in the *CloudTrail API Reference*. Note: Selectors don't support the use of wildcards like "*" . To match multiple values with a single condition, you may use "StartsWith", "EndsWith", "NotStartsWith", or "NotEndsWith" to explicitly match the beginning or end of the event field. * **Equals** *(list) --* An operator that includes events that match the exact value of the event record field specified as the value of "Field". This is the only valid operator that you can use with the "readOnly", "eventCategory", and "resources.type" fields. * *(string) --* * **StartsWith** *(list) --* An operator that includes events that match the first few characters of the event record field specified as the value of "Field". * *(string) --* * **EndsWith** *(list) --* An operator that includes events that match the last few characters of the event record field specified as the value of "Field". * *(string) --* * **NotEquals** *(list) --* An operator that excludes events that match the exact value of the event record field specified as the value of "Field". * *(string) --* * **NotStartsWith** *(list) --* An operator that excludes events that match the first few characters of the event record field specified as the value of "Field". * *(string) --* * **NotEndsWith** *(list) --* An operator that excludes events that match the last few characters of the event record field specified as the value of "Field". * *(string) --* * **MultiRegionEnabled** *(boolean) --* Indicates whether the event data store includes events from all Regions, or only from the Region in which it was created. * **OrganizationEnabled** *(boolean) --* Indicates whether an event data store is collecting logged events for an organization in Organizations. * **RetentionPeriod** *(integer) --* The retention period of the event data store, in days. * **TerminationProtectionEnabled** *(boolean) --* Indicates that termination protection is enabled. * **CreatedTimestamp** *(datetime) --* The timestamp of the event data store's creation. * **UpdatedTimestamp** *(datetime) --* Shows the time that an event data store was updated, if applicable. "UpdatedTimestamp" is always either the same or newer than the time shown in "CreatedTimestamp". * **KmsKeyId** *(string) --* Specifies the KMS key ID that encrypts the events delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the following format. "arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234- 1234-123456789012" * **BillingMode** *(string) --* The billing mode for the event data store. * **FederationStatus** *(string) --* Indicates the Lake query federation status. The status is "ENABLED" if Lake query federation is enabled, or "DISABLED" if Lake query federation is disabled. You cannot delete an event data store if the "FederationStatus" is "ENABLED". * **FederationRoleArn** *(string) --* If Lake query federation is enabled, provides the ARN of the federation role used to access the resources for the federated event data store. * **PartitionKeys** *(list) --* The partition keys for the event data store. To improve query performance and efficiency, CloudTrail Lake organizes event data into partitions based on values derived from partition keys. * *(dict) --* Contains information about a partition key for an event data store. * **Name** *(string) --* The name of the partition key. * **Type** *(string) --* The data type of the partition key. For example, "bigint" or "string". **Exceptions** * "CloudTrail.Client.exceptions.EventDataStoreARNInvalidException" * "CloudTrail.Client.exceptions.EventDataStoreNotFoundException" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" CloudTrail / Client / can_paginate can_paginate ************ CloudTrail.Client.can_paginate(operation_name) Check if an operation can be paginated. Parameters: **operation_name** (*string*) -- The operation name. This is the same name as the method name on the client. For example, if the method name is "create_foo", and you'd normally invoke the operation as "client.create_foo(**kwargs)", if the "create_foo" operation can be paginated, you can use the call "client.get_paginator("create_foo")". Returns: "True" if the operation can be paginated, "False" otherwise. CloudTrail / Client / list_tags list_tags ********* CloudTrail.Client.list_tags(**kwargs) Lists the tags for the specified trails, event data stores, dashboards, or channels in the current Region. See also: AWS API Documentation **Request Syntax** response = client.list_tags( ResourceIdList=[ 'string', ], NextToken='string' ) Parameters: * **ResourceIdList** (*list*) -- **[REQUIRED]** Specifies a list of trail, event data store, dashboard, or channel ARNs whose tags will be listed. The list has a limit of 20 ARNs. Example trail ARN format: "arn:aws:cloudtrail:us- east-2:123456789012:trail/MyTrail" Example event data store ARN format: "arn:aws:cloudtrail:us- east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f- 8bd1-bcf6cEXAMPLE" Example dashboard ARN format: "arn:aws:cloudtrail:us- east-1:123456789012:dashboard/exampleDash" Example channel ARN format: "arn:aws:cloudtrail:us- east-2:123456789012:channel/01234567890" * *(string) --* * **NextToken** (*string*) -- Reserved for future use. Return type: dict Returns: **Response Syntax** { 'ResourceTagList': [ { 'ResourceId': 'string', 'TagsList': [ { 'Key': 'string', 'Value': 'string' }, ] }, ], 'NextToken': 'string' } **Response Structure** * *(dict) --* Returns the objects or data listed below if successful. Otherwise, returns an error. * **ResourceTagList** *(list) --* A list of resource tags. * *(dict) --* A resource tag. * **ResourceId** *(string) --* Specifies the ARN of the resource. * **TagsList** *(list) --* A list of tags. * *(dict) --* A custom key-value pair associated with a resource such as a CloudTrail trail, event data store, dashboard, or channel. * **Key** *(string) --* The key in a key-value pair. The key must be must be no longer than 128 Unicode characters. The key must be unique for the resource to which it applies. * **Value** *(string) --* The value in a key-value pair of a tag. The value must be no longer than 256 Unicode characters. * **NextToken** *(string) --* Reserved for future use. **Exceptions** * "CloudTrail.Client.exceptions.ResourceNotFoundException" * "CloudTrail.Client.exceptions.CloudTrailARNInvalidException" * "CloudTrail.Client.exceptions.EventDataStoreARNInvalidException" * "CloudTrail.Client.exceptions.ChannelARNInvalidException" * "CloudTrail.Client.exceptions.ResourceTypeNotSupportedException" * "CloudTrail.Client.exceptions.InvalidTrailNameException" * "CloudTrail.Client.exceptions.InactiveEventDataStoreException" * "CloudTrail.Client.exceptions.EventDataStoreNotFoundException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.InvalidTokenException" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" CloudTrail / Client / get_query_results get_query_results ***************** CloudTrail.Client.get_query_results(**kwargs) Gets event data results of a query. You must specify the "QueryID" value returned by the "StartQuery" operation. See also: AWS API Documentation **Request Syntax** response = client.get_query_results( EventDataStore='string', QueryId='string', NextToken='string', MaxQueryResults=123, EventDataStoreOwnerAccountId='string' ) Parameters: * **EventDataStore** (*string*) -- The ARN (or ID suffix of the ARN) of the event data store against which the query was run. * **QueryId** (*string*) -- **[REQUIRED]** The ID of the query for which you want to get results. * **NextToken** (*string*) -- A token you can use to get the next page of query results. * **MaxQueryResults** (*integer*) -- The maximum number of query results to display on a single page. * **EventDataStoreOwnerAccountId** (*string*) -- The account ID of the event data store owner. Return type: dict Returns: **Response Syntax** { 'QueryStatus': 'QUEUED'|'RUNNING'|'FINISHED'|'FAILED'|'CANCELLED'|'TIMED_OUT', 'QueryStatistics': { 'ResultsCount': 123, 'TotalResultsCount': 123, 'BytesScanned': 123 }, 'QueryResultRows': [ [ { 'string': 'string' }, ], ], 'NextToken': 'string', 'ErrorMessage': 'string' } **Response Structure** * *(dict) --* * **QueryStatus** *(string) --* The status of the query. Values include "QUEUED", "RUNNING", "FINISHED", "FAILED", "TIMED_OUT", or "CANCELLED". * **QueryStatistics** *(dict) --* Shows the count of query results. * **ResultsCount** *(integer) --* The number of results returned. * **TotalResultsCount** *(integer) --* The total number of results returned by a query. * **BytesScanned** *(integer) --* The total bytes that the query scanned in the event data store. This value matches the number of bytes for which your account is billed for the query, unless the query is still running. * **QueryResultRows** *(list) --* Contains the individual event results of the query. * *(list) --* * *(dict) --* * *(string) --* * *(string) --* * **NextToken** *(string) --* A token you can use to get the next page of query results. * **ErrorMessage** *(string) --* The error message returned if a query failed. **Exceptions** * "CloudTrail.Client.exceptions.EventDataStoreARNInvalidException" * "CloudTrail.Client.exceptions.EventDataStoreNotFoundException" * "CloudTrail.Client.exceptions.InactiveEventDataStoreException" * "CloudTrail.Client.exceptions.InvalidMaxResultsException" * "CloudTrail.Client.exceptions.InvalidNextTokenException" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.QueryIdNotFoundException" * "CloudTrail.Client.exceptions.InsufficientEncryptionPolicyExcept ion" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" CloudTrail / Client / get_dashboard get_dashboard ************* CloudTrail.Client.get_dashboard(**kwargs) Returns the specified dashboard. See also: AWS API Documentation **Request Syntax** response = client.get_dashboard( DashboardId='string' ) Parameters: **DashboardId** (*string*) -- **[REQUIRED]** The name or ARN for the dashboard. Return type: dict Returns: **Response Syntax** { 'DashboardArn': 'string', 'Type': 'MANAGED'|'CUSTOM', 'Status': 'CREATING'|'CREATED'|'UPDATING'|'UPDATED'|'DELETING', 'Widgets': [ { 'QueryAlias': 'string', 'QueryStatement': 'string', 'QueryParameters': [ 'string', ], 'ViewProperties': { 'string': 'string' } }, ], 'RefreshSchedule': { 'Frequency': { 'Unit': 'HOURS'|'DAYS', 'Value': 123 }, 'Status': 'ENABLED'|'DISABLED', 'TimeOfDay': 'string' }, 'CreatedTimestamp': datetime(2015, 1, 1), 'UpdatedTimestamp': datetime(2015, 1, 1), 'LastRefreshId': 'string', 'LastRefreshFailureReason': 'string', 'TerminationProtectionEnabled': True|False } **Response Structure** * *(dict) --* * **DashboardArn** *(string) --* The ARN for the dashboard. * **Type** *(string) --* The type of dashboard. * **Status** *(string) --* The status of the dashboard. * **Widgets** *(list) --* An array of widgets for the dashboard. * *(dict) --* A widget on a CloudTrail Lake dashboard. * **QueryAlias** *(string) --* The query alias used to identify the query for the widget. * **QueryStatement** *(string) --* The SQL query statement for the widget. * **QueryParameters** *(list) --* The query parameters for the widget. * *(string) --* * **ViewProperties** *(dict) --* The view properties for the widget. For more information about view properties, see View properties for widgets in the *CloudTrail User Guide*.. * *(string) --* * *(string) --* * **RefreshSchedule** *(dict) --* The refresh schedule for the dashboard, if configured. * **Frequency** *(dict) --* The frequency at which you want the dashboard refreshed. * **Unit** *(string) --* The unit to use for the refresh. For custom dashboards, the unit can be "HOURS" or "DAYS". For the Highlights dashboard, the "Unit" must be "HOURS". * **Value** *(integer) --* The value for the refresh schedule. For custom dashboards, the following values are valid when the unit is "HOURS": "1", "6", "12", "24" For custom dashboards, the only valid value when the unit is "DAYS" is "1". For the Highlights dashboard, the "Value" must be "6". * **Status** *(string) --* Specifies whether the refresh schedule is enabled. Set the value to "ENABLED" to enable the refresh schedule, or to "DISABLED" to turn off the refresh schedule. * **TimeOfDay** *(string) --* The time of day in UTC to run the schedule; for hourly only refer to minutes; default is 00:00. * **CreatedTimestamp** *(datetime) --* The timestamp that shows when the dashboard was created. * **UpdatedTimestamp** *(datetime) --* The timestamp that shows when the dashboard was last updated. * **LastRefreshId** *(string) --* The ID of the last dashboard refresh. * **LastRefreshFailureReason** *(string) --* Provides information about failures for the last scheduled refresh. * **TerminationProtectionEnabled** *(boolean) --* Indicates whether termination protection is enabled for the dashboard. **Exceptions** * "CloudTrail.Client.exceptions.ResourceNotFoundException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" CloudTrail / Client / put_insight_selectors put_insight_selectors ********************* CloudTrail.Client.put_insight_selectors(**kwargs) Lets you enable Insights event logging by specifying the Insights selectors that you want to enable on an existing trail or event data store. You also use "PutInsightSelectors" to turn off Insights event logging, by passing an empty list of Insights types. The valid Insights event types are "ApiErrorRateInsight" and "ApiCallRateInsight". To enable Insights on an event data store, you must specify the ARNs (or ID suffix of the ARNs) for the source event data store ( "EventDataStore") and the destination event data store ( "InsightsDestination"). The source event data store logs management events and enables Insights. The destination event data store logs Insights events based upon the management event activity of the source event data store. The source and destination event data stores must belong to the same Amazon Web Services account. To log Insights events for a trail, you must specify the name ( "TrailName") of the CloudTrail trail for which you want to change or add Insights selectors. To log CloudTrail Insights events on API call volume, the trail or event data store must log "write" management events. To log CloudTrail Insights events on API error rate, the trail or event data store must log "read" or "write" management events. You can call "GetEventSelectors" on a trail to check whether the trail logs management events. You can call "GetEventDataStore" on an event data store to check whether the event data store logs management events. For more information, see Working with CloudTrail Insights in the *CloudTrail User Guide*. See also: AWS API Documentation **Request Syntax** response = client.put_insight_selectors( TrailName='string', InsightSelectors=[ { 'InsightType': 'ApiCallRateInsight'|'ApiErrorRateInsight' }, ], EventDataStore='string', InsightsDestination='string' ) Parameters: * **TrailName** (*string*) -- The name of the CloudTrail trail for which you want to change or add Insights selectors. You cannot use this parameter with the "EventDataStore" and "InsightsDestination" parameters. * **InsightSelectors** (*list*) -- **[REQUIRED]** A JSON string that contains the Insights types you want to log on a trail or event data store. "ApiCallRateInsight" and "ApiErrorRateInsight" are valid Insight types. The "ApiCallRateInsight" Insights type analyzes write-only management API calls that are aggregated per minute against a baseline API call volume. The "ApiErrorRateInsight" Insights type analyzes management API calls that result in error codes. The error is shown if the API call is unsuccessful. * *(dict) --* A JSON string that contains a list of Insights types that are logged on a trail or event data store. * **InsightType** *(string) --* The type of Insights events to log on a trail or event data store. "ApiCallRateInsight" and "ApiErrorRateInsight" are valid Insight types. The "ApiCallRateInsight" Insights type analyzes write-only management API calls that are aggregated per minute against a baseline API call volume. The "ApiErrorRateInsight" Insights type analyzes management API calls that result in error codes. The error is shown if the API call is unsuccessful. * **EventDataStore** (*string*) -- The ARN (or ID suffix of the ARN) of the source event data store for which you want to change or add Insights selectors. To enable Insights on an event data store, you must provide both the "EventDataStore" and "InsightsDestination" parameters. You cannot use this parameter with the "TrailName" parameter. * **InsightsDestination** (*string*) -- The ARN (or ID suffix of the ARN) of the destination event data store that logs Insights events. To enable Insights on an event data store, you must provide both the "EventDataStore" and "InsightsDestination" parameters. You cannot use this parameter with the "TrailName" parameter. Return type: dict Returns: **Response Syntax** { 'TrailARN': 'string', 'InsightSelectors': [ { 'InsightType': 'ApiCallRateInsight'|'ApiErrorRateInsight' }, ], 'EventDataStoreArn': 'string', 'InsightsDestination': 'string' } **Response Structure** * *(dict) --* * **TrailARN** *(string) --* The Amazon Resource Name (ARN) of a trail for which you want to change or add Insights selectors. * **InsightSelectors** *(list) --* A JSON string that contains the Insights event types that you want to log on a trail or event data store. The valid Insights types are "ApiErrorRateInsight" and "ApiCallRateInsight". * *(dict) --* A JSON string that contains a list of Insights types that are logged on a trail or event data store. * **InsightType** *(string) --* The type of Insights events to log on a trail or event data store. "ApiCallRateInsight" and "ApiErrorRateInsight" are valid Insight types. The "ApiCallRateInsight" Insights type analyzes write- only management API calls that are aggregated per minute against a baseline API call volume. The "ApiErrorRateInsight" Insights type analyzes management API calls that result in error codes. The error is shown if the API call is unsuccessful. * **EventDataStoreArn** *(string) --* The Amazon Resource Name (ARN) of the source event data store for which you want to change or add Insights selectors. * **InsightsDestination** *(string) --* The ARN of the destination event data store that logs Insights events. **Exceptions** * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.InvalidParameterCombinationExcepti on" * "CloudTrail.Client.exceptions.TrailNotFoundException" * "CloudTrail.Client.exceptions.InvalidTrailNameException" * "CloudTrail.Client.exceptions.CloudTrailARNInvalidException" * "CloudTrail.Client.exceptions.InvalidHomeRegionException" * "CloudTrail.Client.exceptions.InvalidInsightSelectorsException" * "CloudTrail.Client.exceptions.InsufficientS3BucketPolicyExceptio n" * "CloudTrail.Client.exceptions.InsufficientEncryptionPolicyExcept ion" * "CloudTrail.Client.exceptions.S3BucketDoesNotExistException" * "CloudTrail.Client.exceptions.KmsException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.NotOrganizationMasterAccountExcept ion" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" * "CloudTrail.Client.exceptions.ThrottlingException" CloudTrail / Client / stop_import stop_import *********** CloudTrail.Client.stop_import(**kwargs) Stops a specified import. See also: AWS API Documentation **Request Syntax** response = client.stop_import( ImportId='string' ) Parameters: **ImportId** (*string*) -- **[REQUIRED]** The ID of the import. Return type: dict Returns: **Response Syntax** { 'ImportId': 'string', 'ImportSource': { 'S3': { 'S3LocationUri': 'string', 'S3BucketRegion': 'string', 'S3BucketAccessRoleArn': 'string' } }, 'Destinations': [ 'string', ], 'ImportStatus': 'INITIALIZING'|'IN_PROGRESS'|'FAILED'|'STOPPED'|'COMPLETED', 'CreatedTimestamp': datetime(2015, 1, 1), 'UpdatedTimestamp': datetime(2015, 1, 1), 'StartEventTime': datetime(2015, 1, 1), 'EndEventTime': datetime(2015, 1, 1), 'ImportStatistics': { 'PrefixesFound': 123, 'PrefixesCompleted': 123, 'FilesCompleted': 123, 'EventsCompleted': 123, 'FailedEntries': 123 } } **Response Structure** * *(dict) --* * **ImportId** *(string) --* The ID for the import. * **ImportSource** *(dict) --* The source S3 bucket for the import. * **S3** *(dict) --* The source S3 bucket. * **S3LocationUri** *(string) --* The URI for the source S3 bucket. * **S3BucketRegion** *(string) --* The Region associated with the source S3 bucket. * **S3BucketAccessRoleArn** *(string) --* The IAM ARN role used to access the source S3 bucket. * **Destinations** *(list) --* The ARN of the destination event data store. * *(string) --* * **ImportStatus** *(string) --* The status of the import. * **CreatedTimestamp** *(datetime) --* The timestamp of the import's creation. * **UpdatedTimestamp** *(datetime) --* The timestamp of the import's last update. * **StartEventTime** *(datetime) --* Used with "EndEventTime" to bound a "StartImport" request, and limit imported trail events to only those events logged within a specified time period. * **EndEventTime** *(datetime) --* Used with "StartEventTime" to bound a "StartImport" request, and limit imported trail events to only those events logged within a specified time period. * **ImportStatistics** *(dict) --* Returns information on the stopped import. * **PrefixesFound** *(integer) --* The number of S3 prefixes found for the import. * **PrefixesCompleted** *(integer) --* The number of S3 prefixes that completed import. * **FilesCompleted** *(integer) --* The number of log files that completed import. * **EventsCompleted** *(integer) --* The number of trail events imported into the event data store. * **FailedEntries** *(integer) --* The number of failed entries. **Exceptions** * "CloudTrail.Client.exceptions.ImportNotFoundException" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" CloudTrail / Client / get_trail_status get_trail_status **************** CloudTrail.Client.get_trail_status(**kwargs) Returns a JSON-formatted list of information about the specified trail. Fields include information on delivery errors, Amazon SNS and Amazon S3 errors, and start and stop logging times for each trail. This operation returns trail status from a single Region. To return trail status from all Regions, you must call the operation on each Region. See also: AWS API Documentation **Request Syntax** response = client.get_trail_status( Name='string' ) Parameters: **Name** (*string*) -- **[REQUIRED]** Specifies the name or the CloudTrail ARN of the trail for which you are requesting status. To get the status of a shadow trail (a replication of the trail in another Region), you must specify its ARN. The following is the format of a trail ARN: "arn:aws:cloudtrail :us-east-2:123456789012:trail/MyTrail" Note: If the trail is an organization trail and you are a member account in the organization in Organizations, you must provide the full ARN of that trail, and not just the name. Return type: dict Returns: **Response Syntax** { 'IsLogging': True|False, 'LatestDeliveryError': 'string', 'LatestNotificationError': 'string', 'LatestDeliveryTime': datetime(2015, 1, 1), 'LatestNotificationTime': datetime(2015, 1, 1), 'StartLoggingTime': datetime(2015, 1, 1), 'StopLoggingTime': datetime(2015, 1, 1), 'LatestCloudWatchLogsDeliveryError': 'string', 'LatestCloudWatchLogsDeliveryTime': datetime(2015, 1, 1), 'LatestDigestDeliveryTime': datetime(2015, 1, 1), 'LatestDigestDeliveryError': 'string', 'LatestDeliveryAttemptTime': 'string', 'LatestNotificationAttemptTime': 'string', 'LatestNotificationAttemptSucceeded': 'string', 'LatestDeliveryAttemptSucceeded': 'string', 'TimeLoggingStarted': 'string', 'TimeLoggingStopped': 'string' } **Response Structure** * *(dict) --* Returns the objects or data listed below if successful. Otherwise, returns an error. * **IsLogging** *(boolean) --* Whether the CloudTrail trail is currently logging Amazon Web Services API calls. * **LatestDeliveryError** *(string) --* Displays any Amazon S3 error that CloudTrail encountered when attempting to deliver log files to the designated bucket. For more information, see Error Responses in the Amazon S3 API Reference. Note: This error occurs only when there is a problem with the destination S3 bucket, and does not occur for requests that time out. To resolve the issue, fix the bucket policy so that CloudTrail can write to the bucket; or create a new bucket and call "UpdateTrail" to specify the new bucket. * **LatestNotificationError** *(string) --* Displays any Amazon SNS error that CloudTrail encountered when attempting to send a notification. For more information about Amazon SNS errors, see the Amazon SNS Developer Guide. * **LatestDeliveryTime** *(datetime) --* Specifies the date and time that CloudTrail last delivered log files to an account's Amazon S3 bucket. * **LatestNotificationTime** *(datetime) --* Specifies the date and time of the most recent Amazon SNS notification that CloudTrail has written a new log file to an account's Amazon S3 bucket. * **StartLoggingTime** *(datetime) --* Specifies the most recent date and time when CloudTrail started recording API calls for an Amazon Web Services account. * **StopLoggingTime** *(datetime) --* Specifies the most recent date and time when CloudTrail stopped recording API calls for an Amazon Web Services account. * **LatestCloudWatchLogsDeliveryError** *(string) --* Displays any CloudWatch Logs error that CloudTrail encountered when attempting to deliver logs to CloudWatch Logs. * **LatestCloudWatchLogsDeliveryTime** *(datetime) --* Displays the most recent date and time when CloudTrail delivered logs to CloudWatch Logs. * **LatestDigestDeliveryTime** *(datetime) --* Specifies the date and time that CloudTrail last delivered a digest file to an account's Amazon S3 bucket. * **LatestDigestDeliveryError** *(string) --* Displays any Amazon S3 error that CloudTrail encountered when attempting to deliver a digest file to the designated bucket. For more information, see Error Responses in the Amazon S3 API Reference. Note: This error occurs only when there is a problem with the destination S3 bucket, and does not occur for requests that time out. To resolve the issue, fix the bucket policy so that CloudTrail can write to the bucket; or create a new bucket and call "UpdateTrail" to specify the new bucket. * **LatestDeliveryAttemptTime** *(string) --* This field is no longer in use. * **LatestNotificationAttemptTime** *(string) --* This field is no longer in use. * **LatestNotificationAttemptSucceeded** *(string) --* This field is no longer in use. * **LatestDeliveryAttemptSucceeded** *(string) --* This field is no longer in use. * **TimeLoggingStarted** *(string) --* This field is no longer in use. * **TimeLoggingStopped** *(string) --* This field is no longer in use. **Exceptions** * "CloudTrail.Client.exceptions.CloudTrailARNInvalidException" * "CloudTrail.Client.exceptions.TrailNotFoundException" * "CloudTrail.Client.exceptions.InvalidTrailNameException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" CloudTrail / Client / get_insight_selectors get_insight_selectors ********************* CloudTrail.Client.get_insight_selectors(**kwargs) Describes the settings for the Insights event selectors that you configured for your trail or event data store. "GetInsightSelectors" shows if CloudTrail Insights event logging is enabled on the trail or event data store, and if it is, which Insights types are enabled. If you run "GetInsightSelectors" on a trail or event data store that does not have Insights events enabled, the operation throws the exception "InsightNotEnabledException" Specify either the "EventDataStore" parameter to get Insights event selectors for an event data store, or the "TrailName" parameter to the get Insights event selectors for a trail. You cannot specify these parameters together. For more information, see Working with CloudTrail Insights in the *CloudTrail User Guide*. See also: AWS API Documentation **Request Syntax** response = client.get_insight_selectors( TrailName='string', EventDataStore='string' ) Parameters: * **TrailName** (*string*) -- Specifies the name of the trail or trail ARN. If you specify a trail name, the string 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-_namespace" and "my--namespace" are not valid. * Not be in IP address format (for example, 192.168.5.4) If you specify a trail ARN, it must be in the format: "arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail" You cannot use this parameter with the "EventDataStore" parameter. * **EventDataStore** (*string*) -- Specifies the ARN (or ID suffix of the ARN) of the event data store for which you want to get Insights selectors. You cannot use this parameter with the "TrailName" parameter. Return type: dict Returns: **Response Syntax** { 'TrailARN': 'string', 'InsightSelectors': [ { 'InsightType': 'ApiCallRateInsight'|'ApiErrorRateInsight' }, ], 'EventDataStoreArn': 'string', 'InsightsDestination': 'string' } **Response Structure** * *(dict) --* * **TrailARN** *(string) --* The Amazon Resource Name (ARN) of a trail for which you want to get Insights selectors. * **InsightSelectors** *(list) --* A JSON string that contains the Insight types you want to log on a trail or event data store. "ApiErrorRateInsight" and "ApiCallRateInsight" are supported as Insights types. * *(dict) --* A JSON string that contains a list of Insights types that are logged on a trail or event data store. * **InsightType** *(string) --* The type of Insights events to log on a trail or event data store. "ApiCallRateInsight" and "ApiErrorRateInsight" are valid Insight types. The "ApiCallRateInsight" Insights type analyzes write- only management API calls that are aggregated per minute against a baseline API call volume. The "ApiErrorRateInsight" Insights type analyzes management API calls that result in error codes. The error is shown if the API call is unsuccessful. * **EventDataStoreArn** *(string) --* The ARN of the source event data store that enabled Insights events. * **InsightsDestination** *(string) --* The ARN of the destination event data store that logs Insights events. **Exceptions** * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.InvalidParameterCombinationExcepti on" * "CloudTrail.Client.exceptions.TrailNotFoundException" * "CloudTrail.Client.exceptions.InvalidTrailNameException" * "CloudTrail.Client.exceptions.CloudTrailARNInvalidException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.InsightNotEnabledException" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" * "CloudTrail.Client.exceptions.ThrottlingException" CloudTrail / Client / list_imports list_imports ************ CloudTrail.Client.list_imports(**kwargs) Returns information on all imports, or a select set of imports by "ImportStatus" or "Destination". See also: AWS API Documentation **Request Syntax** response = client.list_imports( MaxResults=123, Destination='string', ImportStatus='INITIALIZING'|'IN_PROGRESS'|'FAILED'|'STOPPED'|'COMPLETED', NextToken='string' ) Parameters: * **MaxResults** (*integer*) -- The maximum number of imports to display on a single page. * **Destination** (*string*) -- The ARN of the destination event data store. * **ImportStatus** (*string*) -- The status of the import. * **NextToken** (*string*) -- A token you can use to get the next page of import results. Return type: dict Returns: **Response Syntax** { 'Imports': [ { 'ImportId': 'string', 'ImportStatus': 'INITIALIZING'|'IN_PROGRESS'|'FAILED'|'STOPPED'|'COMPLETED', 'Destinations': [ 'string', ], 'CreatedTimestamp': datetime(2015, 1, 1), 'UpdatedTimestamp': datetime(2015, 1, 1) }, ], 'NextToken': 'string' } **Response Structure** * *(dict) --* * **Imports** *(list) --* The list of returned imports. * *(dict) --* Contains information about an import that was returned by a lookup request. * **ImportId** *(string) --* The ID of the import. * **ImportStatus** *(string) --* The status of the import. * **Destinations** *(list) --* The ARN of the destination event data store. * *(string) --* * **CreatedTimestamp** *(datetime) --* The timestamp of the import's creation. * **UpdatedTimestamp** *(datetime) --* The timestamp of the import's last update. * **NextToken** *(string) --* A token you can use to get the next page of import results. **Exceptions** * "CloudTrail.Client.exceptions.EventDataStoreARNInvalidException" * "CloudTrail.Client.exceptions.InvalidNextTokenException" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" CloudTrail / Client / get_channel get_channel *********** CloudTrail.Client.get_channel(**kwargs) Returns information about a specific channel. See also: AWS API Documentation **Request Syntax** response = client.get_channel( Channel='string' ) Parameters: **Channel** (*string*) -- **[REQUIRED]** The ARN or "UUID" of a channel. Return type: dict Returns: **Response Syntax** { 'ChannelArn': 'string', 'Name': 'string', 'Source': 'string', 'SourceConfig': { 'ApplyToAllRegions': True|False, 'AdvancedEventSelectors': [ { 'Name': 'string', 'FieldSelectors': [ { 'Field': 'string', 'Equals': [ 'string', ], 'StartsWith': [ 'string', ], 'EndsWith': [ 'string', ], 'NotEquals': [ 'string', ], 'NotStartsWith': [ 'string', ], 'NotEndsWith': [ 'string', ] }, ] }, ] }, 'Destinations': [ { 'Type': 'EVENT_DATA_STORE'|'AWS_SERVICE', 'Location': 'string' }, ], 'IngestionStatus': { 'LatestIngestionSuccessTime': datetime(2015, 1, 1), 'LatestIngestionSuccessEventID': 'string', 'LatestIngestionErrorCode': 'string', 'LatestIngestionAttemptTime': datetime(2015, 1, 1), 'LatestIngestionAttemptEventID': 'string' } } **Response Structure** * *(dict) --* * **ChannelArn** *(string) --* The ARN of an channel returned by a "GetChannel" request. * **Name** *(string) --* The name of the CloudTrail channel. For service-linked channels, the name is "aws-service-channel/service-name /custom-suffix" where "service-name" represents the name of the Amazon Web Services service that created the channel and "custom-suffix" represents the suffix generated by the Amazon Web Services service. * **Source** *(string) --* The source for the CloudTrail channel. * **SourceConfig** *(dict) --* Provides information about the advanced event selectors configured for the channel, and whether the channel applies to all Regions or a single Region. * **ApplyToAllRegions** *(boolean) --* Specifies whether the channel applies to a single Region or to all Regions. * **AdvancedEventSelectors** *(list) --* The advanced event selectors that are configured for the channel. * *(dict) --* Advanced event selectors let you create fine-grained selectors for CloudTrail management, data, and network activity events. They help you control costs by logging only those events that are important to you. For more information about configuring advanced event selectors, see the Logging data events, Logging network activity events, and Logging management events topics in the *CloudTrail User Guide*. You cannot apply both event selectors and advanced event selectors to a trail. For information about configurable advanced event selector fields, see AdvancedEventSelector in the *CloudTrail API Reference*. * **Name** *(string) --* An optional, descriptive name for an advanced event selector, such as "Log data events for only two S3 buckets". * **FieldSelectors** *(list) --* Contains all selector statements in an advanced event selector. * *(dict) --* A single selector statement in an advanced event selector. * **Field** *(string) --* A field in a CloudTrail event record on which to filter events to be logged. For event data stores for CloudTrail Insights events, Config configuration items, Audit Manager evidence, or events outside of Amazon Web Services, the field is used only for selecting events as filtering is not supported. For more information, see AdvancedFieldSelector in the *CloudTrail API Reference*. Note: Selectors don't support the use of wildcards like "*" . To match multiple values with a single condition, you may use "StartsWith", "EndsWith", "NotStartsWith", or "NotEndsWith" to explicitly match the beginning or end of the event field. * **Equals** *(list) --* An operator that includes events that match the exact value of the event record field specified as the value of "Field". This is the only valid operator that you can use with the "readOnly", "eventCategory", and "resources.type" fields. * *(string) --* * **StartsWith** *(list) --* An operator that includes events that match the first few characters of the event record field specified as the value of "Field". * *(string) --* * **EndsWith** *(list) --* An operator that includes events that match the last few characters of the event record field specified as the value of "Field". * *(string) --* * **NotEquals** *(list) --* An operator that excludes events that match the exact value of the event record field specified as the value of "Field". * *(string) --* * **NotStartsWith** *(list) --* An operator that excludes events that match the first few characters of the event record field specified as the value of "Field". * *(string) --* * **NotEndsWith** *(list) --* An operator that excludes events that match the last few characters of the event record field specified as the value of "Field". * *(string) --* * **Destinations** *(list) --* The destinations for the channel. For channels created for integrations, the destinations are the event data stores that log events arriving through the channel. For service- linked channels, the destination is the Amazon Web Services service that created the service-linked channel to receive events. * *(dict) --* Contains information about the destination receiving events. * **Type** *(string) --* The type of destination for events arriving from a channel. For channels used for a CloudTrail Lake integration, the value is "EVENT_DATA_STORE". For service-linked channels, the value is "AWS_SERVICE". * **Location** *(string) --* For channels used for a CloudTrail Lake integration, the location is the ARN of an event data store that receives events from a channel. For service-linked channels, the location is the name of the Amazon Web Services service. * **IngestionStatus** *(dict) --* A table showing information about the most recent successful and failed attempts to ingest events. * **LatestIngestionSuccessTime** *(datetime) --* The time stamp of the most recent successful ingestion of events for the channel. * **LatestIngestionSuccessEventID** *(string) --* The event ID of the most recent successful ingestion of events. * **LatestIngestionErrorCode** *(string) --* The error code for the most recent failure to ingest events. * **LatestIngestionAttemptTime** *(datetime) --* The time stamp of the most recent attempt to ingest events on the channel. * **LatestIngestionAttemptEventID** *(string) --* The event ID of the most recent attempt to ingest events. **Exceptions** * "CloudTrail.Client.exceptions.ChannelARNInvalidException" * "CloudTrail.Client.exceptions.ChannelNotFoundException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" CloudTrail / Client / list_insights_metric_data list_insights_metric_data ************************* CloudTrail.Client.list_insights_metric_data(**kwargs) 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. Access to the "ListInsightsMetricData" API operation is linked to the "cloudtrail:LookupEvents" action. To use this operation, you must have permissions to perform the "cloudtrail:LookupEvents" action. See also: AWS API Documentation **Request Syntax** response = client.list_insights_metric_data( EventSource='string', EventName='string', InsightType='ApiCallRateInsight'|'ApiErrorRateInsight', ErrorCode='string', StartTime=datetime(2015, 1, 1), EndTime=datetime(2015, 1, 1), Period=123, DataType='FillWithZeros'|'NonZeroData', MaxResults=123, NextToken='string' ) Parameters: * **EventSource** (*string*) -- **[REQUIRED]** The Amazon Web Services service to which the request was made, such as "iam.amazonaws.com" or "s3.amazonaws.com". * **EventName** (*string*) -- **[REQUIRED]** The name of the event, typically the Amazon Web Services API on which unusual levels of activity were recorded. * **InsightType** (*string*) -- **[REQUIRED]** The type of CloudTrail Insights event, which is either "ApiCallRateInsight" or "ApiErrorRateInsight". The "ApiCallRateInsight" Insights type analyzes write-only management API calls that are aggregated per minute against a baseline API call volume. The "ApiErrorRateInsight" Insights type analyzes management API calls that result in error codes. * **ErrorCode** (*string*) -- Conditionally required if the "InsightType" parameter is set to "ApiErrorRateInsight". If returning metrics for the "ApiErrorRateInsight" Insights type, this is the error to retrieve data for. For example, "AccessDenied". * **StartTime** (*datetime*) -- 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. * **EndTime** (*datetime*) -- 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** (*integer*) -- Granularity of data to retrieve, in seconds. Valid values are "60", "300", and "3600". If you specify any other value, you will get an error. The default is 3600 seconds. * **DataType** (*string*) -- Type of data points to return. Valid values are "NonZeroData" and "FillWithZeros". The default is "NonZeroData". * **MaxResults** (*integer*) -- The maximum number of data points to return. Valid values are integers from 1 to 21600. The default value is 21600. * **NextToken** (*string*) -- 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. Return type: dict Returns: **Response Syntax** { 'EventSource': 'string', 'EventName': 'string', 'InsightType': 'ApiCallRateInsight'|'ApiErrorRateInsight', 'ErrorCode': 'string', 'Timestamps': [ datetime(2015, 1, 1), ], 'Values': [ 123.0, ], 'NextToken': 'string' } **Response Structure** * *(dict) --* * **EventSource** *(string) --* The Amazon Web Services service to which the request was made, such as "iam.amazonaws.com" or "s3.amazonaws.com". * **EventName** *(string) --* The name of the event, typically the Amazon Web Services API on which unusual levels of activity were recorded. * **InsightType** *(string) --* The type of CloudTrail Insights event, which is either "ApiCallRateInsight" or "ApiErrorRateInsight". The "ApiCallRateInsight" Insights type analyzes write-only management API calls that are aggregated per minute against a baseline API call volume. The "ApiErrorRateInsight" Insights type analyzes management API calls that result in error codes. * **ErrorCode** *(string) --* Only returned if "InsightType" parameter was set to "ApiErrorRateInsight". If returning metrics for the "ApiErrorRateInsight" Insights type, this is the error to retrieve data for. For example, "AccessDenied". * **Timestamps** *(list) --* List of timestamps at intervals corresponding to the specified time period. * *(datetime) --* * **Values** *(list) --* List of values representing the API call rate or error rate at each timestamp. The number of values is equal to the number of timestamps. * *(float) --* * **NextToken** *(string) --* Only returned if the full results could not be returned in a single query. You can set the "NextToken" parameter in the next request to this value to continue retrieval. **Exceptions** * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" CloudTrail / Client / list_public_keys list_public_keys **************** CloudTrail.Client.list_public_keys(**kwargs) Returns all public keys whose private keys were used to sign the digest files within the specified time range. The public key is needed to validate digest files that were signed with its corresponding private key. Note: CloudTrail uses different private and public key pairs per Region. Each digest file is signed with a private key unique to its Region. When you validate a digest file from a specific Region, you must look in the same Region for its corresponding public key. See also: AWS API Documentation **Request Syntax** response = client.list_public_keys( StartTime=datetime(2015, 1, 1), EndTime=datetime(2015, 1, 1), NextToken='string' ) Parameters: * **StartTime** (*datetime*) -- Optionally specifies, in UTC, the start of the time range to look up public keys for CloudTrail digest files. If not specified, the current time is used, and the current public key is returned. * **EndTime** (*datetime*) -- Optionally specifies, in UTC, the end of the time range to look up public keys for CloudTrail digest files. If not specified, the current time is used. * **NextToken** (*string*) -- Reserved for future use. Return type: dict Returns: **Response Syntax** { 'PublicKeyList': [ { 'Value': b'bytes', 'ValidityStartTime': datetime(2015, 1, 1), 'ValidityEndTime': datetime(2015, 1, 1), 'Fingerprint': 'string' }, ], 'NextToken': 'string' } **Response Structure** * *(dict) --* Returns the objects or data listed below if successful. Otherwise, returns an error. * **PublicKeyList** *(list) --* Contains an array of PublicKey objects. Note: The returned public keys may have validity time ranges that overlap. * *(dict) --* Contains information about a returned public key. * **Value** *(bytes) --* The DER encoded public key value in PKCS#1 format. * **ValidityStartTime** *(datetime) --* The starting time of validity of the public key. * **ValidityEndTime** *(datetime) --* The ending time of validity of the public key. * **Fingerprint** *(string) --* The fingerprint of the public key. * **NextToken** *(string) --* Reserved for future use. **Exceptions** * "CloudTrail.Client.exceptions.InvalidTimeRangeException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.InvalidTokenException" CloudTrail / Client / delete_trail delete_trail ************ CloudTrail.Client.delete_trail(**kwargs) Deletes a trail. This operation must be called from the Region in which the trail was created. "DeleteTrail" cannot be called on the shadow trails (replicated trails in other Regions) of a trail that is enabled in all Regions. See also: AWS API Documentation **Request Syntax** response = client.delete_trail( Name='string' ) Parameters: **Name** (*string*) -- **[REQUIRED]** Specifies the name or the CloudTrail ARN of the trail to be deleted. The following is the format of a trail ARN. "arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail" Return type: dict Returns: **Response Syntax** {} **Response Structure** * *(dict) --* Returns the objects or data listed below if successful. Otherwise, returns an error. **Exceptions** * "CloudTrail.Client.exceptions.TrailNotFoundException" * "CloudTrail.Client.exceptions.InvalidTrailNameException" * "CloudTrail.Client.exceptions.CloudTrailARNInvalidException" * "CloudTrail.Client.exceptions.ConflictException" * "CloudTrail.Client.exceptions.ThrottlingException" * "CloudTrail.Client.exceptions.InvalidHomeRegionException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.NotOrganizationMasterAccountExcept ion" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" * "CloudTrail.Client.exceptions.InsufficientDependencyServiceAcces sPermissionException" CloudTrail / Client / create_event_data_store create_event_data_store *********************** CloudTrail.Client.create_event_data_store(**kwargs) Creates a new event data store. See also: AWS API Documentation **Request Syntax** response = client.create_event_data_store( Name='string', AdvancedEventSelectors=[ { 'Name': 'string', 'FieldSelectors': [ { 'Field': 'string', 'Equals': [ 'string', ], 'StartsWith': [ 'string', ], 'EndsWith': [ 'string', ], 'NotEquals': [ 'string', ], 'NotStartsWith': [ 'string', ], 'NotEndsWith': [ 'string', ] }, ] }, ], MultiRegionEnabled=True|False, OrganizationEnabled=True|False, RetentionPeriod=123, TerminationProtectionEnabled=True|False, TagsList=[ { 'Key': 'string', 'Value': 'string' }, ], KmsKeyId='string', StartIngestion=True|False, BillingMode='EXTENDABLE_RETENTION_PRICING'|'FIXED_RETENTION_PRICING' ) Parameters: * **Name** (*string*) -- **[REQUIRED]** The name of the event data store. * **AdvancedEventSelectors** (*list*) -- The advanced event selectors to use to select the events for the data store. You can configure up to five advanced event selectors for each event data store. For more information about how to use advanced event selectors to log CloudTrail events, see Log events by using advanced event selectors in the CloudTrail User Guide. For more information about how to use advanced event selectors to include Config configuration items in your event data store, see Create an event data store for Config configuration items in the CloudTrail User Guide. For more information about how to use advanced event selectors to include events outside of Amazon Web Services events in your event data store, see Create an integration to log events from outside Amazon Web Services in the CloudTrail User Guide. * *(dict) --* Advanced event selectors let you create fine-grained selectors for CloudTrail management, data, and network activity events. They help you control costs by logging only those events that are important to you. For more information about configuring advanced event selectors, see the Logging data events, Logging network activity events, and Logging management events topics in the *CloudTrail User Guide*. You cannot apply both event selectors and advanced event selectors to a trail. For information about configurable advanced event selector fields, see AdvancedEventSelector in the *CloudTrail API Reference*. * **Name** *(string) --* An optional, descriptive name for an advanced event selector, such as "Log data events for only two S3 buckets". * **FieldSelectors** *(list) --* **[REQUIRED]** Contains all selector statements in an advanced event selector. * *(dict) --* A single selector statement in an advanced event selector. * **Field** *(string) --* **[REQUIRED]** A field in a CloudTrail event record on which to filter events to be logged. For event data stores for CloudTrail Insights events, Config configuration items, Audit Manager evidence, or events outside of Amazon Web Services, the field is used only for selecting events as filtering is not supported. For more information, see AdvancedFieldSelector in the *CloudTrail API Reference*. Note: Selectors don't support the use of wildcards like "*" . To match multiple values with a single condition, you may use "StartsWith", "EndsWith", "NotStartsWith", or "NotEndsWith" to explicitly match the beginning or end of the event field. * **Equals** *(list) --* An operator that includes events that match the exact value of the event record field specified as the value of "Field". This is the only valid operator that you can use with the "readOnly", "eventCategory", and "resources.type" fields. * *(string) --* * **StartsWith** *(list) --* An operator that includes events that match the first few characters of the event record field specified as the value of "Field". * *(string) --* * **EndsWith** *(list) --* An operator that includes events that match the last few characters of the event record field specified as the value of "Field". * *(string) --* * **NotEquals** *(list) --* An operator that excludes events that match the exact value of the event record field specified as the value of "Field". * *(string) --* * **NotStartsWith** *(list) --* An operator that excludes events that match the first few characters of the event record field specified as the value of "Field". * *(string) --* * **NotEndsWith** *(list) --* An operator that excludes events that match the last few characters of the event record field specified as the value of "Field". * *(string) --* * **MultiRegionEnabled** (*boolean*) -- Specifies whether the event data store includes events from all Regions, or only from the Region in which the event data store is created. * **OrganizationEnabled** (*boolean*) -- Specifies whether an event data store collects events logged for an organization in Organizations. * **RetentionPeriod** (*integer*) -- The retention period of the event data store, in days. If "BillingMode" is set to "EXTENDABLE_RETENTION_PRICING", you can set a retention period of up to 3653 days, the equivalent of 10 years. If "BillingMode" is set to "FIXED_RETENTION_PRICING", you can set a retention period of up to 2557 days, the equivalent of seven years. CloudTrail Lake determines whether to retain an event by checking if the "eventTime" of the event is within the specified retention period. For example, if you set a retention period of 90 days, CloudTrail will remove events when the "eventTime" is older than 90 days. Note: If you plan to copy trail events to this event data store, we recommend that you consider both the age of the events that you want to copy as well as how long you want to keep the copied events in your event data store. For example, if you copy trail events that are 5 years old and specify a retention period of 7 years, the event data store will retain those events for two years. * **TerminationProtectionEnabled** (*boolean*) -- Specifies whether termination protection is enabled for the event data store. If termination protection is enabled, you cannot delete the event data store until termination protection is disabled. * **TagsList** (*list*) -- A list of tags. * *(dict) --* A custom key-value pair associated with a resource such as a CloudTrail trail, event data store, dashboard, or channel. * **Key** *(string) --* **[REQUIRED]** The key in a key-value pair. The key must be must be no longer than 128 Unicode characters. The key must be unique for the resource to which it applies. * **Value** *(string) --* The value in a key-value pair of a tag. The value must be no longer than 256 Unicode characters. * **KmsKeyId** (*string*) -- Specifies the KMS key ID to use to encrypt the events delivered by CloudTrail. The value can be an alias name prefixed by "alias/", a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier. Warning: Disabling or deleting the KMS key, or removing CloudTrail permissions on the key, prevents CloudTrail from logging events to the event data store, and prevents users from querying the data in the event data store that was encrypted with the key. After you associate an event data store with a KMS key, the KMS key cannot be removed or changed. Before you disable or delete a KMS key that you are using with an event data store, delete or back up your event data store. CloudTrail also supports KMS multi-Region keys. For more information about multi-Region keys, see Using multi-Region keys in the *Key Management Service Developer Guide*. Examples: * "alias/MyAliasName" * "arn:aws:kms:us-east-2:123456789012:alias/MyAliasName" * "arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234- 1234-123456789012" * "12345678-1234-1234-1234-123456789012" * **StartIngestion** (*boolean*) -- Specifies whether the event data store should start ingesting live events. The default is true. * **BillingMode** (*string*) -- The billing mode for the event data store determines the cost for ingesting events and the default and maximum retention period for the event data store. The following are the possible values: * "EXTENDABLE_RETENTION_PRICING" - This billing mode is generally recommended if you want a flexible retention period of up to 3653 days (about 10 years). The default retention period for this billing mode is 366 days. * "FIXED_RETENTION_PRICING" - This billing mode is recommended if you expect to ingest more than 25 TB of event data per month and need a retention period of up to 2557 days (about 7 years). The default retention period for this billing mode is 2557 days. The default value is "EXTENDABLE_RETENTION_PRICING". For more information about CloudTrail pricing, see CloudTrail Pricing and Managing CloudTrail Lake costs. Return type: dict Returns: **Response Syntax** { 'EventDataStoreArn': 'string', 'Name': 'string', 'Status': 'CREATED'|'ENABLED'|'PENDING_DELETION'|'STARTING_INGESTION'|'STOPPING_INGESTION'|'STOPPED_INGESTION', 'AdvancedEventSelectors': [ { 'Name': 'string', 'FieldSelectors': [ { 'Field': 'string', 'Equals': [ 'string', ], 'StartsWith': [ 'string', ], 'EndsWith': [ 'string', ], 'NotEquals': [ 'string', ], 'NotStartsWith': [ 'string', ], 'NotEndsWith': [ 'string', ] }, ] }, ], 'MultiRegionEnabled': True|False, 'OrganizationEnabled': True|False, 'RetentionPeriod': 123, 'TerminationProtectionEnabled': True|False, 'TagsList': [ { 'Key': 'string', 'Value': 'string' }, ], 'CreatedTimestamp': datetime(2015, 1, 1), 'UpdatedTimestamp': datetime(2015, 1, 1), 'KmsKeyId': 'string', 'BillingMode': 'EXTENDABLE_RETENTION_PRICING'|'FIXED_RETENTION_PRICING' } **Response Structure** * *(dict) --* * **EventDataStoreArn** *(string) --* The ARN of the event data store. * **Name** *(string) --* The name of the event data store. * **Status** *(string) --* The status of event data store creation. * **AdvancedEventSelectors** *(list) --* The advanced event selectors that were used to select the events for the data store. * *(dict) --* Advanced event selectors let you create fine-grained selectors for CloudTrail management, data, and network activity events. They help you control costs by logging only those events that are important to you. For more information about configuring advanced event selectors, see the Logging data events, Logging network activity events, and Logging management events topics in the *CloudTrail User Guide*. You cannot apply both event selectors and advanced event selectors to a trail. For information about configurable advanced event selector fields, see AdvancedEventSelector in the *CloudTrail API Reference*. * **Name** *(string) --* An optional, descriptive name for an advanced event selector, such as "Log data events for only two S3 buckets". * **FieldSelectors** *(list) --* Contains all selector statements in an advanced event selector. * *(dict) --* A single selector statement in an advanced event selector. * **Field** *(string) --* A field in a CloudTrail event record on which to filter events to be logged. For event data stores for CloudTrail Insights events, Config configuration items, Audit Manager evidence, or events outside of Amazon Web Services, the field is used only for selecting events as filtering is not supported. For more information, see AdvancedFieldSelector in the *CloudTrail API Reference*. Note: Selectors don't support the use of wildcards like "*" . To match multiple values with a single condition, you may use "StartsWith", "EndsWith", "NotStartsWith", or "NotEndsWith" to explicitly match the beginning or end of the event field. * **Equals** *(list) --* An operator that includes events that match the exact value of the event record field specified as the value of "Field". This is the only valid operator that you can use with the "readOnly", "eventCategory", and "resources.type" fields. * *(string) --* * **StartsWith** *(list) --* An operator that includes events that match the first few characters of the event record field specified as the value of "Field". * *(string) --* * **EndsWith** *(list) --* An operator that includes events that match the last few characters of the event record field specified as the value of "Field". * *(string) --* * **NotEquals** *(list) --* An operator that excludes events that match the exact value of the event record field specified as the value of "Field". * *(string) --* * **NotStartsWith** *(list) --* An operator that excludes events that match the first few characters of the event record field specified as the value of "Field". * *(string) --* * **NotEndsWith** *(list) --* An operator that excludes events that match the last few characters of the event record field specified as the value of "Field". * *(string) --* * **MultiRegionEnabled** *(boolean) --* Indicates whether the event data store collects events from all Regions, or only from the Region in which it was created. * **OrganizationEnabled** *(boolean) --* Indicates whether an event data store is collecting logged events for an organization in Organizations. * **RetentionPeriod** *(integer) --* The retention period of an event data store, in days. * **TerminationProtectionEnabled** *(boolean) --* Indicates whether termination protection is enabled for the event data store. * **TagsList** *(list) --* A list of tags. * *(dict) --* A custom key-value pair associated with a resource such as a CloudTrail trail, event data store, dashboard, or channel. * **Key** *(string) --* The key in a key-value pair. The key must be must be no longer than 128 Unicode characters. The key must be unique for the resource to which it applies. * **Value** *(string) --* The value in a key-value pair of a tag. The value must be no longer than 256 Unicode characters. * **CreatedTimestamp** *(datetime) --* The timestamp that shows when the event data store was created. * **UpdatedTimestamp** *(datetime) --* The timestamp that shows when an event data store was updated, if applicable. "UpdatedTimestamp" is always either the same or newer than the time shown in "CreatedTimestamp". * **KmsKeyId** *(string) --* Specifies the KMS key ID that encrypts the events delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the following format. "arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234- 1234-123456789012" * **BillingMode** *(string) --* The billing mode for the event data store. **Exceptions** * "CloudTrail.Client.exceptions.EventDataStoreAlreadyExistsExcepti on" * "CloudTrail.Client.exceptions.EventDataStoreMaxLimitExceededExce ption" * "CloudTrail.Client.exceptions.InvalidEventSelectorsException" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.InvalidTagParameterException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.ConflictException" * "CloudTrail.Client.exceptions.InsufficientEncryptionPolicyExcept ion" * "CloudTrail.Client.exceptions.InvalidKmsKeyIdException" * "CloudTrail.Client.exceptions.KmsKeyNotFoundException" * "CloudTrail.Client.exceptions.KmsException" * "CloudTrail.Client.exceptions.CloudTrailAccessNotEnabledExceptio n" * "CloudTrail.Client.exceptions.InsufficientDependencyServiceAcces sPermissionException" * "CloudTrail.Client.exceptions.NotOrganizationMasterAccountExcept ion" * "CloudTrail.Client.exceptions.OrganizationsNotInUseException" * "CloudTrail.Client.exceptions.OrganizationNotInAllFeaturesModeEx ception" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" CloudTrail / Client / list_queries list_queries ************ CloudTrail.Client.list_queries(**kwargs) Returns a list of queries and query statuses for the past seven days. You must specify an ARN value for "EventDataStore". Optionally, to shorten the list of results, you can specify a time range, formatted as timestamps, by adding "StartTime" and "EndTime" parameters, and a "QueryStatus" value. Valid values for "QueryStatus" include "QUEUED", "RUNNING", "FINISHED", "FAILED", "TIMED_OUT", or "CANCELLED". See also: AWS API Documentation **Request Syntax** response = client.list_queries( EventDataStore='string', NextToken='string', MaxResults=123, StartTime=datetime(2015, 1, 1), EndTime=datetime(2015, 1, 1), QueryStatus='QUEUED'|'RUNNING'|'FINISHED'|'FAILED'|'CANCELLED'|'TIMED_OUT' ) Parameters: * **EventDataStore** (*string*) -- **[REQUIRED]** The ARN (or the ID suffix of the ARN) of an event data store on which queries were run. * **NextToken** (*string*) -- A token you can use to get the next page of results. * **MaxResults** (*integer*) -- The maximum number of queries to show on a page. * **StartTime** (*datetime*) -- Use with "EndTime" to bound a "ListQueries" request, and limit its results to only those queries run within a specified time period. * **EndTime** (*datetime*) -- Use with "StartTime" to bound a "ListQueries" request, and limit its results to only those queries run within a specified time period. * **QueryStatus** (*string*) -- The status of queries that you want to return in results. Valid values for "QueryStatus" include "QUEUED", "RUNNING", "FINISHED", "FAILED", "TIMED_OUT", or "CANCELLED". Return type: dict Returns: **Response Syntax** { 'Queries': [ { 'QueryId': 'string', 'QueryStatus': 'QUEUED'|'RUNNING'|'FINISHED'|'FAILED'|'CANCELLED'|'TIMED_OUT', 'CreationTime': datetime(2015, 1, 1) }, ], 'NextToken': 'string' } **Response Structure** * *(dict) --* * **Queries** *(list) --* Lists matching query results, and shows query ID, status, and creation time of each query. * *(dict) --* A SQL string of criteria about events that you want to collect in an event data store. * **QueryId** *(string) --* The ID of a query. * **QueryStatus** *(string) --* The status of the query. This can be "QUEUED", "RUNNING", "FINISHED", "FAILED", "TIMED_OUT", or "CANCELLED". * **CreationTime** *(datetime) --* The creation time of a query. * **NextToken** *(string) --* A token you can use to get the next page of results. **Exceptions** * "CloudTrail.Client.exceptions.EventDataStoreARNInvalidException" * "CloudTrail.Client.exceptions.EventDataStoreNotFoundException" * "CloudTrail.Client.exceptions.InactiveEventDataStoreException" * "CloudTrail.Client.exceptions.InvalidDateRangeException" * "CloudTrail.Client.exceptions.InvalidMaxResultsException" * "CloudTrail.Client.exceptions.InvalidNextTokenException" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.InvalidQueryStatusException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" CloudTrail / Client / update_event_data_store update_event_data_store *********************** CloudTrail.Client.update_event_data_store(**kwargs) Updates an event data store. The required "EventDataStore" value is an ARN or the ID portion of the ARN. Other parameters are optional, but at least one optional parameter must be specified, or CloudTrail throws an error. "RetentionPeriod" is in days, and valid values are integers between 7 and 3653 if the "BillingMode" is set to "EXTENDABLE_RETENTION_PRICING", or between 7 and 2557 if "BillingMode" is set to "FIXED_RETENTION_PRICING". By default, "TerminationProtection" is enabled. For event data stores for CloudTrail events, "AdvancedEventSelectors" includes or excludes management, data, or network activity events in your event data store. For more information about "AdvancedEventSelectors", see AdvancedEventSelectors. For event data stores for CloudTrail Insights events, Config configuration items, Audit Manager evidence, or non-Amazon Web Services events, "AdvancedEventSelectors" includes events of that type in your event data store. See also: AWS API Documentation **Request Syntax** response = client.update_event_data_store( EventDataStore='string', Name='string', AdvancedEventSelectors=[ { 'Name': 'string', 'FieldSelectors': [ { 'Field': 'string', 'Equals': [ 'string', ], 'StartsWith': [ 'string', ], 'EndsWith': [ 'string', ], 'NotEquals': [ 'string', ], 'NotStartsWith': [ 'string', ], 'NotEndsWith': [ 'string', ] }, ] }, ], MultiRegionEnabled=True|False, OrganizationEnabled=True|False, RetentionPeriod=123, TerminationProtectionEnabled=True|False, KmsKeyId='string', BillingMode='EXTENDABLE_RETENTION_PRICING'|'FIXED_RETENTION_PRICING' ) Parameters: * **EventDataStore** (*string*) -- **[REQUIRED]** The ARN (or the ID suffix of the ARN) of the event data store that you want to update. * **Name** (*string*) -- The event data store name. * **AdvancedEventSelectors** (*list*) -- The advanced event selectors used to select events for the event data store. You can configure up to five advanced event selectors for each event data store. * *(dict) --* Advanced event selectors let you create fine-grained selectors for CloudTrail management, data, and network activity events. They help you control costs by logging only those events that are important to you. For more information about configuring advanced event selectors, see the Logging data events, Logging network activity events, and Logging management events topics in the *CloudTrail User Guide*. You cannot apply both event selectors and advanced event selectors to a trail. For information about configurable advanced event selector fields, see AdvancedEventSelector in the *CloudTrail API Reference*. * **Name** *(string) --* An optional, descriptive name for an advanced event selector, such as "Log data events for only two S3 buckets". * **FieldSelectors** *(list) --* **[REQUIRED]** Contains all selector statements in an advanced event selector. * *(dict) --* A single selector statement in an advanced event selector. * **Field** *(string) --* **[REQUIRED]** A field in a CloudTrail event record on which to filter events to be logged. For event data stores for CloudTrail Insights events, Config configuration items, Audit Manager evidence, or events outside of Amazon Web Services, the field is used only for selecting events as filtering is not supported. For more information, see AdvancedFieldSelector in the *CloudTrail API Reference*. Note: Selectors don't support the use of wildcards like "*" . To match multiple values with a single condition, you may use "StartsWith", "EndsWith", "NotStartsWith", or "NotEndsWith" to explicitly match the beginning or end of the event field. * **Equals** *(list) --* An operator that includes events that match the exact value of the event record field specified as the value of "Field". This is the only valid operator that you can use with the "readOnly", "eventCategory", and "resources.type" fields. * *(string) --* * **StartsWith** *(list) --* An operator that includes events that match the first few characters of the event record field specified as the value of "Field". * *(string) --* * **EndsWith** *(list) --* An operator that includes events that match the last few characters of the event record field specified as the value of "Field". * *(string) --* * **NotEquals** *(list) --* An operator that excludes events that match the exact value of the event record field specified as the value of "Field". * *(string) --* * **NotStartsWith** *(list) --* An operator that excludes events that match the first few characters of the event record field specified as the value of "Field". * *(string) --* * **NotEndsWith** *(list) --* An operator that excludes events that match the last few characters of the event record field specified as the value of "Field". * *(string) --* * **MultiRegionEnabled** (*boolean*) -- Specifies whether an event data store collects events from all Regions, or only from the Region in which it was created. * **OrganizationEnabled** (*boolean*) -- Specifies whether an event data store collects events logged for an organization in Organizations. Note: Only the management account for the organization can convert an organization event data store to a non-organization event data store, or convert a non-organization event data store to an organization event data store. * **RetentionPeriod** (*integer*) -- The retention period of the event data store, in days. If "BillingMode" is set to "EXTENDABLE_RETENTION_PRICING", you can set a retention period of up to 3653 days, the equivalent of 10 years. If "BillingMode" is set to "FIXED_RETENTION_PRICING", you can set a retention period of up to 2557 days, the equivalent of seven years. CloudTrail Lake determines whether to retain an event by checking if the "eventTime" of the event is within the specified retention period. For example, if you set a retention period of 90 days, CloudTrail will remove events when the "eventTime" is older than 90 days. Note: If you decrease the retention period of an event data store, CloudTrail will remove any events with an "eventTime" older than the new retention period. For example, if the previous retention period was 365 days and you decrease it to 100 days, CloudTrail will remove events with an "eventTime" older than 100 days. * **TerminationProtectionEnabled** (*boolean*) -- Indicates that termination protection is enabled and the event data store cannot be automatically deleted. * **KmsKeyId** (*string*) -- Specifies the KMS key ID to use to encrypt the events delivered by CloudTrail. The value can be an alias name prefixed by "alias/", a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier. Warning: Disabling or deleting the KMS key, or removing CloudTrail permissions on the key, prevents CloudTrail from logging events to the event data store, and prevents users from querying the data in the event data store that was encrypted with the key. After you associate an event data store with a KMS key, the KMS key cannot be removed or changed. Before you disable or delete a KMS key that you are using with an event data store, delete or back up your event data store. CloudTrail also supports KMS multi-Region keys. For more information about multi-Region keys, see Using multi-Region keys in the *Key Management Service Developer Guide*. Examples: * "alias/MyAliasName" * "arn:aws:kms:us-east-2:123456789012:alias/MyAliasName" * "arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234- 1234-123456789012" * "12345678-1234-1234-1234-123456789012" * **BillingMode** (*string*) -- Note: You can't change the billing mode from "EXTENDABLE_RETENTION_PRICING" to "FIXED_RETENTION_PRICING". If "BillingMode" is set to "EXTENDABLE_RETENTION_PRICING" and you want to use "FIXED_RETENTION_PRICING" instead, you'll need to stop ingestion on the event data store and create a new event data store that uses "FIXED_RETENTION_PRICING". The billing mode for the event data store determines the cost for ingesting events and the default and maximum retention period for the event data store. The following are the possible values: * "EXTENDABLE_RETENTION_PRICING" - This billing mode is generally recommended if you want a flexible retention period of up to 3653 days (about 10 years). The default retention period for this billing mode is 366 days. * "FIXED_RETENTION_PRICING" - This billing mode is recommended if you expect to ingest more than 25 TB of event data per month and need a retention period of up to 2557 days (about 7 years). The default retention period for this billing mode is 2557 days. For more information about CloudTrail pricing, see CloudTrail Pricing and Managing CloudTrail Lake costs. Return type: dict Returns: **Response Syntax** { 'EventDataStoreArn': 'string', 'Name': 'string', 'Status': 'CREATED'|'ENABLED'|'PENDING_DELETION'|'STARTING_INGESTION'|'STOPPING_INGESTION'|'STOPPED_INGESTION', 'AdvancedEventSelectors': [ { 'Name': 'string', 'FieldSelectors': [ { 'Field': 'string', 'Equals': [ 'string', ], 'StartsWith': [ 'string', ], 'EndsWith': [ 'string', ], 'NotEquals': [ 'string', ], 'NotStartsWith': [ 'string', ], 'NotEndsWith': [ 'string', ] }, ] }, ], 'MultiRegionEnabled': True|False, 'OrganizationEnabled': True|False, 'RetentionPeriod': 123, 'TerminationProtectionEnabled': True|False, 'CreatedTimestamp': datetime(2015, 1, 1), 'UpdatedTimestamp': datetime(2015, 1, 1), 'KmsKeyId': 'string', 'BillingMode': 'EXTENDABLE_RETENTION_PRICING'|'FIXED_RETENTION_PRICING', 'FederationStatus': 'ENABLING'|'ENABLED'|'DISABLING'|'DISABLED', 'FederationRoleArn': 'string' } **Response Structure** * *(dict) --* * **EventDataStoreArn** *(string) --* The ARN of the event data store. * **Name** *(string) --* The name of the event data store. * **Status** *(string) --* The status of an event data store. * **AdvancedEventSelectors** *(list) --* The advanced event selectors that are applied to the event data store. * *(dict) --* Advanced event selectors let you create fine-grained selectors for CloudTrail management, data, and network activity events. They help you control costs by logging only those events that are important to you. For more information about configuring advanced event selectors, see the Logging data events, Logging network activity events, and Logging management events topics in the *CloudTrail User Guide*. You cannot apply both event selectors and advanced event selectors to a trail. For information about configurable advanced event selector fields, see AdvancedEventSelector in the *CloudTrail API Reference*. * **Name** *(string) --* An optional, descriptive name for an advanced event selector, such as "Log data events for only two S3 buckets". * **FieldSelectors** *(list) --* Contains all selector statements in an advanced event selector. * *(dict) --* A single selector statement in an advanced event selector. * **Field** *(string) --* A field in a CloudTrail event record on which to filter events to be logged. For event data stores for CloudTrail Insights events, Config configuration items, Audit Manager evidence, or events outside of Amazon Web Services, the field is used only for selecting events as filtering is not supported. For more information, see AdvancedFieldSelector in the *CloudTrail API Reference*. Note: Selectors don't support the use of wildcards like "*" . To match multiple values with a single condition, you may use "StartsWith", "EndsWith", "NotStartsWith", or "NotEndsWith" to explicitly match the beginning or end of the event field. * **Equals** *(list) --* An operator that includes events that match the exact value of the event record field specified as the value of "Field". This is the only valid operator that you can use with the "readOnly", "eventCategory", and "resources.type" fields. * *(string) --* * **StartsWith** *(list) --* An operator that includes events that match the first few characters of the event record field specified as the value of "Field". * *(string) --* * **EndsWith** *(list) --* An operator that includes events that match the last few characters of the event record field specified as the value of "Field". * *(string) --* * **NotEquals** *(list) --* An operator that excludes events that match the exact value of the event record field specified as the value of "Field". * *(string) --* * **NotStartsWith** *(list) --* An operator that excludes events that match the first few characters of the event record field specified as the value of "Field". * *(string) --* * **NotEndsWith** *(list) --* An operator that excludes events that match the last few characters of the event record field specified as the value of "Field". * *(string) --* * **MultiRegionEnabled** *(boolean) --* Indicates whether the event data store includes events from all Regions, or only from the Region in which it was created. * **OrganizationEnabled** *(boolean) --* Indicates whether an event data store is collecting logged events for an organization in Organizations. * **RetentionPeriod** *(integer) --* The retention period, in days. * **TerminationProtectionEnabled** *(boolean) --* Indicates whether termination protection is enabled for the event data store. * **CreatedTimestamp** *(datetime) --* The timestamp that shows when an event data store was first created. * **UpdatedTimestamp** *(datetime) --* The timestamp that shows when the event data store was last updated. "UpdatedTimestamp" is always either the same or newer than the time shown in "CreatedTimestamp". * **KmsKeyId** *(string) --* Specifies the KMS key ID that encrypts the events delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the following format. "arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234- 1234-123456789012" * **BillingMode** *(string) --* The billing mode for the event data store. * **FederationStatus** *(string) --* Indicates the Lake query federation status. The status is "ENABLED" if Lake query federation is enabled, or "DISABLED" if Lake query federation is disabled. You cannot delete an event data store if the "FederationStatus" is "ENABLED". * **FederationRoleArn** *(string) --* If Lake query federation is enabled, provides the ARN of the federation role used to access the resources for the federated event data store. **Exceptions** * "CloudTrail.Client.exceptions.EventDataStoreAlreadyExistsExcepti on" * "CloudTrail.Client.exceptions.EventDataStoreARNInvalidException" * "CloudTrail.Client.exceptions.EventDataStoreNotFoundException" * "CloudTrail.Client.exceptions.InvalidEventSelectorsException" * "CloudTrail.Client.exceptions.InvalidInsightSelectorsException" * "CloudTrail.Client.exceptions.EventDataStoreHasOngoingImportExce ption" * "CloudTrail.Client.exceptions.InactiveEventDataStoreException" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.InsufficientEncryptionPolicyExcept ion" * "CloudTrail.Client.exceptions.InvalidKmsKeyIdException" * "CloudTrail.Client.exceptions.KmsKeyNotFoundException" * "CloudTrail.Client.exceptions.KmsException" * "CloudTrail.Client.exceptions.CloudTrailAccessNotEnabledExceptio n" * "CloudTrail.Client.exceptions.InsufficientDependencyServiceAcces sPermissionException" * "CloudTrail.Client.exceptions.OrganizationsNotInUseException" * "CloudTrail.Client.exceptions.NotOrganizationMasterAccountExcept ion" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" * "CloudTrail.Client.exceptions.OrganizationNotInAllFeaturesModeEx ception" CloudTrail / Client / get_waiter get_waiter ********** CloudTrail.Client.get_waiter(waiter_name) Returns an object that can wait for some condition. Parameters: **waiter_name** (*str*) -- The name of the waiter to get. See the waiters section of the service docs for a list of available waiters. Returns: The specified waiter object. Return type: "botocore.waiter.Waiter" CloudTrail / Client / start_query start_query *********** CloudTrail.Client.start_query(**kwargs) Starts a CloudTrail Lake query. Use the "QueryStatement" parameter to provide your SQL query, enclosed in single quotation marks. Use the optional "DeliveryS3Uri" parameter to deliver the query results to an S3 bucket. "StartQuery" requires you specify either the "QueryStatement" parameter, or a "QueryAlias" and any "QueryParameters". In the current release, the "QueryAlias" and "QueryParameters" parameters are used only for the queries that populate the CloudTrail Lake dashboards. See also: AWS API Documentation **Request Syntax** response = client.start_query( QueryStatement='string', DeliveryS3Uri='string', QueryAlias='string', QueryParameters=[ 'string', ], EventDataStoreOwnerAccountId='string' ) Parameters: * **QueryStatement** (*string*) -- The SQL code of your query. * **DeliveryS3Uri** (*string*) -- The URI for the S3 bucket where CloudTrail delivers the query results. * **QueryAlias** (*string*) -- The alias that identifies a query template. * **QueryParameters** (*list*) -- The query parameters for the specified "QueryAlias". * *(string) --* * **EventDataStoreOwnerAccountId** (*string*) -- The account ID of the event data store owner. Return type: dict Returns: **Response Syntax** { 'QueryId': 'string', 'EventDataStoreOwnerAccountId': 'string' } **Response Structure** * *(dict) --* * **QueryId** *(string) --* The ID of the started query. * **EventDataStoreOwnerAccountId** *(string) --* The account ID of the event data store owner. **Exceptions** * "CloudTrail.Client.exceptions.EventDataStoreARNInvalidException" * "CloudTrail.Client.exceptions.EventDataStoreNotFoundException" * "CloudTrail.Client.exceptions.InactiveEventDataStoreException" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.InvalidQueryStatementException" * "CloudTrail.Client.exceptions.MaxConcurrentQueriesException" * "CloudTrail.Client.exceptions.InsufficientEncryptionPolicyExcept ion" * "CloudTrail.Client.exceptions.InvalidS3PrefixException" * "CloudTrail.Client.exceptions.InvalidS3BucketNameException" * "CloudTrail.Client.exceptions.InsufficientS3BucketPolicyExceptio n" * "CloudTrail.Client.exceptions.S3BucketDoesNotExistException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" CloudTrail / Client / enable_federation enable_federation ***************** CloudTrail.Client.enable_federation(**kwargs) Enables Lake query federation on the specified event data store. Federating an event data store lets you view the metadata associated with the event data store in the Glue Data Catalog and run SQL queries against your event data using Amazon Athena. The table metadata stored in the Glue Data Catalog lets the Athena query engine know how to find, read, and process the data that you want to query. When you enable Lake query federation, CloudTrail creates a managed database named "aws:cloudtrail" (if the database doesn't already exist) and a managed federated table in the Glue Data Catalog. The event data store ID is used for the table name. CloudTrail registers the role ARN and event data store in Lake Formation, the service responsible for allowing fine-grained access control of the federated resources in the Glue Data Catalog. For more information about Lake query federation, see Federate an event data store. See also: AWS API Documentation **Request Syntax** response = client.enable_federation( EventDataStore='string', FederationRoleArn='string' ) Parameters: * **EventDataStore** (*string*) -- **[REQUIRED]** The ARN (or ID suffix of the ARN) of the event data store for which you want to enable Lake query federation. * **FederationRoleArn** (*string*) -- **[REQUIRED]** The ARN of the federation role to use for the event data store. Amazon Web Services services like Lake Formation use this federation role to access data for the federated event data store. The federation role must exist in your account and provide the required minimum permissions. Return type: dict Returns: **Response Syntax** { 'EventDataStoreArn': 'string', 'FederationStatus': 'ENABLING'|'ENABLED'|'DISABLING'|'DISABLED', 'FederationRoleArn': 'string' } **Response Structure** * *(dict) --* * **EventDataStoreArn** *(string) --* The ARN of the event data store for which you enabled Lake query federation. * **FederationStatus** *(string) --* The federation status. * **FederationRoleArn** *(string) --* The ARN of the federation role. **Exceptions** * "CloudTrail.Client.exceptions.EventDataStoreARNInvalidException" * "CloudTrail.Client.exceptions.EventDataStoreNotFoundException" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.InactiveEventDataStoreException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.CloudTrailAccessNotEnabledExceptio n" * "CloudTrail.Client.exceptions.InsufficientDependencyServiceAcces sPermissionException" * "CloudTrail.Client.exceptions.NotOrganizationMasterAccountExcept ion" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" * "CloudTrail.Client.exceptions.OrganizationsNotInUseException" * "CloudTrail.Client.exceptions.OrganizationNotInAllFeaturesModeEx ception" * "CloudTrail.Client.exceptions.ConcurrentModificationException" * "CloudTrail.Client.exceptions.AccessDeniedException" * "CloudTrail.Client.exceptions.EventDataStoreFederationEnabledExc eption" CloudTrail / Client / describe_trails describe_trails *************** CloudTrail.Client.describe_trails(**kwargs) Retrieves settings for one or more trails associated with the current Region for your account. See also: AWS API Documentation **Request Syntax** response = client.describe_trails( trailNameList=[ 'string', ], includeShadowTrails=True|False ) Parameters: * **trailNameList** (*list*) -- Specifies a list of trail names, trail ARNs, or both, of the trails to describe. The format of a trail ARN is: "arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail" If an empty list is specified, information for the trail in the current Region is returned. * If an empty list is specified and "IncludeShadowTrails" is false, then information for all trails in the current Region is returned. * If an empty list is specified and IncludeShadowTrails is null or true, then information for all trails in the current Region and any associated shadow trails in other Regions is returned. Note: If one or more trail names are specified, information is returned only if the names match the names of trails belonging only to the current Region and current account. To return information about a trail in another Region, you must specify its trail ARN. * *(string) --* * **includeShadowTrails** (*boolean*) -- Specifies whether to include shadow trails in the response. A shadow trail is the replication in a Region of a trail that was created in a different Region, or in the case of an organization trail, the replication of an organization trail in member accounts. If you do not include shadow trails, organization trails in a member account and Region replication trails will not be returned. The default is true. Return type: dict Returns: **Response Syntax** { 'trailList': [ { 'Name': 'string', 'S3BucketName': 'string', 'S3KeyPrefix': 'string', 'SnsTopicName': 'string', 'SnsTopicARN': 'string', 'IncludeGlobalServiceEvents': True|False, 'IsMultiRegionTrail': True|False, 'HomeRegion': 'string', 'TrailARN': 'string', 'LogFileValidationEnabled': True|False, 'CloudWatchLogsLogGroupArn': 'string', 'CloudWatchLogsRoleArn': 'string', 'KmsKeyId': 'string', 'HasCustomEventSelectors': True|False, 'HasInsightSelectors': True|False, 'IsOrganizationTrail': True|False }, ] } **Response Structure** * *(dict) --* Returns the objects or data listed below if successful. Otherwise, returns an error. * **trailList** *(list) --* The list of trail objects. Trail objects with string values are only returned if values for the objects exist in a trail's configuration. For example, "SNSTopicName" and "SNSTopicARN" are only returned in results if a trail is configured to send SNS notifications. Similarly, "KMSKeyId" only appears in results if a trail's log files are encrypted with KMS customer managed keys. * *(dict) --* The settings for a trail. * **Name** *(string) --* Name of the trail set by calling CreateTrail. The maximum length is 128 characters. * **S3BucketName** *(string) --* Name of the Amazon S3 bucket into which CloudTrail delivers your trail files. See Amazon S3 Bucket naming rules. * **S3KeyPrefix** *(string) --* Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see Finding Your CloudTrail Log Files. The maximum length is 200 characters. * **SnsTopicName** *(string) --* This field is no longer in use. Use "SnsTopicARN". * **SnsTopicARN** *(string) --* Specifies the ARN of the Amazon SNS topic that CloudTrail uses to send notifications when log files are delivered. The following is the format of a topic ARN. "arn:aws:sns:us-east-2:123456789012:MyTopic" * **IncludeGlobalServiceEvents** *(boolean) --* Set to **True** to include Amazon Web Services API calls from Amazon Web Services global services such as IAM. Otherwise, **False**. * **IsMultiRegionTrail** *(boolean) --* Specifies whether the trail exists only in one Region or exists in all Regions. * **HomeRegion** *(string) --* The Region in which the trail was created. * **TrailARN** *(string) --* Specifies the ARN of the trail. The following is the format of a trail ARN. "arn:aws:cloudtrail:us- east-2:123456789012:trail/MyTrail" * **LogFileValidationEnabled** *(boolean) --* Specifies whether log file validation is enabled. * **CloudWatchLogsLogGroupArn** *(string) --* Specifies an Amazon Resource Name (ARN), a unique identifier that represents the log group to which CloudTrail logs will be delivered. * **CloudWatchLogsRoleArn** *(string) --* Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group. * **KmsKeyId** *(string) --* Specifies the KMS key ID that encrypts the logs delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the following format. "arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1 234-1234-123456789012" * **HasCustomEventSelectors** *(boolean) --* Specifies if the trail has custom event selectors. * **HasInsightSelectors** *(boolean) --* Specifies whether a trail has insight types specified in an "InsightSelector" list. * **IsOrganizationTrail** *(boolean) --* Specifies whether the trail is an organization trail. **Exceptions** * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.InvalidTrailNameException" * "CloudTrail.Client.exceptions.CloudTrailARNInvalidException" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" CloudTrail / Client / list_event_data_stores list_event_data_stores ********************** CloudTrail.Client.list_event_data_stores(**kwargs) Returns information about all event data stores in the account, in the current Region. See also: AWS API Documentation **Request Syntax** response = client.list_event_data_stores( NextToken='string', MaxResults=123 ) Parameters: * **NextToken** (*string*) -- A token you can use to get the next page of event data store results. * **MaxResults** (*integer*) -- The maximum number of event data stores to display on a single page. Return type: dict Returns: **Response Syntax** { 'EventDataStores': [ { 'EventDataStoreArn': 'string', 'Name': 'string', 'TerminationProtectionEnabled': True|False, 'Status': 'CREATED'|'ENABLED'|'PENDING_DELETION'|'STARTING_INGESTION'|'STOPPING_INGESTION'|'STOPPED_INGESTION', 'AdvancedEventSelectors': [ { 'Name': 'string', 'FieldSelectors': [ { 'Field': 'string', 'Equals': [ 'string', ], 'StartsWith': [ 'string', ], 'EndsWith': [ 'string', ], 'NotEquals': [ 'string', ], 'NotStartsWith': [ 'string', ], 'NotEndsWith': [ 'string', ] }, ] }, ], 'MultiRegionEnabled': True|False, 'OrganizationEnabled': True|False, 'RetentionPeriod': 123, 'CreatedTimestamp': datetime(2015, 1, 1), 'UpdatedTimestamp': datetime(2015, 1, 1) }, ], 'NextToken': 'string' } **Response Structure** * *(dict) --* * **EventDataStores** *(list) --* Contains information about event data stores in the account, in the current Region. * *(dict) --* A storage lake of event data against which you can run complex SQL-based queries. An event data store can include events that you have logged on your account. To select events for an event data store, use advanced event selectors. * **EventDataStoreArn** *(string) --* The ARN of the event data store. * **Name** *(string) --* The name of the event data store. * **TerminationProtectionEnabled** *(boolean) --* Indicates whether the event data store is protected from termination. * **Status** *(string) --* The status of an event data store. * **AdvancedEventSelectors** *(list) --* The advanced event selectors that were used to select events for the data store. * *(dict) --* Advanced event selectors let you create fine-grained selectors for CloudTrail management, data, and network activity events. They help you control costs by logging only those events that are important to you. For more information about configuring advanced event selectors, see the Logging data events, Logging network activity events, and Logging management events topics in the *CloudTrail User Guide*. You cannot apply both event selectors and advanced event selectors to a trail. For information about configurable advanced event selector fields, see AdvancedEventSelector in the *CloudTrail API Reference*. * **Name** *(string) --* An optional, descriptive name for an advanced event selector, such as "Log data events for only two S3 buckets". * **FieldSelectors** *(list) --* Contains all selector statements in an advanced event selector. * *(dict) --* A single selector statement in an advanced event selector. * **Field** *(string) --* A field in a CloudTrail event record on which to filter events to be logged. For event data stores for CloudTrail Insights events, Config configuration items, Audit Manager evidence, or events outside of Amazon Web Services, the field is used only for selecting events as filtering is not supported. For more information, see AdvancedFieldSelector in the *CloudTrail API Reference*. Note: Selectors don't support the use of wildcards like "*" . To match multiple values with a single condition, you may use "StartsWith", "EndsWith", "NotStartsWith", or "NotEndsWith" to explicitly match the beginning or end of the event field. * **Equals** *(list) --* An operator that includes events that match the exact value of the event record field specified as the value of "Field". This is the only valid operator that you can use with the "readOnly", "eventCategory", and "resources.type" fields. * *(string) --* * **StartsWith** *(list) --* An operator that includes events that match the first few characters of the event record field specified as the value of "Field". * *(string) --* * **EndsWith** *(list) --* An operator that includes events that match the last few characters of the event record field specified as the value of "Field". * *(string) --* * **NotEquals** *(list) --* An operator that excludes events that match the exact value of the event record field specified as the value of "Field". * *(string) --* * **NotStartsWith** *(list) --* An operator that excludes events that match the first few characters of the event record field specified as the value of "Field". * *(string) --* * **NotEndsWith** *(list) --* An operator that excludes events that match the last few characters of the event record field specified as the value of "Field". * *(string) --* * **MultiRegionEnabled** *(boolean) --* Indicates whether the event data store includes events from all Regions, or only from the Region in which it was created. * **OrganizationEnabled** *(boolean) --* Indicates that an event data store is collecting logged events for an organization. * **RetentionPeriod** *(integer) --* The retention period, in days. * **CreatedTimestamp** *(datetime) --* The timestamp of the event data store's creation. * **UpdatedTimestamp** *(datetime) --* The timestamp showing when an event data store was updated, if applicable. "UpdatedTimestamp" is always either the same or newer than the time shown in "CreatedTimestamp". * **NextToken** *(string) --* A token you can use to get the next page of results. **Exceptions** * "CloudTrail.Client.exceptions.InvalidMaxResultsException" * "CloudTrail.Client.exceptions.InvalidNextTokenException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" CloudTrail / Client / start_import start_import ************ CloudTrail.Client.start_import(**kwargs) Starts an import of logged trail events from a source S3 bucket to a destination event data store. By default, CloudTrail only imports events contained in the S3 bucket's "CloudTrail" prefix and the prefixes inside the "CloudTrail" prefix, and does not check prefixes for other Amazon Web Services services. If you want to import CloudTrail events contained in another prefix, you must include the prefix in the "S3LocationUri". For more considerations about importing trail events, see Considerations for copying trail events in the *CloudTrail User Guide*. When you start a new import, the "Destinations" and "ImportSource" parameters are required. Before starting a new import, disable any access control lists (ACLs) attached to the source S3 bucket. For more information about disabling ACLs, see Controlling ownership of objects and disabling ACLs for your bucket. When you retry an import, the "ImportID" parameter is required. Note: If the destination event data store is for an organization, you must use the management account to import trail events. You cannot use the delegated administrator account for the organization. See also: AWS API Documentation **Request Syntax** response = client.start_import( Destinations=[ 'string', ], ImportSource={ 'S3': { 'S3LocationUri': 'string', 'S3BucketRegion': 'string', 'S3BucketAccessRoleArn': 'string' } }, StartEventTime=datetime(2015, 1, 1), EndEventTime=datetime(2015, 1, 1), ImportId='string' ) Parameters: * **Destinations** (*list*) -- The ARN of the destination event data store. Use this parameter for a new import. * *(string) --* * **ImportSource** (*dict*) -- The source S3 bucket for the import. Use this parameter for a new import. * **S3** *(dict) --* **[REQUIRED]** The source S3 bucket. * **S3LocationUri** *(string) --* **[REQUIRED]** The URI for the source S3 bucket. * **S3BucketRegion** *(string) --* **[REQUIRED]** The Region associated with the source S3 bucket. * **S3BucketAccessRoleArn** *(string) --* **[REQUIRED]** The IAM ARN role used to access the source S3 bucket. * **StartEventTime** (*datetime*) -- Use with "EndEventTime" to bound a "StartImport" request, and limit imported trail events to only those events logged within a specified time period. When you specify a time range, CloudTrail checks the prefix and log file names to verify the names contain a date between the specified "StartEventTime" and "EndEventTime" before attempting to import events. * **EndEventTime** (*datetime*) -- Use with "StartEventTime" to bound a "StartImport" request, and limit imported trail events to only those events logged within a specified time period. When you specify a time range, CloudTrail checks the prefix and log file names to verify the names contain a date between the specified "StartEventTime" and "EndEventTime" before attempting to import events. * **ImportId** (*string*) -- The ID of the import. Use this parameter when you are retrying an import. Return type: dict Returns: **Response Syntax** { 'ImportId': 'string', 'Destinations': [ 'string', ], 'ImportSource': { 'S3': { 'S3LocationUri': 'string', 'S3BucketRegion': 'string', 'S3BucketAccessRoleArn': 'string' } }, 'StartEventTime': datetime(2015, 1, 1), 'EndEventTime': datetime(2015, 1, 1), 'ImportStatus': 'INITIALIZING'|'IN_PROGRESS'|'FAILED'|'STOPPED'|'COMPLETED', 'CreatedTimestamp': datetime(2015, 1, 1), 'UpdatedTimestamp': datetime(2015, 1, 1) } **Response Structure** * *(dict) --* * **ImportId** *(string) --* The ID of the import. * **Destinations** *(list) --* The ARN of the destination event data store. * *(string) --* * **ImportSource** *(dict) --* The source S3 bucket for the import. * **S3** *(dict) --* The source S3 bucket. * **S3LocationUri** *(string) --* The URI for the source S3 bucket. * **S3BucketRegion** *(string) --* The Region associated with the source S3 bucket. * **S3BucketAccessRoleArn** *(string) --* The IAM ARN role used to access the source S3 bucket. * **StartEventTime** *(datetime) --* Used with "EndEventTime" to bound a "StartImport" request, and limit imported trail events to only those events logged within a specified time period. * **EndEventTime** *(datetime) --* Used with "StartEventTime" to bound a "StartImport" request, and limit imported trail events to only those events logged within a specified time period. * **ImportStatus** *(string) --* Shows the status of the import after a "StartImport" request. An import finishes with a status of "COMPLETED" if there were no failures, or "FAILED" if there were failures. * **CreatedTimestamp** *(datetime) --* The timestamp for the import's creation. * **UpdatedTimestamp** *(datetime) --* The timestamp of the import's last update, if applicable. **Exceptions** * "CloudTrail.Client.exceptions.AccountHasOngoingImportException" * "CloudTrail.Client.exceptions.EventDataStoreARNInvalidException" * "CloudTrail.Client.exceptions.EventDataStoreNotFoundException" * "CloudTrail.Client.exceptions.InvalidEventDataStoreStatusExcepti on" * "CloudTrail.Client.exceptions.InvalidEventDataStoreCategoryExcep tion" * "CloudTrail.Client.exceptions.InactiveEventDataStoreException" * "CloudTrail.Client.exceptions.InvalidImportSourceException" * "CloudTrail.Client.exceptions.ImportNotFoundException" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.InsufficientEncryptionPolicyExcept ion" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" CloudTrail / Client / create_channel create_channel ************** CloudTrail.Client.create_channel(**kwargs) Creates a channel for CloudTrail to ingest events from a partner or external source. After you create a channel, a CloudTrail Lake event data store can log events from the partner or source that you specify. See also: AWS API Documentation **Request Syntax** response = client.create_channel( Name='string', Source='string', Destinations=[ { 'Type': 'EVENT_DATA_STORE'|'AWS_SERVICE', 'Location': 'string' }, ], Tags=[ { 'Key': 'string', 'Value': 'string' }, ] ) Parameters: * **Name** (*string*) -- **[REQUIRED]** The name of the channel. * **Source** (*string*) -- **[REQUIRED]** The name of the partner or external event source. You cannot change this name after you create the channel. A maximum of one channel is allowed per source. A source can be either "Custom" for all valid non-Amazon Web Services events, or the name of a partner event source. For information about the source names for available partners, see Additional information about integration partners in the CloudTrail User Guide. * **Destinations** (*list*) -- **[REQUIRED]** One or more event data stores to which events arriving through a channel will be logged. * *(dict) --* Contains information about the destination receiving events. * **Type** *(string) --* **[REQUIRED]** The type of destination for events arriving from a channel. For channels used for a CloudTrail Lake integration, the value is "EVENT_DATA_STORE". For service- linked channels, the value is "AWS_SERVICE". * **Location** *(string) --* **[REQUIRED]** For channels used for a CloudTrail Lake integration, the location is the ARN of an event data store that receives events from a channel. For service-linked channels, the location is the name of the Amazon Web Services service. * **Tags** (*list*) -- A list of tags. * *(dict) --* A custom key-value pair associated with a resource such as a CloudTrail trail, event data store, dashboard, or channel. * **Key** *(string) --* **[REQUIRED]** The key in a key-value pair. The key must be must be no longer than 128 Unicode characters. The key must be unique for the resource to which it applies. * **Value** *(string) --* The value in a key-value pair of a tag. The value must be no longer than 256 Unicode characters. Return type: dict Returns: **Response Syntax** { 'ChannelArn': 'string', 'Name': 'string', 'Source': 'string', 'Destinations': [ { 'Type': 'EVENT_DATA_STORE'|'AWS_SERVICE', 'Location': 'string' }, ], 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ] } **Response Structure** * *(dict) --* * **ChannelArn** *(string) --* The Amazon Resource Name (ARN) of the new channel. * **Name** *(string) --* The name of the new channel. * **Source** *(string) --* The partner or external event source name. * **Destinations** *(list) --* The event data stores that log the events arriving through the channel. * *(dict) --* Contains information about the destination receiving events. * **Type** *(string) --* The type of destination for events arriving from a channel. For channels used for a CloudTrail Lake integration, the value is "EVENT_DATA_STORE". For service-linked channels, the value is "AWS_SERVICE". * **Location** *(string) --* For channels used for a CloudTrail Lake integration, the location is the ARN of an event data store that receives events from a channel. For service-linked channels, the location is the name of the Amazon Web Services service. * **Tags** *(list) --* A list of tags. * *(dict) --* A custom key-value pair associated with a resource such as a CloudTrail trail, event data store, dashboard, or channel. * **Key** *(string) --* The key in a key-value pair. The key must be must be no longer than 128 Unicode characters. The key must be unique for the resource to which it applies. * **Value** *(string) --* The value in a key-value pair of a tag. The value must be no longer than 256 Unicode characters. **Exceptions** * "CloudTrail.Client.exceptions.ChannelMaxLimitExceededException" * "CloudTrail.Client.exceptions.InvalidSourceException" * "CloudTrail.Client.exceptions.ChannelAlreadyExistsException" * "CloudTrail.Client.exceptions.EventDataStoreARNInvalidException" * "CloudTrail.Client.exceptions.EventDataStoreNotFoundException" * "CloudTrail.Client.exceptions.InvalidEventDataStoreCategoryExcep tion" * "CloudTrail.Client.exceptions.InactiveEventDataStoreException" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.InvalidTagParameterException" * "CloudTrail.Client.exceptions.TagsLimitExceededException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" CloudTrail / Client / delete_dashboard delete_dashboard **************** CloudTrail.Client.delete_dashboard(**kwargs) Deletes the specified dashboard. You cannot delete a dashboard that has termination protection enabled. See also: AWS API Documentation **Request Syntax** response = client.delete_dashboard( DashboardId='string' ) Parameters: **DashboardId** (*string*) -- **[REQUIRED]** The name or ARN for the dashboard. Return type: dict Returns: **Response Syntax** {} **Response Structure** * *(dict) --* **Exceptions** * "CloudTrail.Client.exceptions.ConflictException" * "CloudTrail.Client.exceptions.ResourceNotFoundException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" CloudTrail / Client / search_sample_queries search_sample_queries ********************* CloudTrail.Client.search_sample_queries(**kwargs) Searches sample queries and returns a list of sample queries that are sorted by relevance. To search for sample queries, provide a natural language "SearchPhrase" in English. See also: AWS API Documentation **Request Syntax** response = client.search_sample_queries( SearchPhrase='string', MaxResults=123, NextToken='string' ) Parameters: * **SearchPhrase** (*string*) -- **[REQUIRED]** The natural language phrase to use for the semantic search. The phrase must be in English. The length constraint is in characters, not words. * **MaxResults** (*integer*) -- The maximum number of results to return on a single page. The default value is 10. * **NextToken** (*string*) -- A token you can use to get the next page of results. The length constraint is in characters, not words. Return type: dict Returns: **Response Syntax** { 'SearchResults': [ { 'Name': 'string', 'Description': 'string', 'SQL': 'string', 'Relevance': ... }, ], 'NextToken': 'string' } **Response Structure** * *(dict) --* * **SearchResults** *(list) --* A list of objects containing the search results ordered from most relevant to least relevant. * *(dict) --* A search result returned by the "SearchSampleQueries" operation. * **Name** *(string) --* The name of a sample query. * **Description** *(string) --* A longer description of a sample query. * **SQL** *(string) --* The SQL code of the sample query. * **Relevance** *(float) --* A value between 0 and 1 indicating the similarity between the search phrase and result. * **NextToken** *(string) --* A token you can use to get the next page of results. **Exceptions** * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" CloudTrail / Client / create_trail create_trail ************ CloudTrail.Client.create_trail(**kwargs) Creates a trail that specifies the settings for delivery of log data to an Amazon S3 bucket. See also: AWS API Documentation **Request Syntax** response = client.create_trail( Name='string', S3BucketName='string', S3KeyPrefix='string', SnsTopicName='string', IncludeGlobalServiceEvents=True|False, IsMultiRegionTrail=True|False, EnableLogFileValidation=True|False, CloudWatchLogsLogGroupArn='string', CloudWatchLogsRoleArn='string', KmsKeyId='string', IsOrganizationTrail=True|False, TagsList=[ { 'Key': 'string', 'Value': 'string' }, ] ) Parameters: * **Name** (*string*) -- **[REQUIRED]** Specifies the name of the trail. The name 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-_namespace" and "my--namespace" are not valid. * Not be in IP address format (for example, 192.168.5.4) * **S3BucketName** (*string*) -- **[REQUIRED]** Specifies the name of the Amazon S3 bucket designated for publishing log files. For information about bucket naming rules, see Bucket naming rules in the *Amazon Simple Storage Service User Guide*. * **S3KeyPrefix** (*string*) -- Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see Finding Your CloudTrail Log Files. The maximum length is 200 characters. * **SnsTopicName** (*string*) -- Specifies the name or ARN of the Amazon SNS topic defined for notification of log file delivery. The maximum length is 256 characters. * **IncludeGlobalServiceEvents** (*boolean*) -- Specifies whether the trail is publishing events from global services such as IAM to the log files. * **IsMultiRegionTrail** (*boolean*) -- Specifies whether the trail is created in the current Region or in all Regions. The default is false, which creates a trail only in the Region where you are signed in. As a best practice, consider creating trails that log events in all Regions. * **EnableLogFileValidation** (*boolean*) -- Specifies whether log file integrity validation is enabled. The default is false. Note: When you disable log file integrity validation, the chain of digest files is broken after one hour. CloudTrail does not create digest files for log files that were delivered during a period in which log file integrity validation was disabled. For example, if you enable log file integrity validation at noon on January 1, disable it at noon on January 2, and re-enable it at noon on January 10, digest files will not be created for the log files delivered from noon on January 2 to noon on January 10. The same applies whenever you stop CloudTrail logging or delete a trail. * **CloudWatchLogsLogGroupArn** (*string*) -- Specifies a log group name using an Amazon Resource Name (ARN), a unique identifier that represents the log group to which CloudTrail logs will be delivered. You must use a log group that exists in your account. Not required unless you specify "CloudWatchLogsRoleArn". * **CloudWatchLogsRoleArn** (*string*) -- Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group. You must use a role that exists in your account. * **KmsKeyId** (*string*) -- Specifies the KMS key ID to use to encrypt the logs delivered by CloudTrail. The value can be an alias name prefixed by "alias/", a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier. CloudTrail also supports KMS multi-Region keys. For more information about multi-Region keys, see Using multi-Region keys in the *Key Management Service Developer Guide*. Examples: * "alias/MyAliasName" * "arn:aws:kms:us-east-2:123456789012:alias/MyAliasName" * "arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234- 1234-123456789012" * "12345678-1234-1234-1234-123456789012" * **IsOrganizationTrail** (*boolean*) -- Specifies whether the trail is created for all accounts in an organization in Organizations, or only for the current Amazon Web Services account. The default is false, and cannot be true unless the call is made on behalf of an Amazon Web Services account that is the management account or delegated administrator account for an organization in Organizations. * **TagsList** (*list*) -- A list of tags. * *(dict) --* A custom key-value pair associated with a resource such as a CloudTrail trail, event data store, dashboard, or channel. * **Key** *(string) --* **[REQUIRED]** The key in a key-value pair. The key must be must be no longer than 128 Unicode characters. The key must be unique for the resource to which it applies. * **Value** *(string) --* The value in a key-value pair of a tag. The value must be no longer than 256 Unicode characters. Return type: dict Returns: **Response Syntax** { 'Name': 'string', 'S3BucketName': 'string', 'S3KeyPrefix': 'string', 'SnsTopicName': 'string', 'SnsTopicARN': 'string', 'IncludeGlobalServiceEvents': True|False, 'IsMultiRegionTrail': True|False, 'TrailARN': 'string', 'LogFileValidationEnabled': True|False, 'CloudWatchLogsLogGroupArn': 'string', 'CloudWatchLogsRoleArn': 'string', 'KmsKeyId': 'string', 'IsOrganizationTrail': True|False } **Response Structure** * *(dict) --* Returns the objects or data listed below if successful. Otherwise, returns an error. * **Name** *(string) --* Specifies the name of the trail. * **S3BucketName** *(string) --* Specifies the name of the Amazon S3 bucket designated for publishing log files. * **S3KeyPrefix** *(string) --* Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see Finding Your CloudTrail Log Files. * **SnsTopicName** *(string) --* This field is no longer in use. Use "SnsTopicARN". * **SnsTopicARN** *(string) --* Specifies the ARN of the Amazon SNS topic that CloudTrail uses to send notifications when log files are delivered. The format of a topic ARN is: "arn:aws:sns:us-east-2:123456789012:MyTopic" * **IncludeGlobalServiceEvents** *(boolean) --* Specifies whether the trail is publishing events from global services such as IAM to the log files. * **IsMultiRegionTrail** *(boolean) --* Specifies whether the trail exists in one Region or in all Regions. * **TrailARN** *(string) --* Specifies the ARN of the trail that was created. The format of a trail ARN is: "arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail" * **LogFileValidationEnabled** *(boolean) --* Specifies whether log file integrity validation is enabled. * **CloudWatchLogsLogGroupArn** *(string) --* Specifies the Amazon Resource Name (ARN) of the log group to which CloudTrail logs will be delivered. * **CloudWatchLogsRoleArn** *(string) --* Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group. * **KmsKeyId** *(string) --* Specifies the KMS key ID that encrypts the events delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the following format. "arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234- 1234-123456789012" * **IsOrganizationTrail** *(boolean) --* Specifies whether the trail is an organization trail. **Exceptions** * "CloudTrail.Client.exceptions.MaximumNumberOfTrailsExceededExcep tion" * "CloudTrail.Client.exceptions.TrailAlreadyExistsException" * "CloudTrail.Client.exceptions.S3BucketDoesNotExistException" * "CloudTrail.Client.exceptions.InsufficientS3BucketPolicyExceptio n" * "CloudTrail.Client.exceptions.InsufficientSnsTopicPolicyExceptio n" * "CloudTrail.Client.exceptions.InsufficientEncryptionPolicyExcept ion" * "CloudTrail.Client.exceptions.InvalidS3BucketNameException" * "CloudTrail.Client.exceptions.InvalidS3PrefixException" * "CloudTrail.Client.exceptions.InvalidSnsTopicNameException" * "CloudTrail.Client.exceptions.InvalidKmsKeyIdException" * "CloudTrail.Client.exceptions.InvalidTrailNameException" * "CloudTrail.Client.exceptions.TrailNotProvidedException" * "CloudTrail.Client.exceptions.TagsLimitExceededException" * "CloudTrail.Client.exceptions.InvalidParameterCombinationExcepti on" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.KmsKeyNotFoundException" * "CloudTrail.Client.exceptions.KmsKeyDisabledException" * "CloudTrail.Client.exceptions.KmsException" * "CloudTrail.Client.exceptions.InvalidCloudWatchLogsLogGroupArnEx ception" * "CloudTrail.Client.exceptions.InvalidCloudWatchLogsRoleArnExcept ion" * "CloudTrail.Client.exceptions.CloudWatchLogsDeliveryUnavailableE xception" * "CloudTrail.Client.exceptions.InvalidTagParameterException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.CloudTrailAccessNotEnabledExceptio n" * "CloudTrail.Client.exceptions.InsufficientDependencyServiceAcces sPermissionException" * "CloudTrail.Client.exceptions.NotOrganizationMasterAccountExcept ion" * "CloudTrail.Client.exceptions.OrganizationsNotInUseException" * "CloudTrail.Client.exceptions.OrganizationNotInAllFeaturesModeEx ception" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" * "CloudTrail.Client.exceptions.CloudTrailInvalidClientTokenIdExce ption" * "CloudTrail.Client.exceptions.ConflictException" * "CloudTrail.Client.exceptions.ThrottlingException" CloudTrail / Client / restore_event_data_store restore_event_data_store ************************ CloudTrail.Client.restore_event_data_store(**kwargs) Restores a deleted event data store specified by "EventDataStore", which accepts an event data store ARN. You can only restore a deleted event data store within the seven-day wait period after deletion. Restoring an event data store can take several minutes, depending on the size of the event data store. See also: AWS API Documentation **Request Syntax** response = client.restore_event_data_store( EventDataStore='string' ) Parameters: **EventDataStore** (*string*) -- **[REQUIRED]** The ARN (or the ID suffix of the ARN) of the event data store that you want to restore. Return type: dict Returns: **Response Syntax** { 'EventDataStoreArn': 'string', 'Name': 'string', 'Status': 'CREATED'|'ENABLED'|'PENDING_DELETION'|'STARTING_INGESTION'|'STOPPING_INGESTION'|'STOPPED_INGESTION', 'AdvancedEventSelectors': [ { 'Name': 'string', 'FieldSelectors': [ { 'Field': 'string', 'Equals': [ 'string', ], 'StartsWith': [ 'string', ], 'EndsWith': [ 'string', ], 'NotEquals': [ 'string', ], 'NotStartsWith': [ 'string', ], 'NotEndsWith': [ 'string', ] }, ] }, ], 'MultiRegionEnabled': True|False, 'OrganizationEnabled': True|False, 'RetentionPeriod': 123, 'TerminationProtectionEnabled': True|False, 'CreatedTimestamp': datetime(2015, 1, 1), 'UpdatedTimestamp': datetime(2015, 1, 1), 'KmsKeyId': 'string', 'BillingMode': 'EXTENDABLE_RETENTION_PRICING'|'FIXED_RETENTION_PRICING' } **Response Structure** * *(dict) --* * **EventDataStoreArn** *(string) --* The event data store ARN. * **Name** *(string) --* The name of the event data store. * **Status** *(string) --* The status of the event data store. * **AdvancedEventSelectors** *(list) --* The advanced event selectors that were used to select events. * *(dict) --* Advanced event selectors let you create fine-grained selectors for CloudTrail management, data, and network activity events. They help you control costs by logging only those events that are important to you. For more information about configuring advanced event selectors, see the Logging data events, Logging network activity events, and Logging management events topics in the *CloudTrail User Guide*. You cannot apply both event selectors and advanced event selectors to a trail. For information about configurable advanced event selector fields, see AdvancedEventSelector in the *CloudTrail API Reference*. * **Name** *(string) --* An optional, descriptive name for an advanced event selector, such as "Log data events for only two S3 buckets". * **FieldSelectors** *(list) --* Contains all selector statements in an advanced event selector. * *(dict) --* A single selector statement in an advanced event selector. * **Field** *(string) --* A field in a CloudTrail event record on which to filter events to be logged. For event data stores for CloudTrail Insights events, Config configuration items, Audit Manager evidence, or events outside of Amazon Web Services, the field is used only for selecting events as filtering is not supported. For more information, see AdvancedFieldSelector in the *CloudTrail API Reference*. Note: Selectors don't support the use of wildcards like "*" . To match multiple values with a single condition, you may use "StartsWith", "EndsWith", "NotStartsWith", or "NotEndsWith" to explicitly match the beginning or end of the event field. * **Equals** *(list) --* An operator that includes events that match the exact value of the event record field specified as the value of "Field". This is the only valid operator that you can use with the "readOnly", "eventCategory", and "resources.type" fields. * *(string) --* * **StartsWith** *(list) --* An operator that includes events that match the first few characters of the event record field specified as the value of "Field". * *(string) --* * **EndsWith** *(list) --* An operator that includes events that match the last few characters of the event record field specified as the value of "Field". * *(string) --* * **NotEquals** *(list) --* An operator that excludes events that match the exact value of the event record field specified as the value of "Field". * *(string) --* * **NotStartsWith** *(list) --* An operator that excludes events that match the first few characters of the event record field specified as the value of "Field". * *(string) --* * **NotEndsWith** *(list) --* An operator that excludes events that match the last few characters of the event record field specified as the value of "Field". * *(string) --* * **MultiRegionEnabled** *(boolean) --* Indicates whether the event data store is collecting events from all Regions, or only from the Region in which the event data store was created. * **OrganizationEnabled** *(boolean) --* Indicates whether an event data store is collecting logged events for an organization in Organizations. * **RetentionPeriod** *(integer) --* The retention period, in days. * **TerminationProtectionEnabled** *(boolean) --* Indicates that termination protection is enabled and the event data store cannot be automatically deleted. * **CreatedTimestamp** *(datetime) --* The timestamp of an event data store's creation. * **UpdatedTimestamp** *(datetime) --* The timestamp that shows when an event data store was updated, if applicable. "UpdatedTimestamp" is always either the same or newer than the time shown in "CreatedTimestamp". * **KmsKeyId** *(string) --* Specifies the KMS key ID that encrypts the events delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the following format. "arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234- 1234-123456789012" * **BillingMode** *(string) --* The billing mode for the event data store. **Exceptions** * "CloudTrail.Client.exceptions.EventDataStoreARNInvalidException" * "CloudTrail.Client.exceptions.EventDataStoreNotFoundException" * "CloudTrail.Client.exceptions.EventDataStoreMaxLimitExceededExce ption" * "CloudTrail.Client.exceptions.InvalidEventDataStoreStatusExcepti on" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.CloudTrailAccessNotEnabledExceptio n" * "CloudTrail.Client.exceptions.InsufficientDependencyServiceAcces sPermissionException" * "CloudTrail.Client.exceptions.OrganizationsNotInUseException" * "CloudTrail.Client.exceptions.NotOrganizationMasterAccountExcept ion" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" * "CloudTrail.Client.exceptions.OrganizationNotInAllFeaturesModeEx ception" CloudTrail / Client / delete_channel delete_channel ************** CloudTrail.Client.delete_channel(**kwargs) Deletes a channel. See also: AWS API Documentation **Request Syntax** response = client.delete_channel( Channel='string' ) Parameters: **Channel** (*string*) -- **[REQUIRED]** The ARN or the "UUID" value of the channel that you want to delete. Return type: dict Returns: **Response Syntax** {} **Response Structure** * *(dict) --* **Exceptions** * "CloudTrail.Client.exceptions.ChannelARNInvalidException" * "CloudTrail.Client.exceptions.ChannelNotFoundException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" CloudTrail / Client / lookup_events lookup_events ************* CloudTrail.Client.lookup_events(**kwargs) Looks up management events or CloudTrail Insights events that are captured by CloudTrail. You can look up events that occurred in a Region within the last 90 days. Note: "LookupEvents" returns recent Insights events for trails that enable Insights. To view Insights events for an event data store, you can run queries on your Insights event data store, and you can also view the Lake dashboard for Insights. Lookup supports the following attributes for management events: * Amazon Web Services access key * Event ID * Event name * Event source * Read only * Resource name * Resource type * User name Lookup supports the following attributes for Insights events: * Event ID * Event name * Event source All attributes are optional. The default number of results returned is 50, with a maximum of 50 possible. The response includes a token that you can use to get the next page of results. Warning: The rate of lookup requests is limited to two per second, per account, per Region. If this limit is exceeded, a throttling error occurs. See also: AWS API Documentation **Request Syntax** response = client.lookup_events( LookupAttributes=[ { 'AttributeKey': 'EventId'|'EventName'|'ReadOnly'|'Username'|'ResourceType'|'ResourceName'|'EventSource'|'AccessKeyId', 'AttributeValue': 'string' }, ], StartTime=datetime(2015, 1, 1), EndTime=datetime(2015, 1, 1), EventCategory='insight', MaxResults=123, NextToken='string' ) Parameters: * **LookupAttributes** (*list*) -- Contains a list of lookup attributes. Currently the list can contain only one item. * *(dict) --* Specifies an attribute and value that filter the events returned. * **AttributeKey** *(string) --* **[REQUIRED]** Specifies an attribute on which to filter the events returned. * **AttributeValue** *(string) --* **[REQUIRED]** Specifies a value for the specified "AttributeKey". The maximum length for the "AttributeValue" is 2000 characters. The following characters (' "_"', ' `` "', ' ``,"', ' "\\n"') count as two characters towards the 2000 character limit. * **StartTime** (*datetime*) -- Specifies that only events that occur after or at the specified time are returned. If the specified start time is after the specified end time, an error is returned. * **EndTime** (*datetime*) -- Specifies that only events that occur before or at the specified time are returned. If the specified end time is before the specified start time, an error is returned. * **EventCategory** (*string*) -- Specifies the event category. If you do not specify an event category, events of the category are not returned in the response. For example, if you do not specify "insight" as the value of "EventCategory", no Insights events are returned. * **MaxResults** (*integer*) -- The number of events to return. Possible values are 1 through 50. The default is 50. * **NextToken** (*string*) -- The token to use to get the next page of results after a previous API call. This token must be passed in with the same parameters that were specified in the original call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters. Return type: dict Returns: **Response Syntax** { 'Events': [ { 'EventId': 'string', 'EventName': 'string', 'ReadOnly': 'string', 'AccessKeyId': 'string', 'EventTime': datetime(2015, 1, 1), 'EventSource': 'string', 'Username': 'string', 'Resources': [ { 'ResourceType': 'string', 'ResourceName': 'string' }, ], 'CloudTrailEvent': 'string' }, ], 'NextToken': 'string' } **Response Structure** * *(dict) --* Contains a response to a LookupEvents action. * **Events** *(list) --* A list of events returned based on the lookup attributes specified and the CloudTrail event. The events list is sorted by time. The most recent event is listed first. * *(dict) --* Contains information about an event that was returned by a lookup request. The result includes a representation of a CloudTrail event. * **EventId** *(string) --* The CloudTrail ID of the event returned. * **EventName** *(string) --* The name of the event returned. * **ReadOnly** *(string) --* Information about whether the event is a write event or a read event. * **AccessKeyId** *(string) --* The Amazon Web Services access key ID that was used to sign the request. If the request was made with temporary security credentials, this is the access key ID of the temporary credentials. * **EventTime** *(datetime) --* The date and time of the event returned. * **EventSource** *(string) --* The Amazon Web Services service to which the request was made. * **Username** *(string) --* A user name or role name of the requester that called the API in the event returned. * **Resources** *(list) --* A list of resources referenced by the event returned. * *(dict) --* Specifies the type and name of a resource referenced by an event. * **ResourceType** *(string) --* The type of a resource referenced by the event returned. When the resource type cannot be determined, null is returned. Some examples of resource types are: **Instance** for EC2, **Trail** for CloudTrail, **DBInstance** for Amazon RDS, and **AccessKey** for IAM. To learn more about how to look up and filter events by the resource types supported for a service, see Filtering CloudTrail Events. * **ResourceName** *(string) --* The name of the resource referenced by the event returned. These are user-created names whose values will depend on the environment. For example, the resource name might be "auto-scaling-test-group" for an Auto Scaling Group or "i-1234567" for an EC2 Instance. * **CloudTrailEvent** *(string) --* A JSON string that contains a representation of the event returned. * **NextToken** *(string) --* The token to use to get the next page of results after a previous API call. If the token does not appear, there are no more results to return. The token must be passed in with the same parameters as the previous call. For example, if the original call specified an AttributeKey of 'Username' with a value of 'root', the call with NextToken should include those same parameters. **Exceptions** * "CloudTrail.Client.exceptions.InvalidLookupAttributesException" * "CloudTrail.Client.exceptions.InvalidTimeRangeException" * "CloudTrail.Client.exceptions.InvalidMaxResultsException" * "CloudTrail.Client.exceptions.InvalidNextTokenException" * "CloudTrail.Client.exceptions.InvalidEventCategoryException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" CloudTrail / Client / add_tags add_tags ******** CloudTrail.Client.add_tags(**kwargs) Adds one or more tags to a trail, event data store, dashboard, or channel, up to a limit of 50. Overwrites an existing tag's value when a new value is specified for an existing tag key. Tag key names must be unique; you cannot have two keys with the same name but different values. If you specify a key without a value, the tag will be created with the specified key and a value of null. You can tag a trail or event data store that applies to all Amazon Web Services Regions only from the Region in which the trail or event data store was created (also known as its home Region). See also: AWS API Documentation **Request Syntax** response = client.add_tags( ResourceId='string', TagsList=[ { 'Key': 'string', 'Value': 'string' }, ] ) Parameters: * **ResourceId** (*string*) -- **[REQUIRED]** Specifies the ARN of the trail, event data store, dashboard, or channel to which one or more tags will be added. The format of a trail ARN is: "arn:aws:cloudtrail:us- east-2:123456789012:trail/MyTrail" The format of an event data store ARN is: "arn:aws:cloudtrail :us-east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f- 8bd1-bcf6cEXAMPLE" The format of a dashboard ARN is: "arn:aws:cloudtrail:us- east-1:123456789012:dashboard/exampleDash" The format of a channel ARN is: "arn:aws:cloudtrail:us- east-2:123456789012:channel/01234567890" * **TagsList** (*list*) -- **[REQUIRED]** Contains a list of tags, up to a limit of 50 * *(dict) --* A custom key-value pair associated with a resource such as a CloudTrail trail, event data store, dashboard, or channel. * **Key** *(string) --* **[REQUIRED]** The key in a key-value pair. The key must be must be no longer than 128 Unicode characters. The key must be unique for the resource to which it applies. * **Value** *(string) --* The value in a key-value pair of a tag. The value must be no longer than 256 Unicode characters. Return type: dict Returns: **Response Syntax** {} **Response Structure** * *(dict) --* Returns the objects or data if successful. Otherwise, returns an error. **Exceptions** * "CloudTrail.Client.exceptions.ResourceNotFoundException" * "CloudTrail.Client.exceptions.CloudTrailARNInvalidException" * "CloudTrail.Client.exceptions.EventDataStoreARNInvalidException" * "CloudTrail.Client.exceptions.ChannelARNInvalidException" * "CloudTrail.Client.exceptions.ResourceTypeNotSupportedException" * "CloudTrail.Client.exceptions.TagsLimitExceededException" * "CloudTrail.Client.exceptions.InvalidTrailNameException" * "CloudTrail.Client.exceptions.InvalidTagParameterException" * "CloudTrail.Client.exceptions.InactiveEventDataStoreException" * "CloudTrail.Client.exceptions.EventDataStoreNotFoundException" * "CloudTrail.Client.exceptions.ChannelNotFoundException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.NotOrganizationMasterAccountExcept ion" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" * "CloudTrail.Client.exceptions.ConflictException" CloudTrail / Client / put_event_configuration put_event_configuration *********************** CloudTrail.Client.put_event_configuration(**kwargs) Updates the event configuration settings for the specified event data store. You can update the maximum event size and context key selectors. See also: AWS API Documentation **Request Syntax** response = client.put_event_configuration( EventDataStore='string', MaxEventSize='Standard'|'Large', ContextKeySelectors=[ { 'Type': 'TagContext'|'RequestContext', 'Equals': [ 'string', ] }, ] ) Parameters: * **EventDataStore** (*string*) -- The Amazon Resource Name (ARN) or ID suffix of the ARN of the event data store for which you want to update event configuration settings. * **MaxEventSize** (*string*) -- **[REQUIRED]** The maximum allowed size for events to be stored in the specified event data store. If you are using context key selectors, MaxEventSize must be set to Large. * **ContextKeySelectors** (*list*) -- **[REQUIRED]** A list of context key selectors that will be included to provide enriched event data. * *(dict) --* An object that contains information types to be included in CloudTrail enriched events. * **Type** *(string) --* **[REQUIRED]** Specifies the type of the event record field in ContextKeySelector. Valid values include RequestContext, TagContext. * **Equals** *(list) --* **[REQUIRED]** A list of keys defined by Type to be included in CloudTrail enriched events. * *(string) --* Return type: dict Returns: **Response Syntax** { 'EventDataStoreArn': 'string', 'MaxEventSize': 'Standard'|'Large', 'ContextKeySelectors': [ { 'Type': 'TagContext'|'RequestContext', 'Equals': [ 'string', ] }, ] } **Response Structure** * *(dict) --* * **EventDataStoreArn** *(string) --* The Amazon Resource Name (ARN) or ID suffix of the ARN of the event data store for which the event configuration settings were updated. * **MaxEventSize** *(string) --* The maximum allowed size for events stored in the specified event data store. * **ContextKeySelectors** *(list) --* The list of context key selectors that are configured for the event data store. * *(dict) --* An object that contains information types to be included in CloudTrail enriched events. * **Type** *(string) --* Specifies the type of the event record field in ContextKeySelector. Valid values include RequestContext, TagContext. * **Equals** *(list) --* A list of keys defined by Type to be included in CloudTrail enriched events. * *(string) --* **Exceptions** * "CloudTrail.Client.exceptions.EventDataStoreARNInvalidException" * "CloudTrail.Client.exceptions.EventDataStoreNotFoundException" * "CloudTrail.Client.exceptions.InvalidEventDataStoreStatusExcepti on" * "CloudTrail.Client.exceptions.InvalidEventDataStoreCategoryExcep tion" * "CloudTrail.Client.exceptions.InactiveEventDataStoreException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.ThrottlingException" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.InvalidParameterCombinationExcepti on" * "CloudTrail.Client.exceptions.CloudTrailARNInvalidException" * "CloudTrail.Client.exceptions.ConflictException" * "CloudTrail.Client.exceptions.NotOrganizationMasterAccountExcept ion" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" * "CloudTrail.Client.exceptions.InsufficientDependencyServiceAcces sPermissionException" * "CloudTrail.Client.exceptions.InsufficientIAMAccessPermissionExc eption" CloudTrail / Client / describe_query describe_query ************** CloudTrail.Client.describe_query(**kwargs) Returns metadata about a query, including query run time in milliseconds, number of events scanned and matched, and query status. If the query results were delivered to an S3 bucket, the response also provides the S3 URI and the delivery status. You must specify either "QueryId" or "QueryAlias". Specifying the "QueryAlias" parameter returns information about the last query run for the alias. You can provide "RefreshId" along with "QueryAlias" to view the query results of a dashboard query for the specified "RefreshId". See also: AWS API Documentation **Request Syntax** response = client.describe_query( EventDataStore='string', QueryId='string', QueryAlias='string', RefreshId='string', EventDataStoreOwnerAccountId='string' ) Parameters: * **EventDataStore** (*string*) -- The ARN (or the ID suffix of the ARN) of an event data store on which the specified query was run. * **QueryId** (*string*) -- The query ID. * **QueryAlias** (*string*) -- The alias that identifies a query template. * **RefreshId** (*string*) -- The ID of the dashboard refresh. * **EventDataStoreOwnerAccountId** (*string*) -- The account ID of the event data store owner. Return type: dict Returns: **Response Syntax** { 'QueryId': 'string', 'QueryString': 'string', 'QueryStatus': 'QUEUED'|'RUNNING'|'FINISHED'|'FAILED'|'CANCELLED'|'TIMED_OUT', 'QueryStatistics': { 'EventsMatched': 123, 'EventsScanned': 123, 'BytesScanned': 123, 'ExecutionTimeInMillis': 123, 'CreationTime': datetime(2015, 1, 1) }, 'ErrorMessage': 'string', 'DeliveryS3Uri': 'string', 'DeliveryStatus': 'SUCCESS'|'FAILED'|'FAILED_SIGNING_FILE'|'PENDING'|'RESOURCE_NOT_FOUND'|'ACCESS_DENIED'|'ACCESS_DENIED_SIGNING_FILE'|'CANCELLED'|'UNKNOWN', 'Prompt': 'string', 'EventDataStoreOwnerAccountId': 'string' } **Response Structure** * *(dict) --* * **QueryId** *(string) --* The ID of the query. * **QueryString** *(string) --* The SQL code of a query. * **QueryStatus** *(string) --* The status of a query. Values for "QueryStatus" include "QUEUED", "RUNNING", "FINISHED", "FAILED", "TIMED_OUT", or "CANCELLED" * **QueryStatistics** *(dict) --* Metadata about a query, including the number of events that were matched, the total number of events scanned, the query run time in milliseconds, and the query's creation time. * **EventsMatched** *(integer) --* The number of events that matched a query. * **EventsScanned** *(integer) --* The number of events that the query scanned in the event data store. * **BytesScanned** *(integer) --* The total bytes that the query scanned in the event data store. This value matches the number of bytes for which your account is billed for the query, unless the query is still running. * **ExecutionTimeInMillis** *(integer) --* The query's run time, in milliseconds. * **CreationTime** *(datetime) --* The creation time of the query. * **ErrorMessage** *(string) --* The error message returned if a query failed. * **DeliveryS3Uri** *(string) --* The URI for the S3 bucket where CloudTrail delivered query results, if applicable. * **DeliveryStatus** *(string) --* The delivery status. * **Prompt** *(string) --* The prompt used for a generated query. For information about generated queries, see Create CloudTrail Lake queries from natural language prompts in the *CloudTrail* user guide. * **EventDataStoreOwnerAccountId** *(string) --* The account ID of the event data store owner. **Exceptions** * "CloudTrail.Client.exceptions.EventDataStoreARNInvalidException" * "CloudTrail.Client.exceptions.EventDataStoreNotFoundException" * "CloudTrail.Client.exceptions.InactiveEventDataStoreException" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.QueryIdNotFoundException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" CloudTrail / Client / get_trail get_trail ********* CloudTrail.Client.get_trail(**kwargs) Returns settings information for a specified trail. See also: AWS API Documentation **Request Syntax** response = client.get_trail( Name='string' ) Parameters: **Name** (*string*) -- **[REQUIRED]** The name or the Amazon Resource Name (ARN) of the trail for which you want to retrieve settings information. Return type: dict Returns: **Response Syntax** { 'Trail': { 'Name': 'string', 'S3BucketName': 'string', 'S3KeyPrefix': 'string', 'SnsTopicName': 'string', 'SnsTopicARN': 'string', 'IncludeGlobalServiceEvents': True|False, 'IsMultiRegionTrail': True|False, 'HomeRegion': 'string', 'TrailARN': 'string', 'LogFileValidationEnabled': True|False, 'CloudWatchLogsLogGroupArn': 'string', 'CloudWatchLogsRoleArn': 'string', 'KmsKeyId': 'string', 'HasCustomEventSelectors': True|False, 'HasInsightSelectors': True|False, 'IsOrganizationTrail': True|False } } **Response Structure** * *(dict) --* * **Trail** *(dict) --* The settings for a trail. * **Name** *(string) --* Name of the trail set by calling CreateTrail. The maximum length is 128 characters. * **S3BucketName** *(string) --* Name of the Amazon S3 bucket into which CloudTrail delivers your trail files. See Amazon S3 Bucket naming rules. * **S3KeyPrefix** *(string) --* Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see Finding Your CloudTrail Log Files. The maximum length is 200 characters. * **SnsTopicName** *(string) --* This field is no longer in use. Use "SnsTopicARN". * **SnsTopicARN** *(string) --* Specifies the ARN of the Amazon SNS topic that CloudTrail uses to send notifications when log files are delivered. The following is the format of a topic ARN. "arn:aws:sns:us-east-2:123456789012:MyTopic" * **IncludeGlobalServiceEvents** *(boolean) --* Set to **True** to include Amazon Web Services API calls from Amazon Web Services global services such as IAM. Otherwise, **False**. * **IsMultiRegionTrail** *(boolean) --* Specifies whether the trail exists only in one Region or exists in all Regions. * **HomeRegion** *(string) --* The Region in which the trail was created. * **TrailARN** *(string) --* Specifies the ARN of the trail. The following is the format of a trail ARN. "arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail" * **LogFileValidationEnabled** *(boolean) --* Specifies whether log file validation is enabled. * **CloudWatchLogsLogGroupArn** *(string) --* Specifies an Amazon Resource Name (ARN), a unique identifier that represents the log group to which CloudTrail logs will be delivered. * **CloudWatchLogsRoleArn** *(string) --* Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group. * **KmsKeyId** *(string) --* Specifies the KMS key ID that encrypts the logs delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the following format. "arn:aws:kms:us-east-2:123456789012:key/12345678-1234-123 4-1234-123456789012" * **HasCustomEventSelectors** *(boolean) --* Specifies if the trail has custom event selectors. * **HasInsightSelectors** *(boolean) --* Specifies whether a trail has insight types specified in an "InsightSelector" list. * **IsOrganizationTrail** *(boolean) --* Specifies whether the trail is an organization trail. **Exceptions** * "CloudTrail.Client.exceptions.CloudTrailARNInvalidException" * "CloudTrail.Client.exceptions.TrailNotFoundException" * "CloudTrail.Client.exceptions.InvalidTrailNameException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" CloudTrail / Client / close close ***** CloudTrail.Client.close() Closes underlying endpoint connections. CloudTrail / Client / put_resource_policy put_resource_policy ******************* CloudTrail.Client.put_resource_policy(**kwargs) Attaches a resource-based permission policy to a CloudTrail event data store, dashboard, or channel. For more information about resource-based policies, see CloudTrail resource-based policy examples in the *CloudTrail User Guide*. See also: AWS API Documentation **Request Syntax** response = client.put_resource_policy( ResourceArn='string', ResourcePolicy='string' ) Parameters: * **ResourceArn** (*string*) -- **[REQUIRED]** The Amazon Resource Name (ARN) of the CloudTrail event data store, dashboard, or channel attached to the resource-based policy. Example event data store ARN format: "arn:aws:cloudtrail:us- east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f- 8bd1-bcf6cEXAMPLE" Example dashboard ARN format: "arn:aws:cloudtrail:us- east-1:123456789012:dashboard/exampleDash" Example channel ARN format: "arn:aws:cloudtrail:us- east-2:123456789012:channel/01234567890" * **ResourcePolicy** (*string*) -- **[REQUIRED]** A JSON-formatted string for an Amazon Web Services resource- based policy. For example resource-based policies, see CloudTrail resource- based policy examples in the *CloudTrail User Guide*. Return type: dict Returns: **Response Syntax** { 'ResourceArn': 'string', 'ResourcePolicy': 'string', 'DelegatedAdminResourcePolicy': 'string' } **Response Structure** * *(dict) --* * **ResourceArn** *(string) --* The Amazon Resource Name (ARN) of the CloudTrail event data store, dashboard, or channel attached to the resource-based policy. Example event data store ARN format: "arn:aws:cloudtrail:us- east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f- 8bd1-bcf6cEXAMPLE" Example dashboard ARN format: "arn:aws:cloudtrail:us- east-1:123456789012:dashboard/exampleDash" Example channel ARN format: "arn:aws:cloudtrail:us- east-2:123456789012:channel/01234567890" * **ResourcePolicy** *(string) --* The JSON-formatted string of the Amazon Web Services resource-based policy attached to the CloudTrail event data store, dashboard, or channel. * **DelegatedAdminResourcePolicy** *(string) --* The default resource-based policy that is automatically generated for the delegated administrator of an Organizations organization. This policy will be evaluated in tandem with any policy you submit for the resource. For more information about this policy, see Default resource policy for delegated administrators. **Exceptions** * "CloudTrail.Client.exceptions.ResourceARNNotValidException" * "CloudTrail.Client.exceptions.ResourcePolicyNotValidException" * "CloudTrail.Client.exceptions.ResourceNotFoundException" * "CloudTrail.Client.exceptions.ResourceTypeNotSupportedException" * "CloudTrail.Client.exceptions.ConflictException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" CloudTrail / Client / get_resource_policy get_resource_policy ******************* CloudTrail.Client.get_resource_policy(**kwargs) Retrieves the JSON text of the resource-based policy document attached to the CloudTrail event data store, dashboard, or channel. See also: AWS API Documentation **Request Syntax** response = client.get_resource_policy( ResourceArn='string' ) Parameters: **ResourceArn** (*string*) -- **[REQUIRED]** The Amazon Resource Name (ARN) of the CloudTrail event data store, dashboard, or channel attached to the resource-based policy. Example event data store ARN format: "arn:aws:cloudtrail:us- east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f- 8bd1-bcf6cEXAMPLE" Example dashboard ARN format: "arn:aws:cloudtrail:us- east-1:123456789012:dashboard/exampleDash" Example channel ARN format: "arn:aws:cloudtrail:us- east-2:123456789012:channel/01234567890" Return type: dict Returns: **Response Syntax** { 'ResourceArn': 'string', 'ResourcePolicy': 'string', 'DelegatedAdminResourcePolicy': 'string' } **Response Structure** * *(dict) --* * **ResourceArn** *(string) --* The Amazon Resource Name (ARN) of the CloudTrail event data store, dashboard, or channel attached to resource-based policy. Example event data store ARN format: "arn:aws:cloudtrail:us- east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f- 8bd1-bcf6cEXAMPLE" Example dashboard ARN format: "arn:aws:cloudtrail:us- east-1:123456789012:dashboard/exampleDash" Example channel ARN format: "arn:aws:cloudtrail:us- east-2:123456789012:channel/01234567890" * **ResourcePolicy** *(string) --* A JSON-formatted string that contains the resource-based policy attached to the CloudTrail event data store, dashboard, or channel. * **DelegatedAdminResourcePolicy** *(string) --* The default resource-based policy that is automatically generated for the delegated administrator of an Organizations organization. This policy will be evaluated in tandem with any policy you submit for the resource. For more information about this policy, see Default resource policy for delegated administrators. **Exceptions** * "CloudTrail.Client.exceptions.ResourceARNNotValidException" * "CloudTrail.Client.exceptions.ResourceNotFoundException" * "CloudTrail.Client.exceptions.ResourcePolicyNotFoundException" * "CloudTrail.Client.exceptions.ResourceTypeNotSupportedException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" CloudTrail / Client / disable_federation disable_federation ****************** CloudTrail.Client.disable_federation(**kwargs) Disables Lake query federation on the specified event data store. When you disable federation, CloudTrail disables the integration with Glue, Lake Formation, and Amazon Athena. After disabling Lake query federation, you can no longer query your event data in Amazon Athena. No CloudTrail Lake data is deleted when you disable federation and you can continue to run queries in CloudTrail Lake. See also: AWS API Documentation **Request Syntax** response = client.disable_federation( EventDataStore='string' ) Parameters: **EventDataStore** (*string*) -- **[REQUIRED]** The ARN (or ID suffix of the ARN) of the event data store for which you want to disable Lake query federation. Return type: dict Returns: **Response Syntax** { 'EventDataStoreArn': 'string', 'FederationStatus': 'ENABLING'|'ENABLED'|'DISABLING'|'DISABLED' } **Response Structure** * *(dict) --* * **EventDataStoreArn** *(string) --* The ARN of the event data store for which you disabled Lake query federation. * **FederationStatus** *(string) --* The federation status. **Exceptions** * "CloudTrail.Client.exceptions.EventDataStoreARNInvalidException" * "CloudTrail.Client.exceptions.EventDataStoreNotFoundException" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.InactiveEventDataStoreException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.CloudTrailAccessNotEnabledExceptio n" * "CloudTrail.Client.exceptions.InsufficientDependencyServiceAcces sPermissionException" * "CloudTrail.Client.exceptions.NotOrganizationMasterAccountExcept ion" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" * "CloudTrail.Client.exceptions.OrganizationsNotInUseException" * "CloudTrail.Client.exceptions.OrganizationNotInAllFeaturesModeEx ception" * "CloudTrail.Client.exceptions.ConcurrentModificationException" * "CloudTrail.Client.exceptions.AccessDeniedException" CloudTrail / Client / stop_logging stop_logging ************ CloudTrail.Client.stop_logging(**kwargs) Suspends the recording of Amazon Web Services API calls and log file delivery for the specified trail. Under most circumstances, there is no need to use this action. You can update a trail without stopping it first. This action is the only way to stop recording. For a trail enabled in all Regions, this operation must be called from the Region in which the trail was created, or an "InvalidHomeRegionException" will occur. This operation cannot be called on the shadow trails (replicated trails in other Regions) of a trail enabled in all Regions. See also: AWS API Documentation **Request Syntax** response = client.stop_logging( Name='string' ) Parameters: **Name** (*string*) -- **[REQUIRED]** Specifies the name or the CloudTrail ARN of the trail for which CloudTrail will stop logging Amazon Web Services API calls. The following is the format of a trail ARN. "arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail" Return type: dict Returns: **Response Syntax** {} **Response Structure** * *(dict) --* Returns the objects or data listed below if successful. Otherwise, returns an error. **Exceptions** * "CloudTrail.Client.exceptions.TrailNotFoundException" * "CloudTrail.Client.exceptions.InvalidTrailNameException" * "CloudTrail.Client.exceptions.CloudTrailARNInvalidException" * "CloudTrail.Client.exceptions.ConflictException" * "CloudTrail.Client.exceptions.ThrottlingException" * "CloudTrail.Client.exceptions.InvalidHomeRegionException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.NotOrganizationMasterAccountExcept ion" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" * "CloudTrail.Client.exceptions.InsufficientDependencyServiceAcces sPermissionException" CloudTrail / Client / deregister_organization_delegated_admin deregister_organization_delegated_admin *************************************** CloudTrail.Client.deregister_organization_delegated_admin(**kwargs) Removes CloudTrail delegated administrator permissions from a member account in an organization. See also: AWS API Documentation **Request Syntax** response = client.deregister_organization_delegated_admin( DelegatedAdminAccountId='string' ) Parameters: **DelegatedAdminAccountId** (*string*) -- **[REQUIRED]** A delegated administrator account ID. This is a member account in an organization that is currently designated as a delegated administrator. Return type: dict Returns: **Response Syntax** {} **Response Structure** * *(dict) --* Returns the following response if successful. Otherwise, returns an error. **Exceptions** * "CloudTrail.Client.exceptions.AccountNotFoundException" * "CloudTrail.Client.exceptions.AccountNotRegisteredException" * "CloudTrail.Client.exceptions.CloudTrailAccessNotEnabledExceptio n" * "CloudTrail.Client.exceptions.ConflictException" * "CloudTrail.Client.exceptions.InsufficientDependencyServiceAcces sPermissionException" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.NotOrganizationManagementAccountEx ception" * "CloudTrail.Client.exceptions.OrganizationNotInAllFeaturesModeEx ception" * "CloudTrail.Client.exceptions.OrganizationsNotInUseException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" CloudTrail / Client / remove_tags remove_tags *********** CloudTrail.Client.remove_tags(**kwargs) Removes the specified tags from a trail, event data store, dashboard, or channel. See also: AWS API Documentation **Request Syntax** response = client.remove_tags( ResourceId='string', TagsList=[ { 'Key': 'string', 'Value': 'string' }, ] ) Parameters: * **ResourceId** (*string*) -- **[REQUIRED]** Specifies the ARN of the trail, event data store, dashboard, or channel from which tags should be removed. Example trail ARN format: "arn:aws:cloudtrail:us- east-2:123456789012:trail/MyTrail" Example event data store ARN format: "arn:aws:cloudtrail:us- east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f- 8bd1-bcf6cEXAMPLE" Example dashboard ARN format: "arn:aws:cloudtrail:us- east-1:123456789012:dashboard/exampleDash" Example channel ARN format: "arn:aws:cloudtrail:us- east-2:123456789012:channel/01234567890" * **TagsList** (*list*) -- **[REQUIRED]** Specifies a list of tags to be removed. * *(dict) --* A custom key-value pair associated with a resource such as a CloudTrail trail, event data store, dashboard, or channel. * **Key** *(string) --* **[REQUIRED]** The key in a key-value pair. The key must be must be no longer than 128 Unicode characters. The key must be unique for the resource to which it applies. * **Value** *(string) --* The value in a key-value pair of a tag. The value must be no longer than 256 Unicode characters. Return type: dict Returns: **Response Syntax** {} **Response Structure** * *(dict) --* Returns the objects or data listed below if successful. Otherwise, returns an error. **Exceptions** * "CloudTrail.Client.exceptions.ResourceNotFoundException" * "CloudTrail.Client.exceptions.CloudTrailARNInvalidException" * "CloudTrail.Client.exceptions.EventDataStoreARNInvalidException" * "CloudTrail.Client.exceptions.ChannelARNInvalidException" * "CloudTrail.Client.exceptions.ResourceTypeNotSupportedException" * "CloudTrail.Client.exceptions.InvalidTrailNameException" * "CloudTrail.Client.exceptions.InvalidTagParameterException" * "CloudTrail.Client.exceptions.InactiveEventDataStoreException" * "CloudTrail.Client.exceptions.EventDataStoreNotFoundException" * "CloudTrail.Client.exceptions.ChannelNotFoundException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.NotOrganizationMasterAccountExcept ion" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" * "CloudTrail.Client.exceptions.ConflictException" CloudTrail / Client / get_import get_import ********** CloudTrail.Client.get_import(**kwargs) Returns information about a specific import. See also: AWS API Documentation **Request Syntax** response = client.get_import( ImportId='string' ) Parameters: **ImportId** (*string*) -- **[REQUIRED]** The ID for the import. Return type: dict Returns: **Response Syntax** { 'ImportId': 'string', 'Destinations': [ 'string', ], 'ImportSource': { 'S3': { 'S3LocationUri': 'string', 'S3BucketRegion': 'string', 'S3BucketAccessRoleArn': 'string' } }, 'StartEventTime': datetime(2015, 1, 1), 'EndEventTime': datetime(2015, 1, 1), 'ImportStatus': 'INITIALIZING'|'IN_PROGRESS'|'FAILED'|'STOPPED'|'COMPLETED', 'CreatedTimestamp': datetime(2015, 1, 1), 'UpdatedTimestamp': datetime(2015, 1, 1), 'ImportStatistics': { 'PrefixesFound': 123, 'PrefixesCompleted': 123, 'FilesCompleted': 123, 'EventsCompleted': 123, 'FailedEntries': 123 } } **Response Structure** * *(dict) --* * **ImportId** *(string) --* The ID of the import. * **Destinations** *(list) --* The ARN of the destination event data store. * *(string) --* * **ImportSource** *(dict) --* The source S3 bucket. * **S3** *(dict) --* The source S3 bucket. * **S3LocationUri** *(string) --* The URI for the source S3 bucket. * **S3BucketRegion** *(string) --* The Region associated with the source S3 bucket. * **S3BucketAccessRoleArn** *(string) --* The IAM ARN role used to access the source S3 bucket. * **StartEventTime** *(datetime) --* Used with "EndEventTime" to bound a "StartImport" request, and limit imported trail events to only those events logged within a specified time period. * **EndEventTime** *(datetime) --* Used with "StartEventTime" to bound a "StartImport" request, and limit imported trail events to only those events logged within a specified time period. * **ImportStatus** *(string) --* The status of the import. * **CreatedTimestamp** *(datetime) --* The timestamp of the import's creation. * **UpdatedTimestamp** *(datetime) --* The timestamp of when the import was updated. * **ImportStatistics** *(dict) --* Provides statistics for the import. CloudTrail does not update import statistics in real-time. Returned values for parameters such as "EventsCompleted" may be lower than the actual value, because CloudTrail updates statistics incrementally over the course of the import. * **PrefixesFound** *(integer) --* The number of S3 prefixes found for the import. * **PrefixesCompleted** *(integer) --* The number of S3 prefixes that completed import. * **FilesCompleted** *(integer) --* The number of log files that completed import. * **EventsCompleted** *(integer) --* The number of trail events imported into the event data store. * **FailedEntries** *(integer) --* The number of failed entries. **Exceptions** * "CloudTrail.Client.exceptions.ImportNotFoundException" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" CloudTrail / Client / register_organization_delegated_admin register_organization_delegated_admin ************************************* CloudTrail.Client.register_organization_delegated_admin(**kwargs) Registers an organization’s member account as the CloudTrail delegated administrator. See also: AWS API Documentation **Request Syntax** response = client.register_organization_delegated_admin( MemberAccountId='string' ) Parameters: **MemberAccountId** (*string*) -- **[REQUIRED]** An organization member account ID that you want to designate as a delegated administrator. Return type: dict Returns: **Response Syntax** {} **Response Structure** * *(dict) --* Returns the following response if successful. Otherwise, returns an error. **Exceptions** * "CloudTrail.Client.exceptions.AccountRegisteredException" * "CloudTrail.Client.exceptions.AccountNotFoundException" * "CloudTrail.Client.exceptions.InsufficientDependencyServiceAcces sPermissionException" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.CannotDelegateManagementAccountExc eption" * "CloudTrail.Client.exceptions.CloudTrailAccessNotEnabledExceptio n" * "CloudTrail.Client.exceptions.ConflictException" * "CloudTrail.Client.exceptions.DelegatedAdminAccountLimitExceeded Exception" * "CloudTrail.Client.exceptions.NotOrganizationManagementAccountEx ception" * "CloudTrail.Client.exceptions.OrganizationNotInAllFeaturesModeEx ception" * "CloudTrail.Client.exceptions.OrganizationsNotInUseException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.InsufficientIAMAccessPermissionExc eption" CloudTrail / Client / update_channel update_channel ************** CloudTrail.Client.update_channel(**kwargs) Updates a channel specified by a required channel ARN or UUID. See also: AWS API Documentation **Request Syntax** response = client.update_channel( Channel='string', Destinations=[ { 'Type': 'EVENT_DATA_STORE'|'AWS_SERVICE', 'Location': 'string' }, ], Name='string' ) Parameters: * **Channel** (*string*) -- **[REQUIRED]** The ARN or ID (the ARN suffix) of the channel that you want to update. * **Destinations** (*list*) -- The ARNs of event data stores that you want to log events arriving through the channel. * *(dict) --* Contains information about the destination receiving events. * **Type** *(string) --* **[REQUIRED]** The type of destination for events arriving from a channel. For channels used for a CloudTrail Lake integration, the value is "EVENT_DATA_STORE". For service- linked channels, the value is "AWS_SERVICE". * **Location** *(string) --* **[REQUIRED]** For channels used for a CloudTrail Lake integration, the location is the ARN of an event data store that receives events from a channel. For service-linked channels, the location is the name of the Amazon Web Services service. * **Name** (*string*) -- Changes the name of the channel. Return type: dict Returns: **Response Syntax** { 'ChannelArn': 'string', 'Name': 'string', 'Source': 'string', 'Destinations': [ { 'Type': 'EVENT_DATA_STORE'|'AWS_SERVICE', 'Location': 'string' }, ] } **Response Structure** * *(dict) --* * **ChannelArn** *(string) --* The ARN of the channel that was updated. * **Name** *(string) --* The name of the channel that was updated. * **Source** *(string) --* The event source of the channel that was updated. * **Destinations** *(list) --* The event data stores that log events arriving through the channel. * *(dict) --* Contains information about the destination receiving events. * **Type** *(string) --* The type of destination for events arriving from a channel. For channels used for a CloudTrail Lake integration, the value is "EVENT_DATA_STORE". For service-linked channels, the value is "AWS_SERVICE". * **Location** *(string) --* For channels used for a CloudTrail Lake integration, the location is the ARN of an event data store that receives events from a channel. For service-linked channels, the location is the name of the Amazon Web Services service. **Exceptions** * "CloudTrail.Client.exceptions.ChannelARNInvalidException" * "CloudTrail.Client.exceptions.ChannelNotFoundException" * "CloudTrail.Client.exceptions.ChannelAlreadyExistsException" * "CloudTrail.Client.exceptions.EventDataStoreARNInvalidException" * "CloudTrail.Client.exceptions.EventDataStoreNotFoundException" * "CloudTrail.Client.exceptions.InvalidEventDataStoreCategoryExcep tion" * "CloudTrail.Client.exceptions.InactiveEventDataStoreException" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" CloudTrail / Client / delete_resource_policy delete_resource_policy ********************** CloudTrail.Client.delete_resource_policy(**kwargs) Deletes the resource-based policy attached to the CloudTrail event data store, dashboard, or channel. See also: AWS API Documentation **Request Syntax** response = client.delete_resource_policy( ResourceArn='string' ) Parameters: **ResourceArn** (*string*) -- **[REQUIRED]** The Amazon Resource Name (ARN) of the CloudTrail event data store, dashboard, or channel you're deleting the resource-based policy from. Example event data store ARN format: "arn:aws:cloudtrail:us- east-2:123456789012:eventdatastore/EXAMPLE-f852-4e8f- 8bd1-bcf6cEXAMPLE" Example dashboard ARN format: "arn:aws:cloudtrail:us- east-1:123456789012:dashboard/exampleDash" Example channel ARN format: "arn:aws:cloudtrail:us- east-2:123456789012:channel/01234567890" Return type: dict Returns: **Response Syntax** {} **Response Structure** * *(dict) --* **Exceptions** * "CloudTrail.Client.exceptions.ResourceARNNotValidException" * "CloudTrail.Client.exceptions.ResourceNotFoundException" * "CloudTrail.Client.exceptions.ResourcePolicyNotFoundException" * "CloudTrail.Client.exceptions.ResourceTypeNotSupportedException" * "CloudTrail.Client.exceptions.ConflictException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" CloudTrail / Client / generate_query generate_query ************** CloudTrail.Client.generate_query(**kwargs) Generates a query from a natural language prompt. This operation uses generative artificial intelligence (generative AI) to produce a ready-to-use SQL query from the prompt. The prompt can be a question or a statement about the event data in your event data store. For example, you can enter prompts like "What are my top errors in the past month?" and “Give me a list of users that used SNS.” The prompt must be in English. For information about limitations, permissions, and supported Regions, see Create CloudTrail Lake queries from natural language prompts in the *CloudTrail* user guide. Note: Do not include any personally identifying, confidential, or sensitive information in your prompts.This feature uses generative AI large language models (LLMs); we recommend double- checking the LLM response. See also: AWS API Documentation **Request Syntax** response = client.generate_query( EventDataStores=[ 'string', ], Prompt='string' ) Parameters: * **EventDataStores** (*list*) -- **[REQUIRED]** The ARN (or ID suffix of the ARN) of the event data store that you want to query. You can only specify one event data store. * *(string) --* * **Prompt** (*string*) -- **[REQUIRED]** The prompt that you want to use to generate the query. The prompt must be in English. For example prompts, see Example prompts in the *CloudTrail* user guide. Return type: dict Returns: **Response Syntax** { 'QueryStatement': 'string', 'QueryAlias': 'string', 'EventDataStoreOwnerAccountId': 'string' } **Response Structure** * *(dict) --* * **QueryStatement** *(string) --* The SQL query statement generated from the prompt. * **QueryAlias** *(string) --* An alias that identifies the prompt. When you run the "StartQuery" operation, you can pass in either the "QueryAlias" or "QueryStatement" parameter. * **EventDataStoreOwnerAccountId** *(string) --* The account ID of the event data store owner. **Exceptions** * "CloudTrail.Client.exceptions.EventDataStoreARNInvalidException" * "CloudTrail.Client.exceptions.EventDataStoreNotFoundException" * "CloudTrail.Client.exceptions.InactiveEventDataStoreException" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.GenerateResponseException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" CloudTrail / Client / create_dashboard create_dashboard **************** CloudTrail.Client.create_dashboard(**kwargs) Creates a custom dashboard or the Highlights dashboard. * **Custom dashboards** - Custom dashboards allow you to query events in any event data store type. You can add up to 10 widgets to a custom dashboard. You can manually refresh a custom dashboard, or you can set a refresh schedule. * **Highlights dashboard** - You can create the Highlights dashboard to see a summary of key user activities and API usage across all your event data stores. CloudTrail Lake manages the Highlights dashboard and refreshes the dashboard every 6 hours. To create the Highlights dashboard, you must set and enable a refresh schedule. CloudTrail runs queries to populate the dashboard's widgets during a manual or scheduled refresh. CloudTrail must be granted permissions to run the "StartQuery" operation on your behalf. To provide permissions, run the "PutResourcePolicy" operation to attach a resource-based policy to each event data store. For more information, see Example: Allow CloudTrail to run queries to populate a dashboard in the *CloudTrail User Guide*. To set a refresh schedule, CloudTrail must be granted permissions to run the "StartDashboardRefresh" operation to refresh the dashboard on your behalf. To provide permissions, run the "PutResourcePolicy" operation to attach a resource-based policy to the dashboard. For more information, see Resource-based policy example for a dashboard in the *CloudTrail User Guide*. For more information about dashboards, see CloudTrail Lake dashboards in the *CloudTrail User Guide*. See also: AWS API Documentation **Request Syntax** response = client.create_dashboard( Name='string', RefreshSchedule={ 'Frequency': { 'Unit': 'HOURS'|'DAYS', 'Value': 123 }, 'Status': 'ENABLED'|'DISABLED', 'TimeOfDay': 'string' }, TagsList=[ { 'Key': 'string', 'Value': 'string' }, ], TerminationProtectionEnabled=True|False, Widgets=[ { 'QueryStatement': 'string', 'QueryParameters': [ 'string', ], 'ViewProperties': { 'string': 'string' } }, ] ) Parameters: * **Name** (*string*) -- **[REQUIRED]** The name of the dashboard. The name must be unique to your account. To create the Highlights dashboard, the name must be "AWSCloudTrail-Highlights". * **RefreshSchedule** (*dict*) -- The refresh schedule configuration for the dashboard. To create the Highlights dashboard, you must set a refresh schedule and set the "Status" to "ENABLED". The "Unit" for the refresh schedule must be "HOURS" and the "Value" must be "6". * **Frequency** *(dict) --* The frequency at which you want the dashboard refreshed. * **Unit** *(string) --* The unit to use for the refresh. For custom dashboards, the unit can be "HOURS" or "DAYS". For the Highlights dashboard, the "Unit" must be "HOURS". * **Value** *(integer) --* The value for the refresh schedule. For custom dashboards, the following values are valid when the unit is "HOURS": "1", "6", "12", "24" For custom dashboards, the only valid value when the unit is "DAYS" is "1". For the Highlights dashboard, the "Value" must be "6". * **Status** *(string) --* Specifies whether the refresh schedule is enabled. Set the value to "ENABLED" to enable the refresh schedule, or to "DISABLED" to turn off the refresh schedule. * **TimeOfDay** *(string) --* The time of day in UTC to run the schedule; for hourly only refer to minutes; default is 00:00. * **TagsList** (*list*) -- A list of tags. * *(dict) --* A custom key-value pair associated with a resource such as a CloudTrail trail, event data store, dashboard, or channel. * **Key** *(string) --* **[REQUIRED]** The key in a key-value pair. The key must be must be no longer than 128 Unicode characters. The key must be unique for the resource to which it applies. * **Value** *(string) --* The value in a key-value pair of a tag. The value must be no longer than 256 Unicode characters. * **TerminationProtectionEnabled** (*boolean*) -- Specifies whether termination protection is enabled for the dashboard. If termination protection is enabled, you cannot delete the dashboard until termination protection is disabled. * **Widgets** (*list*) -- An array of widgets for a custom dashboard. A custom dashboard can have a maximum of ten widgets. You do not need to specify widgets for the Highlights dashboard. * *(dict) --* Contains information about a widget on a CloudTrail Lake dashboard. * **QueryStatement** *(string) --* **[REQUIRED]** The query statement for the widget. For custom dashboard widgets, you can query across multiple event data stores as long as all event data stores exist in your account. Note: When a query uses "?" with "eventTime", "?" must be surrounded by single quotes as follows: "'?'". * **QueryParameters** *(list) --* The optional query parameters. The following query parameters are valid: "$StartTime$", "$EndTime$", and "$Period$". * *(string) --* * **ViewProperties** *(dict) --* **[REQUIRED]** The view properties for the widget. For more information about view properties, see View properties for widgets in the *CloudTrail User Guide*. * *(string) --* * *(string) --* Return type: dict Returns: **Response Syntax** { 'DashboardArn': 'string', 'Name': 'string', 'Type': 'MANAGED'|'CUSTOM', 'Widgets': [ { 'QueryAlias': 'string', 'QueryStatement': 'string', 'QueryParameters': [ 'string', ], 'ViewProperties': { 'string': 'string' } }, ], 'TagsList': [ { 'Key': 'string', 'Value': 'string' }, ], 'RefreshSchedule': { 'Frequency': { 'Unit': 'HOURS'|'DAYS', 'Value': 123 }, 'Status': 'ENABLED'|'DISABLED', 'TimeOfDay': 'string' }, 'TerminationProtectionEnabled': True|False } **Response Structure** * *(dict) --* * **DashboardArn** *(string) --* The ARN for the dashboard. * **Name** *(string) --* The name of the dashboard. * **Type** *(string) --* The dashboard type. * **Widgets** *(list) --* An array of widgets for the dashboard. * *(dict) --* A widget on a CloudTrail Lake dashboard. * **QueryAlias** *(string) --* The query alias used to identify the query for the widget. * **QueryStatement** *(string) --* The SQL query statement for the widget. * **QueryParameters** *(list) --* The query parameters for the widget. * *(string) --* * **ViewProperties** *(dict) --* The view properties for the widget. For more information about view properties, see View properties for widgets in the *CloudTrail User Guide*.. * *(string) --* * *(string) --* * **TagsList** *(list) --* A list of tags. * *(dict) --* A custom key-value pair associated with a resource such as a CloudTrail trail, event data store, dashboard, or channel. * **Key** *(string) --* The key in a key-value pair. The key must be must be no longer than 128 Unicode characters. The key must be unique for the resource to which it applies. * **Value** *(string) --* The value in a key-value pair of a tag. The value must be no longer than 256 Unicode characters. * **RefreshSchedule** *(dict) --* The refresh schedule for the dashboard, if configured. * **Frequency** *(dict) --* The frequency at which you want the dashboard refreshed. * **Unit** *(string) --* The unit to use for the refresh. For custom dashboards, the unit can be "HOURS" or "DAYS". For the Highlights dashboard, the "Unit" must be "HOURS". * **Value** *(integer) --* The value for the refresh schedule. For custom dashboards, the following values are valid when the unit is "HOURS": "1", "6", "12", "24" For custom dashboards, the only valid value when the unit is "DAYS" is "1". For the Highlights dashboard, the "Value" must be "6". * **Status** *(string) --* Specifies whether the refresh schedule is enabled. Set the value to "ENABLED" to enable the refresh schedule, or to "DISABLED" to turn off the refresh schedule. * **TimeOfDay** *(string) --* The time of day in UTC to run the schedule; for hourly only refer to minutes; default is 00:00. * **TerminationProtectionEnabled** *(boolean) --* Indicates whether termination protection is enabled for the dashboard. **Exceptions** * "CloudTrail.Client.exceptions.ConflictException" * "CloudTrail.Client.exceptions.InvalidTagParameterException" * "CloudTrail.Client.exceptions.EventDataStoreNotFoundException" * "CloudTrail.Client.exceptions.InactiveEventDataStoreException" * "CloudTrail.Client.exceptions.InsufficientEncryptionPolicyExcept ion" * "CloudTrail.Client.exceptions.InvalidQueryStatementException" * "CloudTrail.Client.exceptions.ServiceQuotaExceededException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" CloudTrail / Client / cancel_query cancel_query ************ CloudTrail.Client.cancel_query(**kwargs) Cancels a query if the query is not in a terminated state, such as "CANCELLED", "FAILED", "TIMED_OUT", or "FINISHED". You must specify an ARN value for "EventDataStore". The ID of the query that you want to cancel is also required. When you run "CancelQuery", the query status might show as "CANCELLED" even if the operation is not yet finished. See also: AWS API Documentation **Request Syntax** response = client.cancel_query( EventDataStore='string', QueryId='string', EventDataStoreOwnerAccountId='string' ) Parameters: * **EventDataStore** (*string*) -- The ARN (or the ID suffix of the ARN) of an event data store on which the specified query is running. * **QueryId** (*string*) -- **[REQUIRED]** The ID of the query that you want to cancel. The "QueryId" comes from the response of a "StartQuery" operation. * **EventDataStoreOwnerAccountId** (*string*) -- The account ID of the event data store owner. Return type: dict Returns: **Response Syntax** { 'QueryId': 'string', 'QueryStatus': 'QUEUED'|'RUNNING'|'FINISHED'|'FAILED'|'CANCELLED'|'TIMED_OUT', 'EventDataStoreOwnerAccountId': 'string' } **Response Structure** * *(dict) --* * **QueryId** *(string) --* The ID of the canceled query. * **QueryStatus** *(string) --* Shows the status of a query after a "CancelQuery" request. Typically, the values shown are either "RUNNING" or "CANCELLED". * **EventDataStoreOwnerAccountId** *(string) --* The account ID of the event data store owner. **Exceptions** * "CloudTrail.Client.exceptions.EventDataStoreARNInvalidException" * "CloudTrail.Client.exceptions.EventDataStoreNotFoundException" * "CloudTrail.Client.exceptions.InactiveEventDataStoreException" * "CloudTrail.Client.exceptions.InactiveQueryException" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.QueryIdNotFoundException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" * "CloudTrail.Client.exceptions.ConflictException" CloudTrail / Client / start_logging start_logging ************* CloudTrail.Client.start_logging(**kwargs) Starts the recording of Amazon Web Services API calls and log file delivery for a trail. For a trail that is enabled in all Regions, this operation must be called from the Region in which the trail was created. This operation cannot be called on the shadow trails (replicated trails in other Regions) of a trail that is enabled in all Regions. See also: AWS API Documentation **Request Syntax** response = client.start_logging( Name='string' ) Parameters: **Name** (*string*) -- **[REQUIRED]** Specifies the name or the CloudTrail ARN of the trail for which CloudTrail logs Amazon Web Services API calls. The following is the format of a trail ARN. "arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail" Return type: dict Returns: **Response Syntax** {} **Response Structure** * *(dict) --* Returns the objects or data listed below if successful. Otherwise, returns an error. **Exceptions** * "CloudTrail.Client.exceptions.CloudTrailARNInvalidException" * "CloudTrail.Client.exceptions.ConflictException" * "CloudTrail.Client.exceptions.ThrottlingException" * "CloudTrail.Client.exceptions.TrailNotFoundException" * "CloudTrail.Client.exceptions.InvalidTrailNameException" * "CloudTrail.Client.exceptions.InvalidHomeRegionException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.NotOrganizationMasterAccountExcept ion" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" * "CloudTrail.Client.exceptions.InsufficientDependencyServiceAcces sPermissionException" CloudTrail / Client / update_trail update_trail ************ CloudTrail.Client.update_trail(**kwargs) Updates trail settings that control what events you are logging, and how to handle log files. Changes to a trail do not require stopping the CloudTrail service. Use this action to designate an existing bucket for log delivery. If the existing bucket has previously been a target for CloudTrail log files, an IAM policy exists for the bucket. "UpdateTrail" must be called from the Region in which the trail was created; otherwise, an "InvalidHomeRegionException" is thrown. See also: AWS API Documentation **Request Syntax** response = client.update_trail( Name='string', S3BucketName='string', S3KeyPrefix='string', SnsTopicName='string', IncludeGlobalServiceEvents=True|False, IsMultiRegionTrail=True|False, EnableLogFileValidation=True|False, CloudWatchLogsLogGroupArn='string', CloudWatchLogsRoleArn='string', KmsKeyId='string', IsOrganizationTrail=True|False ) Parameters: * **Name** (*string*) -- **[REQUIRED]** Specifies the name of the trail or trail ARN. If "Name" is a trail name, the string 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-_namespace" and "my--namespace" are not valid. * Not be in IP address format (for example, 192.168.5.4) If "Name" is a trail ARN, it must be in the following format. "arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail" * **S3BucketName** (*string*) -- Specifies the name of the Amazon S3 bucket designated for publishing log files. See Amazon S3 Bucket naming rules. * **S3KeyPrefix** (*string*) -- Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see Finding Your CloudTrail Log Files. The maximum length is 200 characters. * **SnsTopicName** (*string*) -- Specifies the name or ARN of the Amazon SNS topic defined for notification of log file delivery. The maximum length is 256 characters. * **IncludeGlobalServiceEvents** (*boolean*) -- Specifies whether the trail is publishing events from global services such as IAM to the log files. * **IsMultiRegionTrail** (*boolean*) -- Specifies whether the trail applies only to the current Region or to all Regions. The default is false. If the trail exists only in the current Region and this value is set to true, shadow trails (replications of the trail) will be created in the other Regions. If the trail exists in all Regions and this value is set to false, the trail will remain in the Region where it was created, and its shadow trails in other Regions will be deleted. As a best practice, consider using trails that log events in all Regions. * **EnableLogFileValidation** (*boolean*) -- Specifies whether log file validation is enabled. The default is false. Note: When you disable log file integrity validation, the chain of digest files is broken after one hour. CloudTrail does not create digest files for log files that were delivered during a period in which log file integrity validation was disabled. For example, if you enable log file integrity validation at noon on January 1, disable it at noon on January 2, and re-enable it at noon on January 10, digest files will not be created for the log files delivered from noon on January 2 to noon on January 10. The same applies whenever you stop CloudTrail logging or delete a trail. * **CloudWatchLogsLogGroupArn** (*string*) -- Specifies a log group name using an Amazon Resource Name (ARN), a unique identifier that represents the log group to which CloudTrail logs are delivered. You must use a log group that exists in your account. Not required unless you specify "CloudWatchLogsRoleArn". * **CloudWatchLogsRoleArn** (*string*) -- Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group. You must use a role that exists in your account. * **KmsKeyId** (*string*) -- Specifies the KMS key ID to use to encrypt the logs delivered by CloudTrail. The value can be an alias name prefixed by "alias/", a fully specified ARN to an alias, a fully specified ARN to a key, or a globally unique identifier. CloudTrail also supports KMS multi-Region keys. For more information about multi-Region keys, see Using multi-Region keys in the *Key Management Service Developer Guide*. Examples: * alias/MyAliasName * arn:aws:kms:us-east-2:123456789012:alias/MyAliasName * arn:aws:kms:us- east-2:123456789012:key/12345678-1234-1234-1234-123456789012 * 12345678-1234-1234-1234-123456789012 * **IsOrganizationTrail** (*boolean*) -- Specifies whether the trail is applied to all accounts in an organization in Organizations, or only for the current Amazon Web Services account. The default is false, and cannot be true unless the call is made on behalf of an Amazon Web Services account that is the management account for an organization in Organizations. If the trail is not an organization trail and this is set to "true", the trail will be created in all Amazon Web Services accounts that belong to the organization. If the trail is an organization trail and this is set to "false", the trail will remain in the current Amazon Web Services account but be deleted from all member accounts in the organization. Note: Only the management account for the organization can convert an organization trail to a non-organization trail, or convert a non-organization trail to an organization trail. Return type: dict Returns: **Response Syntax** { 'Name': 'string', 'S3BucketName': 'string', 'S3KeyPrefix': 'string', 'SnsTopicName': 'string', 'SnsTopicARN': 'string', 'IncludeGlobalServiceEvents': True|False, 'IsMultiRegionTrail': True|False, 'TrailARN': 'string', 'LogFileValidationEnabled': True|False, 'CloudWatchLogsLogGroupArn': 'string', 'CloudWatchLogsRoleArn': 'string', 'KmsKeyId': 'string', 'IsOrganizationTrail': True|False } **Response Structure** * *(dict) --* Returns the objects or data listed below if successful. Otherwise, returns an error. * **Name** *(string) --* Specifies the name of the trail. * **S3BucketName** *(string) --* Specifies the name of the Amazon S3 bucket designated for publishing log files. * **S3KeyPrefix** *(string) --* Specifies the Amazon S3 key prefix that comes after the name of the bucket you have designated for log file delivery. For more information, see Finding Your IAM Log Files. * **SnsTopicName** *(string) --* This field is no longer in use. Use "SnsTopicARN". * **SnsTopicARN** *(string) --* Specifies the ARN of the Amazon SNS topic that CloudTrail uses to send notifications when log files are delivered. The following is the format of a topic ARN. "arn:aws:sns:us-east-2:123456789012:MyTopic" * **IncludeGlobalServiceEvents** *(boolean) --* Specifies whether the trail is publishing events from global services such as IAM to the log files. * **IsMultiRegionTrail** *(boolean) --* Specifies whether the trail exists in one Region or in all Regions. * **TrailARN** *(string) --* Specifies the ARN of the trail that was updated. The following is the format of a trail ARN. "arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail" * **LogFileValidationEnabled** *(boolean) --* Specifies whether log file integrity validation is enabled. * **CloudWatchLogsLogGroupArn** *(string) --* Specifies the Amazon Resource Name (ARN) of the log group to which CloudTrail logs are delivered. * **CloudWatchLogsRoleArn** *(string) --* Specifies the role for the CloudWatch Logs endpoint to assume to write to a user's log group. * **KmsKeyId** *(string) --* Specifies the KMS key ID that encrypts the logs delivered by CloudTrail. The value is a fully specified ARN to a KMS key in the following format. "arn:aws:kms:us-east-2:123456789012:key/12345678-1234-1234- 1234-123456789012" * **IsOrganizationTrail** *(boolean) --* Specifies whether the trail is an organization trail. **Exceptions** * "CloudTrail.Client.exceptions.S3BucketDoesNotExistException" * "CloudTrail.Client.exceptions.InsufficientS3BucketPolicyExceptio n" * "CloudTrail.Client.exceptions.InsufficientSnsTopicPolicyExceptio n" * "CloudTrail.Client.exceptions.InsufficientEncryptionPolicyExcept ion" * "CloudTrail.Client.exceptions.TrailNotFoundException" * "CloudTrail.Client.exceptions.InvalidS3BucketNameException" * "CloudTrail.Client.exceptions.InvalidS3PrefixException" * "CloudTrail.Client.exceptions.InvalidSnsTopicNameException" * "CloudTrail.Client.exceptions.InvalidKmsKeyIdException" * "CloudTrail.Client.exceptions.InvalidTrailNameException" * "CloudTrail.Client.exceptions.TrailNotProvidedException" * "CloudTrail.Client.exceptions.InvalidEventSelectorsException" * "CloudTrail.Client.exceptions.CloudTrailARNInvalidException" * "CloudTrail.Client.exceptions.ConflictException" * "CloudTrail.Client.exceptions.ThrottlingException" * "CloudTrail.Client.exceptions.InvalidParameterCombinationExcepti on" * "CloudTrail.Client.exceptions.InvalidHomeRegionException" * "CloudTrail.Client.exceptions.KmsKeyNotFoundException" * "CloudTrail.Client.exceptions.KmsKeyDisabledException" * "CloudTrail.Client.exceptions.KmsException" * "CloudTrail.Client.exceptions.InvalidCloudWatchLogsLogGroupArnEx ception" * "CloudTrail.Client.exceptions.InvalidCloudWatchLogsRoleArnExcept ion" * "CloudTrail.Client.exceptions.CloudWatchLogsDeliveryUnavailableE xception" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.CloudTrailAccessNotEnabledExceptio n" * "CloudTrail.Client.exceptions.InsufficientDependencyServiceAcces sPermissionException" * "CloudTrail.Client.exceptions.OrganizationsNotInUseException" * "CloudTrail.Client.exceptions.NotOrganizationMasterAccountExcept ion" * "CloudTrail.Client.exceptions.OrganizationNotInAllFeaturesModeEx ception" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" * "CloudTrail.Client.exceptions.CloudTrailInvalidClientTokenIdExce ption" * "CloudTrail.Client.exceptions.InvalidParameterException" CloudTrail / Client / stop_event_data_store_ingestion stop_event_data_store_ingestion ******************************* CloudTrail.Client.stop_event_data_store_ingestion(**kwargs) Stops the ingestion of live events on an event data store specified as either an ARN or the ID portion of the ARN. To stop ingestion, the event data store "Status" must be "ENABLED" and the "eventCategory" must be "Management", "Data", "NetworkActivity", or "ConfigurationItem". See also: AWS API Documentation **Request Syntax** response = client.stop_event_data_store_ingestion( EventDataStore='string' ) Parameters: **EventDataStore** (*string*) -- **[REQUIRED]** The ARN (or ID suffix of the ARN) of the event data store for which you want to stop ingestion. Return type: dict Returns: **Response Syntax** {} **Response Structure** * *(dict) --* **Exceptions** * "CloudTrail.Client.exceptions.EventDataStoreARNInvalidException" * "CloudTrail.Client.exceptions.EventDataStoreNotFoundException" * "CloudTrail.Client.exceptions.InvalidEventDataStoreStatusExcepti on" * "CloudTrail.Client.exceptions.InvalidParameterException" * "CloudTrail.Client.exceptions.InvalidEventDataStoreCategoryExcep tion" * "CloudTrail.Client.exceptions.OperationNotPermittedException" * "CloudTrail.Client.exceptions.UnsupportedOperationException" * "CloudTrail.Client.exceptions.NotOrganizationMasterAccountExcept ion" * "CloudTrail.Client.exceptions.NoManagementAccountSLRExistsExcept ion" * "CloudTrail.Client.exceptions.InsufficientDependencyServiceAcces sPermissionException" * "CloudTrail.Client.exceptions.ConflictException"