diff --git a/.apigentools-info b/.apigentools-info index 8008c17e2f4..76cc0946f92 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.2", - "regenerated": "2022-04-05 10:17:39.328437", - "spec_repo_commit": "9a0922b9" + "regenerated": "2022-04-05 11:14:23.181836", + "spec_repo_commit": "1bea0809" }, "v2": { "apigentools_version": "1.6.2", - "regenerated": "2022-04-05 10:17:39.341191", - "spec_repo_commit": "9a0922b9" + "regenerated": "2022-04-05 11:14:23.204763", + "spec_repo_commit": "1bea0809" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 1ec4d796084..a538438c6ec 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -1270,6 +1270,7 @@ components: properties: deleted_monitor_id: description: ID of the deleted monitor. + example: 666486743 format: int64 type: integer readOnly: true @@ -21650,6 +21651,7 @@ paths: required: true schema: items: + example: 666486743 format: int64 type: integer type: array @@ -21925,6 +21927,7 @@ paths: name: monitor_id required: true schema: + example: 666486743 format: int64 type: integer - description: Delete the monitor even if it's referenced by other resources @@ -21988,6 +21991,7 @@ paths: name: monitor_id required: true schema: + example: 666486743 format: int64 type: integer - description: When specified, shows additional information about the group @@ -22044,6 +22048,7 @@ paths: name: monitor_id required: true schema: + example: 666486743 format: int64 type: integer requestBody: @@ -22145,6 +22150,60 @@ paths: x-menu-order: 7 x-undo: type: safe + /api/v1/monitor/{monitor_id}/validate: + post: + description: Validate the monitor provided in the request. + operationId: ValidateExistingMonitor + parameters: + - description: The ID of the monitor + in: path + name: monitor_id + required: true + schema: + example: 666486743 + format: int64 + type: integer + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Monitor' + description: Monitor request object + required: true + responses: + '200': + content: + application/json: + schema: + example: {} + type: object + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Invalid JSON + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - monitors_write + summary: Validate an existing monitor + tags: + - Monitors + x-codegen-request-body-name: body + x-menu-order: 8 + x-undo: + type: idempotent /api/v1/monthly_custom_reports: get: description: Get monthly custom reports. diff --git a/api/v1/datadog/api_monitors.go b/api/v1/datadog/api_monitors.go index e9184e4544a..2940f5d0a03 100644 --- a/api/v1/datadog/api_monitors.go +++ b/api/v1/datadog/api_monitors.go @@ -1723,6 +1723,171 @@ func (a *MonitorsApiService) updateMonitorExecute(r apiUpdateMonitorRequest) (Mo return localVarReturnValue, localVarHTTPResponse, nil } +type apiValidateExistingMonitorRequest struct { + ctx _context.Context + ApiService *MonitorsApiService + monitorId int64 + body *Monitor +} + +/* + * ValidateExistingMonitor Validate an existing monitor + * Validate the monitor provided in the request. + */ +func (a *MonitorsApiService) ValidateExistingMonitor(ctx _context.Context, monitorId int64, body Monitor) (interface{}, *_nethttp.Response, error) { + req := apiValidateExistingMonitorRequest{ + ApiService: a, + ctx: ctx, + monitorId: monitorId, + body: &body, + } + + return req.ApiService.validateExistingMonitorExecute(req) +} + +/* + * Execute executes the request + * @return interface{} + */ +func (a *MonitorsApiService) validateExistingMonitorExecute(r apiValidateExistingMonitorRequest) (interface{}, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte + localVarReturnValue interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MonitorsApiService.ValidateExistingMonitor") + if err != nil { + return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/api/v1/monitor/{monitor_id}/validate" + localVarPath = strings.Replace(localVarPath, "{"+"monitor_id"+"}", _neturl.PathEscape(parameterToString(r.monitorId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if r.body == nil { + return localVarReturnValue, nil, reportError("body is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + + // body params + localVarPostBody = r.body + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["apiKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-API-KEY"] = key + } + } + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["appKeyAuth"]; ok { + var key string + if apiKey.Prefix != "" { + key = apiKey.Prefix + " " + apiKey.Key + } else { + key = apiKey.Key + } + localVarHeaderParams["DD-APPLICATION-KEY"] = key + } + } + } + req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + type apiValidateMonitorRequest struct { ctx _context.Context ApiService *MonitorsApiService diff --git a/examples/v1/dashboards/CreateDashboard_2308247857.go b/examples/v1/dashboards/CreateDashboard_2308247857.go index a997ca33764..b171194a333 100644 --- a/examples/v1/dashboards/CreateDashboard_2308247857.go +++ b/examples/v1/dashboards/CreateDashboard_2308247857.go @@ -32,7 +32,7 @@ func main() { TitleAlign: datadog.WIDGETTEXTALIGN_LEFT.Ptr(), Time: &datadog.WidgetTime{}, Type: datadog.ALERTGRAPHWIDGETDEFINITIONTYPE_ALERT_GRAPH, - AlertId: "1", + AlertId: "7", VizType: datadog.WIDGETVIZTYPE_TIMESERIES, }}, }, diff --git a/examples/v1/dashboards/CreateDashboard_2316374332.go b/examples/v1/dashboards/CreateDashboard_2316374332.go index 3119644f0b9..597e5dee924 100644 --- a/examples/v1/dashboards/CreateDashboard_2316374332.go +++ b/examples/v1/dashboards/CreateDashboard_2316374332.go @@ -31,7 +31,7 @@ func main() { TitleSize: datadog.PtrString("16"), TitleAlign: datadog.WIDGETTEXTALIGN_LEFT.Ptr(), Type: datadog.ALERTVALUEWIDGETDEFINITIONTYPE_ALERT_VALUE, - AlertId: "1", + AlertId: "7", Unit: datadog.PtrString("auto"), TextAlign: datadog.WIDGETTEXTALIGN_LEFT.Ptr(), Precision: datadog.PtrInt64(2), diff --git a/examples/v1/monitors/ValidateExistingMonitor.go b/examples/v1/monitors/ValidateExistingMonitor.go new file mode 100644 index 00000000000..1520ad1136d --- /dev/null +++ b/examples/v1/monitors/ValidateExistingMonitor.go @@ -0,0 +1,61 @@ +// Validate an existing monitor returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + "strconv" + + datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog" +) + +func main() { + // there is a valid "monitor" in the system + MonitorID, _ := strconv.ParseInt(os.Getenv("MONITOR_ID"), 10, 64) + + body := datadog.Monitor{ + Name: datadog.PtrString("Example-Validate_an_existing_monitor_returns_OK_response"), + Type: datadog.MONITORTYPE_LOG_ALERT, + Query: `logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2`, + Message: datadog.PtrString("some message Notify: @hipchat-channel"), + Tags: &[]string{ + "test:examplevalidateanexistingmonitorreturnsokresponse", + "env:ci", + }, + Priority: *datadog.NewNullableInt64(datadog.PtrInt64(3)), + Options: &datadog.MonitorOptions{ + EnableLogsSample: datadog.PtrBool(true), + EscalationMessage: datadog.PtrString("the situation has escalated"), + EvaluationDelay: *datadog.NewNullableInt64(datadog.PtrInt64(700)), + GroupbySimpleMonitor: datadog.PtrBool(true), + IncludeTags: datadog.PtrBool(true), + Locked: datadog.PtrBool(false), + NewHostDelay: *datadog.NewNullableInt64(datadog.PtrInt64(600)), + NoDataTimeframe: *datadog.NewNullableInt64(nil), + NotifyAudit: datadog.PtrBool(false), + NotifyNoData: datadog.PtrBool(false), + RenotifyInterval: *datadog.NewNullableInt64(datadog.PtrInt64(60)), + RequireFullWindow: datadog.PtrBool(true), + TimeoutH: *datadog.NewNullableInt64(datadog.PtrInt64(24)), + Thresholds: &datadog.MonitorThresholds{ + Critical: datadog.PtrFloat64(2), + Warning: *datadog.NewNullableFloat64(datadog.PtrFloat64(1)), + }, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + resp, r, err := apiClient.MonitorsApi.ValidateExistingMonitor(ctx, MonitorID, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `MonitorsApi.ValidateExistingMonitor`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `MonitorsApi.ValidateExistingMonitor`:\n%s\n", responseContent) +} diff --git a/examples/v1/usage-metering/GetUsageBillableSummary.go b/examples/v1/usage-metering/GetUsageBillableSummary.go index 96caf8de621..416f253b5e7 100644 --- a/examples/v1/usage-metering/GetUsageBillableSummary.go +++ b/examples/v1/usage-metering/GetUsageBillableSummary.go @@ -7,7 +7,6 @@ import ( "encoding/json" "fmt" "os" - "time" datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog" ) @@ -16,7 +15,7 @@ func main() { ctx := datadog.NewDefaultContext(context.Background()) configuration := datadog.NewConfiguration() apiClient := datadog.NewAPIClient(configuration) - resp, r, err := apiClient.UsageMeteringApi.GetUsageBillableSummary(ctx, *datadog.NewGetUsageBillableSummaryOptionalParameters().WithMonth(time.Now().AddDate(0, 0, -3))) + resp, r, err := apiClient.UsageMeteringApi.GetUsageBillableSummary(ctx, *datadog.NewGetUsageBillableSummaryOptionalParameters()) if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetUsageBillableSummary`: %v\n", err) diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Validate_an_existing_monitor_returns_Invalid_JSON_response.freeze b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Validate_an_existing_monitor_returns_Invalid_JSON_response.freeze new file mode 100644 index 00000000000..f7fccb4c385 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Validate_an_existing_monitor_returns_Invalid_JSON_response.freeze @@ -0,0 +1 @@ +2022-04-04T09:34:37.709Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Validate_an_existing_monitor_returns_Invalid_JSON_response.yaml b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Validate_an_existing_monitor_returns_Invalid_JSON_response.yaml new file mode 100644 index 00000000000..2ea246c19e4 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Validate_an_existing_monitor_returns_Invalid_JSON_response.yaml @@ -0,0 +1,61 @@ +interactions: +- request: + body: | + {"message":"some message Notify: @hipchat-channel","name":"Test-Validate_an_existing_monitor_returns_Invalid_JSON_response-1649064877","options":{"enable_logs_sample":true,"escalation_message":"the situation has escalated","evaluation_delay":700,"groupby_simple_monitor":true,"include_tags":true,"locked":false,"new_host_delay":600,"no_data_timeframe":null,"notify_audit":false,"notify_no_data":false,"renotify_interval":60,"require_full_window":true,"thresholds":{"critical":2,"warning":1},"timeout_h":24},"priority":3,"query":"logs(\"service:foo AND type:error\").index(\"main\").rollup(\"count\").by(\"source\").last(\"5m\") \u003e 2","tags":["test:testvalidateanexistingmonitorreturnsinvalidjsonresponse1649064877","env:ci"],"type":"log 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":["test:testvalidateanexistingmonitorreturnsinvalidjsonresponse1649064877","env:ci"],"deleted":null,"query":"logs(\"service:foo + AND type:error\").index(\"main\").rollup(\"count\").by(\"source\").last(\"5m\") + > 2","message":"some message Notify: @hipchat-channel","id":67817255,"multi":true,"name":"Test-Validate_an_existing_monitor_returns_Invalid_JSON_response-1649064877","created":"2022-04-04T09:34:38.039976+00:00","created_at":1649064878000,"creator":{"id":1445416,"handle":"frog@datadoghq.com","name":null,"email":"frog@datadoghq.com"},"org_id":321813,"modified":"2022-04-04T09:34:38.039976+00:00","priority":3,"overall_state_modified":null,"overall_state":"No + Data","type":"log alert","options":{"notify_audit":false,"locked":false,"timeout_h":24,"renotify_interval":60,"include_tags":true,"no_data_timeframe":null,"silenced":{},"new_host_delay":600,"require_full_window":true,"notify_no_data":false,"enable_logs_sample":true,"groupby_simple_monitor":true,"escalation_message":"the + situation has escalated","evaluation_delay":700,"thresholds":{"critical":2.0,"warning":1.0}}}' + code: 200 + duration: '' + headers: + Content-Type: + - application/json + status: 200 OK +- request: + body: | + {"query":"query","type":"log alert"} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + url: https://api.datadoghq.com/api/v1/monitor/67817255/validate + response: + body: '{"errors": ["The value provided for parameter ''query'' is invalid: invalid + operator specified: "]}' + code: 400 + duration: '' + headers: + Content-Type: + - application/json + status: 400 Bad Request +- request: + body: '' + form: {} + headers: + Accept: + - application/json + method: DELETE + url: https://api.datadoghq.com/api/v1/monitor/67817255 + response: + body: '{"deleted_monitor_id":67817255}' + code: 200 + duration: '' + headers: + Content-Type: + - application/json + status: 200 OK +version: 1 diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Validate_an_existing_monitor_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Validate_an_existing_monitor_returns_OK_response.freeze new file mode 100644 index 00000000000..400e96f5cbb --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Validate_an_existing_monitor_returns_OK_response.freeze @@ -0,0 +1 @@ +2022-04-04T09:34:38.711Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Validate_an_existing_monitor_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Validate_an_existing_monitor_returns_OK_response.yaml new file mode 100644 index 00000000000..f2047377794 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Monitors/Scenario_Validate_an_existing_monitor_returns_OK_response.yaml @@ -0,0 +1,60 @@ +interactions: +- request: + body: | + {"message":"some message Notify: @hipchat-channel","name":"Test-Validate_an_existing_monitor_returns_OK_response-1649064878","options":{"enable_logs_sample":true,"escalation_message":"the situation has escalated","evaluation_delay":700,"groupby_simple_monitor":true,"include_tags":true,"locked":false,"new_host_delay":600,"no_data_timeframe":null,"notify_audit":false,"notify_no_data":false,"renotify_interval":60,"require_full_window":true,"thresholds":{"critical":2,"warning":1},"timeout_h":24},"priority":3,"query":"logs(\"service:foo AND type:error\").index(\"main\").rollup(\"count\").by(\"source\").last(\"5m\") \u003e 2","tags":["test:testvalidateanexistingmonitorreturnsokresponse1649064878","env:ci"],"type":"log 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":["test:testvalidateanexistingmonitorreturnsokresponse1649064878","env:ci"],"deleted":null,"query":"logs(\"service:foo + AND type:error\").index(\"main\").rollup(\"count\").by(\"source\").last(\"5m\") + > 2","message":"some message Notify: @hipchat-channel","id":67817256,"multi":true,"name":"Test-Validate_an_existing_monitor_returns_OK_response-1649064878","created":"2022-04-04T09:34:38.970851+00:00","created_at":1649064878000,"creator":{"id":1445416,"handle":"frog@datadoghq.com","name":null,"email":"frog@datadoghq.com"},"org_id":321813,"modified":"2022-04-04T09:34:38.970851+00:00","priority":3,"overall_state_modified":null,"overall_state":"No + Data","type":"log alert","options":{"notify_audit":false,"locked":false,"timeout_h":24,"renotify_interval":60,"include_tags":true,"no_data_timeframe":null,"silenced":{},"new_host_delay":600,"require_full_window":true,"notify_no_data":false,"enable_logs_sample":true,"groupby_simple_monitor":true,"escalation_message":"the + situation has escalated","evaluation_delay":700,"thresholds":{"critical":2.0,"warning":1.0}}}' + code: 200 + duration: '' + headers: + Content-Type: + - application/json + status: 200 OK +- request: + body: | + {"message":"some message Notify: @hipchat-channel","name":"Test-Validate_an_existing_monitor_returns_OK_response-1649064878","options":{"enable_logs_sample":true,"escalation_message":"the situation has escalated","evaluation_delay":700,"groupby_simple_monitor":true,"include_tags":true,"locked":false,"new_host_delay":600,"no_data_timeframe":null,"notify_audit":false,"notify_no_data":false,"renotify_interval":60,"require_full_window":true,"thresholds":{"critical":2,"warning":1},"timeout_h":24},"priority":3,"query":"logs(\"service:foo AND type:error\").index(\"main\").rollup(\"count\").by(\"source\").last(\"5m\") \u003e 2","tags":["test:testvalidateanexistingmonitorreturnsokresponse1649064878","env:ci"],"type":"log alert"} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + url: https://api.datadoghq.com/api/v1/monitor/67817256/validate + response: + body: '{}' + 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/67817256 + response: + body: '{"deleted_monitor_id":67817256}' + 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 06d35e2c0b5..a4773b2db3e 100644 --- a/tests/scenarios/features/v1/monitors.feature +++ b/tests/scenarios/features/v1/monitors.feature @@ -217,3 +217,28 @@ Feature: Monitors And body from file "monitor_payload.json" When the request is sent Then the response status is 200 OK + + @team:DataDog/monitor-app + Scenario: Validate an existing monitor returns "Invalid JSON" response + Given there is a valid "monitor" in the system + And new "ValidateExistingMonitor" request + And request contains "monitor_id" parameter from "monitor.id" + And body with value {"type": "log alert", "query": "query"} + When the request is sent + Then the response status is 400 Invalid JSON + + @skip @team:DataDog/monitor-app + Scenario: Validate an existing monitor returns "Item not found error" response + Given new "ValidateExistingMonitor" request + And request contains "monitor_id" parameter with value 0 + When the request is sent + Then the response status is 404 Item not found error + + @team:DataDog/monitor-app + Scenario: Validate an existing monitor returns "OK" response + Given there is a valid "monitor" in the system + And new "ValidateExistingMonitor" request + And request contains "monitor_id" parameter from "monitor.id" + And body from file "monitor_payload.json" + When the request is sent + Then the response status is 200 OK diff --git a/tests/scenarios/features/v1/undo.json b/tests/scenarios/features/v1/undo.json index 33d5823521b..2dc6d57d8e4 100644 --- a/tests/scenarios/features/v1/undo.json +++ b/tests/scenarios/features/v1/undo.json @@ -736,6 +736,12 @@ "type": "safe" } }, + "ValidateExistingMonitor": { + "tag": "Monitors", + "undo": { + "type": "idempotent" + } + }, "GetMonthlyCustomReports": { "tag": "Usage Metering", "undo": { diff --git a/tests/scenarios/features/v1/usage_metering.feature b/tests/scenarios/features/v1/usage_metering.feature index 1c45c27f234..743c0f4d7e0 100644 --- a/tests/scenarios/features/v1/usage_metering.feature +++ b/tests/scenarios/features/v1/usage_metering.feature @@ -83,7 +83,6 @@ Feature: Usage Metering @generated @skip @team:DataDog/red-zone-revenue-query Scenario: Get billable usage across your account returns "OK" response Given new "GetUsageBillableSummary" request - And request contains "month" parameter with value "{{ timeISO('now - 3d') }}" When the request is sent Then the response status is 200 OK