Skip to content

Examples#

Index > FMS > Examples

Auto-generated documentation for FMS type annotations stubs module mypy-boto3-fms.

Client#

Implicit type annotations#

Can be used with boto3-stubs[fms] package installed.

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

# FMSClient usage example

from boto3.session import Session


session = Session()

client = session.client("fms")  # (1)
result = client.associate_admin_account()  # (2)
  1. client: FMSClient
  2. result: EmptyResponseMetadataTypeDef
# ListAdminAccountsForOrganizationPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_admin_accounts_for_organization")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: FMSClient
  2. paginator: ListAdminAccountsForOrganizationPaginator
  3. item: ListAdminAccountsForOrganizationResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[fms] or a standalone mypy_boto3_fms package, you have to explicitly specify client: FMSClient 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.

# FMSClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_fms.client import FMSClient
from mypy_boto3_fms.type_defs import EmptyResponseMetadataTypeDef
from mypy_boto3_fms.type_defs import AssociateAdminAccountRequestRequestTypeDef


session = Session()

client: FMSClient = session.client("fms")

kwargs: AssociateAdminAccountRequestRequestTypeDef = {...}
result: EmptyResponseMetadataTypeDef = client.associate_admin_account(**kwargs)
# ListAdminAccountsForOrganizationPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_fms.client import FMSClient
from mypy_boto3_fms.paginator import ListAdminAccountsForOrganizationPaginator
from mypy_boto3_fms.type_defs import ListAdminAccountsForOrganizationResponseTypeDef


session = Session()
client: FMSClient = session.client("fms")

paginator: ListAdminAccountsForOrganizationPaginator = client.get_paginator("list_admin_accounts_for_organization")
for item in paginator.paginate(...):
    item: ListAdminAccountsForOrganizationResponseTypeDef
    print(item)