Examples#
Index > PrometheusService > Examples
Auto-generated documentation for PrometheusService type annotations stubs module types-boto3-amp.
Client#
Implicit type annotations#
Can be used with types-boto3[amp] package installed.
Write your PrometheusService code as usual,
type checking and code completion should work out of the box.
Client method usage example#
# PrometheusServiceClient usage example
from boto3.session import Session
session = Session()
client = session.client("amp")  # (1)
result = client.create_alert_manager_definition()  # (2)- client: PrometheusServiceClient
- result: CreateAlertManagerDefinitionResponseTypeDef
Paginator usage example#
# ListAnomalyDetectorsPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("amp")  # (1)
paginator = client.get_paginator("list_anomaly_detectors")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)- client: PrometheusServiceClient
- paginator: ListAnomalyDetectorsPaginator
- item: ListAnomalyDetectorsResponseTypeDef
Waiter usage example#
# AnomalyDetectorActiveWaiter usage example
from boto3.session import Session
session = Session()
client = session.client("amp")  # (1)
waiter = client.get_waiter("anomaly_detector_active")  # (2)
waiter.wait(...)- client: PrometheusServiceClient
- waiter: AnomalyDetectorActiveWaiter
Explicit type annotations#
With types-boto3-lite[amp]
or a standalone types_boto3_amp package, you have to explicitly specify client: PrometheusServiceClient 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#
# PrometheusServiceClient usage example with type annotations
from boto3.session import Session
from types_boto3_amp.client import PrometheusServiceClient
from types_boto3_amp.type_defs import CreateAlertManagerDefinitionResponseTypeDef
from types_boto3_amp.type_defs import CreateAlertManagerDefinitionRequestTypeDef
session = Session()
client: PrometheusServiceClient = session.client("amp")
kwargs: CreateAlertManagerDefinitionRequestTypeDef = {...}
result: CreateAlertManagerDefinitionResponseTypeDef = client.create_alert_manager_definition(**kwargs)Paginator usage example#
# ListAnomalyDetectorsPaginator usage example with type annotations
from boto3.session import Session
from types_boto3_amp.client import PrometheusServiceClient
from types_boto3_amp.paginator import ListAnomalyDetectorsPaginator
from types_boto3_amp.type_defs import ListAnomalyDetectorsResponseTypeDef
session = Session()
client: PrometheusServiceClient = session.client("amp")
paginator: ListAnomalyDetectorsPaginator = client.get_paginator("list_anomaly_detectors")
for item in paginator.paginate(...):
    item: ListAnomalyDetectorsResponseTypeDef
    print(item)Waiter usage example#
# AnomalyDetectorActiveWaiter usage example with type annotations
from boto3.session import Session
from types_boto3_amp.client import PrometheusServiceClient
from types_boto3_amp.waiter import AnomalyDetectorActiveWaiter
session = Session()
client: PrometheusServiceClient = session.client("amp")
waiter: AnomalyDetectorActiveWaiter = client.get_waiter("anomaly_detector_active")
waiter.wait(...)