createWorkspaceApiKey method
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.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter keyName :
Specifies the name of the key. Keynames must be unique to the workspace.
Parameter keyRole :
Specifies the permission level of the key.
Valid values: ADMIN|EDITOR|VIEWER
Parameter secondsToLive :
Specifies the time in seconds until the key expires. Keys can be valid for
up to 30 days.
Parameter workspaceId :
The ID of the workspace to create an API key.
Implementation
Future<CreateWorkspaceApiKeyResponse> createWorkspaceApiKey({
required String keyName,
required String keyRole,
required int secondsToLive,
required String workspaceId,
}) async {
final $payload = <String, dynamic>{
'keyName': keyName,
'keyRole': keyRole,
'secondsToLive': secondsToLive,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/workspaces/${Uri.encodeComponent(workspaceId)}/apikeys',
exceptionFnMap: _exceptionFns,
);
return CreateWorkspaceApiKeyResponse.fromJson(response);
}