Examples#
Index > CloudWatchNetworkMonitor > Examples
Auto-generated documentation for CloudWatchNetworkMonitor type annotations stubs module mypy-boto3-networkmonitor.
Client#
Implicit type annotations#
Can be used with boto3-stubs[networkmonitor]
package installed.
Write your CloudWatchNetworkMonitor
code as usual,
type checking and code completion should work out of the box.
Client method usage example#
# CloudWatchNetworkMonitorClient usage example
from boto3.session import Session
session = Session()
client = session.client("networkmonitor") # (1)
result = client.create_monitor() # (2)
- client: CloudWatchNetworkMonitorClient
- result: CreateMonitorOutputTypeDef
Paginator usage example#
# ListMonitorsPaginator usage example
from boto3.session import Session
session = Session()
client = session.client("networkmonitor") # (1)
paginator = client.get_paginator("list_monitors") # (2)
for item in paginator.paginate(...):
print(item) # (3)
- client: CloudWatchNetworkMonitorClient
- paginator: ListMonitorsPaginator
- item: ListMonitorsOutputTypeDef
Explicit type annotations#
With boto3-stubs-lite[networkmonitor]
or a standalone mypy_boto3_networkmonitor
package, you have to explicitly specify client: CloudWatchNetworkMonitorClient
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#
# CloudWatchNetworkMonitorClient usage example with type annotations
from boto3.session import Session
from mypy_boto3_networkmonitor.client import CloudWatchNetworkMonitorClient
from mypy_boto3_networkmonitor.type_defs import CreateMonitorOutputTypeDef
from mypy_boto3_networkmonitor.type_defs import CreateMonitorInputTypeDef
session = Session()
client: CloudWatchNetworkMonitorClient = session.client("networkmonitor")
kwargs: CreateMonitorInputTypeDef = {...}
result: CreateMonitorOutputTypeDef = client.create_monitor(**kwargs)
Paginator usage example#
# ListMonitorsPaginator usage example with type annotations
from boto3.session import Session
from mypy_boto3_networkmonitor.client import CloudWatchNetworkMonitorClient
from mypy_boto3_networkmonitor.paginator import ListMonitorsPaginator
from mypy_boto3_networkmonitor.type_defs import ListMonitorsOutputTypeDef
session = Session()
client: CloudWatchNetworkMonitorClient = session.client("networkmonitor")
paginator: ListMonitorsPaginator = client.get_paginator("list_monitors")
for item in paginator.paginate(...):
item: ListMonitorsOutputTypeDef
print(item)