execution_policies
Creates, updates, deletes, gets or lists an execution_policies resource.
Overview
| Name | execution_policies |
| Type | Resource |
| Id | datadog.actions.execution_policies |
Fields
The following fields are returned by SELECT queries:
- get_execution_policy
- list_execution_policies
| Name | Datatype | Description |
|---|---|---|
id | string | The ID of the execution policy. (example: 3fa85f64-5717-4562-b3fc-2c963f66afa6) |
attributes | object | An execution policy. |
type | string | The type of the resource. The value should always be execution_policy. (execution_policy) (default: execution_policy, example: execution_policy) |
| Name | Datatype | Description |
|---|---|---|
id | string | The ID of the execution policy. (example: 3fa85f64-5717-4562-b3fc-2c963f66afa6) |
attributes | object | An execution policy. |
type | string | The type of the resource. The value should always be execution_policy. (execution_policy) (default: execution_policy, example: execution_policy) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_execution_policy | select | policy_id | Retrieve an existing execution policy by ID. | |
list_execution_policies | select | page[size], page[number], filter[name], filter[ids], filter[integration], filter[effects], filter[creator_ids], sort | Retrieve a list of execution policies for the current organization. | |
create_execution_policy | insert | data | Create a new execution policy. | |
update_execution_policy | replace | policy_id, data | Update an existing execution policy.<br />Returns the execution policy object when the request is successful. | |
delete_execution_policy | delete | policy_id | Delete a specific execution policy. |
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 |
|---|---|---|
policy_id | string | The ID of the execution policy. (example: 3fa85f64-5717-4562-b3fc-2c963f66afa6) |
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[creator_ids] | array | Filter execution policies by a list of creator IDs. (example: [3fa85f64-5717-4562-b3fc-2c963f66afa6]) |
filter[effects] | array | Filter execution policies by a list of effects. (example: [allow]) |
filter[ids] | array | Filter execution policies by a list of IDs. (example: [3fa85f64-5717-4562-b3fc-2c963f66afa6]) |
filter[integration] | array | Filter execution policies by a list of integrations. (example: [INTEGRATION_SCRIPT]) |
filter[name] | string | Filter execution policies by name. (example: Block prod restarts) |
page[number] | integer (int32) | The page number to return. (example: 0) |
page[size] | integer (int32) | The number of execution policies to return per page. (example: 100) |
sort | array | The sort order for the results. Prefix a field with - to sort in descending order. Valid fields are name, effect, integration, created_at, and updated_at. (example: [-created_at]) |
SELECT examples
- get_execution_policy
- list_execution_policies
Retrieve an existing execution policy by ID.
SELECT
id,
attributes,
type
FROM datadog.actions.execution_policies
WHERE policy_id = '{{ policy_id }}' -- required
;
Retrieve a list of execution policies for the current organization.
SELECT
id,
attributes,
type
FROM datadog.actions.execution_policies
WHERE page[size] = '{{ page[size] }}'
AND page[number] = '{{ page[number] }}'
AND filter[name] = '{{ filter[name] }}'
AND filter[ids] = '{{ filter[ids] }}'
AND filter[integration] = '{{ filter[integration] }}'
AND filter[effects] = '{{ filter[effects] }}'
AND filter[creator_ids] = '{{ filter[creator_ids] }}'
AND sort = '{{ sort }}'
;
INSERT examples
- create_execution_policy
- Manifest
Create a new execution policy.
INSERT INTO datadog.actions.execution_policies (
data
)
SELECT
'{{ data }}' /* required */
RETURNING
data
;
# Description fields are for documentation purposes
- name: execution_policies
props:
- name: data
description: |
Object for a single execution policy.
value:
attributes:
action_pattern:
action_fqns:
- "{{ action_fqns }}"
integration: "{{ integration }}"
effect: "{{ effect }}"
name: "{{ name }}"
scope:
kubernetes:
rules:
- target_namespaces: "{{ target_namespaces }}"
remote_action_rshell:
rules:
- access: "{{ access }}"
target_paths: "{{ target_paths }}"
scripts:
rules:
- target_script_names: "{{ target_script_names }}"
targets:
- agent_tags: "{{ agent_tags }}"
name: "{{ name }}"
type: "{{ type }}"
REPLACE examples
- update_execution_policy
Update an existing execution policy.<br />Returns the execution policy object when the request is successful.
REPLACE datadog.actions.execution_policies
SET
data = '{{ data }}'
WHERE
policy_id = '{{ policy_id }}' --required
AND data = '{{ data }}' --required
RETURNING
data;
DELETE examples
- delete_execution_policy
Delete a specific execution policy.
DELETE FROM datadog.actions.execution_policies
WHERE policy_id = '{{ policy_id }}' --required
;