Examples#
Index > VPCLattice > Examples
Auto-generated documentation for VPCLattice type annotations stubs module mypy-boto3-vpc-lattice.
Client#
Implicit type annotations#
Can be used with boto3-stubs[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)
- client: VPCLatticeClient
- 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)
- client: VPCLatticeClient
- paginator: ListAccessLogSubscriptionsPaginator
- item: ListAccessLogSubscriptionsResponseTypeDef
Explicit type annotations#
With boto3-stubs-lite[vpc-lattice]
or a standalone mypy_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 mypy_boto3_vpc_lattice.client import VPCLatticeClient
from mypy_boto3_vpc_lattice.type_defs import BatchUpdateRuleResponseTypeDef
from mypy_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 mypy_boto3_vpc_lattice.client import VPCLatticeClient
from mypy_boto3_vpc_lattice.paginator import ListAccessLogSubscriptionsPaginator
from mypy_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)