Skip to content

Examples

Index > CloudWatchRUM > Examples

Auto-generated documentation for CloudWatchRUM type annotations stubs module types-aiobotocore-rum.

Client

Implicit type annotations

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

Write your CloudWatchRUM 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("rum") as client:  # (1)
    result = await client.create_app_monitor()  # (2)
  1. client: CloudWatchRUMClient
  2. result: CreateAppMonitorResponseTypeDef
Paginator usage example
from aioboto3.session import Session


session = Session()

async with session.client("rum") as client:  # (1)
    paginator = client.get_paginator("get_app_monitor_data")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: CloudWatchRUMClient
  2. paginator: GetAppMonitorDataPaginator
  3. item: GetAppMonitorDataResponseTypeDef

Explicit type annotations

With types-aioboto3-lite[rum] or a standalone types_aiobotocore_rum package, you have to explicitly specify client: CloudWatchRUMClient 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_rum.client import CloudWatchRUMClient
from types_aiobotocore_rum.type_defs import CreateAppMonitorResponseTypeDef
from types_aiobotocore_rum.type_defs import CreateAppMonitorRequestRequestTypeDef


session = Session()

client: CloudWatchRUMClient
async with session.client("rum") as client:  # (1)
    kwargs: CreateAppMonitorRequestRequestTypeDef = {...}  # (2)
    result: CreateAppMonitorResponseTypeDef = await client.create_app_monitor(**kwargs)  # (3)
  1. client: CloudWatchRUMClient
  2. kwargs: CreateAppMonitorRequestRequestTypeDef
  3. result: CreateAppMonitorResponseTypeDef
Paginator usage example
from aioboto3.session import Session

from types_aiobotocore_rum.client import CloudWatchRUMClient
from types_aiobotocore_rum.paginator import GetAppMonitorDataPaginator
from types_aiobotocore_rum.type_defs import GetAppMonitorDataResponseTypeDef


session = Session()

client: CloudWatchRUMClient
async with session.client("rum") as client:  # (1)
    paginator: GetAppMonitorDataPaginator = client.get_paginator("get_app_monitor_data")  # (2)
    async for item in paginator.paginate(...):
        item: GetAppMonitorDataResponseTypeDef
        print(item)  # (3)
  1. client: CloudWatchRUMClient
  2. paginator: GetAppMonitorDataPaginator
  3. item: GetAppMonitorDataResponseTypeDef