Skip to content

Examples#

Index > AccessAnalyzer > Examples

Auto-generated documentation for AccessAnalyzer type annotations stubs module mypy-boto3-accessanalyzer.

Client#

Implicit type annotations#

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

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

# AccessAnalyzerClient usage example

from boto3.session import Session


session = Session()

client = session.client("accessanalyzer")  # (1)
result = client.apply_archive_rule()  # (2)
  1. client: AccessAnalyzerClient
  2. result: EmptyResponseMetadataTypeDef
# GetFindingV2Paginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("get_finding_v2")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: AccessAnalyzerClient
  2. paginator: GetFindingV2Paginator
  3. item: GetFindingV2ResponseTypeDef

Explicit type annotations#

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

# AccessAnalyzerClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_accessanalyzer.client import AccessAnalyzerClient
from mypy_boto3_accessanalyzer.type_defs import EmptyResponseMetadataTypeDef
from mypy_boto3_accessanalyzer.type_defs import ApplyArchiveRuleRequestRequestTypeDef


session = Session()

client: AccessAnalyzerClient = session.client("accessanalyzer")

kwargs: ApplyArchiveRuleRequestRequestTypeDef = {...}
result: EmptyResponseMetadataTypeDef = client.apply_archive_rule(**kwargs)
# GetFindingV2Paginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_accessanalyzer.client import AccessAnalyzerClient
from mypy_boto3_accessanalyzer.paginator import GetFindingV2Paginator
from mypy_boto3_accessanalyzer.type_defs import GetFindingV2ResponseTypeDef


session = Session()
client: AccessAnalyzerClient = session.client("accessanalyzer")

paginator: GetFindingV2Paginator = client.get_paginator("get_finding_v2")
for item in paginator.paginate(...):
    item: GetFindingV2ResponseTypeDef
    print(item)