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. (roles) (default: roles, example: roles)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_roleselectrole_idGet a role in the organization specified by the role’s role_id.
list_rolesselectpage[size], page[number], sort, filter, filter[id]Returns all roles, including their names and their unique identifiers.
create_roleinsertdataCreate a new role for your organization.<br /><br />The following read permissions are automatically added to every new role, even if they are not included in the request:<br /><br />- Dashboards Read<br />- Notebooks Read<br />- Monitors Read<br />- APM Read<br />- Vulnerability Management Read<br />- RUM Apps Read<br />- Incidents Read<br />- SLOs Read<br />- CI Visibility Read<br />- CD Visibility Read
update_roleupdaterole_id, dataEdit a role. Can only be used with application keys belonging to administrators.
delete_roledeleterole_idDisables a role.
clone_roleexecrole_id, 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
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 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)Number of items to return per 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
;

INSERT examples

Create a new role for your organization.<br /><br />The following read permissions are automatically added to every new role, even if they are not included in the request:<br /><br />- Dashboards Read<br />- Notebooks Read<br />- Monitors Read<br />- APM Read<br />- Vulnerability Management Read<br />- RUM Apps Read<br />- Incidents Read<br />- SLOs Read<br />- CI Visibility Read<br />- CD Visibility Read

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

UPDATE examples

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

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

DELETE examples

Disables a role.

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

Lifecycle Methods

EXEC variables use wire (API) names.

Clone an existing role

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