case_project_rules
Creates, updates, deletes, gets or lists a case_project_rules resource.
Overview
| Name | case_project_rules |
| Type | Resource |
| Id | datadog.service_management.case_project_rules |
Fields
The following fields are returned by SELECT queries:
- get_case_automation_rule
- list_case_automation_rules
| Name | Datatype | Description |
|---|---|---|
id | string | Automation rule identifier. (example: e6773723-fe58-49ff-9975-dff00f14e28d) |
attributes | object | Core attributes of an automation rule, including its name, trigger condition, action to execute, and current state. |
relationships | object | Related resources for the automation rule, including the users who created and last modified it. |
type | string | JSON:API resource type for case automation rules. (rule) (default: rule, example: rule) |
| Name | Datatype | Description |
|---|---|---|
id | string | Automation rule identifier. (example: e6773723-fe58-49ff-9975-dff00f14e28d) |
attributes | object | Core attributes of an automation rule, including its name, trigger condition, action to execute, and current state. |
relationships | object | Related resources for the automation rule, including the users who created and last modified it. |
type | string | JSON:API resource type for case automation rules. (rule) (default: rule, example: rule) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_case_automation_rule | select | project_id, rule_id | Returns a single automation rule identified by its UUID, including its trigger, action, and current state (enabled/disabled). | |
list_case_automation_rules | select | project_id | Returns all automation rules configured for a project. Automation rules allow automatic actions to be triggered by case events like creation, status transitions, or attribute changes. | |
create_case_automation_rule | insert | project_id, data | Creates an automation rule for a project. The rule defines a trigger event (for example, case created, status transitioned) and an action to execute. | |
update_case_automation_rule | replace | project_id, rule_id, data | Updates the trigger, action, name, or state of an existing automation rule. | |
delete_case_automation_rule | delete | project_id, rule_id | Permanently deletes an automation rule from a project. | |
disable_case_automation_rule | exec | project_id, rule_id | Disables an automation rule so it no longer triggers on case events. The rule configuration is preserved. | |
enable_case_automation_rule | exec | project_id, rule_id | Enables a previously disabled automation rule so it triggers on matching case events. |
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 |
|---|---|---|
project_id | string | The UUID of the project that owns the automation rules. (example: e555e290-ed65-49bd-ae18-8acbfcf18db7) |
rule_id | string | The UUID of the automation rule. (example: e6773723-fe58-49ff-9975-dff00f14e28d) |
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. |
SELECT examples
- get_case_automation_rule
- list_case_automation_rules
Returns a single automation rule identified by its UUID, including its trigger, action, and current state (enabled/disabled).
SELECT
id,
attributes,
relationships,
type
FROM datadog.service_management.case_project_rules
WHERE project_id = '{{ project_id }}' -- required
AND rule_id = '{{ rule_id }}' -- required
;
Returns all automation rules configured for a project. Automation rules allow automatic actions to be triggered by case events like creation, status transitions, or attribute changes.
SELECT
id,
attributes,
relationships,
type
FROM datadog.service_management.case_project_rules
WHERE project_id = '{{ project_id }}' -- required
;
INSERT examples
- create_case_automation_rule
- Manifest
Creates an automation rule for a project. The rule defines a trigger event (for example, case created, status transitioned) and an action to execute.
INSERT INTO datadog.service_management.case_project_rules (
data,
project_id
)
SELECT
'{{ data }}' /* required */,
'{{ project_id }}'
RETURNING
data
;
# Description fields are for documentation purposes
- name: case_project_rules
props:
- name: project_id
value: "{{ project_id }}"
description: Required parameter for the case_project_rules resource.
- name: data
description: |
Data object for creating an automation rule.
value:
attributes:
action:
data:
agent_type: "{{ agent_type }}"
assigned_agent_id: "{{ assigned_agent_id }}"
handle: "{{ handle }}"
type: "{{ type }}"
name: "{{ name }}"
state: "{{ state }}"
trigger:
data:
approval_type: "{{ approval_type }}"
change_type: "{{ change_type }}"
field: "{{ field }}"
from_status_name: "{{ from_status_name }}"
to_status_name: "{{ to_status_name }}"
type: "{{ type }}"
type: "{{ type }}"
REPLACE examples
- update_case_automation_rule
Updates the trigger, action, name, or state of an existing automation rule.
REPLACE datadog.service_management.case_project_rules
SET
data = '{{ data }}'
WHERE
project_id = '{{ project_id }}' --required
AND rule_id = '{{ rule_id }}' --required
AND data = '{{ data }}' --required
RETURNING
data;
DELETE examples
- delete_case_automation_rule
Permanently deletes an automation rule from a project.
DELETE FROM datadog.service_management.case_project_rules
WHERE project_id = '{{ project_id }}' --required
AND rule_id = '{{ rule_id }}' --required
;
Lifecycle Methods
EXEC variables use wire (API) names.
- disable_case_automation_rule
- enable_case_automation_rule
Disables an automation rule so it no longer triggers on case events. The rule configuration is preserved.
EXEC datadog.service_management.case_project_rules.disable_case_automation_rule
@project_id='{{ project_id }}' --required,
@rule_id='{{ rule_id }}' --required
;
Enables a previously disabled automation rule so it triggers on matching case events.
EXEC datadog.service_management.case_project_rules.enable_case_automation_rule
@project_id='{{ project_id }}' --required,
@rule_id='{{ rule_id }}' --required
;