Skip to main content

service_account_keys

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

Overview

Nameservice_account_keys
TypeResource
Iddatadog.organization.service_account_keys

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringID of the application key.
attributesobjectAttributes of a partial application key.
relationshipsobjectResources related to the application key.
typestringApplication Keys resource type. (application_keys) (default: application_keys, example: application_keys)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_service_account_application_keyselectservice_account_id, app_key_idGet an application key owned by this service account.
list_service_account_application_keysselectservice_account_idpage[size], page[number], sort, filter, filter[created_at][start], filter[created_at][end]List all application keys available for this service account.
create_service_account_application_keyinsertservice_account_id, dataCreate an application key for this service account.
update_service_account_application_keyupdateservice_account_id, app_key_id, dataEdit an application key owned by this service account.
delete_service_account_application_keydeleteservice_account_id, app_key_idDelete an application key owned by this 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
app_key_idstringThe ID of the application key.
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.
filterstringFilter application keys by the specified string.
filter[created_at][end]stringOnly include application keys created on or before the specified date.
filter[created_at][start]stringOnly include application keys created on or after the specified date.
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.
sortstringApplication key 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 an application key owned by this service account.

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

INSERT examples

Create an application key for this service account.

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

UPDATE examples

Edit an application key owned by this service account.

UPDATE datadog.organization.service_account_keys
SET
data = '{{ data }}'
WHERE
service_account_id = '{{ service_account_id }}' --required
AND app_key_id = '{{ app_key_id }}' --required
AND data = '{{ data }}' --required
RETURNING
data,
included;

DELETE examples

Delete an application key owned by this service account.

DELETE FROM datadog.organization.service_account_keys
WHERE service_account_id = '{{ service_account_id }}' --required
AND app_key_id = '{{ app_key_id }}' --required
;