Examples#
Index > ControlCatalog > Examples
Auto-generated documentation for ControlCatalog type annotations stubs module mypy-boto3-controlcatalog.
Client#
Implicit type annotations#
Can be used with boto3-stubs[controlcatalog] package installed.
Write your ControlCatalog code as usual,
type checking and code completion should work out of the box.
Client method usage example#
# ControlCatalogClient usage example
from boto3.session import Session
session = Session()
client = session.client("controlcatalog") # (1)
result = client.get_control() # (2)
- client: ControlCatalogClient
- result: GetControlResponseTypeDef
Paginator usage example#
# ListCommonControlsPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("controlcatalog") # (1)
paginator = client.get_paginator("list_common_controls") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: ControlCatalogClient
- paginator: ListCommonControlsPaginator
- item: ListCommonControlsResponseTypeDef
Explicit type annotations#
With boto3-stubs-lite[controlcatalog]
or a standalone mypy_boto3_controlcatalog package, you have to explicitly specify client: ControlCatalogClient 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 method usage example#
# ControlCatalogClient usage example with type annotations
from boto3.session import Session
from mypy_boto3_controlcatalog.client import ControlCatalogClient
from mypy_boto3_controlcatalog.type_defs import GetControlResponseTypeDef
from mypy_boto3_controlcatalog.type_defs import GetControlRequestTypeDef
session = Session()
client: ControlCatalogClient = session.client("controlcatalog")
kwargs: GetControlRequestTypeDef = {...}
result: GetControlResponseTypeDef = client.get_control(**kwargs)
Paginator usage example#
# ListCommonControlsPaginator usage example with type annotations
from boto3.session import Session
from mypy_boto3_controlcatalog.client import ControlCatalogClient
from mypy_boto3_controlcatalog.paginator import ListCommonControlsPaginator
from mypy_boto3_controlcatalog.type_defs import ListCommonControlsResponseTypeDef
session = Session()
client: ControlCatalogClient = session.client("controlcatalog")
paginator: ListCommonControlsPaginator = client.get_paginator("list_common_controls")
for item in paginator.paginate(...):
item: ListCommonControlsResponseTypeDef
print(item)