rules
Creates, updates, deletes, gets or lists a rules
resource.
Overview
Name | rules |
Type | Resource |
Id | pagerduty.rulesets.rules |
Fields
The following fields are returned by SELECT
queries:
- get_ruleset_event_rule
- list_ruleset_event_rules
The Event Rule object.
Name | Datatype | Description |
---|---|---|
id | string | ID of the Event Rule. |
actions | object | When an event matches this Event Rule, the actions that will be taken to change the resulting Alert and Incident. |
catch_all | boolean | Indicates whether the Event Rule is the last Event Rule of the Ruleset that serves as a catch-all. It has limited functionality compared to other rules and always matches. |
conditions | object | Conditions evaluated to check if an event matches this Event Rule. Is always empty for the catch_all rule, though. |
disabled | boolean | Indicates whether the Event Rule is disabled and would therefore not be evaluated. |
position | integer | Position/index of the Event Rule in the Ruleset. Starting from position 0 (the first rule), rules are evaluated one-by-one until a matching rule is found. |
self | string (url) | the API show URL at which the object is accessible. |
time_frame | object | Time-based conditions for limiting when the rule is active. |
variables | array | [Early Access] Populate variables from event payloads and use those variables in other event actions. |
A paginated array of Event Rule objects.
Name | Datatype | Description |
---|---|---|
id | string | ID of the Event Rule. |
actions | object | When an event matches this Event Rule, the actions that will be taken to change the resulting Alert and Incident. |
catch_all | boolean | Indicates whether the Event Rule is the last Event Rule of the Ruleset that serves as a catch-all. It has limited functionality compared to other rules and always matches. |
conditions | object | Conditions evaluated to check if an event matches this Event Rule. Is always empty for the catch_all rule, though. |
disabled | boolean | Indicates whether the Event Rule is disabled and would therefore not be evaluated. |
position | integer | Position/index of the Event Rule in the Ruleset. Starting from position 0 (the first rule), rules are evaluated one-by-one until a matching rule is found. |
self | string (url) | the API show URL at which the object is accessible. |
time_frame | object | Time-based conditions for limiting when the rule is active. |
variables | array | [Early Access] Populate variables from event payloads and use those variables in other event actions. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get_ruleset_event_rule | select | id , rule_id | Accept , Content-Type | Get an Event Rule. <!-- theme: warning --> > ### End-of-life > Rulesets and Event Rules will end-of-life soon. We highly recommend that you migrate to Event Orchestration as soon as possible so you can take advantage of the new functionality, such as improved UI, rule creation, APIs and Terraform support, advanced conditions, and rule nesting. Rulesets allow you to route events to an endpoint and create collections of Event Rules, which define sets of actions to take based on event content. For more information see the API Concepts Document Note: Create and Update on rules will accept 'description' or 'summary' interchangeably as an extraction action target. Get and List on rules will always return 'summary' as the target. If you are expecting 'description' please change your automation code to expect 'summary' instead. Scoped OAuth requires: event_rules.read |
list_ruleset_event_rules | select | id | Accept , Content-Type , limit , offset , total | List all Event Rules on a Ruleset. <!-- theme: warning --> > ### End-of-life > Rulesets and Event Rules will end-of-life soon. We highly recommend that you migrate to Event Orchestration as soon as possible so you can take advantage of the new functionality, such as improved UI, rule creation, APIs and Terraform support, advanced conditions, and rule nesting. Rulesets allow you to route events to an endpoint and create collections of Event Rules, which define sets of actions to take based on event content. For more information see the API Concepts Document Note: Create and Update on rules will accept 'description' or 'summary' interchangeably as an extraction action target. Get and List on rules will always return 'summary' as the target. If you are expecting 'description' please change your automation code to expect 'summary' instead. Scoped OAuth requires: event_rules.read |
create_ruleset_event_rule | insert | id , data__rule | Accept , Content-Type | Create a new Event Rule. <!-- theme: warning --> > ### End-of-life > Rulesets and Event Rules will end-of-life soon. We highly recommend that you migrate to Event Orchestration as soon as possible so you can take advantage of the new functionality, such as improved UI, rule creation, APIs and Terraform support, advanced conditions, and rule nesting. Rulesets allow you to route events to an endpoint and create collections of Event Rules, which define sets of actions to take based on event content. For more information see the API Concepts Document Note: Create and Update on rules will accept 'description' or 'summary' interchangeably as an extraction action target. Get and List on rules will always return 'summary' as the target. If you are expecting 'description' please change your automation code to expect 'summary' instead. Scoped OAuth requires: event_rules.write |
delete_ruleset_event_rule | delete | id , rule_id | Accept , Content-Type | Delete an Event Rule. <!-- theme: warning --> > ### End-of-life > Rulesets and Event Rules will end-of-life soon. We highly recommend that you migrate to Event Orchestration as soon as possible so you can take advantage of the new functionality, such as improved UI, rule creation, APIs and Terraform support, advanced conditions, and rule nesting. Rulesets allow you to route events to an endpoint and create collections of Event Rules, which define sets of actions to take based on event content. For more information see the API Concepts Document Scoped OAuth requires: event_rules.write |
_list_ruleset_event_rules | exec | id | Accept , Content-Type , limit , offset , total | List all Event Rules on a Ruleset. <!-- theme: warning --> > ### End-of-life > Rulesets and Event Rules will end-of-life soon. We highly recommend that you migrate to Event Orchestration as soon as possible so you can take advantage of the new functionality, such as improved UI, rule creation, APIs and Terraform support, advanced conditions, and rule nesting. Rulesets allow you to route events to an endpoint and create collections of Event Rules, which define sets of actions to take based on event content. For more information see the API Concepts Document Note: Create and Update on rules will accept 'description' or 'summary' interchangeably as an extraction action target. Get and List on rules will always return 'summary' as the target. If you are expecting 'description' please change your automation code to expect 'summary' instead. Scoped OAuth requires: event_rules.read |
_get_ruleset_event_rule | exec | id , rule_id | Accept , Content-Type | Get an Event Rule. <!-- theme: warning --> > ### End-of-life > Rulesets and Event Rules will end-of-life soon. We highly recommend that you migrate to Event Orchestration as soon as possible so you can take advantage of the new functionality, such as improved UI, rule creation, APIs and Terraform support, advanced conditions, and rule nesting. Rulesets allow you to route events to an endpoint and create collections of Event Rules, which define sets of actions to take based on event content. For more information see the API Concepts Document Note: Create and Update on rules will accept 'description' or 'summary' interchangeably as an extraction action target. Get and List on rules will always return 'summary' as the target. If you are expecting 'description' please change your automation code to expect 'summary' instead. Scoped OAuth requires: event_rules.read |
update_ruleset_event_rule | exec | id , rule_id , rule_id | Accept , Content-Type | Update an Event Rule. Note that the endpoint supports partial updates, so any number of the writable fields can be provided. <!-- theme: warning --> > ### End-of-life > Rulesets and Event Rules will end-of-life soon. We highly recommend that you migrate to Event Orchestration as soon as possible so you can take advantage of the new functionality, such as improved UI, rule creation, APIs and Terraform support, advanced conditions, and rule nesting. Rulesets allow you to route events to an endpoint and create collections of Event Rules, which define sets of actions to take based on event content. For more information see the API Concepts Document Note: Create and Update on rules will accept 'description' or 'summary' interchangeably as an extraction action target. Get and List on rules will always return 'summary' as the target. If you are expecting 'description' please change your automation code to expect 'summary' instead. Scoped OAuth requires: event_rules.write |
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 |
---|---|---|
id | string | The ID of the resource. |
rule_id | string | The id of the Event Rule to retrieve. |
Accept | string | The Accept header is used as a versioning header. |
Content-Type | string | |
limit | integer | The number of results per page. |
offset | integer | Offset to start pagination search results. |
total | boolean | By default the total field in pagination responses is set to null to provide the fastest possible response times. Set total to true for this field to be populated. See our Pagination Docs for more information. |
SELECT
examples
- get_ruleset_event_rule
- list_ruleset_event_rules
Get an Event Rule.
<!-- theme: warning -->
> ### End-of-life
> Rulesets and Event Rules will end-of-life soon. We highly recommend that you migrate to Event Orchestration as soon as possible so you can take advantage of the new functionality, such as improved UI, rule creation, APIs and Terraform support, advanced conditions, and rule nesting.
Rulesets allow you to route events to an endpoint and create collections of Event Rules, which define sets of actions to take based on event content.
For more information see the API Concepts Document
Note: Create and Update on rules will accept 'description' or 'summary' interchangeably as an extraction action target. Get and List on rules will always return 'summary' as the target. If you are expecting 'description' please change your automation code to expect 'summary' instead.
Scoped OAuth requires: event_rules.read
SELECT
id,
actions,
catch_all,
conditions,
disabled,
position,
self,
time_frame,
variables
FROM pagerduty.rulesets.rules
WHERE id = '{{ id }}' -- required
AND rule_id = '{{ rule_id }}' -- required
AND Accept = '{{ Accept }}'
AND Content-Type = '{{ Content-Type }}'
;
List all Event Rules on a Ruleset.
<!-- theme: warning -->
> ### End-of-life
> Rulesets and Event Rules will end-of-life soon. We highly recommend that you migrate to Event Orchestration as soon as possible so you can take advantage of the new functionality, such as improved UI, rule creation, APIs and Terraform support, advanced conditions, and rule nesting.
Rulesets allow you to route events to an endpoint and create collections of Event Rules, which define sets of actions to take based on event content.
For more information see the API Concepts Document
Note: Create and Update on rules will accept 'description' or 'summary' interchangeably as an extraction action target. Get and List on rules will always return 'summary' as the target. If you are expecting 'description' please change your automation code to expect 'summary' instead.
Scoped OAuth requires: event_rules.read
SELECT
id,
actions,
catch_all,
conditions,
disabled,
position,
self,
time_frame,
variables
FROM pagerduty.rulesets.rules
WHERE id = '{{ id }}' -- required
AND Accept = '{{ Accept }}'
AND Content-Type = '{{ Content-Type }}'
AND limit = '{{ limit }}'
AND offset = '{{ offset }}'
AND total = '{{ total }}'
;
INSERT
examples
- create_ruleset_event_rule
- Manifest
Create a new Event Rule.
<!-- theme: warning -->
> ### End-of-life
> Rulesets and Event Rules will end-of-life soon. We highly recommend that you migrate to Event Orchestration as soon as possible so you can take advantage of the new functionality, such as improved UI, rule creation, APIs and Terraform support, advanced conditions, and rule nesting.
Rulesets allow you to route events to an endpoint and create collections of Event Rules, which define sets of actions to take based on event content.
For more information see the API Concepts Document
Note: Create and Update on rules will accept 'description' or 'summary' interchangeably as an extraction action target. Get and List on rules will always return 'summary' as the target. If you are expecting 'description' please change your automation code to expect 'summary' instead.
Scoped OAuth requires: event_rules.write
INSERT INTO pagerduty.rulesets.rules (
data__rule,
id,
Accept,
Content-Type
)
SELECT
'{{ rule }}' /* required */,
'{{ id }}',
'{{ Accept }}',
'{{ Content-Type }}'
RETURNING
rule
;
# Description fields are for documentation purposes
- name: rules
props:
- name: id
value: string
description: Required parameter for the rules resource.
- name: rule
value: object
- name: Accept
value: string
description: The `Accept` header is used as a versioning header.
- name: Content-Type
value: string
DELETE
examples
- delete_ruleset_event_rule
Delete an Event Rule.
<!-- theme: warning -->
> ### End-of-life
> Rulesets and Event Rules will end-of-life soon. We highly recommend that you migrate to Event Orchestration as soon as possible so you can take advantage of the new functionality, such as improved UI, rule creation, APIs and Terraform support, advanced conditions, and rule nesting.
Rulesets allow you to route events to an endpoint and create collections of Event Rules, which define sets of actions to take based on event content.
For more information see the API Concepts Document
Scoped OAuth requires: event_rules.write
DELETE FROM pagerduty.rulesets.rules
WHERE id = '{{ id }}' --required
AND rule_id = '{{ rule_id }}' --required
AND Accept = '{{ Accept }}'
AND Content-Type = '{{ Content-Type }}'
;
Lifecycle Methods
- _list_ruleset_event_rules
- _get_ruleset_event_rule
- update_ruleset_event_rule
List all Event Rules on a Ruleset.
<!-- theme: warning -->
> ### End-of-life
> Rulesets and Event Rules will end-of-life soon. We highly recommend that you migrate to Event Orchestration as soon as possible so you can take advantage of the new functionality, such as improved UI, rule creation, APIs and Terraform support, advanced conditions, and rule nesting.
Rulesets allow you to route events to an endpoint and create collections of Event Rules, which define sets of actions to take based on event content.
For more information see the API Concepts Document
Note: Create and Update on rules will accept 'description' or 'summary' interchangeably as an extraction action target. Get and List on rules will always return 'summary' as the target. If you are expecting 'description' please change your automation code to expect 'summary' instead.
Scoped OAuth requires: event_rules.read
EXEC pagerduty.rulesets.rules._list_ruleset_event_rules
@id='{{ id }}' --required,
@Accept='{{ Accept }}',
@Content-Type='{{ Content-Type }}',
@limit='{{ limit }}',
@offset='{{ offset }}',
@total={{ total }}
;
Get an Event Rule.
<!-- theme: warning -->
> ### End-of-life
> Rulesets and Event Rules will end-of-life soon. We highly recommend that you migrate to Event Orchestration as soon as possible so you can take advantage of the new functionality, such as improved UI, rule creation, APIs and Terraform support, advanced conditions, and rule nesting.
Rulesets allow you to route events to an endpoint and create collections of Event Rules, which define sets of actions to take based on event content.
For more information see the API Concepts Document
Note: Create and Update on rules will accept 'description' or 'summary' interchangeably as an extraction action target. Get and List on rules will always return 'summary' as the target. If you are expecting 'description' please change your automation code to expect 'summary' instead.
Scoped OAuth requires: event_rules.read
EXEC pagerduty.rulesets.rules._get_ruleset_event_rule
@id='{{ id }}' --required,
@rule_id='{{ rule_id }}' --required,
@Accept='{{ Accept }}',
@Content-Type='{{ Content-Type }}'
;
Update an Event Rule. Note that the endpoint supports partial updates, so any number of the writable fields can be provided.
<!-- theme: warning -->
> ### End-of-life
> Rulesets and Event Rules will end-of-life soon. We highly recommend that you migrate to Event Orchestration as soon as possible so you can take advantage of the new functionality, such as improved UI, rule creation, APIs and Terraform support, advanced conditions, and rule nesting.
Rulesets allow you to route events to an endpoint and create collections of Event Rules, which define sets of actions to take based on event content.
For more information see the API Concepts Document
Note: Create and Update on rules will accept 'description' or 'summary' interchangeably as an extraction action target. Get and List on rules will always return 'summary' as the target. If you are expecting 'description' please change your automation code to expect 'summary' instead.
Scoped OAuth requires: event_rules.write
EXEC pagerduty.rulesets.rules.update_ruleset_event_rule
@id='{{ id }}' --required,
@rule_id='{{ rule_id }}' --required,
@Accept='{{ Accept }}',
@Content-Type='{{ Content-Type }}'
@@json=
'{
"rule": "{{ rule }}",
"rule_id": "{{ rule_id }}"
}'
;