Skip to content

Examples#

Index > FSx > Examples

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

Client#

Implicit type annotations#

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

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

# FSxClient usage example

from aioboto3.session import Session


session = Session()

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

from aioboto3.session import Session


session = Session()

async with session.client("fsx") as client:  # (1)
    paginator = client.get_paginator("describe_backups")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: FSxClient
  2. paginator: DescribeBackupsPaginator
  3. item: DescribeBackupsResponseTypeDef

Explicit type annotations#

With types-aioboto3-lite[fsx] or a standalone types_aiobotocore_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 aioboto3.session import Session

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


session = Session()

client: FSxClient
async with session.client("fsx") as client:  # (1)
    kwargs: AssociateFileSystemAliasesRequestRequestTypeDef = {...}  # (2)
    result: AssociateFileSystemAliasesResponseTypeDef = await client.associate_file_system_aliases(**kwargs)  # (3)
  1. client: FSxClient
  2. kwargs: AssociateFileSystemAliasesRequestRequestTypeDef
  3. result: AssociateFileSystemAliasesResponseTypeDef
# DescribeBackupsPaginator usage example with type annotations

from aioboto3.session import Session

from types_aiobotocore_fsx.client import FSxClient
from types_aiobotocore_fsx.paginator import DescribeBackupsPaginator
from types_aiobotocore_fsx.type_defs import DescribeBackupsResponseTypeDef


session = Session()

client: FSxClient
async with session.client("fsx") as client:  # (1)
    paginator: DescribeBackupsPaginator = client.get_paginator("describe_backups")  # (2)
    async for item in paginator.paginate(...):
        item: DescribeBackupsResponseTypeDef
        print(item)  # (3)
  1. client: FSxClient
  2. paginator: DescribeBackupsPaginator
  3. item: DescribeBackupsResponseTypeDef