Skip to content

Examples

Index > ControlTower > Examples

Auto-generated documentation for ControlTower type annotations stubs module mypy-boto3-controltower.

Client

Implicit type annotations

Can be used with boto3-stubs[controltower] package installed.

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

Client usage example
from boto3.session import Session


session = Session()

client = session.client("controltower")  # (1)
result = client.disable_control()  # (2)
  1. client: ControlTowerClient
  2. result: DisableControlOutputTypeDef
Paginator usage example
from boto3.session import Session


session = Session()
client = session.client("controltower")  # (1)

paginator = client.get_paginator("list_enabled_controls")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: ControlTowerClient
  2. paginator: ListEnabledControlsPaginator
  3. item: ListEnabledControlsOutputTypeDef

Explicit type annotations

With boto3-stubs-lite[controltower] or a standalone mypy_boto3_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.

Client usage example
from boto3.session import Session

from mypy_boto3_controltower.client import ControlTowerClient
from mypy_boto3_controltower.type_defs import DisableControlOutputTypeDef
from mypy_boto3_controltower.type_defs import DisableControlInputRequestTypeDef


session = Session()

client: ControlTowerClient = session.client("controltower")

kwargs: DisableControlInputRequestTypeDef = {...}
result: DisableControlOutputTypeDef = client.disable_control(**kwargs)
Paginator usage example
from boto3.session import Session

from mypy_boto3_controltower.client import ControlTowerClient
from mypy_boto3_controltower.paginator import ListEnabledControlsPaginator
from mypy_boto3_controltower.type_defs import ListEnabledControlsOutputTypeDef


session = Session()
client: ControlTowerClient = session.client("controltower")

paginator: ListEnabledControlsPaginator = client.get_paginator("list_enabled_controls")
for item in paginator.paginate(...):
    item: ListEnabledControlsOutputTypeDef
    print(item)