Skip to content

Examples#

Index > EFS > Examples

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

Client#

Implicit type annotations#

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

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

# EFSClient usage example

from boto3.session import Session


session = Session()

client = session.client("efs")  # (1)
result = client.create_access_point()  # (2)
  1. client: EFSClient
  2. result: AccessPointDescriptionResponseTypeDef
# DescribeAccessPointsPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("efs")  # (1)

paginator = client.get_paginator("describe_access_points")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: EFSClient
  2. paginator: DescribeAccessPointsPaginator
  3. item: DescribeAccessPointsResponseTypeDef

Explicit type annotations#

With types-boto3-lite[efs] or a standalone types_boto3_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 boto3.session import Session

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


session = Session()

client: EFSClient = session.client("efs")

kwargs: CreateAccessPointRequestRequestTypeDef = {...}
result: AccessPointDescriptionResponseTypeDef = client.create_access_point(**kwargs)
# DescribeAccessPointsPaginator usage example with type annotations

from boto3.session import Session

from types_boto3_efs.client import EFSClient
from types_boto3_efs.paginator import DescribeAccessPointsPaginator
from types_boto3_efs.type_defs import DescribeAccessPointsResponseTypeDef


session = Session()
client: EFSClient = session.client("efs")

paginator: DescribeAccessPointsPaginator = client.get_paginator("describe_access_points")
for item in paginator.paginate(...):
    item: DescribeAccessPointsResponseTypeDef
    print(item)