roles
Creates, updates, deletes, gets or lists a roles resource.
Overview
| Name | roles |
| Type | Resource |
| Id | datadog.organization.roles |
Fields
The following fields are returned by SELECT queries:
- get_role
- list_roles
| Name | Datatype | Description |
|---|---|---|
id | string | The unique identifier of the role. |
attributes | object | Attributes of the role. |
relationships | object | Relationships of the role object returned by the API. |
type | string | Roles type. (roles) (default: roles, example: roles) |
| Name | Datatype | Description |
|---|---|---|
id | string | The unique identifier of the role. |
attributes | object | Attributes of the role. |
relationships | object | Relationships of the role object returned by the API. |
type | string | Roles type. (roles) (default: roles, example: roles) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_role | select | role_id | Get a role in the organization specified by the role’s role_id. | |
list_roles | select | page[size], page[number], sort, filter, filter[id] | Returns all roles, including their names and their unique identifiers. | |
create_role | insert | data | 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 | |
update_role | update | role_id, data | Edit a role. Can only be used with application keys belonging to administrators. | |
delete_role | delete | role_id | Disables a role. | |
clone_role | exec | role_id, data | Clone 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.
| Name | Datatype | Description |
|---|---|---|
role_id | string | The unique identifier of the role. |
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. |
filter | string | Filter all roles by the given string. |
filter[id] | string | Filter 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. |
sort | string | Sort 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_role
- list_roles
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
;
Returns all roles, including their names and their unique identifiers.
SELECT
id,
attributes,
relationships,
type
FROM datadog.organization.roles
WHERE page[size] = '{{ page[size] }}'
AND page[number] = '{{ page[number] }}'
AND sort = '{{ sort }}'
AND filter = '{{ filter }}'
AND filter[id] = '{{ filter[id] }}'
;
INSERT examples
- create_role
- Manifest
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
;
# Description fields are for documentation purposes
- name: roles
props:
- name: data
description: |
Data related to the creation of a role.
value:
attributes:
created_at: "{{ created_at }}"
modified_at: "{{ modified_at }}"
name: "{{ name }}"
receives_permissions_from:
- "{{ receives_permissions_from }}"
relationships:
permissions:
data:
- id: "{{ id }}"
type: "{{ type }}"
type: "{{ type }}"
UPDATE examples
- update_role
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
- delete_role
Disables a role.
DELETE FROM datadog.organization.roles
WHERE role_id = '{{ role_id }}' --required
;
Lifecycle Methods
EXEC variables use wire (API) names.
- clone_role
Clone an existing role
EXEC datadog.organization.roles.clone_role
@role_id='{{ role_id }}' --required,
@@json=
'{
"data": "{{ data }}"
}'
;