Alerting: Mute Timing service to prevent changing provenance status to none (#88462)

* use relaxed validation to not introduce breaking changes for now but to be able to use the service
in non-provisioning APIs.
This commit is contained in:
Yuri Tseretyan
2024-06-04 08:54:33 -04:00
committed by GitHub
parent 25c57f21cd
commit a63ef42816
7 changed files with 182 additions and 22 deletions
+2 -2
View File
@@ -56,7 +56,7 @@ type MuteTimingService interface {
GetMuteTiming(ctx context.Context, name string, orgID int64) (definitions.MuteTimeInterval, error)
CreateMuteTiming(ctx context.Context, mt definitions.MuteTimeInterval, orgID int64) (definitions.MuteTimeInterval, error)
UpdateMuteTiming(ctx context.Context, mt definitions.MuteTimeInterval, orgID int64) (definitions.MuteTimeInterval, error)
DeleteMuteTiming(ctx context.Context, name string, orgID int64) error
DeleteMuteTiming(ctx context.Context, name string, orgID int64, provenance definitions.Provenance) error
}
type AlertRuleService interface {
@@ -303,7 +303,7 @@ func (srv *ProvisioningSrv) RoutePutMuteTiming(c *contextmodel.ReqContext, mt de
}
func (srv *ProvisioningSrv) RouteDeleteMuteTiming(c *contextmodel.ReqContext, name string) response.Response {
err := srv.muteTimings.DeleteMuteTiming(c.Req.Context(), name, c.SignedInUser.GetOrgID())
err := srv.muteTimings.DeleteMuteTiming(c.Req.Context(), name, c.SignedInUser.GetOrgID(), determineProvenance(c))
if err != nil {
return response.ErrOrFallback(http.StatusInternalServerError, "failed to delete mute timing", err)
}