Skip to content

Examples#

Index > Route53Resolver > Examples

Auto-generated documentation for Route53Resolver type annotations stubs module mypy-boto3-route53resolver.

Client#

Implicit type annotations#

Can be used with boto3-stubs[route53resolver] package installed.

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

# Route53ResolverClient usage example

from boto3.session import Session


session = Session()

client = session.client("route53resolver")  # (1)
result = client.associate_firewall_rule_group()  # (2)
  1. client: Route53ResolverClient
  2. result: AssociateFirewallRuleGroupResponseTypeDef
# ListFirewallConfigsPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_firewall_configs")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: Route53ResolverClient
  2. paginator: ListFirewallConfigsPaginator
  3. item: ListFirewallConfigsResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[route53resolver] or a standalone mypy_boto3_route53resolver package, you have to explicitly specify client: Route53ResolverClient 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.

# Route53ResolverClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_route53resolver.client import Route53ResolverClient
from mypy_boto3_route53resolver.type_defs import AssociateFirewallRuleGroupResponseTypeDef
from mypy_boto3_route53resolver.type_defs import AssociateFirewallRuleGroupRequestRequestTypeDef


session = Session()

client: Route53ResolverClient = session.client("route53resolver")

kwargs: AssociateFirewallRuleGroupRequestRequestTypeDef = {...}
result: AssociateFirewallRuleGroupResponseTypeDef = client.associate_firewall_rule_group(**kwargs)
# ListFirewallConfigsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_route53resolver.client import Route53ResolverClient
from mypy_boto3_route53resolver.paginator import ListFirewallConfigsPaginator
from mypy_boto3_route53resolver.type_defs import ListFirewallConfigsResponseTypeDef


session = Session()
client: Route53ResolverClient = session.client("route53resolver")

paginator: ListFirewallConfigsPaginator = client.get_paginator("list_firewall_configs")
for item in paginator.paginate(...):
    item: ListFirewallConfigsResponseTypeDef
    print(item)