Examples#
Auto-generated documentation for ECS type annotations stubs module types-boto3-ecs.
Client#
Implicit type annotations#
Can be used with types-boto3[ecs]
package installed.
Write your ECS
code as usual,
type checking and code completion should work out of the box.
Client method usage example#
# ECSClient usage example
from boto3.session import Session
session = Session()
client = session.client("ecs") # (1)
result = client.create_capacity_provider() # (2)
- client: ECSClient
- result: CreateCapacityProviderResponseTypeDef
Paginator usage example#
# ListAccountSettingsPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("ecs") # (1)
paginator = client.get_paginator("list_account_settings") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: ECSClient
- paginator: ListAccountSettingsPaginator
- item: ListAccountSettingsResponseTypeDef
Waiter usage example#
# ServicesInactiveWaiter usage example
from boto3.session import Session
session = Session()
client = session.client("ecs") # (1)
waiter = client.get_waiter("services_inactive") # (2)
waiter.wait(...)
- client: ECSClient
- waiter: ServicesInactiveWaiter
Explicit type annotations#
With types-boto3-lite[ecs]
or a standalone types_boto3_ecs
package, you have to explicitly specify client: ECSClient
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#
# ECSClient usage example with type annotations
from boto3.session import Session
from types_boto3_ecs.client import ECSClient
from types_boto3_ecs.type_defs import CreateCapacityProviderResponseTypeDef
from types_boto3_ecs.type_defs import CreateCapacityProviderRequestTypeDef
session = Session()
client: ECSClient = session.client("ecs")
kwargs: CreateCapacityProviderRequestTypeDef = {...}
result: CreateCapacityProviderResponseTypeDef = client.create_capacity_provider(**kwargs)
Paginator usage example#
# ListAccountSettingsPaginator usage example with type annotations
from boto3.session import Session
from types_boto3_ecs.client import ECSClient
from types_boto3_ecs.paginator import ListAccountSettingsPaginator
from types_boto3_ecs.type_defs import ListAccountSettingsResponseTypeDef
session = Session()
client: ECSClient = session.client("ecs")
paginator: ListAccountSettingsPaginator = client.get_paginator("list_account_settings")
for item in paginator.paginate(...):
item: ListAccountSettingsResponseTypeDef
print(item)
Waiter usage example#
# ServicesInactiveWaiter usage example with type annotations
from boto3.session import Session
from types_boto3_ecs.client import ECSClient
from types_boto3_ecs.waiter import ServicesInactiveWaiter
session = Session()
client: ECSClient = session.client("ecs")
waiter: ServicesInactiveWaiter = client.get_waiter("services_inactive")
waiter.wait(...)