Examples#
Index > ControlTower > Examples
Auto-generated documentation for ControlTower type annotations stubs module types-aiobotocore-controltower.
Client#
Implicit type annotations#
Can be used with types-aioboto3[controltower]
package installed.
Write your ControlTower
code as usual,
type checking and code completion should work out of the box.
# ControlTowerClient usage example
from aioboto3.session import Session
session = Session()
async with session.client("controltower") as client: # (1)
result = await client.create_landing_zone() # (2)
- client: ControlTowerClient
- result: CreateLandingZoneOutputTypeDef
# ListEnabledControlsPaginator usage example
from aioboto3.session import Session
session = Session()
async with session.client("controltower") as client: # (1)
paginator = client.get_paginator("list_enabled_controls") # (2)
async for item in paginator.paginate(...):
print(item) # (3)
- client: ControlTowerClient
- paginator: ListEnabledControlsPaginator
- item: ListEnabledControlsOutputTypeDef
Explicit type annotations#
With types-aioboto3-lite[controltower]
or a standalone types_aiobotocore_controltower
package, you have to explicitly specify
client: ControlTowerClient
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.
# ControlTowerClient usage example with type annotations
from aioboto3.session import Session
from types_aiobotocore_controltower.client import ControlTowerClient
from types_aiobotocore_controltower.type_defs import CreateLandingZoneOutputTypeDef
from types_aiobotocore_controltower.type_defs import CreateLandingZoneInputRequestTypeDef
session = Session()
client: ControlTowerClient
async with session.client("controltower") as client: # (1)
kwargs: CreateLandingZoneInputRequestTypeDef = {...} # (2)
result: CreateLandingZoneOutputTypeDef = await client.create_landing_zone(**kwargs) # (3)
- client: ControlTowerClient
- kwargs: CreateLandingZoneInputRequestTypeDef
- result: CreateLandingZoneOutputTypeDef
# ListEnabledControlsPaginator usage example with type annotations
from aioboto3.session import Session
from types_aiobotocore_controltower.client import ControlTowerClient
from types_aiobotocore_controltower.paginator import ListEnabledControlsPaginator
from types_aiobotocore_controltower.type_defs import ListEnabledControlsOutputTypeDef
session = Session()
client: ControlTowerClient
async with session.client("controltower") as client: # (1)
paginator: ListEnabledControlsPaginator = client.get_paginator("list_enabled_controls") # (2)
async for item in paginator.paginate(...):
item: ListEnabledControlsOutputTypeDef
print(item) # (3)
- client: ControlTowerClient
- paginator: ListEnabledControlsPaginator
- item: ListEnabledControlsOutputTypeDef