Skip to content

Examples

Index > PrometheusService > Examples

Auto-generated documentation for PrometheusService type annotations stubs module types-aiobotocore-amp.

Client

Implicit type annotations

Can be used with types-aioboto3[amp] package installed.

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

Client usage example
from aioboto3.session import Session


session = Session()

async with session.client("amp") as client:  # (1)
    result = await client.create_alert_manager_definition()  # (2)
  1. client: PrometheusServiceClient
  2. result: CreateAlertManagerDefinitionResponseTypeDef
Paginator usage example
from aioboto3.session import Session


session = Session()

async with session.client("amp") as client:  # (1)
    paginator = client.get_paginator("list_rule_groups_namespaces")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: PrometheusServiceClient
  2. paginator: ListRuleGroupsNamespacesPaginator
  3. item: ListRuleGroupsNamespacesResponseTypeDef
Waiter usage example
from aioboto3.session import Session


session = Session()

async with session.client("amp") as client:  # (1)
    waiter = client.get_waiter("workspace_active")  # (2)
    await waiter.wait()
  1. client: PrometheusServiceClient
  2. waiter: WorkspaceActiveWaiter

Explicit type annotations

With types-aioboto3-lite[amp] or a standalone types_aiobotocore_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 usage example
from aioboto3.session import Session

from types_aiobotocore_amp.client import PrometheusServiceClient
from types_aiobotocore_amp.type_defs import CreateAlertManagerDefinitionResponseTypeDef
from types_aiobotocore_amp.type_defs import CreateAlertManagerDefinitionRequestRequestTypeDef


session = Session()

client: PrometheusServiceClient
async with session.client("amp") as client:  # (1)
    kwargs: CreateAlertManagerDefinitionRequestRequestTypeDef = {...}  # (2)
    result: CreateAlertManagerDefinitionResponseTypeDef = await client.create_alert_manager_definition(**kwargs)  # (3)
  1. client: PrometheusServiceClient
  2. kwargs: CreateAlertManagerDefinitionRequestRequestTypeDef
  3. result: CreateAlertManagerDefinitionResponseTypeDef
Paginator usage example
from aioboto3.session import Session

from types_aiobotocore_amp.client import PrometheusServiceClient
from types_aiobotocore_amp.paginator import ListRuleGroupsNamespacesPaginator
from types_aiobotocore_amp.type_defs import ListRuleGroupsNamespacesResponseTypeDef


session = Session()

client: PrometheusServiceClient
async with session.client("amp") as client:  # (1)
    paginator: ListRuleGroupsNamespacesPaginator = client.get_paginator("list_rule_groups_namespaces")  # (2)
    async for item in paginator.paginate(...):
        item: ListRuleGroupsNamespacesResponseTypeDef
        print(item)  # (3)
  1. client: PrometheusServiceClient
  2. paginator: ListRuleGroupsNamespacesPaginator
  3. item: ListRuleGroupsNamespacesResponseTypeDef
Waiter usage example
from aioboto3.session import Session

from types_aiobotocore_amp.client import PrometheusServiceClient
from types_aiobotocore_amp.waiter import WorkspaceActiveWaiter


session = Session()

async with session.client("amp") as client:  # (1)
    waiter = client.get_waiter("workspace_active")  # (2)
    await waiter.wait()
  1. client: PrometheusServiceClient
  2. waiter: WorkspaceActiveWaiter