users
Creates, updates, deletes, gets or lists a users resource.
Overview
| Name | users |
| Type | Resource |
| Id | datadog.organization.users |
Fields
The following fields are returned by SELECT queries:
- get_user
- list_users
| Name | Datatype | Description |
|---|---|---|
id | string | ID of the user. |
attributes | object | Attributes of user object returned by the API. |
relationships | object | Relationships of the user object returned by the API. |
type | string | Users resource type. (users) (default: users, example: users) |
| Name | Datatype | Description |
|---|---|---|
id | string | ID of the user. |
attributes | object | Attributes of user object returned by the API. |
relationships | object | Relationships of the user object returned by the API. |
type | string | Users resource type. (users) (default: users, example: users) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_user | select | user_id | Get a user in the organization specified by the user’s user_id. | |
list_users | select | page[size], page[number], sort, sort_dir, filter, filter[status] | Get the list of all users in the organization. This list includes<br />all users even if they are deactivated or unverified. | |
create_user | insert | data | Create a user for your organization. | |
update_user | update | user_id, data | Edit a user. Can only be used with an application key belonging<br />to an administrator user. | |
anonymize_users | exec | data | Anonymize a list of users, removing their personal data. This operation is irreversible.<br />Requires the user_access_manage permission. | |
disable_user | exec | user_id | Disable a user. Can only be used with an application key belonging<br />to an administrator user. |
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.
| Name | Datatype | Description |
|---|---|---|
site | string | The 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. |
user_id | string | The ID of the user. |
filter | string | Filter all users by the given string. Defaults to no filtering. |
filter[status] | string | Filter on status attribute. Comma separated list, with possible values Active, Pending, and Disabled. Defaults to no filtering. |
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. |
sort | string | User attribute to order results by. Sort order is ascending by default. Sort order is descending if the field is prefixed by a negative sign, for example sort=-name. Options: name, modified_at, user_count. |
sort_dir | string | Direction of sort. Options: asc, desc. |
SELECT examples
- get_user
- list_users
Get a user in the organization specified by the user’s user_id.
SELECT
id,
attributes,
relationships,
type
FROM datadog.organization.users
WHERE user_id = '{{ user_id }}' -- required
;
Get the list of all users in the organization. This list includes<br />all users even if they are deactivated or unverified.
SELECT
id,
attributes,
relationships,
type
FROM datadog.organization.users
WHERE page[size] = '{{ page[size] }}'
AND page[number] = '{{ page[number] }}'
AND sort = '{{ sort }}'
AND sort_dir = '{{ sort_dir }}'
AND filter = '{{ filter }}'
AND filter[status] = '{{ filter[status] }}'
;
INSERT examples
- create_user
- Manifest
Create a user for your organization.
INSERT INTO datadog.organization.users (
data
)
SELECT
'{{ data }}' /* required */
RETURNING
data,
included
;
# Description fields are for documentation purposes
- name: users
props:
- name: data
description: |
Object to create a user.
value:
attributes:
email: "{{ email }}"
name: "{{ name }}"
title: "{{ title }}"
relationships:
roles:
data:
- id: "{{ id }}"
type: "{{ type }}"
type: "{{ type }}"
UPDATE examples
- update_user
Edit a user. Can only be used with an application key belonging<br />to an administrator user.
UPDATE datadog.organization.users
SET
data = '{{ data }}'
WHERE
user_id = '{{ user_id }}' --required
AND data = '{{ data }}' --required
RETURNING
data,
included;
Lifecycle Methods
EXEC variables use wire (API) names.
- anonymize_users
- disable_user
Anonymize a list of users, removing their personal data. This operation is irreversible.<br />Requires the user_access_manage permission.
EXEC datadog.organization.users.anonymize_users
@@json=
'{
"data": "{{ data }}"
}'
;
Disable a user. Can only be used with an application key belonging<br />to an administrator user.
EXEC datadog.organization.users.disable_user
@user_id='{{ user_id }}' --required
;