Examples#
Index > ElasticLoadBalancing > Examples
Auto-generated documentation for ElasticLoadBalancing type annotations stubs module types-boto3-elb.
Client#
Implicit type annotations#
Can be used with types-boto3[elb]
package installed.
Write your ElasticLoadBalancing
code as usual,
type checking and code completion should work out of the box.
# ElasticLoadBalancingClient usage example
from boto3.session import Session
session = Session()
client = session.client("elb") # (1)
result = client.apply_security_groups_to_load_balancer() # (2)
# DescribeAccountLimitsPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("elb") # (1)
paginator = client.get_paginator("describe_account_limits") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: ElasticLoadBalancingClient
- paginator: DescribeAccountLimitsPaginator
- item: DescribeAccountLimitsOutputTypeDef
# AnyInstanceInServiceWaiter usage example
from boto3.session import Session
session = Session()
client = session.client("elb") # (1)
waiter = client.get_waiter("any_instance_in_service") # (2)
waiter.wait()
- client: ElasticLoadBalancingClient
- waiter: AnyInstanceInServiceWaiter
Explicit type annotations#
With types-boto3-lite[elb]
or a standalone types_boto3_elb
package, you have to explicitly specify client: ElasticLoadBalancingClient
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.
# ElasticLoadBalancingClient usage example with type annotations
from boto3.session import Session
from types_boto3_elb.client import ElasticLoadBalancingClient
from types_boto3_elb.type_defs import ApplySecurityGroupsToLoadBalancerOutputTypeDef
from types_boto3_elb.type_defs import ApplySecurityGroupsToLoadBalancerInputRequestTypeDef
session = Session()
client: ElasticLoadBalancingClient = session.client("elb")
kwargs: ApplySecurityGroupsToLoadBalancerInputRequestTypeDef = {...}
result: ApplySecurityGroupsToLoadBalancerOutputTypeDef = client.apply_security_groups_to_load_balancer(**kwargs)
# DescribeAccountLimitsPaginator usage example with type annotations
from boto3.session import Session
from types_boto3_elb.client import ElasticLoadBalancingClient
from types_boto3_elb.paginator import DescribeAccountLimitsPaginator
from types_boto3_elb.type_defs import DescribeAccountLimitsOutputTypeDef
session = Session()
client: ElasticLoadBalancingClient = session.client("elb")
paginator: DescribeAccountLimitsPaginator = client.get_paginator("describe_account_limits")
for item in paginator.paginate(...):
item: DescribeAccountLimitsOutputTypeDef
print(item)
# AnyInstanceInServiceWaiter usage example with type annotations
from boto3.session import Session
from types_boto3_elb.client import ElasticLoadBalancingClient
from types_boto3_elb.waiter import AnyInstanceInServiceWaiter
session = Session()
client: ElasticLoadBalancingClient = session.client("elb")
waiter: AnyInstanceInServiceWaiter = client.get_waiter("any_instance_in_service")
waiter.wait()