Amazon Managed Grafana

2022/05/13 - Amazon Managed Grafana - 2 new 2 updated api methods

Changes  This release adds APIs for creating and deleting API keys in an Amazon Managed Grafana workspace.

DeleteWorkspaceApiKey (new) Link ¶

Deletes an API key for a workspace.

See also: AWS API Documentation

Request Syntax

client.delete_workspace_api_key(
    keyName='string',
    workspaceId='string'
)
type keyName

string

param keyName

[REQUIRED]

The name of the API key to delete.

type workspaceId

string

param workspaceId

[REQUIRED]

The ID of the workspace to delete.

rtype

dict

returns

Response Syntax

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

Response Structure

  • (dict) --

    • keyName (string) --

      The name of the API key that was deleted.

    • workspaceId (string) --

      The ID of the workspace where the key was deleted.

CreateWorkspaceApiKey (new) Link ¶

Creates an 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 < https://docs.aws.amazon.com/grafana/latest/userguide/Using-Grafana-APIs.html>`__ for available APIs and example requests.

See also: AWS API Documentation

Request Syntax

client.create_workspace_api_key(
    keyName='string',
    keyRole='string',
    secondsToLive=123,
    workspaceId='string'
)
type keyName

string

param keyName

[REQUIRED]

Specifies the name of the key to create. Key names must be unique to the workspace.

type keyRole

string

param keyRole

[REQUIRED]

Specifies the permission level of the key.

Valid Values: VIEWER | EDITOR | ADMIN

type secondsToLive

integer

param secondsToLive

[REQUIRED]

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

type workspaceId

string

param workspaceId

[REQUIRED]

The ID of the workspace in which to create an API key.

rtype

dict

returns

Response Syntax

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

Response Structure

  • (dict) --

    • key (string) --

      The key token that was created. 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.

ListPermissions (updated) Link ¶
Changes (response)
{'permissions': {'role': {'VIEWER'}}}

Lists the users and groups who have the Grafana Admin and Editor roles in this workspace. If you use this operation without specifying userId or groupId , the operation returns the roles of all users and groups. If you specify a userId or a groupId , only the roles for that user or group are returned. If you do this, you can specify only one userId or one groupId .

See also: AWS API Documentation

Request Syntax

client.list_permissions(
    groupId='string',
    maxResults=123,
    nextToken='string',
    userId='string',
    userType='SSO_USER'|'SSO_GROUP',
    workspaceId='string'
)
type groupId

string

param groupId

(Optional) Limits the results to only the group that matches this ID.

type maxResults

integer

param maxResults

The maximum number of results to include in the response.

type nextToken

string

param nextToken

The token to use when requesting the next set of results. You received this token from a previous ListPermissions operation.

type userId

string

param userId

(Optional) Limits the results to only the user that matches this ID.

type userType

string

param userType

(Optional) If you specify SSO_USER , then only the permissions of Amazon Web Services SSO users are returned. If you specify SSO_GROUP , only the permissions of Amazon Web Services SSO groups are returned.

type workspaceId

string

param workspaceId

[REQUIRED]

The ID of the workspace to list permissions for. This parameter is required.

rtype

dict

returns

Response Syntax

{
    'nextToken': 'string',
    'permissions': [
        {
            'role': 'ADMIN'|'EDITOR'|'VIEWER',
            'user': {
                'id': 'string',
                'type': 'SSO_USER'|'SSO_GROUP'
            }
        },
    ]
}

Response Structure

  • (dict) --

    • nextToken (string) --

      The token to use in a subsequent ListPermissions operation to return the next set of results.

    • permissions (list) --

      The permissions returned by the operation.

      • (dict) --

        A structure containing the identity of one user or group and the Admin or Editor role that they have.

        • role (string) --

          Specifies whether the user or group has the Admin or Editor role.

        • user (dict) --

          A structure with the ID of the user or group with this role.

          • id (string) --

            The ID of the user or group.

            Pattern: ^([0-9a-fA-F]{10}-|)[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}$

          • type (string) --

            Specifies whether this is a single user or a group.

UpdatePermissions (updated) Link ¶
Changes (request, response)
Request
{'updateInstructionBatch': {'role': {'VIEWER'}}}
Response
{'errors': {'causedBy': {'role': {'VIEWER'}}}}

Updates which users in a workspace have the Grafana Admin or Editor roles.

See also: AWS API Documentation

Request Syntax

client.update_permissions(
    updateInstructionBatch=[
        {
            'action': 'ADD'|'REVOKE',
            'role': 'ADMIN'|'EDITOR'|'VIEWER',
            'users': [
                {
                    'id': 'string',
                    'type': 'SSO_USER'|'SSO_GROUP'
                },
            ]
        },
    ],
    workspaceId='string'
)
type updateInstructionBatch

list

param updateInstructionBatch

[REQUIRED]

An array of structures that contain the permission updates to make.

  • (dict) --

    Contains the instructions for one Grafana role permission update in a UpdatePermissions operation.

    • action (string) -- [REQUIRED]

      Specifies whether this update is to add or revoke role permissions.

    • role (string) -- [REQUIRED]

      The role to add or revoke for the user or the group specified in users .

    • users (list) -- [REQUIRED]

      A structure that specifies the user or group to add or revoke the role for.

      • (dict) --

        A structure that specifies one user or group in the workspace.

        • id (string) -- [REQUIRED]

          The ID of the user or group.

          Pattern: ^([0-9a-fA-F]{10}-|)[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}$

        • type (string) -- [REQUIRED]

          Specifies whether this is a single user or a group.

type workspaceId

string

param workspaceId

[REQUIRED]

The ID of the workspace to update.

rtype

dict

returns

Response Syntax

{
    'errors': [
        {
            'causedBy': {
                'action': 'ADD'|'REVOKE',
                'role': 'ADMIN'|'EDITOR'|'VIEWER',
                'users': [
                    {
                        'id': 'string',
                        'type': 'SSO_USER'|'SSO_GROUP'
                    },
                ]
            },
            'code': 123,
            'message': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • errors (list) --

      An array of structures that contain the errors from the operation, if any.

      • (dict) --

        A structure containing information about one error encountered while performing an UpdatePermissions operation.

        • causedBy (dict) --

          Specifies which permission update caused the error.

          • action (string) --

            Specifies whether this update is to add or revoke role permissions.

          • role (string) --

            The role to add or revoke for the user or the group specified in users .

          • users (list) --

            A structure that specifies the user or group to add or revoke the role for.

            • (dict) --

              A structure that specifies one user or group in the workspace.

              • id (string) --

                The ID of the user or group.

                Pattern: ^([0-9a-fA-F]{10}-|)[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}$

              • type (string) --

                Specifies whether this is a single user or a group.

        • code (integer) --

          The error code.

        • message (string) --

          The message for this error.