Skip to content

Examples#

Index > DocDBElastic > Examples

Auto-generated documentation for DocDBElastic type annotations stubs module mypy-boto3-docdb-elastic.

Client#

Implicit type annotations#

Can be used with boto3-stubs[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 boto3.session import Session


session = Session()

client = session.client("docdb-elastic")  # (1)
result = client.copy_cluster_snapshot()  # (2)
  1. client: DocDBElasticClient
  2. result: CopyClusterSnapshotOutputTypeDef
# ListClusterSnapshotsPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("docdb-elastic")  # (1)

paginator = client.get_paginator("list_cluster_snapshots")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: DocDBElasticClient
  2. paginator: ListClusterSnapshotsPaginator
  3. item: ListClusterSnapshotsOutputTypeDef

Explicit type annotations#

With boto3-stubs-lite[docdb-elastic] or a standalone mypy_boto3_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 boto3.session import Session

from mypy_boto3_docdb_elastic.client import DocDBElasticClient
from mypy_boto3_docdb_elastic.type_defs import CopyClusterSnapshotOutputTypeDef
from mypy_boto3_docdb_elastic.type_defs import CopyClusterSnapshotInputRequestTypeDef


session = Session()

client: DocDBElasticClient = session.client("docdb-elastic")

kwargs: CopyClusterSnapshotInputRequestTypeDef = {...}
result: CopyClusterSnapshotOutputTypeDef = client.copy_cluster_snapshot(**kwargs)
# ListClusterSnapshotsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_docdb_elastic.client import DocDBElasticClient
from mypy_boto3_docdb_elastic.paginator import ListClusterSnapshotsPaginator
from mypy_boto3_docdb_elastic.type_defs import ListClusterSnapshotsOutputTypeDef


session = Session()
client: DocDBElasticClient = session.client("docdb-elastic")

paginator: ListClusterSnapshotsPaginator = client.get_paginator("list_cluster_snapshots")
for item in paginator.paginate(...):
    item: ListClusterSnapshotsOutputTypeDef
    print(item)