Table of Contents
annotations
Annotations Objects
class Annotations()
The class includes all necessary methods to access the Grafana annotations API endpoints. Annotations can be organization annotations that can be shown on any dashboard by configuring an annotation data source filtered by tags. They can also be tied to a panel on a dashboard and are then only shown on that panel
HINT: Note Grafana Enterprise API need required permissions if fine-grained access control is enabled
Arguments:
grafana_api_model
APIModel - Inject a Grafana API model object that includes all necessary values and information
Attributes:
grafana_api_model
APIModel - This is where we store the grafana_api_model
find_annotations
def find_annotations(annotation: FindAnnotationObject = None) -> list
The method includes a functionality to find the corresponding annotations
Arguments:
annotation
FindAnnotationObject - Specify the find annotation object
Raises:
Exception
- Unspecified error by executing the API call
Returns:
api_call
list - Returns the result of the find annotations call
create_annotation
def create_annotation(annotation: AnnotationObject) -> int
The method includes a functionality to create the corresponding annotation
Args: annotation (AnnotationObject): Specify the annotation object
Required Permissions: Action: annotations:create Scope: annotations:type:
Raises: ValueError: Missed specifying a necessary value Exception: Unspecified error by executing the API call
Returns: api_call (int): Returns the annotation id
create_graphite_annotation
def create_graphite_annotation(annotation: AnnotationGraphiteObject) -> int
The method includes a functionality to create the corresponding graphite annotation
Args: annotation (AnnotationGraphiteObject): Specify the annotation object
Required Permissions: Action: annotations:create Scope: annotations:type:organization
Raises: ValueError: Missed specifying a necessary value Exception: Unspecified error by executing the API call
Returns: api_call (int): Returns the annotation id
update_annotation
def update_annotation(id: int, annotation: AnnotationObject)
The method includes a functionality to update the corresponding annotation specified by the annotation id
Args: id (int): Specify the annotation object id annotation (AnnotationObject): Specify the annotation object
Required Permissions: Action: annotations:write Scope: annotations:type:
Raises: ValueError: Missed specifying a necessary value Exception: Unspecified error by executing the API call
Returns: None
delete_annotation
def delete_annotation(id: int)
The method includes a functionality to delete the corresponding annotation specified by the annotation id
Args: id (int): Specify the annotation object id
Required Permissions: Action: annotations:write Scope: annotations:type:
Raises: ValueError: Missed specifying a necessary value Exception: Unspecified error by executing the API call
Returns: None
find_annotation_tags
def find_annotation_tags(tag: str = None, limit: int = 100)
The method includes a functionality to find the annotation tags
Arguments:
tag
str - Specify the optional annotation taglimit
int - Specify the optional annotation limit (default 100)
Required Permissions:
- Action
- annotations:read
- Scope
- N/A
Raises:
Exception
- Unspecified error by executing the API call
Returns:
api_call
dict - Returns the result of the find annotation tags call