Skip to main content

roles

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

Overview

Nameroles
TypeResource
Iddatadog.organization.roles

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe unique identifier of the role.
attributesobjectAttributes of the role.
relationshipsobjectRelationships of the role object returned by the API.
typestringRoles type. (default: roles, example: roles)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_roleselectrole_id, regionGet a role in the organization specified by the role’s role_id.
list_rolesselectregionpage[size], page[number], sort, filter, filter[id]Returns all roles, including their names and their unique identifiers.
create_roleinsertregion, data__dataCreate a new role for your organization.
update_roleupdaterole_id, region, data__dataEdit a role. Can only be used with application keys belonging to administrators.
delete_roledeleterole_id, regionDisables a role.
clone_roleexecrole_id, region, dataClone an existing 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
regionstring(default: datadoghq.com)
role_idstringThe unique identifier of the role.
filterstringFilter all roles by the given string.
filter[id]stringFilter all roles by the given list of role IDs.
page[number]integer (int64)Specific page number to return.
page[size]integer (int64)Size for a given page. The maximum allowed value is 100.
sortstringSort roles depending on the given field. Sort order is ascending by default. Sort order is descending if the field is prefixed by a negative sign, for example: sort=-name.

SELECT examples

Get a role in the organization specified by the role’s role_id.

SELECT
id,
attributes,
relationships,
type
FROM datadog.organization.roles
WHERE role_id = '{{ role_id }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Create a new role for your organization.

INSERT INTO datadog.organization.roles (
data__data,
region
)
SELECT
'{{ data }}' /* required */,
'{{ region }}'
RETURNING
data
;

UPDATE examples

Edit a role. Can only be used with application keys belonging to administrators.

UPDATE datadog.organization.roles
SET
data__data = '{{ data }}'
WHERE
role_id = '{{ role_id }}' --required
AND region = '{{ region }}' --required
AND data__data = '{{ data }}' --required
RETURNING
data;

DELETE examples

Disables a role.

DELETE FROM datadog.organization.roles
WHERE role_id = '{{ role_id }}' --required
AND region = '{{ region }}' --required
;

Lifecycle Methods

Clone an existing role

EXEC datadog.organization.roles.clone_role 
@role_id='{{ role_id }}' --required,
@region='{{ region }}' --required
@@json=
'{
"data": "{{ data }}"
}'
;