listWorkspaceServiceAccountTokens method

Future<ListWorkspaceServiceAccountTokensResponse> listWorkspaceServiceAccountTokens({
  1. required String serviceAccountId,
  2. required String workspaceId,
  3. int? maxResults,
  4. String? nextToken,
})

Returns a list of tokens for a workspace service account. Service accounts are only available for workspaces that are compatible with Grafana version 9 and above.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter serviceAccountId : The ID of the service account for which to return tokens.

Parameter workspaceId : The ID of the workspace for which to return tokens.

Parameter maxResults : The maximum number of tokens to include in the results.

Parameter nextToken : The token for the next set of service accounts to return. (You receive this token from a previous ListWorkspaceServiceAccountTokens operation.)

Implementation

Future<ListWorkspaceServiceAccountTokensResponse>
    listWorkspaceServiceAccountTokens({
  required String serviceAccountId,
  required String workspaceId,
  int? maxResults,
  String? nextToken,
}) async {
  final $query = <String, List<String>>{
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri:
        '/workspaces/${Uri.encodeComponent(workspaceId)}/serviceaccounts/${Uri.encodeComponent(serviceAccountId)}/tokens',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListWorkspaceServiceAccountTokensResponse.fromJson(response);
}