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-aiobotocore[fsx] package installed.

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

# FSxClient usage example

from aiobotocore.session import get_session


session = get_session()

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

from aiobotocore.session import get_session


session = get_session()

async with session.create_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-aiobotocore-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 aiobotocore.session import get_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 = get_session()

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

from aiobotocore.session import get_session

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


session = get_session()

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