createWorkspaceServiceAccount method
Creates a service account for the workspace. A service account can be used
to call Grafana HTTP APIs, and run automated workloads. After creating the
service account with the correct GrafanaRole for your use
case, use CreateWorkspaceServiceAccountToken to create a
token that can be used to authenticate and authorize Grafana HTTP API
calls.
You can only create service accounts for workspaces that are compatible with Grafana version 9 and above.
For more information about the Grafana HTTP APIs, see Using Grafana HTTP APIs in the Amazon Managed Grafana User Guide.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter grafanaRole :
The permission level to use for this service account.
Parameter name :
A name for the service account. The name must be unique within the
workspace, as it determines the ID associated with the service account.
Parameter workspaceId :
The ID of the workspace within which to create the service account.
Implementation
Future<CreateWorkspaceServiceAccountResponse> createWorkspaceServiceAccount({
required Role grafanaRole,
required String name,
required String workspaceId,
}) async {
final $payload = <String, dynamic>{
'grafanaRole': grafanaRole.value,
'name': name,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/workspaces/${Uri.encodeComponent(workspaceId)}/serviceaccounts',
exceptionFnMap: _exceptionFns,
);
return CreateWorkspaceServiceAccountResponse.fromJson(response);
}