diff --git a/pkg/alerts/muting_rules_test.go b/pkg/alerts/muting_rules_test.go index d5f50075..2af85db7 100644 --- a/pkg/alerts/muting_rules_test.go +++ b/pkg/alerts/muting_rules_test.go @@ -55,6 +55,7 @@ var ( "timeZone": "America/Los_Angeles", "weeklyRepeatDays": null }, + "actionOnMutingRuleWindowEnded": "CLOSE_ISSUES_ON_INACTIVE", "status": "INACTIVE", "updatedAt": "2021-01-12T00:50:39.533Z", "updatedByUser": { @@ -117,7 +118,8 @@ var ( "gravatar": "https://secure.gravatar.com/avatar/692dc9742bd717014494f5093faff304", "id": 1, "name": "Test User" - } + }, + "actionOnMutingRuleWindowEnded": "CLOSE_ISSUES_ON_INACTIVE", } } } @@ -168,7 +170,8 @@ var ( "gravatar": "https://secure.gravatar.com/avatar/692dc9742bd717014494f5093faff304", "id": 1, "name": "Test User" - } + }, + "actionOnMutingRuleWindowEnded": "CLOSE_ISSUES_ON_INACTIVE", } }` @@ -182,7 +185,8 @@ var ( "repeat": null, "repeatCount": null, "weeklyRepeatDays": null - } + }, + "actionOnMutingRuleWindowEnded": "DO_NOTHING", } }` @@ -248,6 +252,7 @@ func TestListMutingRules(t *testing.T) { ID: 1, Name: "Test User", }, + ActionOnMutingRuleWindowEnded: "CLOSE_ISSUES_ON_INACTIVE", }, } @@ -313,6 +318,7 @@ func TestGetMutingRule(t *testing.T) { ID: 1, Name: "Test User", }, + ActionOnMutingRuleWindowEnded: "CLOSE_ISSUES_ON_INACTIVE", } actual, err := alerts.GetMutingRule(accountID, ruleID) @@ -376,6 +382,7 @@ func TestCreateMutingRule(t *testing.T) { ID: 1, Name: "Test User", }, + ActionOnMutingRuleWindowEnded: "CLOSE_ISSUES_ON_INACTIVE", } actual, err := alerts.CreateMutingRule(accountID, MutingRuleCreateInput{}) @@ -407,6 +414,7 @@ func TestUpdateMutingRule(t *testing.T) { EndRepeat: &endRepeat, StartTime: &startTime, }, + ActionOnMutingRuleWindowEnded: "DO_NOTHING", } actual, err := alerts.UpdateMutingRule(accountID, ruleID, MutingRuleUpdateInput{}) diff --git a/pkg/alerts/types.go b/pkg/alerts/types.go index bc8daed7..7df6511b 100644 --- a/pkg/alerts/types.go +++ b/pkg/alerts/types.go @@ -3,6 +3,21 @@ package alerts import "github.com/newrelic/newrelic-client-go/v2/pkg/nrtime" +// AlertsActionOnMutingRuleWindowEnded - Configuration on the action when the muting rule window is ended or disabled +type AlertsActionOnMutingRuleWindowEnded string + +var AlertsActionOnMutingRuleWindowEndedTypes = struct { + // Muting Rule closes issues when the muting rule window is ended or disabled to notify users. + CLOSE_ISSUES_ON_INACTIVE AlertsActionOnMutingRuleWindowEnded + // The currently opened issues will not be notified even if the muting rule window is ended or disabled. + DO_NOTHING AlertsActionOnMutingRuleWindowEnded +}{ + // Muting Rule closes issues when the muting rule window is ended or disabled to notify users. + CLOSE_ISSUES_ON_INACTIVE: "CLOSE_ISSUES_ON_INACTIVE", + // The currently opened issues will not be notified even if the muting rule window is ended or disabled. + DO_NOTHING: "DO_NOTHING", +} + // AlertsDayOfWeek - The day of the week used to configure a WEEKLY scheduled MutingRule type AlertsDayOfWeek string @@ -221,6 +236,8 @@ type AlertsMutingRuleConditionInput struct { // AlertsMutingRuleInput - Input for creating MutingRules for New Relic Alerts Violations. type AlertsMutingRuleInput struct { + // The action when the muting rule window is ended or disabled. + ActionOnMutingRuleWindowEnded AlertsActionOnMutingRuleWindowEnded `json:"actionOnMutingRuleWindowEnded,omitempty"` // The condition that defines which violations to target. Condition AlertsMutingRuleConditionGroupInput `json:"condition,omitempty"` // The description of the MutingRule.