Skip to content

Examples#

Index > CloudTrailDataService > Examples

Auto-generated documentation for CloudTrailDataService type annotations stubs module types-boto3-cloudtrail-data.

Client#

Implicit type annotations#

Can be used with types-boto3[cloudtrail-data] package installed.

Write your CloudTrailDataService code as usual, type checking and code completion should work out of the box.

# CloudTrailDataServiceClient usage example

from boto3.session import Session


session = Session()

client = session.client("cloudtrail-data")  # (1)
result = client.put_audit_events()  # (2)
  1. client: CloudTrailDataServiceClient
  2. result: PutAuditEventsResponseTypeDef

Explicit type annotations#

With types-boto3-lite[cloudtrail-data] or a standalone types_boto3_cloudtrail_data package, you have to explicitly specify client: CloudTrailDataServiceClient type annotation.

All other type annotations are optional, as types should be discovered automatically. However, these type annotations can be helpful in your functions and methods.

# CloudTrailDataServiceClient usage example with type annotations

from boto3.session import Session

from types_boto3_cloudtrail_data.client import CloudTrailDataServiceClient
from types_boto3_cloudtrail_data.type_defs import PutAuditEventsResponseTypeDef
from types_boto3_cloudtrail_data.type_defs import PutAuditEventsRequestRequestTypeDef


session = Session()

client: CloudTrailDataServiceClient = session.client("cloudtrail-data")

kwargs: PutAuditEventsRequestRequestTypeDef = {...}
result: PutAuditEventsResponseTypeDef = client.put_audit_events(**kwargs)