From cbc82391f2a820fcf5b01d1a637942553a956ba3 Mon Sep 17 00:00:00 2001 From: Diego Bonfigli Date: Thu, 2 May 2024 10:47:59 +0200 Subject: [PATCH] fix(alerts): use correct type un api for downtime alerts (#509) fix(alerts): use correct type un api for downtime alerts --- sysdig/internal/client/v2/alerts_v2.go | 1 + sysdig/internal/client/v2/model.go | 1 - sysdig/resource_sysdig_monitor_alert_v2_downtime.go | 4 +--- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/sysdig/internal/client/v2/alerts_v2.go b/sysdig/internal/client/v2/alerts_v2.go index 8a8e085a..3d88e23a 100644 --- a/sysdig/internal/client/v2/alerts_v2.go +++ b/sysdig/internal/client/v2/alerts_v2.go @@ -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" diff --git a/sysdig/internal/client/v2/model.go b/sysdig/internal/client/v2/model.go index ebd3d28c..bdc33bb7 100644 --- a/sysdig/internal/client/v2/model.go +++ b/sysdig/internal/client/v2/model.go @@ -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 { diff --git a/sysdig/resource_sysdig_monitor_alert_v2_downtime.go b/sysdig/resource_sysdig_monitor_alert_v2_downtime.go index 94366300..67410041 100644 --- a/sysdig/resource_sysdig_monitor_alert_v2_downtime.go +++ b/sysdig/resource_sysdig_monitor_alert_v2_downtime.go @@ -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) @@ -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)