Skip to content

Examples#

Index > EFS > Examples

Auto-generated documentation for EFS type annotations stubs module types-aiobotocore-efs.

Client#

Implicit type annotations#

Can be used with types-aiobotocore[efs] package installed.

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

# EFSClient usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("efs") as client:  # (1)
    result = await client.create_access_point()  # (2)
  1. client: EFSClient
  2. result: AccessPointDescriptionResponseTypeDef
# DescribeFileSystemsPaginator usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("efs") as client:  # (1)
    paginator = client.get_paginator("describe_file_systems")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: EFSClient
  2. paginator: DescribeFileSystemsPaginator
  3. item: DescribeFileSystemsResponseTypeDef

Explicit type annotations#

With types-aiobotocore-lite[efs] or a standalone types_aiobotocore_efs package, you have to explicitly specify client: EFSClient 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.

# EFSClient usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_efs.client import EFSClient
from types_aiobotocore_efs.type_defs import AccessPointDescriptionResponseTypeDef
from types_aiobotocore_efs.type_defs import CreateAccessPointRequestRequestTypeDef


session = get_session()

async with session.create_client("efs") as client:
    client: EFSClient
    kwargs: CreateAccessPointRequestRequestTypeDef = {...}
    result: AccessPointDescriptionResponseTypeDef = await client.create_access_point(**kwargs)
# DescribeFileSystemsPaginator usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_efs.client import EFSClient
from types_aiobotocore_efs.paginator import DescribeFileSystemsPaginator
from types_aiobotocore_efs.type_defs import DescribeFileSystemsResponseTypeDef


session = get_session()

async with session.create_client("efs") as client:
    client: EFSClient
    paginator: DescribeFileSystemsPaginator = client.get_paginator("describe_file_systems")
    async for item in paginator.paginate(...):
        item: DescribeFileSystemsResponseTypeDef
        print(item)