diff --git a/alertmuting/model_alert_muting_rule.go b/alertmuting/model_alert_muting_rule.go index 757b74b..2be4785 100644 --- a/alertmuting/model_alert_muting_rule.go +++ b/alertmuting/model_alert_muting_rule.go @@ -25,6 +25,8 @@ type AlertMutingRule struct { LastUpdated int64 `json:"lastUpdated,omitempty"` // The SignalFx-assigned user ID of the last user who updated the alert muting rule, in the form of a JSON string. If the system made the last update, the value is \"AAAAAAAAAA\". **This property is read-only; it's always set by the system.** LastUpdatedBy string `json:"lastUpdatedBy,omitempty"` + // Recurrence period of the muting rule. **read/write** + Recurrence *AlertMutingRuleRecurrence `json:"recurrence,omitempty"` // Toggle if alerts should be sent once the muting period is over. If not specified, defaults to true SendAlertsOnceMutingPeriodHasEnded bool `json:"sendAlertsOnceMutingPeriodHasEnded,omitempty"` // Starting time of an alert muting rule, in Unix time format UTC. If not specified, defaults to the current time. **read/write**. diff --git a/alertmuting/model_alert_muting_rule_recurrence.go b/alertmuting/model_alert_muting_rule_recurrence.go new file mode 100644 index 0000000..653b1e6 --- /dev/null +++ b/alertmuting/model_alert_muting_rule_recurrence.go @@ -0,0 +1,6 @@ +package alertmuting + +type AlertMutingRuleRecurrence struct { + Value int32 `json:"value,omitempty"` + Unit string `json:"unit,omitempty"` +} diff --git a/alertmuting/model_create_update_alert_muting_rule_request.go b/alertmuting/model_create_update_alert_muting_rule_request.go index 25c3239..7c71299 100644 --- a/alertmuting/model_create_update_alert_muting_rule_request.go +++ b/alertmuting/model_create_update_alert_muting_rule_request.go @@ -15,6 +15,8 @@ type CreateUpdateAlertMutingRuleRequest struct { Description string `json:"description,omitempty"` // List of alert muting filters for this rule, in the form of a JSON array of alert muting filter objects. Each object is a set of conditions for an alert muting rule. Each object property (name-value pair) specifies a dimension or custom property to match to alert events. **read/write** Filters []*AlertMutingRuleFilter `json:"filters,omitempty"` + // Recurrence period of the muting rule. **read/write** + Recurrence *AlertMutingRuleRecurrence `json:"recurrence,omitempty"` // Toggle if alerts should be sent once the muting period is over. If not specified, defaults to true **read/write** SendAlertsOnceMutingPeriodHasEnded bool `json:"sendAlertsOnceMutingPeriodHasEnded,omitempty"` // Starting time of an alert muting rule, in Unix time format UTC. If not specified, defaults to the current time. **read/write**. diff --git a/alertmuting_test.go b/alertmuting_test.go index 7c6c746..5bec24a 100644 --- a/alertmuting_test.go +++ b/alertmuting_test.go @@ -69,6 +69,9 @@ func TestGetAlertMutingRule(t *testing.T) { result, err := client.GetAlertMutingRule(context.Background(), "string") assert.NoError(t, err, "Unexpected error getting alert mutnig rule") assert.Equal(t, result.Description, "string", "Name does not match") + assert.NotNil(t, result.Recurrence, "Recurrence is nil") + assert.Equal(t, "d", result.Recurrence.Unit, "Recurrence Unit does not match") + assert.Equal(t, int32(10), result.Recurrence.Value, "Recurrence Value does not match") assert.Equal(t, "server6", result.Filters[0].PropertyValue.Values[1], "Property Value does not match") } @@ -115,8 +118,15 @@ func TestUpdateAlertMutingRule(t *testing.T) { result, err := client.UpdateAlertMutingRule(context.Background(), "string", &alertmuting.CreateUpdateAlertMutingRuleRequest{ Description: "string", + Recurrence: &alertmuting.AlertMutingRuleRecurrence{ + Unit: "d", + Value: 10, + }, }) assert.NoError(t, err, "Unexpected error updating alert muting rule") + assert.NotNil(t, result.Recurrence, "Recurrence is nil") + assert.Equal(t, "d", result.Recurrence.Unit, "Recurrence Unit does not match") + assert.Equal(t, int32(10), result.Recurrence.Value, "Recurrence Value does not match") assert.Equal(t, "string", result.Description, "Description does not match") } diff --git a/testdata/fixtures/alertmuting/get_success.json b/testdata/fixtures/alertmuting/get_success.json index fd758d1..b308f78 100644 --- a/testdata/fixtures/alertmuting/get_success.json +++ b/testdata/fixtures/alertmuting/get_success.json @@ -12,5 +12,9 @@ "lastUpdated": 1557689430000, "lastUpdatedBy": "string", "startTime": 0, - "stopTime": 0 + "stopTime": 0, + "recurrence": { + "unit": "d", + "value": 10 + } } diff --git a/testdata/fixtures/alertmuting/update_success.json b/testdata/fixtures/alertmuting/update_success.json index 88fa0d3..7de7aac 100644 --- a/testdata/fixtures/alertmuting/update_success.json +++ b/testdata/fixtures/alertmuting/update_success.json @@ -12,5 +12,9 @@ "lastUpdated": 1557689430000, "lastUpdatedBy": "string", "startTime": 0, - "stopTime": 0 + "stopTime": 0, + "recurrence": { + "unit": "d", + "value": 10 + } }