Skip to content

Examples#

Index > ManagedGrafana > Examples

Auto-generated documentation for ManagedGrafana type annotations stubs module mypy-boto3-grafana.

Client#

Implicit type annotations#

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

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

# ManagedGrafanaClient usage example

from boto3.session import Session


session = Session()

client = session.client("grafana")  # (1)
result = client.associate_license()  # (2)
  1. client: ManagedGrafanaClient
  2. result: AssociateLicenseResponseTypeDef
# ListPermissionsPaginator usage example

from boto3.session import Session


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

paginator = client.get_paginator("list_permissions")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: ManagedGrafanaClient
  2. paginator: ListPermissionsPaginator
  3. item: ListPermissionsResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[grafana] or a standalone mypy_boto3_grafana package, you have to explicitly specify client: ManagedGrafanaClient 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.

# ManagedGrafanaClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_grafana.client import ManagedGrafanaClient
from mypy_boto3_grafana.type_defs import AssociateLicenseResponseTypeDef
from mypy_boto3_grafana.type_defs import AssociateLicenseRequestRequestTypeDef


session = Session()

client: ManagedGrafanaClient = session.client("grafana")

kwargs: AssociateLicenseRequestRequestTypeDef = {...}
result: AssociateLicenseResponseTypeDef = client.associate_license(**kwargs)
# ListPermissionsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_grafana.client import ManagedGrafanaClient
from mypy_boto3_grafana.paginator import ListPermissionsPaginator
from mypy_boto3_grafana.type_defs import ListPermissionsResponseTypeDef


session = Session()
client: ManagedGrafanaClient = session.client("grafana")

paginator: ListPermissionsPaginator = client.get_paginator("list_permissions")
for item in paginator.paginate(...):
    item: ListPermissionsResponseTypeDef
    print(item)