Skip to content

Examples#

Index > VPCLattice > Examples

Auto-generated documentation for VPCLattice type annotations stubs module types-aiobotocore-vpc-lattice.

Client#

Implicit type annotations#

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

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

Client method usage example#

# VPCLatticeClient usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("vpc-lattice") as client:  # (1)
    result = await client.batch_update_rule()  # (2)
  1. client: VPCLatticeClient
  2. result: BatchUpdateRuleResponseTypeDef

Paginator usage example#

# ListAccessLogSubscriptionsPaginator usage example

from aiobotocore.session import get_session


session = get_session()

async with session.create_client("vpc-lattice") as client:  # (1)
    paginator = client.get_paginator("list_access_log_subscriptions")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: VPCLatticeClient
  2. paginator: ListAccessLogSubscriptionsPaginator
  3. item: ListAccessLogSubscriptionsResponseTypeDef

Explicit type annotations#

With types-aiobotocore-lite[vpc-lattice] or a standalone types_aiobotocore_vpc_lattice package, you have to explicitly specify client: VPCLatticeClient 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 method usage example#

# VPCLatticeClient usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_vpc_lattice.client import VPCLatticeClient
from types_aiobotocore_vpc_lattice.type_defs import BatchUpdateRuleResponseTypeDef
from types_aiobotocore_vpc_lattice.type_defs import BatchUpdateRuleRequestTypeDef


session = get_session()

async with session.create_client("vpc-lattice") as client:
    client: VPCLatticeClient
    kwargs: BatchUpdateRuleRequestTypeDef = {...}
    result: BatchUpdateRuleResponseTypeDef = await client.batch_update_rule(**kwargs)

Paginator usage example#

# ListAccessLogSubscriptionsPaginator usage example with type annotations

from aiobotocore.session import get_session

from types_aiobotocore_vpc_lattice.client import VPCLatticeClient
from types_aiobotocore_vpc_lattice.paginator import ListAccessLogSubscriptionsPaginator
from types_aiobotocore_vpc_lattice.type_defs import ListAccessLogSubscriptionsResponseTypeDef


session = get_session()

async with session.create_client("vpc-lattice") as client:
    client: VPCLatticeClient
    paginator: ListAccessLogSubscriptionsPaginator = client.get_paginator("list_access_log_subscriptions")
    async for item in paginator.paginate(...):
        item: ListAccessLogSubscriptionsResponseTypeDef
        print(item)