Skip to content

Commit

Permalink
fix(alerts): use correct type un api for downtime alerts (#509)
Browse files Browse the repository at this point in the history
fix(alerts): use correct type un api for downtime alerts
  • Loading branch information
dbonf authored May 2, 2024
1 parent a76a098 commit cbc8239
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
1 change: 1 addition & 0 deletions sysdig/internal/client/v2/alerts_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const (
AlertV2TypeChange AlertV2Type = "PERCENTAGE_OF_CHANGE"
AlertV2TypeFormBasedPrometheus AlertV2Type = "FORM_BASED_PROMETHEUS"
AlertV2TypeGroupOutlier AlertV2Type = "GROUP_OUTLIERS"
AlertV2TypeDowntime AlertV2Type = "DOWNTIME"

AlertV2SeverityHigh AlertV2Severity = "high"
AlertV2SeverityMedium AlertV2Severity = "medium"
Expand Down
1 change: 0 additions & 1 deletion sysdig/internal/client/v2/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,6 @@ type AlertV2ConfigDowntime struct {
GroupAggregation string `json:"groupAggregation"`
TimeAggregation string `json:"timeAggregation"`
Metric AlertMetricDescriptorV2 `json:"metric"`
NoDataBehaviour string `json:"noDataBehaviour"`
}

type AlertV2Downtime struct {
Expand Down
4 changes: 1 addition & 3 deletions sysdig/resource_sysdig_monitor_alert_v2_downtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func resourceSysdigMonitorAlertV2DowntimeDelete(ctx context.Context, d *schema.R

func buildAlertV2DowntimeStruct(d *schema.ResourceData) *v2.AlertV2Downtime {
alertV2Common := buildAlertV2CommonStruct(d)
alertV2Common.Type = string(v2.AlertV2TypeManual)
alertV2Common.Type = string(v2.AlertV2TypeDowntime)
config := v2.AlertV2ConfigDowntime{}

buildScopedSegmentedConfigStruct(d, &config.ScopedSegmentedConfig)
Expand All @@ -175,8 +175,6 @@ func buildAlertV2DowntimeStruct(d *schema.ResourceData) *v2.AlertV2Downtime {
metric := d.Get("metric").(string)
config.Metric.ID = metric

config.NoDataBehaviour = "DO_NOTHING"

var unreportedAlertNotificationsRetentionSec *int
if unreportedAlertNotificationsRetentionSecInterface, ok := d.GetOk("unreported_alert_notifications_retention_seconds"); ok {
u := unreportedAlertNotificationsRetentionSecInterface.(int)
Expand Down

0 comments on commit cbc8239

Please sign in to comment.