Skip to main content

role_users

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

Overview

Namerole_users
TypeResource
Iddatadog.organization.role_users

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringID of the user.
attributesobjectAttributes of user object returned by the API.
relationshipsobjectRelationships of the user object returned by the API.
typestringUsers resource type. (users) (default: users, example: users)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_role_usersselectrole_idpage[size], page[number], sort, filterGets all users of a role.
add_user_to_roleinsertrole_id, dataAdds a user to a role.
remove_user_from_roledeleterole_idRemoves a user from a role.

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
role_idstringThe unique identifier of the role.
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 all users by the given string. 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.
sortstringUser 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, email, status.

SELECT examples

Gets all users of a role.

SELECT
id,
attributes,
relationships,
type
FROM datadog.organization.role_users
WHERE role_id = '{{ role_id }}' -- required
AND page[size] = '{{ page[size] }}'
AND page[number] = '{{ page[number] }}'
AND sort = '{{ sort }}'
AND filter = '{{ filter }}'
;

INSERT examples

Adds a user to a role.

INSERT INTO datadog.organization.role_users (
data,
role_id
)
SELECT
'{{ data }}' /* required */,
'{{ role_id }}'
RETURNING
data,
included,
meta
;

DELETE examples

Removes a user from a role.

DELETE FROM datadog.organization.role_users
WHERE role_id = '{{ role_id }}' --required
;