Skip to content

Examples#

Index > Macie2 > Examples

Auto-generated documentation for Macie2 type annotations stubs module types-boto3-macie2.

Client#

Implicit type annotations#

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

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

# Macie2Client usage example

from boto3.session import Session


session = Session()

client = session.client("macie2")  # (1)
result = client.batch_get_custom_data_identifiers()  # (2)
  1. client: Macie2Client
  2. result: BatchGetCustomDataIdentifiersResponseTypeDef
# DescribeBucketsPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("describe_buckets")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: Macie2Client
  2. paginator: DescribeBucketsPaginator
  3. item: DescribeBucketsResponseTypeDef
# FindingRevealedWaiter usage example

from boto3.session import Session


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

waiter = client.get_waiter("finding_revealed")  # (2)
waiter.wait()
  1. client: Macie2Client
  2. waiter: FindingRevealedWaiter

Explicit type annotations#

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

# Macie2Client usage example with type annotations

from boto3.session import Session

from types_boto3_macie2.client import Macie2Client
from types_boto3_macie2.type_defs import BatchGetCustomDataIdentifiersResponseTypeDef
from types_boto3_macie2.type_defs import BatchGetCustomDataIdentifiersRequestRequestTypeDef


session = Session()

client: Macie2Client = session.client("macie2")

kwargs: BatchGetCustomDataIdentifiersRequestRequestTypeDef = {...}
result: BatchGetCustomDataIdentifiersResponseTypeDef = client.batch_get_custom_data_identifiers(**kwargs)
# DescribeBucketsPaginator usage example with type annotations

from boto3.session import Session

from types_boto3_macie2.client import Macie2Client
from types_boto3_macie2.paginator import DescribeBucketsPaginator
from types_boto3_macie2.type_defs import DescribeBucketsResponseTypeDef


session = Session()
client: Macie2Client = session.client("macie2")

paginator: DescribeBucketsPaginator = client.get_paginator("describe_buckets")
for item in paginator.paginate(...):
    item: DescribeBucketsResponseTypeDef
    print(item)
# FindingRevealedWaiter usage example with type annotations

from boto3.session import Session

from types_boto3_macie2.client import Macie2Client
from types_boto3_macie2.waiter import FindingRevealedWaiter

session = Session()
client: Macie2Client = session.client("macie2")

waiter: FindingRevealedWaiter = client.get_waiter("finding_revealed")
waiter.wait()