Examples#
Index > DocDBElastic > Examples
Auto-generated documentation for DocDBElastic type annotations stubs module types-aiobotocore-docdb-elastic.
Client#
Implicit type annotations#
Can be used with types-aiobotocore[docdb-elastic]
package installed.
Write your DocDBElastic
code as usual,
type checking and code completion should work out of the box.
# DocDBElasticClient usage example
from aiobotocore.session import get_session
session = get_session()
async with session.create_client("docdb-elastic") as client: # (1)
result = await client.create_cluster() # (2)
- client: DocDBElasticClient
- result: CreateClusterOutputTypeDef
# ListClusterSnapshotsPaginator usage example
from aiobotocore.session import get_session
session = get_session()
async with session.create_client("docdb-elastic") as client: # (1)
paginator = client.get_paginator("list_cluster_snapshots") # (2)
async for item in paginator.paginate(...):
print(item) # (3)
- client: DocDBElasticClient
- paginator: ListClusterSnapshotsPaginator
- item: ListClusterSnapshotsOutputTypeDef
Explicit type annotations#
With types-aiobotocore-lite[docdb-elastic]
or a standalone types_aiobotocore_docdb_elastic
package, you have to explicitly specify
client: DocDBElasticClient
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.
# DocDBElasticClient usage example with type annotations
from aiobotocore.session import get_session
from types_aiobotocore_docdb_elastic.client import DocDBElasticClient
from types_aiobotocore_docdb_elastic.type_defs import CreateClusterOutputTypeDef
from types_aiobotocore_docdb_elastic.type_defs import CreateClusterInputRequestTypeDef
session = get_session()
async with session.create_client("docdb-elastic") as client:
client: DocDBElasticClient
kwargs: CreateClusterInputRequestTypeDef = {...}
result: CreateClusterOutputTypeDef = await client.create_cluster(**kwargs)
# ListClusterSnapshotsPaginator usage example with type annotations
from aiobotocore.session import get_session
from types_aiobotocore_docdb_elastic.client import DocDBElasticClient
from types_aiobotocore_docdb_elastic.paginator import ListClusterSnapshotsPaginator
from types_aiobotocore_docdb_elastic.type_defs import ListClusterSnapshotsOutputTypeDef
session = get_session()
async with session.create_client("docdb-elastic") as client:
client: DocDBElasticClient
paginator: ListClusterSnapshotsPaginator = client.get_paginator("list_cluster_snapshots")
async for item in paginator.paginate(...):
item: ListClusterSnapshotsOutputTypeDef
print(item)