Skip to content

Examples#

Index > AIOps > Examples

Auto-generated documentation for AIOps type annotations stubs module types-boto3-aiops.

Client#

Implicit type annotations#

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

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

Client method usage example#

# AIOpsClient usage example

from boto3.session import Session


session = Session()

client = session.client("aiops")  # (1)
result = client.create_investigation_group()  # (2)
  1. client: AIOpsClient
  2. result: CreateInvestigationGroupOutputTypeDef

Paginator usage example#

# ListInvestigationGroupsPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_investigation_groups")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: AIOpsClient
  2. paginator: ListInvestigationGroupsPaginator
  3. item: ListInvestigationGroupsOutputTypeDef

Explicit type annotations#

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

Client method usage example#

# AIOpsClient usage example with type annotations

from boto3.session import Session

from types_boto3_aiops.client import AIOpsClient
from types_boto3_aiops.type_defs import CreateInvestigationGroupOutputTypeDef
from types_boto3_aiops.type_defs import CreateInvestigationGroupInputTypeDef


session = Session()

client: AIOpsClient = session.client("aiops")

kwargs: CreateInvestigationGroupInputTypeDef = {...}
result: CreateInvestigationGroupOutputTypeDef = client.create_investigation_group(**kwargs)

Paginator usage example#

# ListInvestigationGroupsPaginator usage example with type annotations

from boto3.session import Session

from types_boto3_aiops.client import AIOpsClient
from types_boto3_aiops.paginator import ListInvestigationGroupsPaginator
from types_boto3_aiops.type_defs import ListInvestigationGroupsOutputTypeDef


session = Session()
client: AIOpsClient = session.client("aiops")

paginator: ListInvestigationGroupsPaginator = client.get_paginator("list_investigation_groups")
for item in paginator.paginate(...):
    item: ListInvestigationGroupsOutputTypeDef
    print(item)