From 8254bf6e371ce40df949938e6757da76a9dcf5f8 Mon Sep 17 00:00:00 2001 From: Yuri Tseretyan Date: Thu, 7 Dec 2023 16:26:20 -0500 Subject: [PATCH] add support for location field to mute timings --- alerting_mute_timing.go | 4 ++++ alerting_mute_timing_test.go | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/alerting_mute_timing.go b/alerting_mute_timing.go index b6d79bb6..80f813da 100644 --- a/alerting_mute_timing.go +++ b/alerting_mute_timing.go @@ -19,6 +19,7 @@ type TimeInterval struct { DaysOfMonth []DayOfMonthRange `json:"days_of_month,omitempty"` Months []MonthRange `json:"months,omitempty"` Years []YearRange `json:"years,omitempty"` + Location Location `json:"location,omitempty"` } // TimeRange represents a range of minutes within a 1440 minute day, exclusive of the End minute. @@ -39,6 +40,9 @@ type MonthRange string // A YearRange is a positive inclusive range of years, e.g. "2030" or "2021:2022". type YearRange string +// A Location time zone for the time interval in IANA time zone database, e.g. "America/New_York" +type Location string + // MuteTimings fetches all mute timings. func (c *Client) MuteTimings() ([]MuteTiming, error) { mts := make([]MuteTiming, 0) diff --git a/alerting_mute_timing_test.go b/alerting_mute_timing_test.go index b3b7111c..758b9a95 100644 --- a/alerting_mute_timing_test.go +++ b/alerting_mute_timing_test.go @@ -100,6 +100,7 @@ func createMuteTiming() MuteTiming { Weekdays: []WeekdayRange{"monday", "wednesday"}, Months: []MonthRange{"1:3", "4"}, Years: []YearRange{"2022", "2023"}, + Location: "America/New_York", }, }, } @@ -122,7 +123,8 @@ const getMuteTimingsJSON = ` ], "months": [ "1" - ] + ], + "location": "America/New_York" } ] },