ManagedGrafana / Client / create_workspace_service_account_token
create_workspace_service_account_token#
- ManagedGrafana.Client.create_workspace_service_account_token(**kwargs)#
Creates a token that can be used to authenticate and authorize Grafana HTTP API operations for the given workspace service account. The service account acts as a user for the API operations, and defines the permissions that are used by the API.
Warning
When you create the service account token, you will receive a key that is used when calling Grafana APIs. Do not lose this key, as it will not be retrievable again.
If you do lose the key, you can delete the token and recreate it to receive a new key. This will disable the initial key.
Service accounts are only available for workspaces that are compatible with Grafana version 9 and above.
See also: AWS API Documentation
Request Syntax
response = client.create_workspace_service_account_token( name='string', secondsToLive=123, serviceAccountId='string', workspaceId='string' )
- Parameters:
name (string) –
[REQUIRED]
A name for the token to create.
secondsToLive (integer) –
[REQUIRED]
Sets how long the token will be valid, in seconds. You can set the time up to 30 days in the future.
serviceAccountId (string) –
[REQUIRED]
The ID of the service account for which to create a token.
workspaceId (string) –
[REQUIRED]
The ID of the workspace the service account resides within.
- Return type:
dict
- Returns:
Response Syntax
{ 'serviceAccountId': 'string', 'serviceAccountToken': { 'id': 'string', 'key': 'string', 'name': 'string' }, 'workspaceId': 'string' }
Response Structure
(dict) –
serviceAccountId (string) –
The ID of the service account where the token was created.
serviceAccountToken (dict) –
Information about the created token, including the key. Be sure to store the key securely.
id (string) –
The unique ID of the service account token.
key (string) –
The key for the service account token. Used when making calls to the Grafana HTTP APIs to authenticate and authorize the requests.
name (string) –
The name of the service account token.
workspaceId (string) –
The ID of the workspace where the token was created.
Exceptions
ManagedGrafana.Client.exceptions.ResourceNotFoundException
ManagedGrafana.Client.exceptions.ThrottlingException
ManagedGrafana.Client.exceptions.ConflictException
ManagedGrafana.Client.exceptions.ValidationException
ManagedGrafana.Client.exceptions.AccessDeniedException
ManagedGrafana.Client.exceptions.InternalServerException
ManagedGrafana.Client.exceptions.ServiceQuotaExceededException