ManagedGrafana / Client / create_workspace_api_key

create_workspace_api_key#

ManagedGrafana.Client.create_workspace_api_key(**kwargs)#

Creates a Grafana API key for the workspace. This key can be used to authenticate requests sent to the workspace’s HTTP API. See https://docs.aws.amazon.com/grafana/latest/userguide/Using-Grafana-APIs.html for available APIs and example requests.

Note

In workspaces compatible with Grafana version 9 or above, use workspace service accounts instead of API keys. API keys will be removed in a future release.

See also: AWS API Documentation

Request Syntax

response = client.create_workspace_api_key(
    keyName='string',
    keyRole='string',
    secondsToLive=123,
    workspaceId='string'
)
Parameters:
  • keyName (string) –

    [REQUIRED]

    Specifies the name of the key. Keynames must be unique to the workspace.

  • keyRole (string) –

    [REQUIRED]

    Specifies the permission level of the key.

    Valid values: ADMIN``| ``EDITOR``| ``VIEWER

  • secondsToLive (integer) –

    [REQUIRED]

    Specifies the time in seconds until the key expires. Keys can be valid for up to 30 days.

  • workspaceId (string) –

    [REQUIRED]

    The ID of the workspace to create an API key.

Return type:

dict

Returns:

Response Syntax

{
    'key': 'string',
    'keyName': 'string',
    'workspaceId': 'string'
}

Response Structure

  • (dict) –

    • key (string) –

      The key token. Use this value as a bearer token to authenticate HTTP requests to the workspace.

    • keyName (string) –

      The name of the key that was created.

    • workspaceId (string) –

      The ID of the workspace that the key is valid for.

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