Examples#
Auto-generated documentation for DocDB type annotations stubs module types-boto3-docdb.
Client#
Implicit type annotations#
Can be used with types-boto3[docdb]
package installed.
Write your DocDB
code as usual,
type checking and code completion should work out of the box.
# DocDBClient usage example
from boto3.session import Session
session = Session()
client = session.client("docdb") # (1)
result = client.add_source_identifier_to_subscription() # (2)
- client: DocDBClient
- result: AddSourceIdentifierToSubscriptionResultTypeDef
# DescribeCertificatesPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("docdb") # (1)
paginator = client.get_paginator("describe_certificates") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: DocDBClient
- paginator: DescribeCertificatesPaginator
- item: CertificateMessageTypeDef
# DBInstanceAvailableWaiter usage example
from boto3.session import Session
session = Session()
client = session.client("docdb") # (1)
waiter = client.get_waiter("db_instance_available") # (2)
waiter.wait()
- client: DocDBClient
- waiter: DBInstanceAvailableWaiter
Explicit type annotations#
With types-boto3-lite[docdb]
or a standalone types_boto3_docdb
package, you have to explicitly specify client: DocDBClient
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.
# DocDBClient usage example with type annotations
from boto3.session import Session
from types_boto3_docdb.client import DocDBClient
from types_boto3_docdb.type_defs import AddSourceIdentifierToSubscriptionResultTypeDef
from types_boto3_docdb.type_defs import AddSourceIdentifierToSubscriptionMessageRequestTypeDef
session = Session()
client: DocDBClient = session.client("docdb")
kwargs: AddSourceIdentifierToSubscriptionMessageRequestTypeDef = {...}
result: AddSourceIdentifierToSubscriptionResultTypeDef = client.add_source_identifier_to_subscription(**kwargs)
# DescribeCertificatesPaginator usage example with type annotations
from boto3.session import Session
from types_boto3_docdb.client import DocDBClient
from types_boto3_docdb.paginator import DescribeCertificatesPaginator
from types_boto3_docdb.type_defs import CertificateMessageTypeDef
session = Session()
client: DocDBClient = session.client("docdb")
paginator: DescribeCertificatesPaginator = client.get_paginator("describe_certificates")
for item in paginator.paginate(...):
item: CertificateMessageTypeDef
print(item)
# DBInstanceAvailableWaiter usage example with type annotations
from boto3.session import Session
from types_boto3_docdb.client import DocDBClient
from types_boto3_docdb.waiter import DBInstanceAvailableWaiter
session = Session()
client: DocDBClient = session.client("docdb")
waiter: DBInstanceAvailableWaiter = client.get_waiter("db_instance_available")
waiter.wait()