Skip to content

CloudTrailClient#

Index > CloudTrail > CloudTrailClient

Auto-generated documentation for CloudTrail type annotations stubs module mypy-boto3-cloudtrail.

CloudTrailClient#

Type annotations and code completion for boto3.client("cloudtrail"). boto3 documentation

# CloudTrailClient usage example

from boto3.session import Session
from mypy_boto3_cloudtrail.client import CloudTrailClient

def get_cloudtrail_client() -> CloudTrailClient:
    return Session().client("cloudtrail")

Exceptions#

boto3 client exceptions are generated in runtime. This class provides code completion for boto3.client("cloudtrail").exceptions structure.

# Exceptions.exceptions usage example

client = boto3.client("cloudtrail")

try:
    do_something(client)
except (
    client.exceptions.AccessDeniedException,
    client.exceptions.AccountHasOngoingImportException,
    client.exceptions.AccountNotFoundException,
    client.exceptions.AccountNotRegisteredException,
    client.exceptions.AccountRegisteredException,
    client.exceptions.CannotDelegateManagementAccountException,
    client.exceptions.ChannelARNInvalidException,
    client.exceptions.ChannelAlreadyExistsException,
    client.exceptions.ChannelExistsForEDSException,
    client.exceptions.ChannelMaxLimitExceededException,
    client.exceptions.ChannelNotFoundException,
    client.exceptions.ClientError,
    client.exceptions.CloudTrailARNInvalidException,
    client.exceptions.CloudTrailAccessNotEnabledException,
    client.exceptions.CloudTrailInvalidClientTokenIdException,
    client.exceptions.CloudWatchLogsDeliveryUnavailableException,
    client.exceptions.ConcurrentModificationException,
    client.exceptions.ConflictException,
    client.exceptions.DelegatedAdminAccountLimitExceededException,
    client.exceptions.EventDataStoreARNInvalidException,
    client.exceptions.EventDataStoreAlreadyExistsException,
    client.exceptions.EventDataStoreFederationEnabledException,
    client.exceptions.EventDataStoreHasOngoingImportException,
    client.exceptions.EventDataStoreMaxLimitExceededException,
    client.exceptions.EventDataStoreNotFoundException,
    client.exceptions.EventDataStoreTerminationProtectedException,
    client.exceptions.ImportNotFoundException,
    client.exceptions.InactiveEventDataStoreException,
    client.exceptions.InactiveQueryException,
    client.exceptions.InsightNotEnabledException,
    client.exceptions.InsufficientDependencyServiceAccessPermissionException,
    client.exceptions.InsufficientEncryptionPolicyException,
    client.exceptions.InsufficientS3BucketPolicyException,
    client.exceptions.InsufficientSnsTopicPolicyException,
    client.exceptions.InvalidCloudWatchLogsLogGroupArnException,
    client.exceptions.InvalidCloudWatchLogsRoleArnException,
    client.exceptions.InvalidDateRangeException,
    client.exceptions.InvalidEventCategoryException,
    client.exceptions.InvalidEventDataStoreCategoryException,
    client.exceptions.InvalidEventDataStoreStatusException,
    client.exceptions.InvalidEventSelectorsException,
    client.exceptions.InvalidHomeRegionException,
    client.exceptions.InvalidImportSourceException,
    client.exceptions.InvalidInsightSelectorsException,
    client.exceptions.InvalidKmsKeyIdException,
    client.exceptions.InvalidLookupAttributesException,
    client.exceptions.InvalidMaxResultsException,
    client.exceptions.InvalidNextTokenException,
    client.exceptions.InvalidParameterCombinationException,
    client.exceptions.InvalidParameterException,
    client.exceptions.InvalidQueryStatementException,
    client.exceptions.InvalidQueryStatusException,
    client.exceptions.InvalidS3BucketNameException,
    client.exceptions.InvalidS3PrefixException,
    client.exceptions.InvalidSnsTopicNameException,
    client.exceptions.InvalidSourceException,
    client.exceptions.InvalidTagParameterException,
    client.exceptions.InvalidTimeRangeException,
    client.exceptions.InvalidTokenException,
    client.exceptions.InvalidTrailNameException,
    client.exceptions.KmsException,
    client.exceptions.KmsKeyDisabledException,
    client.exceptions.KmsKeyNotFoundException,
    client.exceptions.MaxConcurrentQueriesException,
    client.exceptions.MaximumNumberOfTrailsExceededException,
    client.exceptions.NoManagementAccountSLRExistsException,
    client.exceptions.NotOrganizationManagementAccountException,
    client.exceptions.NotOrganizationMasterAccountException,
    client.exceptions.OperationNotPermittedException,
    client.exceptions.OrganizationNotInAllFeaturesModeException,
    client.exceptions.OrganizationsNotInUseException,
    client.exceptions.QueryIdNotFoundException,
    client.exceptions.ResourceARNNotValidException,
    client.exceptions.ResourceNotFoundException,
    client.exceptions.ResourcePolicyNotFoundException,
    client.exceptions.ResourcePolicyNotValidException,
    client.exceptions.ResourceTypeNotSupportedException,
    client.exceptions.S3BucketDoesNotExistException,
    client.exceptions.TagsLimitExceededException,
    client.exceptions.ThrottlingException,
    client.exceptions.TrailAlreadyExistsException,
    client.exceptions.TrailNotFoundException,
    client.exceptions.TrailNotProvidedException,
    client.exceptions.UnsupportedOperationException,
) as e:
    print(e)
# Exceptions.exceptions type checking example

from mypy_boto3_cloudtrail.client import Exceptions

def handle_error(exc: Exceptions.AccessDeniedException) -> None:
    ...

Methods#

add_tags#

Adds one or more tags to a trail, event data store, or channel, up to a limit of 50.

Type annotations and code completion for boto3.client("cloudtrail").add_tags method. boto3 documentation

# add_tags method definition

def add_tags(
    self,
    *,
    ResourceId: str,
    TagsList: Sequence[TagTypeDef],  # (1)
) -> Dict[str, Any]:
    ...
  1. See TagTypeDef
# add_tags method usage example with argument unpacking

kwargs: AddTagsRequestRequestTypeDef = {  # (1)
    "ResourceId": ...,
    "TagsList": ...,
}

parent.add_tags(**kwargs)
  1. See AddTagsRequestRequestTypeDef

can_paginate#

Check if an operation can be paginated.

Type annotations and code completion for boto3.client("cloudtrail").can_paginate method. boto3 documentation

# can_paginate method definition

def can_paginate(
    self,
    operation_name: str,
) -> bool:
    ...

cancel_query#

Cancels a query if the query is not in a terminated state, such as CANCELLED, FAILED, TIMED_OUT, or FINISHED.

Type annotations and code completion for boto3.client("cloudtrail").cancel_query method. boto3 documentation

# cancel_query method definition

def cancel_query(
    self,
    *,
    QueryId: str,
    EventDataStore: str = ...,
) -> CancelQueryResponseTypeDef:  # (1)
    ...
  1. See CancelQueryResponseTypeDef
# cancel_query method usage example with argument unpacking

kwargs: CancelQueryRequestRequestTypeDef = {  # (1)
    "QueryId": ...,
}

parent.cancel_query(**kwargs)
  1. See CancelQueryRequestRequestTypeDef

close#

Closes underlying endpoint connections.

Type annotations and code completion for boto3.client("cloudtrail").close method. boto3 documentation

# close method definition

def close(
    self,
) -> None:
    ...

create_channel#

Creates a channel for CloudTrail to ingest events from a partner or external source.

Type annotations and code completion for boto3.client("cloudtrail").create_channel method.