Skip to content

Examples#

Index > SSM > Examples

Auto-generated documentation for SSM type annotations stubs module types-aiobotocore-ssm.

Client#

Implicit type annotations#

Can be used with types-aioboto3[ssm] package installed.

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

# SSMClient usage example

from aioboto3.session import Session


session = Session()

async with session.client("ssm") as client:  # (1)
    result = await client.associate_ops_item_related_item()  # (2)
  1. client: SSMClient
  2. result: AssociateOpsItemRelatedItemResponseTypeDef
# DescribeActivationsPaginator usage example

from aioboto3.session import Session


session = Session()

async with session.client("ssm") as client:  # (1)
    paginator = client.get_paginator("describe_activations")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: SSMClient
  2. paginator: DescribeActivationsPaginator
  3. item: DescribeActivationsResultTypeDef
# CommandExecutedWaiter usage example

from aioboto3.session import Session


session = Session()

async with session.client("ssm") as client:  # (1)
    waiter = client.get_waiter("command_executed")  # (2)
    await waiter.wait()
  1. client: SSMClient
  2. waiter: CommandExecutedWaiter

Explicit type annotations#

With types-aioboto3-lite[ssm] or a standalone types_aiobotocore_ssm package, you have to explicitly specify client: SSMClient 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.

# SSMClient usage example with type annotations

from aioboto3.session import Session

from types_aiobotocore_ssm.client import SSMClient
from types_aiobotocore_ssm.type_defs import AssociateOpsItemRelatedItemResponseTypeDef
from types_aiobotocore_ssm.type_defs import AssociateOpsItemRelatedItemRequestRequestTypeDef


session = Session()

client: SSMClient
async with session.client("ssm") as client:  # (1)
    kwargs: AssociateOpsItemRelatedItemRequestRequestTypeDef = {...}  # (2)
    result: AssociateOpsItemRelatedItemResponseTypeDef = await client.associate_ops_item_related_item(**kwargs)  # (3)
  1. client: SSMClient
  2. kwargs: AssociateOpsItemRelatedItemRequestRequestTypeDef
  3. result: AssociateOpsItemRelatedItemResponseTypeDef
# DescribeActivationsPaginator usage example with type annotations

from aioboto3.session import Session

from types_aiobotocore_ssm.client import SSMClient
from types_aiobotocore_ssm.paginator import DescribeActivationsPaginator
from types_aiobotocore_ssm.type_defs import DescribeActivationsResultTypeDef


session = Session()

client: SSMClient
async with session.client("ssm") as client:  # (1)
    paginator: DescribeActivationsPaginator = client.get_paginator("describe_activations")  # (2)
    async for item in paginator.paginate(...):
        item: DescribeActivationsResultTypeDef
        print(item)  # (3)
  1. client: SSMClient
  2. paginator: DescribeActivationsPaginator
  3. item: DescribeActivationsResultTypeDef
# CommandExecutedWaiter usage example with type annotations

from aioboto3.session import Session

from types_aiobotocore_ssm.client import SSMClient
from types_aiobotocore_ssm.waiter import CommandExecutedWaiter


session = Session()

async with session.client("ssm") as client:  # (1)
    waiter = client.get_waiter("command_executed")  # (2)
    await waiter.wait()
  1. client: SSMClient
  2. waiter: CommandExecutedWaiter