diff --git a/.apigentools-info b/.apigentools-info index cfc4b9995b2..daf813982a1 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.4", - "regenerated": "2022-10-31 18:53:29.504722", - "spec_repo_commit": "06929484" + "regenerated": "2022-10-31 20:12:34.768350", + "spec_repo_commit": "420bd229" }, "v2": { "apigentools_version": "1.6.4", - "regenerated": "2022-10-31 18:53:29.521764", - "spec_repo_commit": "06929484" + "regenerated": "2022-10-31 20:12:34.781417", + "spec_repo_commit": "420bd229" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 9736bad7b6d..625d00e6e38 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -6340,6 +6340,8 @@ components: to `false` for sparse metrics,\notherwise some evaluations are skipped. Default is false." type: boolean + scheduling_options: + $ref: '#/components/schemas/MonitorOptionsSchedulingOptions' silenced: additionalProperties: description: UTC epoch timestamp in seconds when the downtime for the @@ -6391,6 +6393,39 @@ components: type: string readOnly: true type: object + MonitorOptionsSchedulingOptions: + description: Configuration options for scheduling. + properties: + evaluation_window: + $ref: '#/components/schemas/MonitorOptionsSchedulingOptionsEvaluationWindow' + type: object + MonitorOptionsSchedulingOptionsEvaluationWindow: + description: 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. + 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. + example: 04:00 + type: string + hour_starts: + description: The minute of the hour at which a one hour cumulative evaluation + window starts. + example: 0 + format: int32 + maximum: 59 + minimum: 0 + type: integer + month_starts: + description: The day of the month at which a one month cumulative evaluation + window starts. + example: 1 + format: int32 + maximum: 1 + minimum: 1 + type: integer + type: object MonitorOverallStates: description: The different states your monitor can be in. enum: diff --git a/api/datadogV1/model_monitor_options.go b/api/datadogV1/model_monitor_options.go index fadacd37fd4..4fcc89ccc0c 100644 --- a/api/datadogV1/model_monitor_options.go +++ b/api/datadogV1/model_monitor_options.go @@ -95,6 +95,8 @@ type MonitorOptions struct { // We highly recommend you set this to `false` for sparse metrics, // otherwise some evaluations are skipped. Default is false. RequireFullWindow *bool `json:"require_full_window,omitempty"` + // Configuration options for scheduling. + SchedulingOptions *MonitorOptionsSchedulingOptions `json:"scheduling_options,omitempty"` // Information about the downtime applied to the monitor. // Deprecated Silenced map[string]int64 `json:"silenced,omitempty"` @@ -877,6 +879,34 @@ func (o *MonitorOptions) SetRequireFullWindow(v bool) { o.RequireFullWindow = &v } +// GetSchedulingOptions returns the SchedulingOptions field value if set, zero value otherwise. +func (o *MonitorOptions) GetSchedulingOptions() MonitorOptionsSchedulingOptions { + if o == nil || o.SchedulingOptions == nil { + var ret MonitorOptionsSchedulingOptions + return ret + } + return *o.SchedulingOptions +} + +// GetSchedulingOptionsOk returns a tuple with the SchedulingOptions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorOptions) GetSchedulingOptionsOk() (*MonitorOptionsSchedulingOptions, bool) { + if o == nil || o.SchedulingOptions == nil { + return nil, false + } + return o.SchedulingOptions, true +} + +// HasSchedulingOptions returns a boolean if a field has been set. +func (o *MonitorOptions) HasSchedulingOptions() bool { + return o != nil && o.SchedulingOptions != nil +} + +// SetSchedulingOptions gets a reference to the given MonitorOptionsSchedulingOptions and assigns it to the SchedulingOptions field. +func (o *MonitorOptions) SetSchedulingOptions(v MonitorOptionsSchedulingOptions) { + o.SchedulingOptions = &v +} + // GetSilenced returns the Silenced field value if set, zero value otherwise. // Deprecated func (o *MonitorOptions) GetSilenced() map[string]int64 { @@ -1145,6 +1175,9 @@ func (o MonitorOptions) MarshalJSON() ([]byte, error) { if o.RequireFullWindow != nil { toSerialize["require_full_window"] = o.RequireFullWindow } + if o.SchedulingOptions != nil { + toSerialize["scheduling_options"] = o.SchedulingOptions + } if o.Silenced != nil { toSerialize["silenced"] = o.Silenced } @@ -1196,6 +1229,7 @@ func (o *MonitorOptions) UnmarshalJSON(bytes []byte) (err error) { RenotifyOccurrences datadog.NullableInt64 `json:"renotify_occurrences,omitempty"` RenotifyStatuses []MonitorRenotifyStatusType `json:"renotify_statuses,omitempty"` RequireFullWindow *bool `json:"require_full_window,omitempty"` + SchedulingOptions *MonitorOptionsSchedulingOptions `json:"scheduling_options,omitempty"` Silenced map[string]int64 `json:"silenced,omitempty"` SyntheticsCheckId datadog.NullableString `json:"synthetics_check_id,omitempty"` ThresholdWindows *MonitorThresholdWindowOptions `json:"threshold_windows,omitempty"` @@ -1249,6 +1283,14 @@ func (o *MonitorOptions) UnmarshalJSON(bytes []byte) (err error) { o.RenotifyOccurrences = all.RenotifyOccurrences o.RenotifyStatuses = all.RenotifyStatuses o.RequireFullWindow = all.RequireFullWindow + if all.SchedulingOptions != nil && all.SchedulingOptions.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.SchedulingOptions = all.SchedulingOptions o.Silenced = all.Silenced o.SyntheticsCheckId = all.SyntheticsCheckId if all.ThresholdWindows != nil && all.ThresholdWindows.UnparsedObject != nil && o.UnparsedObject == nil { diff --git a/api/datadogV1/model_monitor_options_scheduling_options.go b/api/datadogV1/model_monitor_options_scheduling_options.go new file mode 100644 index 00000000000..ef7d2801e8e --- /dev/null +++ b/api/datadogV1/model_monitor_options_scheduling_options.go @@ -0,0 +1,105 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV1 + +import ( + "encoding/json" +) + +// MonitorOptionsSchedulingOptions Configuration options for scheduling. +type MonitorOptionsSchedulingOptions struct { + // 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. + EvaluationWindow *MonitorOptionsSchedulingOptionsEvaluationWindow `json:"evaluation_window,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{} +} + +// NewMonitorOptionsSchedulingOptions instantiates a new MonitorOptionsSchedulingOptions object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewMonitorOptionsSchedulingOptions() *MonitorOptionsSchedulingOptions { + this := MonitorOptionsSchedulingOptions{} + return &this +} + +// NewMonitorOptionsSchedulingOptionsWithDefaults instantiates a new MonitorOptionsSchedulingOptions object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewMonitorOptionsSchedulingOptionsWithDefaults() *MonitorOptionsSchedulingOptions { + this := MonitorOptionsSchedulingOptions{} + return &this +} + +// GetEvaluationWindow returns the EvaluationWindow field value if set, zero value otherwise. +func (o *MonitorOptionsSchedulingOptions) GetEvaluationWindow() MonitorOptionsSchedulingOptionsEvaluationWindow { + if o == nil || o.EvaluationWindow == nil { + var ret MonitorOptionsSchedulingOptionsEvaluationWindow + return ret + } + return *o.EvaluationWindow +} + +// GetEvaluationWindowOk returns a tuple with the EvaluationWindow field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorOptionsSchedulingOptions) GetEvaluationWindowOk() (*MonitorOptionsSchedulingOptionsEvaluationWindow, bool) { + if o == nil || o.EvaluationWindow == nil { + return nil, false + } + return o.EvaluationWindow, true +} + +// HasEvaluationWindow returns a boolean if a field has been set. +func (o *MonitorOptionsSchedulingOptions) HasEvaluationWindow() bool { + return o != nil && o.EvaluationWindow != nil +} + +// SetEvaluationWindow gets a reference to the given MonitorOptionsSchedulingOptionsEvaluationWindow and assigns it to the EvaluationWindow field. +func (o *MonitorOptionsSchedulingOptions) SetEvaluationWindow(v MonitorOptionsSchedulingOptionsEvaluationWindow) { + o.EvaluationWindow = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorOptionsSchedulingOptions) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.EvaluationWindow != nil { + toSerialize["evaluation_window"] = o.EvaluationWindow + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorOptionsSchedulingOptions) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + EvaluationWindow *MonitorOptionsSchedulingOptionsEvaluationWindow `json:"evaluation_window,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + if all.EvaluationWindow != nil && all.EvaluationWindow.UnparsedObject != nil && o.UnparsedObject == nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + } + o.EvaluationWindow = all.EvaluationWindow + return nil +} diff --git a/api/datadogV1/model_monitor_options_scheduling_options_evaluation_window.go b/api/datadogV1/model_monitor_options_scheduling_options_evaluation_window.go new file mode 100644 index 00000000000..643ea227ac9 --- /dev/null +++ b/api/datadogV1/model_monitor_options_scheduling_options_evaluation_window.go @@ -0,0 +1,168 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV1 + +import ( + "encoding/json" +) + +// 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. + 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"` + // 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{} +} + +// NewMonitorOptionsSchedulingOptionsEvaluationWindow instantiates a new MonitorOptionsSchedulingOptionsEvaluationWindow object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewMonitorOptionsSchedulingOptionsEvaluationWindow() *MonitorOptionsSchedulingOptionsEvaluationWindow { + this := MonitorOptionsSchedulingOptionsEvaluationWindow{} + return &this +} + +// NewMonitorOptionsSchedulingOptionsEvaluationWindowWithDefaults instantiates a new MonitorOptionsSchedulingOptionsEvaluationWindow object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewMonitorOptionsSchedulingOptionsEvaluationWindowWithDefaults() *MonitorOptionsSchedulingOptionsEvaluationWindow { + this := MonitorOptionsSchedulingOptionsEvaluationWindow{} + return &this +} + +// GetDayStarts returns the DayStarts field value if set, zero value otherwise. +func (o *MonitorOptionsSchedulingOptionsEvaluationWindow) GetDayStarts() string { + if o == nil || o.DayStarts == nil { + var ret string + return ret + } + return *o.DayStarts +} + +// GetDayStartsOk returns a tuple with the DayStarts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorOptionsSchedulingOptionsEvaluationWindow) GetDayStartsOk() (*string, bool) { + if o == nil || o.DayStarts == nil { + return nil, false + } + return o.DayStarts, true +} + +// HasDayStarts returns a boolean if a field has been set. +func (o *MonitorOptionsSchedulingOptionsEvaluationWindow) HasDayStarts() bool { + return o != nil && o.DayStarts != nil +} + +// SetDayStarts gets a reference to the given string and assigns it to the DayStarts field. +func (o *MonitorOptionsSchedulingOptionsEvaluationWindow) SetDayStarts(v string) { + o.DayStarts = &v +} + +// GetHourStarts returns the HourStarts field value if set, zero value otherwise. +func (o *MonitorOptionsSchedulingOptionsEvaluationWindow) GetHourStarts() int32 { + if o == nil || o.HourStarts == nil { + var ret int32 + return ret + } + return *o.HourStarts +} + +// GetHourStartsOk returns a tuple with the HourStarts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorOptionsSchedulingOptionsEvaluationWindow) GetHourStartsOk() (*int32, bool) { + if o == nil || o.HourStarts == nil { + return nil, false + } + return o.HourStarts, true +} + +// HasHourStarts returns a boolean if a field has been set. +func (o *MonitorOptionsSchedulingOptionsEvaluationWindow) HasHourStarts() bool { + return o != nil && o.HourStarts != nil +} + +// SetHourStarts gets a reference to the given int32 and assigns it to the HourStarts field. +func (o *MonitorOptionsSchedulingOptionsEvaluationWindow) SetHourStarts(v int32) { + o.HourStarts = &v +} + +// GetMonthStarts returns the MonthStarts field value if set, zero value otherwise. +func (o *MonitorOptionsSchedulingOptionsEvaluationWindow) GetMonthStarts() int32 { + if o == nil || o.MonthStarts == nil { + var ret int32 + return ret + } + return *o.MonthStarts +} + +// GetMonthStartsOk returns a tuple with the MonthStarts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MonitorOptionsSchedulingOptionsEvaluationWindow) GetMonthStartsOk() (*int32, bool) { + if o == nil || o.MonthStarts == nil { + return nil, false + } + return o.MonthStarts, true +} + +// HasMonthStarts returns a boolean if a field has been set. +func (o *MonitorOptionsSchedulingOptionsEvaluationWindow) HasMonthStarts() bool { + return o != nil && o.MonthStarts != nil +} + +// SetMonthStarts gets a reference to the given int32 and assigns it to the MonthStarts field. +func (o *MonitorOptionsSchedulingOptionsEvaluationWindow) SetMonthStarts(v int32) { + o.MonthStarts = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o MonitorOptionsSchedulingOptionsEvaluationWindow) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return json.Marshal(o.UnparsedObject) + } + if o.DayStarts != nil { + toSerialize["day_starts"] = o.DayStarts + } + if o.HourStarts != nil { + toSerialize["hour_starts"] = o.HourStarts + } + if o.MonthStarts != nil { + toSerialize["month_starts"] = o.MonthStarts + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return json.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *MonitorOptionsSchedulingOptionsEvaluationWindow) UnmarshalJSON(bytes []byte) (err error) { + raw := map[string]interface{}{} + all := struct { + DayStarts *string `json:"day_starts,omitempty"` + HourStarts *int32 `json:"hour_starts,omitempty"` + MonthStarts *int32 `json:"month_starts,omitempty"` + }{} + err = json.Unmarshal(bytes, &all) + if err != nil { + err = json.Unmarshal(bytes, &raw) + if err != nil { + return err + } + o.UnparsedObject = raw + return nil + } + o.DayStarts = all.DayStarts + o.HourStarts = all.HourStarts + o.MonthStarts = all.MonthStarts + return nil +} diff --git a/examples/v1/monitors/CreateMonitor_2012680290.go b/examples/v1/monitors/CreateMonitor_2012680290.go new file mode 100644 index 00000000000..014a9245df0 --- /dev/null +++ b/examples/v1/monitors/CreateMonitor_2012680290.go @@ -0,0 +1,46 @@ +// Create a metric monitor returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV1" +) + +func main() { + body := datadogV1.Monitor{ + Name: datadog.PtrString("Example-Create_a_metric_monitor_returns_OK_response"), + Type: datadogV1.MONITORTYPE_METRIC_ALERT, + Query: "avg(current_1d):avg:system.load.5{*} > 0.5", + Message: datadog.PtrString("some message Notify: @hipchat-channel"), + Options: &datadogV1.MonitorOptions{ + Thresholds: &datadogV1.MonitorThresholds{ + Critical: datadog.PtrFloat64(0.5), + }, + SchedulingOptions: &datadogV1.MonitorOptionsSchedulingOptions{ + EvaluationWindow: &datadogV1.MonitorOptionsSchedulingOptionsEvaluationWindow{ + DayStarts: datadog.PtrString("04:00"), + MonthStarts: datadog.PtrInt32(1), + }, + }, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV1.NewMonitorsApi(apiClient) + resp, r, err := api.CreateMonitor(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MonitorsApi.CreateMonitor`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `MonitorsApi.CreateMonitor`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Create_a_metric_monitor_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Create_a_metric_monitor_returns_OK_response.freeze new file mode 100644 index 00000000000..74d4860bcce --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Create_a_metric_monitor_returns_OK_response.freeze @@ -0,0 +1 @@ +2022-10-28T19:34:06.761Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Create_a_metric_monitor_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Create_a_metric_monitor_returns_OK_response.yaml new file mode 100644 index 00000000000..5263a058081 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Create_a_metric_monitor_returns_OK_response.yaml @@ -0,0 +1,43 @@ +interactions: +- request: + body: | + {"message":"some message Notify: @hipchat-channel","name":"Test-Create_a_metric_monitor_returns_OK_response-1666985646","options":{"scheduling_options":{"evaluation_window":{"day_starts":"04:00","month_starts":1}},"thresholds":{"critical":0.5}},"query":"avg(current_1d):avg:system.load.5{*} \u003e 0.5","type":"metric alert"} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + url: https://api.datadoghq.com/api/v1/monitor + response: + body: '{"restricted_roles":null,"tags":[],"deleted":null,"query":"avg(current_1d):avg:system.load.5{*} + > 0.5","message":"some message Notify: @hipchat-channel","id":101334182,"multi":false,"name":"Test-Create_a_metric_monitor_returns_OK_response-1666985646","created":"2022-10-28T19:34:06.916192+00:00","created_at":1666985646000,"creator":{"id":1445416,"handle":"frog@datadoghq.com","name":null,"email":"frog@datadoghq.com"},"org_id":321813,"modified":"2022-10-28T19:34:06.916192+00:00","priority":null,"overall_state_modified":null,"overall_state":"No + Data","type":"query alert","options":{"notify_audit":false,"scheduling_options":{"evaluation_window":{"day_starts":"04:00","month_starts":1}},"include_tags":true,"thresholds":{"critical":0.5},"silenced":{},"new_host_delay":300,"notify_no_data":false}} + + ' + code: 200 + duration: '' + headers: + Content-Type: + - application/json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - application/json + method: DELETE + url: https://api.datadoghq.com/api/v1/monitor/101334182 + response: + body: '{"deleted_monitor_id":101334182} + + ' + code: 200 + duration: '' + headers: + Content-Type: + - application/json + status: 200 OK +version: 1 diff --git a/tests/scenarios/features/v1/monitors.feature b/tests/scenarios/features/v1/monitors.feature index 15e92f86b21..b0e43e00ae0 100644 --- a/tests/scenarios/features/v1/monitors.feature +++ b/tests/scenarios/features/v1/monitors.feature @@ -67,6 +67,13 @@ Feature: Monitors When the request is sent Then the response status is 200 OK + @team:DataDog/monitor-app + Scenario: Create a metric monitor returns "OK" response + Given new "CreateMonitor" request + And body with value {"name": "{{ unique }}", "type": "metric alert", "query": "avg(current_1d):avg:system.load.5{*} > 0.5", "message": "some message Notify: @hipchat-channel", "options":{"thresholds":{"critical":0.5}, "scheduling_options":{"evaluation_window":{"day_starts":"04:00", "month_starts":1}}}} + When the request is sent + Then the response status is 200 OK + @team:DataDog/monitor-app Scenario: Create a monitor returns "Bad Request" response Given new "CreateMonitor" request @@ -115,7 +122,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": {"escalation_message": "none", "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, "notify_audit": false, "notify_by": [], "notify_no_data": false, "on_missing_data": "default", "renotify_interval": null, "renotify_occurrences": null, "renotify_statuses": ["alert"], "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"}}]}, "restricted_roles": [], "tags": [], "type": "query alert"} + And body with value {"options": {"escalation_message": "none", "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, "notify_audit": false, "notify_by": [], "notify_no_data": false, "on_missing_data": "default", "renotify_interval": null, "renotify_occurrences": null, "renotify_statuses": ["alert"], "scheduling_options": {"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"}}]}, "restricted_roles": [], "tags": [], "type": "query alert"} When the request is sent Then the response status is 400 Bad Request