diff --git a/.apigentools-info b/.apigentools-info index 567b048fb1c..c85f9fafbb2 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-02-24 14:19:07.230112", - "spec_repo_commit": "b34a35ef" + "regenerated": "2025-02-24 18:17:18.536080", + "spec_repo_commit": "5f4a614e" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-02-24 14:19:07.246168", - "spec_repo_commit": "b34a35ef" + "regenerated": "2025-02-24 18:17:18.551562", + "spec_repo_commit": "5f4a614e" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 595a7442a15..fbb13d77ad4 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -7437,7 +7437,7 @@ components: properties: day_starts: description: The time of the day at which a one day cumulative evaluation - window starts. Must be defined in UTC time in `HH:mm` format. + window starts. example: 04:00 type: string hour_starts: @@ -7456,6 +7456,11 @@ components: maximum: 1 minimum: 1 type: integer + timezone: + description: The timezone of the time of the day of the cumulative evaluation + window start. + example: Europe/Paris + type: string type: object MonitorOverallStates: description: The different states your monitor can be in. diff --git a/api/datadogV1/model_monitor_options_scheduling_options_evaluation_window.go b/api/datadogV1/model_monitor_options_scheduling_options_evaluation_window.go index a14224adb86..c92196a3273 100644 --- a/api/datadogV1/model_monitor_options_scheduling_options_evaluation_window.go +++ b/api/datadogV1/model_monitor_options_scheduling_options_evaluation_window.go @@ -10,12 +10,14 @@ import ( // MonitorOptionsSchedulingOptionsEvaluationWindow Configuration options for the evaluation window. If `hour_starts` is set, no other fields may be set. Otherwise, `day_starts` and `month_starts` must be set together. type MonitorOptionsSchedulingOptionsEvaluationWindow struct { - // The time of the day at which a one day cumulative evaluation window starts. Must be defined in UTC time in `HH:mm` format. + // The time of the day at which a one day cumulative evaluation window starts. DayStarts *string `json:"day_starts,omitempty"` // The minute of the hour at which a one hour cumulative evaluation window starts. HourStarts *int32 `json:"hour_starts,omitempty"` // The day of the month at which a one month cumulative evaluation window starts. MonthStarts *int32 `json:"month_starts,omitempty"` + // The timezone of the time of the day of the cumulative evaluation window start. + Timezone *string `json:"timezone,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` AdditionalProperties map[string]interface{} `json:"-"` @@ -122,6 +124,34 @@ func (o *MonitorOptionsSchedulingOptionsEvaluationWindow) SetMonthStarts(v int32 o.MonthStarts = &v } +// GetTimezone returns the Timezone field value if set, zero value otherwise. +func (o *MonitorOptionsSchedulingOptionsEvaluationWindow) GetTimezone() string { + if o == nil || o.Timezone == nil { + var ret string + return ret + } + return *o.Timezone +} + +// GetTimezoneOk returns a tuple with the Timezone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorOptionsSchedulingOptionsEvaluationWindow) GetTimezoneOk() (*string, bool) { + if o == nil || o.Timezone == nil { + return nil, false + } + return o.Timezone, true +} + +// HasTimezone returns a boolean if a field has been set. +func (o *MonitorOptionsSchedulingOptionsEvaluationWindow) HasTimezone() bool { + return o != nil && o.Timezone != nil +} + +// SetTimezone gets a reference to the given string and assigns it to the Timezone field. +func (o *MonitorOptionsSchedulingOptionsEvaluationWindow) SetTimezone(v string) { + o.Timezone = &v +} + // MarshalJSON serializes the struct using spec logic. func (o MonitorOptionsSchedulingOptionsEvaluationWindow) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -137,6 +167,9 @@ func (o MonitorOptionsSchedulingOptionsEvaluationWindow) MarshalJSON() ([]byte, if o.MonthStarts != nil { toSerialize["month_starts"] = o.MonthStarts } + if o.Timezone != nil { + toSerialize["timezone"] = o.Timezone + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -150,19 +183,21 @@ func (o *MonitorOptionsSchedulingOptionsEvaluationWindow) UnmarshalJSON(bytes [] DayStarts *string `json:"day_starts,omitempty"` HourStarts *int32 `json:"hour_starts,omitempty"` MonthStarts *int32 `json:"month_starts,omitempty"` + Timezone *string `json:"timezone,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"day_starts", "hour_starts", "month_starts"}) + datadog.DeleteKeys(additionalProperties, &[]string{"day_starts", "hour_starts", "month_starts", "timezone"}) } else { return err } o.DayStarts = all.DayStarts o.HourStarts = all.HourStarts o.MonthStarts = all.MonthStarts + o.Timezone = all.Timezone if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/tests/scenarios/features/v1/monitors.feature b/tests/scenarios/features/v1/monitors.feature index bb344afd780..05ef98216ed 100644 --- a/tests/scenarios/features/v1/monitors.feature +++ b/tests/scenarios/features/v1/monitors.feature @@ -164,7 +164,7 @@ Feature: Monitors Scenario: Edit a monitor returns "Bad Request" response Given new "UpdateMonitor" request And request contains "monitor_id" parameter from "REPLACE.ME" - And body with value {"options": {"evaluation_delay": null, "include_tags": true, "min_failure_duration": 0, "min_location_failed": 1, "new_group_delay": null, "new_host_delay": 300, "no_data_timeframe": null, "notification_preset_name": "show_all", "notify_audit": false, "notify_by": [], "on_missing_data": "default", "renotify_interval": null, "renotify_occurrences": null, "renotify_statuses": ["alert"], "scheduling_options": {"custom_schedule": {"recurrences": [{"rrule": "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR", "start": "2023-08-31T16:30:00", "timezone": "Europe/Paris"}]}, "evaluation_window": {"day_starts": "04:00", "hour_starts": 0, "month_starts": 1}}, "synthetics_check_id": null, "threshold_windows": {"recovery_window": null, "trigger_window": null}, "thresholds": {"critical_recovery": null, "ok": null, "unknown": null, "warning": null, "warning_recovery": null}, "timeout_h": null, "variables": [{"compute": {"aggregation": "avg", "interval": 60000, "metric": "@duration"}, "data_source": "rum", "group_by": [{"facet": "status", "limit": 10, "sort": {"aggregation": "avg", "order": "desc"}}], "indexes": ["days-3", "days-7"], "name": "query_errors", "search": {"query": "service:query"}}]}, "priority": null, "restricted_roles": [], "tags": [], "type": "query alert"} + And body with value {"options": {"evaluation_delay": null, "include_tags": true, "min_failure_duration": 0, "min_location_failed": 1, "new_group_delay": null, "new_host_delay": 300, "no_data_timeframe": null, "notification_preset_name": "show_all", "notify_audit": false, "notify_by": [], "on_missing_data": "default", "renotify_interval": null, "renotify_occurrences": null, "renotify_statuses": ["alert"], "scheduling_options": {"custom_schedule": {"recurrences": [{"rrule": "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR", "start": "2023-08-31T16:30:00", "timezone": "Europe/Paris"}]}, "evaluation_window": {"day_starts": "04:00", "hour_starts": 0, "month_starts": 1, "timezone": "Europe/Paris"}}, "synthetics_check_id": null, "threshold_windows": {"recovery_window": null, "trigger_window": null}, "thresholds": {"critical_recovery": null, "ok": null, "unknown": null, "warning": null, "warning_recovery": null}, "timeout_h": null, "variables": [{"compute": {"aggregation": "avg", "interval": 60000, "metric": "@duration"}, "data_source": "rum", "group_by": [{"facet": "status", "limit": 10, "sort": {"aggregation": "avg", "order": "desc"}}], "indexes": ["days-3", "days-7"], "name": "query_errors", "search": {"query": "service:query"}}]}, "priority": null, "restricted_roles": [], "tags": [], "type": "query alert"} When the request is sent Then the response status is 400 Bad Request