Skip to content

Examples#

Index > ManagedGrafana > Examples

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

Client#

Implicit type annotations#

Can be used with types-boto3[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 types-boto3-lite[grafana] or a standalone types_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 types_boto3_grafana.client import ManagedGrafanaClient
from types_boto3_grafana.type_defs import AssociateLicenseResponseTypeDef
from types_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 types_boto3_grafana.client import ManagedGrafanaClient
from types_boto3_grafana.paginator import ListPermissionsPaginator
from types_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)