Skip to content

Examples#

Index > CloudTrailDataService > Examples

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

Client#

Implicit type annotations#

Can be used with types-aioboto3[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 aioboto3.session import Session


session = Session()

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

Explicit type annotations#

With types-aioboto3-lite[cloudtrail-data] or a standalone types_aiobotocore_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 aioboto3.session import Session

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


session = Session()

client: CloudTrailDataServiceClient
async with session.client("cloudtrail-data") as client:  # (1)
    kwargs: PutAuditEventsRequestRequestTypeDef = {...}  # (2)
    result: PutAuditEventsResponseTypeDef = await client.put_audit_events(**kwargs)  # (3)
  1. client: CloudTrailDataServiceClient
  2. kwargs: PutAuditEventsRequestRequestTypeDef
  3. result: PutAuditEventsResponseTypeDef