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.
Client usage example
from boto3.session import Session
session = Session()
client = session.client("fsx") # (1)
result = client.associate_file_system_aliases() # (2)
- client: FSxClient
- result: AssociateFileSystemAliasesResponseTypeDef
Paginator 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)
- client: FSxClient
- paginator: DescribeBackupsPaginator
- item: DescribeBackupsResponseTypeDef
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.
Client usage example
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)
Paginator usage example
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 DescribeBackupsResponseTypeDef
session = Session()
client: FSxClient = session.client("fsx")
paginator: DescribeBackupsPaginator = client.get_paginator("describe_backups")
for item in paginator.paginate(...):
item: DescribeBackupsResponseTypeDef
print(item)