diff --git a/automations_fire_test.go b/automations_fire_test.go index 0d674c9..5ceb279 100644 --- a/automations_fire_test.go +++ b/automations_fire_test.go @@ -92,3 +92,30 @@ func TestAutomationRuleUpdateRequestCanSendFalseValues(t *testing.T) { t.Fatalf("zero rotate flag should stay omitted: %s", got) } } + +func TestAutomationRuleUpdateRequestPreservesOncallIncidentTriggerFields(t *testing.T) { + var req AutomationRuleUpdateRequest + if err := json.Unmarshal([]byte(`{ + "rule_id":"auto_1", + "oncall_incident_trigger_enabled":false, + "oncall_incident_channel_ids":[], + "oncall_incident_severities":[] + }`), &req); err != nil { + t.Fatal(err) + } + payload, err := json.Marshal(&req) + if err != nil { + t.Fatal(err) + } + got := string(payload) + for _, want := range []string{ + `"rule_id":"auto_1"`, + `"oncall_incident_trigger_enabled":false`, + `"oncall_incident_channel_ids":[]`, + `"oncall_incident_severities":[]`, + } { + if !strings.Contains(got, want) { + t.Fatalf("payload %s missing %s", got, want) + } + } +} diff --git a/automations_models.go b/automations_models.go index ff8b883..fc7f260 100644 --- a/automations_models.go +++ b/automations_models.go @@ -26,4 +26,10 @@ type AutomationRuleUpdateRequest struct { HTTPPostTriggerEnabled *bool `json:"http_post_trigger_enabled,omitempty" toon:"http_post_trigger_enabled,omitempty"` // Whether to rotate the HTTP POST trigger token. The new token is returned only in this response. RotateHTTPPostTriggerToken bool `json:"rotate_http_post_trigger_token,omitempty" toon:"rotate_http_post_trigger_token,omitempty"` + // Whether the on-call incident trigger is enabled. Sending true creates it when missing and channel/severity filters are provided. + OncallIncidentTriggerEnabled *bool `json:"oncall_incident_trigger_enabled,omitempty" toon:"oncall_incident_trigger_enabled,omitempty"` + // On-call channel IDs whose new incidents can trigger this rule. + OncallIncidentChannelIDs *[]int64 `json:"oncall_incident_channel_ids,omitempty" toon:"oncall_incident_channel_ids,omitempty"` + // Incident severities that can trigger this rule. + OncallIncidentSeverities *[]string `json:"oncall_incident_severities,omitempty" toon:"oncall_incident_severities,omitempty"` }