Skip to content

Examples#

Index > FSx > Examples

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

Client#

Implicit type annotations#

Can be used with types-boto3[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 types-boto3-lite[fsx] or a standalone types_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 types_boto3_fsx.client import FSxClient
from types_boto3_fsx.type_defs import AssociateFileSystemAliasesResponseTypeDef
from types_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 types_boto3_fsx.client import FSxClient
from types_boto3_fsx.paginator import DescribeBackupsPaginator
from types_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)