Skip to content

Examples#

Index > VPCLattice > Examples

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

Client#

Implicit type annotations#

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

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

# VPCLatticeClient usage example

from boto3.session import Session


session = Session()

client = session.client("vpc-lattice")  # (1)
result = client.batch_update_rule()  # (2)
  1. client: VPCLatticeClient
  2. result: BatchUpdateRuleResponseTypeDef
# ListAccessLogSubscriptionsPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("vpc-lattice")  # (1)

paginator = client.get_paginator("list_access_log_subscriptions")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: VPCLatticeClient
  2. paginator: ListAccessLogSubscriptionsPaginator
  3. item: ListAccessLogSubscriptionsResponseTypeDef

Explicit type annotations#

With types-boto3-lite[vpc-lattice] or a standalone types_boto3_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.

# VPCLatticeClient usage example with type annotations

from boto3.session import Session

from types_boto3_vpc_lattice.client import VPCLatticeClient
from types_boto3_vpc_lattice.type_defs import BatchUpdateRuleResponseTypeDef
from types_boto3_vpc_lattice.type_defs import BatchUpdateRuleRequestRequestTypeDef


session = Session()

client: VPCLatticeClient = session.client("vpc-lattice")

kwargs: BatchUpdateRuleRequestRequestTypeDef = {...}
result: BatchUpdateRuleResponseTypeDef = client.batch_update_rule(**kwargs)
# ListAccessLogSubscriptionsPaginator usage example with type annotations

from boto3.session import Session

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


session = Session()
client: VPCLatticeClient = session.client("vpc-lattice")

paginator: ListAccessLogSubscriptionsPaginator = client.get_paginator("list_access_log_subscriptions")
for item in paginator.paginate(...):
    item: ListAccessLogSubscriptionsResponseTypeDef
    print(item)