Skip to content

Examples#

Index > FSx > Examples

Auto-generated documentation for FSx type annotations stubs module mypy-boto3-fsx.

Client#

Implicit type annotations#

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

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

# FSxClient usage example

from boto3.session import Session


session = Session()

client = session.client("fsx")  # (1)
result = client.associate_file_system_aliases()  # (2)
  1. client: FSxClient
  2. result: AssociateFileSystemAliasesResponseTypeDef
# DescribeBackupsPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("describe_backups")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: FSxClient
  2. paginator: DescribeBackupsPaginator
  3. item: DescribeBackupsResponsePaginatorTypeDef

Explicit type annotations#

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

# FSxClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_fsx.client import FSxClient
from mypy_boto3_fsx.type_defs import AssociateFileSystemAliasesResponseTypeDef
from mypy_boto3_fsx.type_defs import AssociateFileSystemAliasesRequestRequestTypeDef


session = Session()

client: FSxClient = session.client("fsx")

kwargs: AssociateFileSystemAliasesRequestRequestTypeDef = {...}
result: AssociateFileSystemAliasesResponseTypeDef = client.associate_file_system_aliases(**kwargs)
# DescribeBackupsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_fsx.client import FSxClient
from mypy_boto3_fsx.paginator import DescribeBackupsPaginator
from mypy_boto3_fsx.type_defs import DescribeBackupsResponsePaginatorTypeDef


session = Session()
client: FSxClient = session.client("fsx")

paginator: DescribeBackupsPaginator = client.get_paginator("describe_backups")
for item in paginator.paginate(...):
    item: DescribeBackupsResponsePaginatorTypeDef
    print(item)