notification_rules
Creates, updates, deletes, gets or lists a notification_rules resource.
Overview​
| Name | notification_rules |
| Type | Resource |
| Id | railway.observability.notification_rules |
Fields​
The following fields are returned by SELECT queries:
- list
One row per NotificationRule.
| Name | Datatype | Description |
|---|---|---|
id | string | |
environment_id | string | |
project_id | string | |
service_id | string | |
workspace_id | string | |
channels | array | List of NotificationChannel objects |
created_at | string (date-time) | |
ephemeral_environments | boolean | |
event_types | array | |
severities | array | |
updated_at | string (date-time) |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | workspace_id | project_id | Get all notification rules for a workspace and project. Backed by the Railway GraphQL query notificationRules. |
create | insert | channel_configs, event_types, workspace_id | Create a new notification rule. Backed by the Railway GraphQL mutation notificationRuleCreate. | |
update | update | id | Update a notification rule. Backed by the Railway GraphQL mutation notificationRuleUpdate. | |
delete | delete | id | Delete a notification rule. Backed by the Railway GraphQL mutation notificationRuleDelete. | |
test_webhook | exec | payload, url | Test a webhook URL by sending a sample payload. Returns the HTTP status code. Backed by the Railway GraphQL mutation webhookTest. |
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 |
|---|---|---|
workspace_id | string | |
project_id | string | |
channel_configs | array | |
event_types | array | |
id | string | |
payload | string | |
url | string |
SELECT examples​
- list
Get all notification rules for a workspace and project. Backed by the Railway GraphQL query notificationRules.
SELECT
id,
environment_id,
project_id,
service_id,
workspace_id,
channels,
created_at,
ephemeral_environments,
event_types,
severities,
updated_at
FROM railway.observability.notification_rules
WHERE workspace_id = '{{ workspace_id }}' -- required
AND project_id = '{{ project_id }}'
;
INSERT examples​
- create
- Manifest
Create a new notification rule. Backed by the Railway GraphQL mutation notificationRuleCreate.
INSERT INTO railway.observability.notification_rules (
channel_configs,
ephemeral_environments,
event_types,
project_id,
severities,
workspace_id
)
SELECT
'{{ channel_configs }}' /* required */,
{{ ephemeral_environments }},
'{{ event_types }}' /* required */,
'{{ project_id }}',
'{{ severities }}',
'{{ workspace_id }}' /* required */
RETURNING
id,
environment_id,
project_id,
service_id,
workspace_id,
channels,
created_at,
ephemeral_environments,
event_types,
severities,
updated_at
;
# Description fields are for documentation purposes
- name: notification_rules
props:
- name: channel_configs
value: "{{ channel_configs }}"
- name: ephemeral_environments
value: {{ ephemeral_environments }}
- name: event_types
value:
- "{{ event_types }}"
- name: project_id
value: "{{ project_id }}"
- name: severities
value:
- "{{ severities }}"
- name: workspace_id
value: "{{ workspace_id }}"
UPDATE examples​
- update
Update a notification rule. Backed by the Railway GraphQL mutation notificationRuleUpdate.
UPDATE railway.observability.notification_rules
SET
channel_configs = '{{ channel_configs }}',
ephemeral_environments = '{{ ephemeral_environments }}',
event_types = '{{ event_types }}',
severities = '{{ severities }}'
WHERE
id = '{{ id }}' --required
RETURNING
id,
environment_id,
project_id,
service_id,
workspace_id,
channels,
created_at,
ephemeral_environments,
event_types,
severities,
updated_at;
DELETE examples​
- delete
Delete a notification rule. Backed by the Railway GraphQL mutation notificationRuleDelete.
DELETE FROM railway.observability.notification_rules
WHERE
id = '{{ id }}' --required
;
Lifecycle Methods​
- test_webhook
Test a webhook URL by sending a sample payload. Returns the HTTP status code. Backed by the Railway GraphQL mutation webhookTest.
EXEC railway.observability.notification_rules.test_webhook
@payload='{{ payload }}', --required
@url='{{ url }}' --required
;