Skip to content

Examples#

Index > ElasticLoadBalancingv2 > Examples

Auto-generated documentation for ElasticLoadBalancingv2 type annotations stubs module types-boto3-elbv2.

Client#

Implicit type annotations#

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

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

# ElasticLoadBalancingv2Client usage example

from boto3.session import Session


session = Session()

client = session.client("elbv2")  # (1)
result = client.add_listener_certificates()  # (2)
  1. client: ElasticLoadBalancingv2Client
  2. result: AddListenerCertificatesOutputTypeDef
# DescribeAccountLimitsPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("describe_account_limits")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: ElasticLoadBalancingv2Client
  2. paginator: DescribeAccountLimitsPaginator
  3. item: DescribeAccountLimitsOutputTypeDef
# LoadBalancerAvailableWaiter usage example

from boto3.session import Session


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

waiter = client.get_waiter("load_balancer_available")  # (2)
waiter.wait()
  1. client: ElasticLoadBalancingv2Client
  2. waiter: LoadBalancerAvailableWaiter

Explicit type annotations#

With types-boto3-lite[elbv2] or a standalone types_boto3_elbv2 package, you have to explicitly specify client: ElasticLoadBalancingv2Client 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.

# ElasticLoadBalancingv2Client usage example with type annotations

from boto3.session import Session

from types_boto3_elbv2.client import ElasticLoadBalancingv2Client
from types_boto3_elbv2.type_defs import AddListenerCertificatesOutputTypeDef
from types_boto3_elbv2.type_defs import AddListenerCertificatesInputRequestTypeDef


session = Session()

client: ElasticLoadBalancingv2Client = session.client("elbv2")

kwargs: AddListenerCertificatesInputRequestTypeDef = {...}
result: AddListenerCertificatesOutputTypeDef = client.add_listener_certificates(**kwargs)
# DescribeAccountLimitsPaginator usage example with type annotations

from boto3.session import Session

from types_boto3_elbv2.client import ElasticLoadBalancingv2Client
from types_boto3_elbv2.paginator import DescribeAccountLimitsPaginator
from types_boto3_elbv2.type_defs import DescribeAccountLimitsOutputTypeDef


session = Session()
client: ElasticLoadBalancingv2Client = session.client("elbv2")

paginator: DescribeAccountLimitsPaginator = client.get_paginator("describe_account_limits")
for item in paginator.paginate(...):
    item: DescribeAccountLimitsOutputTypeDef
    print(item)
# LoadBalancerAvailableWaiter usage example with type annotations

from boto3.session import Session

from types_boto3_elbv2.client import ElasticLoadBalancingv2Client
from types_boto3_elbv2.waiter import LoadBalancerAvailableWaiter

session = Session()
client: ElasticLoadBalancingv2Client = session.client("elbv2")

waiter: LoadBalancerAvailableWaiter = client.get_waiter("load_balancer_available")
waiter.wait()