Table of Contents
authentication
Authentication Objects
class Authentication()
The class includes all necessary methods to access the Grafana authentication 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_api_tokens
def get_api_tokens(org_id_header: int = None) -> list
The method includes a functionality to get the corresponding api tokens of the organisation
Arguments:
org_id_header
int - Specify the org id as header to execute call for that specific organisation
Raises:
Exception
- Unspecified error by executing the API call
Returns:
api_call
list - Returns the result of the API token call
create_api_token
def create_api_token(name: str,
role: str,
seconds_to_live: int = 0,
org_id_header: int = None) -> dict
The method includes a functionality to create a corresponding api tokens of the organisation specified by the name and role
Arguments:
name
str - Specify the token namerole
str - Specify the access level/Grafana Role for the token. Can be one of the following values: Viewer, Editor or Adminseconds_to_live
int - Specify the seconds of the token expiration in seconds. If it is a positive number an expiration date for the key is set. If it is null, zero or is omitted completely (unless api_key_max_seconds_to_live configuration option is set) the key will never expire (default 0)org_id_header
int - Specify the org id as header to execute call for that specific organisation
Raises:
ValueError
- Missed specifying a necessary valueException
- Unspecified error by executing the API call
Returns:
api_call
dict - Returns the API token object
delete_api_token
def delete_api_token(token_id: int, org_id_header: int = None)
The method includes a functionality to delete a corresponding api token specified by the token id
Arguments:
token_id
int - Specify the token idorg_id_header
int - Specify the org id as header to execute call for that specific organisation
Raises:
ValueError
- Missed specifying a necessary valueException
- Unspecified error by executing the API call
Returns:
None