Table of Contents
folder
Folder Objects
class Folder()
The class includes all necessary methods to access the Grafana folder API endpoints
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
get_folders
def get_folders() -> list
The method includes a functionality to extract all folders inside the organization
Raises:
Exception
- Unspecified error by executing the API call
Returns:
api_call
list - Returns all folders
get_folder_by_uid
def get_folder_by_uid(uid: str) -> dict
The method includes a functionality to extract all folder information specified by the uid of the folder
Arguments:
uid
str - Specify the uid of the folder
Raises:
ValueError
- Missed specifying a necessary valueException
- Unspecified error by executing the API call
Returns:
api_call
dict - Returns a folder
get_folder_by_id
def get_folder_by_id(id: int) -> dict
The method includes a functionality to extract all folder information specified by the id of the folder
Arguments:
id
int - Specify the id of the folder
Raises:
ValueError
- Missed specifying a necessary valueException
- Unspecified error by executing the API call
Returns:
api_call
dict - Returns a folder
create_folder
def create_folder(title: str, uid: str = None) -> dict
The method includes a functionality to create a new folder inside the organization specified by the defined title and the optional uid
Arguments:
title
str - Specify the title of the folderuid
str - Specify the uid of the folder (default None)
Raises:
ValueError
- Missed specifying a necessary valueException
- Unspecified error by executing the API call
Returns:
api_call
dict - Returns a newly created folder
update_folder
def update_folder(title: str,
uid: str,
version: int = 0,
overwrite: bool = False) -> dict
The method includes a functionality to update a folder information inside the organization specified by the uid, the title, the version of the folder or if folder information be overwritten
Arguments:
title
str - Specify the title of the folderuid
str - Specify the uid of the folderversion
int - Specify the version of the folder (default 0)overwrite
bool - Should the already existing folder information be overwritten (default False)
Raises:
ValueError
- Missed specifying a necessary valueException
- Unspecified error by executing the API call
Returns:
api_call
dict - Returns an updated folder
delete_folder
def delete_folder(uid: str)
The method includes a functionality to delete a folder inside the organization specified by the defined uid
Arguments:
uid
str - Specify the uid of the folder
Raises:
ValueError
- Missed specifying a necessary valueException
- Unspecified error by executing the API call
Returns:
None
get_folder_permissions
def get_folder_permissions(uid: str) -> list
The method includes a functionality to extract the folder permissions inside the organization specified by the defined uid
Arguments:
uid
str - Specify the uid of the folder
Raises:
ValueError
- Missed specifying a necessary valueException
- Unspecified error by executing the API call
Returns:
api_call
list - Returns a list of folder permissions
update_folder_permissions
def update_folder_permissions(uid: str, permission_json: dict)
The method includes a functionality to update the folder permissions based on the specified uid and the permission json document
Arguments:
uid
str - Specify the uid of the folderpermission_json
dict - Specify the inserted permissions as dict
Raises:
ValueError
- Missed specifying a necessary valueException
- Unspecified error by executing the API call
Returns:
None
get_folder_id_by_dashboard_path
def get_folder_id_by_dashboard_path(dashboard_path: str) -> int
The method includes a functionality to extract the folder id specified inside model dashboard path
Arguments:
dashboard_path
str - Specify the dashboard path
Raises:
ValueError
- Missed specifying a necessary valueException
- Unspecified error by executing the API call
Returns:
folder_id
int - Returns the folder id
get_all_folder_ids_and_names
def get_all_folder_ids_and_names() -> list
The method extract all folder id and names inside the complete organisation
Returns:
folders
list - Returns a list of dicts with folder ids and the corresponding names