Skip to content

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-aioboto3[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 aioboto3.session import Session


session = Session()

async with session.client("docdb-elastic") as client:  # (1)
    result = await client.create_cluster()  # (2)
  1. client: DocDBElasticClient
  2. result: CreateClusterOutputTypeDef
# ListClusterSnapshotsPaginator usage example

from aioboto3.session import Session


session = Session()

async with session.client("docdb-elastic") as client:  # (1)
    paginator = client.get_paginator("list_cluster_snapshots")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: DocDBElasticClient
  2. paginator: ListClusterSnapshotsPaginator
  3. item: ListClusterSnapshotsOutputTypeDef

Explicit type annotations#

With types-aioboto3-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 aioboto3.session import 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 = Session()

client: DocDBElasticClient
async with session.client("docdb-elastic") as client:  # (1)
    kwargs: CreateClusterInputRequestTypeDef = {...}  # (2)
    result: CreateClusterOutputTypeDef = await client.create_cluster(**kwargs)  # (3)
  1. client: DocDBElasticClient
  2. kwargs: CreateClusterInputRequestTypeDef
  3. result: CreateClusterOutputTypeDef
# ListClusterSnapshotsPaginator usage example with type annotations

from aioboto3.session import 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 = Session()

client: DocDBElasticClient
async with session.client("docdb-elastic") as client:  # (1)
    paginator: ListClusterSnapshotsPaginator = client.get_paginator("list_cluster_snapshots")  # (2)
    async for item in paginator.paginate(...):
        item: ListClusterSnapshotsOutputTypeDef
        print(item)  # (3)
  1. client: DocDBElasticClient
  2. paginator: ListClusterSnapshotsPaginator
  3. item: ListClusterSnapshotsOutputTypeDef