Skip to main content

service_account_access_tokens

Creates, updates, deletes, gets or lists a service_account_access_tokens resource.

Overview

Nameservice_account_access_tokens
TypeResource
Iddatadog.organization.service_account_access_tokens

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringID of the access token.
attributesobjectAttributes of an access token.
relationshipsobjectResources related to the access token.
typestringService access tokens resource type. (service_access_tokens) (default: service_access_tokens, example: service_access_tokens)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_service_account_access_tokenselectservice_account_id, token_idGet a specific access token for a service account by its ID.
list_service_account_access_tokensselectservice_account_idpage[size], page[number], sort, filterList all access tokens for a specific service account.
create_service_account_access_tokeninsertservice_account_id, dataCreate an access token for a service account.
update_service_account_access_tokenupdateservice_account_id, token_id, dataUpdate a specific access token for a service account.
revoke_service_account_access_tokendeleteservice_account_id, token_idRevoke a specific access token for a service account.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
service_account_idstringThe ID of the service account.
sitestringThe Datadog site (region) for your organization, for example datadoghq.com, us3.datadoghq.com, us5.datadoghq.com, ap1.datadoghq.com, ap2.datadoghq.com, datadoghq.eu, ddog-gov.com. Resolved from the DD_SITE environment variable when set. Optional: defaults to datadoghq.com, or the value of the DD_SITE environment variable when set; a WHERE value overrides both.
token_idstringThe ID of the access token.
filterstringFilter access tokens by the specified string.
page[number]integer (int64)Specific page number to return.
page[size]integer (int64)Number of items to return per page. The maximum allowed value is 100.
sortstringAccess token attribute used to sort results. Sort order is ascending by default. In order to specify a descending sort, prefix the attribute with a minus sign.

SELECT examples

Get a specific access token for a service account by its ID.

SELECT
id,
attributes,
relationships,
type
FROM datadog.organization.service_account_access_tokens
WHERE service_account_id = '{{ service_account_id }}' -- required
AND token_id = '{{ token_id }}' -- required
;

INSERT examples

Create an access token for a service account.

INSERT INTO datadog.organization.service_account_access_tokens (
data,
service_account_id
)
SELECT
'{{ data }}' /* required */,
'{{ service_account_id }}'
RETURNING
data
;

UPDATE examples

Update a specific access token for a service account.

UPDATE datadog.organization.service_account_access_tokens
SET
data = '{{ data }}'
WHERE
service_account_id = '{{ service_account_id }}' --required
AND token_id = '{{ token_id }}' --required
AND data = '{{ data }}' --required
RETURNING
data;

DELETE examples

Revoke a specific access token for a service account.

DELETE FROM datadog.organization.service_account_access_tokens
WHERE service_account_id = '{{ service_account_id }}' --required
AND token_id = '{{ token_id }}' --required
;