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. (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. (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,region | Get a role in the organization specified by the role’s role_id. | |
| list_roles | select | region | page[size],page[number],sort,filter,filter[id] | Returns all roles, including their names and their unique identifiers. | 
| create_role | insert | region,data__data | Create a new role for your organization. | |
| update_role | update | role_id,region,data__data | Edit a role. Can only be used with application keys belonging to administrators. | |
| delete_role | delete | role_id,region | Disables a role. | |
| clone_role | exec | role_id,region,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 | 
|---|---|---|
| region | string | (default: datadoghq.com) | 
| role_id | string | The unique identifier of the role. | 
| 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) | Size for a given 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
AND region = '{{ region }}' -- required
;
Returns all roles, including their names and their unique identifiers.
SELECT
id,
attributes,
relationships,
type
FROM datadog.organization.roles
WHERE region = '{{ region }}' -- required
AND 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.
INSERT INTO datadog.organization.roles (
data__data,
region
)
SELECT 
'{{ data }}' /* required */,
'{{ region }}'
RETURNING
data
;
# Description fields are for documentation purposes
- name: roles
  props:
    - name: region
      value: string
      description: Required parameter for the roles resource.
    - name: data
      value: object
      description: |
        Data related to the creation of a role.
UPDATE examples
- update_role
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
- delete_role
Disables a role.
DELETE FROM datadog.organization.roles
WHERE role_id = '{{ role_id }}' --required
AND region = '{{ region }}' --required
;
Lifecycle Methods
- clone_role
Clone an existing role
EXEC datadog.organization.roles.clone_role 
@role_id='{{ role_id }}' --required, 
@region='{{ region }}' --required 
@@json=
'{
"data": "{{ data }}"
}'
;