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.
Client method usage example#
# ManagedGrafanaClient usage example
from boto3.session import Session
session = Session()
client = session.client("grafana") # (1)
result = client.associate_license() # (2)
- client: ManagedGrafanaClient
- result: AssociateLicenseResponseTypeDef
Paginator usage example#
# 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)
- client: ManagedGrafanaClient
- paginator: ListPermissionsPaginator
- 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.
Client method usage example#
# 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 AssociateLicenseRequestTypeDef
session = Session()
client: ManagedGrafanaClient = session.client("grafana")
kwargs: AssociateLicenseRequestTypeDef = {...}
result: AssociateLicenseResponseTypeDef = client.associate_license(**kwargs)
Paginator usage example#
# 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)