Skip to content

Examples

Index > CloudWatchRUM > Examples

Auto-generated documentation for CloudWatchRUM type annotations stubs module mypy-boto3-rum.

Client

Implicit type annotations

Can be used with boto3-stubs[rum] package installed.

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

Client usage example
from boto3.session import Session


session = Session()

client = session.client("rum")  # (1)
result = client.create_app_monitor()  # (2)
  1. client: CloudWatchRUMClient
  2. result: CreateAppMonitorResponseTypeDef
Paginator usage example
from boto3.session import Session


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

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

Explicit type annotations

With boto3-stubs-lite[rum] or a standalone mypy_boto3_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 boto3.session import Session

from mypy_boto3_rum.client import CloudWatchRUMClient
from mypy_boto3_rum.type_defs import CreateAppMonitorResponseTypeDef
from mypy_boto3_rum.type_defs import CreateAppMonitorRequestRequestTypeDef


session = Session()

client: CloudWatchRUMClient = session.client("rum")

kwargs: CreateAppMonitorRequestRequestTypeDef = {...}
result: CreateAppMonitorResponseTypeDef = client.create_app_monitor(**kwargs)
Paginator usage example
from boto3.session import Session

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


session = Session()
client: CloudWatchRUMClient = session.client("rum")

paginator: GetAppMonitorDataPaginator = client.get_paginator("get_app_monitor_data")
for item in paginator.paginate(...):
    item: GetAppMonitorDataResponseTypeDef
    print(item)