Skip to content

Examples#

Index > MemoryDB > Examples

Auto-generated documentation for MemoryDB type annotations stubs module types-boto3-memorydb.

Client#

Implicit type annotations#

Can be used with types-boto3[memorydb] package installed.

Write your MemoryDB code as usual, type checking and code completion should work out of the box.

# MemoryDBClient usage example

from boto3.session import Session


session = Session()

client = session.client("memorydb")  # (1)
result = client.batch_update_cluster()  # (2)
  1. client: MemoryDBClient
  2. result: BatchUpdateClusterResponseTypeDef
# DescribeACLsPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("memorydb")  # (1)

paginator = client.get_paginator("describe_acls")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: MemoryDBClient
  2. paginator: DescribeACLsPaginator
  3. item: DescribeACLsResponseTypeDef

Explicit type annotations#

With types-boto3-lite[memorydb] or a standalone types_boto3_memorydb package, you have to explicitly specify client: MemoryDBClient 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.

# MemoryDBClient usage example with type annotations

from boto3.session import Session

from types_boto3_memorydb.client import MemoryDBClient
from types_boto3_memorydb.type_defs import BatchUpdateClusterResponseTypeDef
from types_boto3_memorydb.type_defs import BatchUpdateClusterRequestRequestTypeDef


session = Session()

client: MemoryDBClient = session.client("memorydb")

kwargs: BatchUpdateClusterRequestRequestTypeDef = {...}
result: BatchUpdateClusterResponseTypeDef = client.batch_update_cluster(**kwargs)
# DescribeACLsPaginator usage example with type annotations

from boto3.session import Session

from types_boto3_memorydb.client import MemoryDBClient
from types_boto3_memorydb.paginator import DescribeACLsPaginator
from types_boto3_memorydb.type_defs import DescribeACLsResponseTypeDef


session = Session()
client: MemoryDBClient = session.client("memorydb")

paginator: DescribeACLsPaginator = client.get_paginator("describe_acls")
for item in paginator.paginate(...):
    item: DescribeACLsResponseTypeDef
    print(item)