Skip to content

Commit ca521eb

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 5d8b0bc1 of spec repo
1 parent 5e10410 commit ca521eb

File tree

11 files changed

+229
-24
lines changed

11 files changed

+229
-24
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2023-10-02 18:58:17.891416",
8-
"spec_repo_commit": "aee9e14a"
7+
"regenerated": "2023-10-04 18:34:01.004048",
8+
"spec_repo_commit": "5d8b0bc1"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2023-10-02 18:58:17.905529",
13-
"spec_repo_commit": "aee9e14a"
12+
"regenerated": "2023-10-04 18:34:01.018668",
13+
"spec_repo_commit": "5d8b0bc1"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6839,6 +6839,33 @@ components:
68396839
type: string
68406840
readOnly: true
68416841
type: object
6842+
MonitorOptionsCustomSchedule:
6843+
description: Configuration options for the custom schedule. **This feature is
6844+
in private beta.**
6845+
properties:
6846+
recurrences:
6847+
description: Array of custom schedule recurrences.
6848+
items:
6849+
$ref: '#/components/schemas/MonitorOptionsCustomScheduleRecurrence'
6850+
type: array
6851+
type: object
6852+
MonitorOptionsCustomScheduleRecurrence:
6853+
description: Configuration for a recurrence set on the monitor options for custom
6854+
schedule.
6855+
properties:
6856+
rrule:
6857+
description: Defines the recurrence rule (RRULE) for a given schedule.
6858+
example: FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR
6859+
type: string
6860+
start:
6861+
description: Defines the start date and time of the recurring schedule.
6862+
example: '2023-08-31T16:30:00'
6863+
type: string
6864+
timezone:
6865+
description: Defines the timezone the schedule runs on.
6866+
example: Europe/Paris
6867+
type: string
6868+
type: object
68426869
MonitorOptionsNotificationPresets:
68436870
default: show_all
68446871
description: Toggles the display of additional content sent in the monitor notification.
@@ -6856,6 +6883,8 @@ components:
68566883
MonitorOptionsSchedulingOptions:
68576884
description: Configuration options for scheduling.
68586885
properties:
6886+
custom_schedule:
6887+
$ref: '#/components/schemas/MonitorOptionsCustomSchedule'
68596888
evaluation_window:
68606889
$ref: '#/components/schemas/MonitorOptionsSchedulingOptionsEvaluationWindow'
68616890
type: object
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"2023-01-18T18:37:20.511Z"
1+
"2023-10-04T18:21:59.260Z"

cassettes/v1/Monitors_4022238206/Validate-an-existing-monitor-returns-OK-response_898284207/recording.har

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"entries": [
1010
{
11-
"_id": "a6398d92236de6af6e0c182ccfc97958",
11+
"_id": "872abdb5f24e9461c6643498d4bc4eb3",
1212
"_order": 0,
1313
"cache": {},
1414
"request": {
@@ -32,7 +32,7 @@
3232
"postData": {
3333
"mimeType": "application/json",
3434
"params": [],
35-
"text": "{\"message\":\"some message Notify: @hipchat-channel\",\"name\":\"Test-Validate_an_existing_monitor_returns_OK_response-1674067040\",\"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,\"notification_preset_name\":\"hide_handles\",\"notify_audit\":false,\"notify_no_data\":false,\"on_missing_data\":\"show_and_notify_no_data\",\"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\\\") > 2\",\"tags\":[\"test:testvalidateanexistingmonitorreturnsokresponse1674067040\",\"env:ci\"],\"type\":\"log alert\"}"
35+
"text": "{\"message\":\"some message Notify: @hipchat-channel\",\"name\":\"Test-Validate_an_existing_monitor_returns_OK_response-1696443719\",\"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,\"notification_preset_name\":\"hide_handles\",\"notify_audit\":false,\"notify_no_data\":false,\"on_missing_data\":\"show_and_notify_no_data\",\"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\\\") > 2\",\"tags\":[\"test:testvalidateanexistingmonitorreturnsokresponse1696443719\",\"env:ci\"],\"type\":\"log alert\"}"
3636
},
3737
"queryString": [],
3838
"url": "https://api.datadoghq.com/api/v1/monitor"
@@ -42,7 +42,7 @@
4242
"content": {
4343
"mimeType": "application/json",
4444
"size": 1182,
45-
"text": "{\"id\":108260307,\"org_id\":321813,\"type\":\"log alert\",\"name\":\"Test-Validate_an_existing_monitor_returns_OK_response-1674067040\",\"message\":\"some message Notify: @hipchat-channel\",\"tags\":[\"test:testvalidateanexistingmonitorreturnsokresponse1674067040\",\"env:ci\"],\"query\":\"logs(\\\"service:foo AND type:error\\\").index(\\\"main\\\").rollup(\\\"count\\\").by(\\\"source\\\").last(\\\"5m\\\") > 2\",\"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,\"notification_preset_name\":\"hide_handles\",\"notify_audit\":false,\"notify_no_data\":false,\"on_missing_data\":\"show_and_notify_no_data\",\"renotify_interval\":60,\"require_full_window\":true,\"thresholds\":{\"critical\":2.0,\"warning\":1.0},\"timeout_h\":24,\"silenced\":{}},\"multi\":true,\"created_at\":1674067040000,\"created\":\"2023-01-18T18:37:20.717952+00:00\",\"modified\":\"2023-01-18T18:37:20.717952+00:00\",\"deleted\":null,\"restricted_roles\":null,\"priority\":3,\"overall_state_modified\":null,\"overall_state\":\"No Data\",\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\",\"id\":1445416}}\n"
45+
"text": "{\"id\":132537531,\"org_id\":321813,\"type\":\"log alert\",\"name\":\"Test-Validate_an_existing_monitor_returns_OK_response-1696443719\",\"message\":\"some message Notify: @hipchat-channel\",\"tags\":[\"test:testvalidateanexistingmonitorreturnsokresponse1696443719\",\"env:ci\"],\"query\":\"logs(\\\"service:foo AND type:error\\\").index(\\\"main\\\").rollup(\\\"count\\\").by(\\\"source\\\").last(\\\"5m\\\") > 2\",\"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,\"notification_preset_name\":\"hide_handles\",\"notify_audit\":false,\"notify_no_data\":false,\"on_missing_data\":\"show_and_notify_no_data\",\"renotify_interval\":60,\"require_full_window\":true,\"thresholds\":{\"critical\":2.0,\"warning\":1.0},\"timeout_h\":24,\"silenced\":{}},\"multi\":true,\"created_at\":1696443719000,\"created\":\"2023-10-04T18:21:59.676309+00:00\",\"modified\":\"2023-10-04T18:21:59.676309+00:00\",\"deleted\":null,\"restricted_roles\":null,\"priority\":3,\"overall_state_modified\":null,\"overall_state\":\"No Data\",\"creator\":{\"name\":null,\"handle\":\"frog@datadoghq.com\",\"email\":\"frog@datadoghq.com\",\"id\":1445416}}\n"
4646
},
4747
"cookies": [],
4848
"headers": [
@@ -51,17 +51,17 @@
5151
"value": "application/json"
5252
}
5353
],
54-
"headersSize": 623,
54+
"headersSize": 649,
5555
"httpVersion": "HTTP/1.1",
5656
"redirectURL": "",
5757
"status": 200,
5858
"statusText": "OK"
5959
},
60-
"startedDateTime": "2023-01-18T18:37:20.519Z",
61-
"time": 242
60+
"startedDateTime": "2023-10-04T18:21:59.263Z",
61+
"time": 466
6262
},
6363
{
64-
"_id": "b495ccaf91c389cb4434e4eba81e682d",
64+
"_id": "5617e437dd2a9746b727974e417a3e02",
6565
"_order": 0,
6666
"cache": {},
6767
"request": {
@@ -85,10 +85,10 @@
8585
"postData": {
8686
"mimeType": "application/json",
8787
"params": [],
88-
"text": "{\"message\":\"some message Notify: @hipchat-channel\",\"name\":\"Test-Validate_an_existing_monitor_returns_OK_response-1674067040\",\"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,\"notification_preset_name\":\"hide_handles\",\"notify_audit\":false,\"notify_no_data\":false,\"on_missing_data\":\"show_and_notify_no_data\",\"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\\\") > 2\",\"tags\":[\"test:testvalidateanexistingmonitorreturnsokresponse1674067040\",\"env:ci\"],\"type\":\"log alert\"}"
88+
"text": "{\"message\":\"some message Notify: @hipchat-channel\",\"name\":\"Test-Validate_an_existing_monitor_returns_OK_response-1696443719\",\"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,\"notification_preset_name\":\"hide_handles\",\"notify_audit\":false,\"notify_no_data\":false,\"on_missing_data\":\"show_and_notify_no_data\",\"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\\\") > 2\",\"tags\":[\"test:testvalidateanexistingmonitorreturnsokresponse1696443719\",\"env:ci\"],\"type\":\"log alert\"}"
8989
},
9090
"queryString": [],
91-
"url": "https://api.datadoghq.com/api/v1/monitor/108260307/validate"
91+
"url": "https://api.datadoghq.com/api/v1/monitor/132537531/validate"
9292
},
9393
"response": {
9494
"bodySize": 3,
@@ -104,17 +104,17 @@
104104
"value": "application/json"
105105
}
106106
],
107-
"headersSize": 465,
107+
"headersSize": 492,
108108
"httpVersion": "HTTP/1.1",
109109
"redirectURL": "",
110110
"status": 200,
111111
"statusText": "OK"
112112
},
113-
"startedDateTime": "2023-01-18T18:37:20.767Z",
114-
"time": 202
113+
"startedDateTime": "2023-10-04T18:21:59.738Z",
114+
"time": 368
115115
},
116116
{
117-
"_id": "446ceaa56aae6e109dbabd3db5f74550",
117+
"_id": "63d7eb81b0cfd7dc7311ab550a0fd2f4",
118118
"_order": 0,
119119
"cache": {},
120120
"request": {
@@ -131,14 +131,14 @@
131131
"httpVersion": "HTTP/1.1",
132132
"method": "DELETE",
133133
"queryString": [],
134-
"url": "https://api.datadoghq.com/api/v1/monitor/108260307"
134+
"url": "https://api.datadoghq.com/api/v1/monitor/132537531"
135135
},
136136
"response": {
137137
"bodySize": 33,
138138
"content": {
139139
"mimeType": "application/json",
140140
"size": 33,
141-
"text": "{\"deleted_monitor_id\":108260307}\n"
141+
"text": "{\"deleted_monitor_id\":132537531}\n"
142142
},
143143
"cookies": [],
144144
"headers": [
@@ -147,14 +147,14 @@
147147
"value": "application/json"
148148
}
149149
],
150-
"headersSize": 489,
150+
"headersSize": 516,
151151
"httpVersion": "HTTP/1.1",
152152
"redirectURL": "",
153153
"status": 200,
154154
"statusText": "OK"
155155
},
156-
"startedDateTime": "2023-01-18T18:37:20.975Z",
157-
"time": 117
156+
"startedDateTime": "2023-10-04T18:22:00.114Z",
157+
"time": 482
158158
}
159159
],
160160
"pages": [],
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/**
2+
* Create a metric monitor with a custom schedule returns "OK" response
3+
*/
4+
5+
import { client, v1 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
const apiInstance = new v1.MonitorsApi(configuration);
9+
10+
const params: v1.MonitorsApiCreateMonitorRequest = {
11+
body: {
12+
message: "some message Notify: @hipchat-channel",
13+
name: "Example-Monitor",
14+
query: "avg(current_1mo):avg:system.load.5{*} > 0.5",
15+
tags: [],
16+
options: {
17+
thresholds: {
18+
critical: 0.5,
19+
},
20+
notifyAudit: false,
21+
onMissingData: "default",
22+
includeTags: false,
23+
schedulingOptions: {
24+
evaluationWindow: {
25+
dayStarts: "04:00",
26+
monthStarts: 1,
27+
},
28+
customSchedule: {
29+
recurrences: [
30+
{
31+
rrule: "FREQ=DAILY;INTERVAL=1",
32+
timezone: "America/Los_Angeles",
33+
start: "2024-10-26T09:13:00",
34+
},
35+
],
36+
},
37+
},
38+
},
39+
type: "query alert",
40+
},
41+
};
42+
43+
apiInstance
44+
.createMonitor(params)
45+
.then((data: v1.Monitor) => {
46+
console.log(
47+
"API called successfully. Returned data: " + JSON.stringify(data)
48+
);
49+
})
50+
.catch((error: any) => console.error(error));

features/v1/monitors.feature

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,17 @@ Feature: Monitors
9191
And the response "name" is equal to "{{ unique }}"
9292
And the response "query" is equal to "avg(current_1mo):avg:system.load.5{*} > 0.5"
9393

94+
@team:DataDog/monitor-app
95+
Scenario: Create a metric monitor with a custom schedule returns "OK" response
96+
Given new "CreateMonitor" request
97+
And body with value {"message":"some message Notify: @hipchat-channel","name":"{{ unique }}","query":"avg(current_1mo):avg:system.load.5{*} > 0.5","tags":[],"options":{"thresholds":{"critical":0.5},"notify_audit":false,"on_missing_data":"default","include_tags":false,"scheduling_options":{"evaluation_window":{"day_starts":"04:00", "month_starts":1},"custom_schedule":{"recurrences":[{"rrule":"FREQ=DAILY;INTERVAL=1","timezone":"America/Los_Angeles","start":"2024-10-26T09:13:00"}]}}},"type":"query alert"}
98+
When the request is sent
99+
Then the response status is 200 OK
100+
And the response "name" is equal to "{{ unique }}"
101+
And the response "options.scheduling_options.custom_schedule.recurrences[0].rrule" is equal to "FREQ=DAILY;INTERVAL=1"
102+
And the response "options.scheduling_options.custom_schedule.recurrences[0].start" is equal to "2024-10-26T09:13:00"
103+
And the response "options.scheduling_options.custom_schedule.recurrences[0].timezone" is equal to "America/Los_Angeles"
104+
94105
@team:DataDog/monitor-app
95106
Scenario: Create a monitor returns "Bad Request" response
96107
Given new "CreateMonitor" request
@@ -146,7 +157,7 @@ Feature: Monitors
146157
Scenario: Edit a monitor returns "Bad Request" response
147158
Given new "UpdateMonitor" request
148159
And request contains "monitor_id" parameter from "REPLACE.ME"
149-
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, "notification_preset_name": "show_all", "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"}
160+
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, "notification_preset_name": "show_all", "notify_audit": false, "notify_by": [], "notify_no_data": false, "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"}}]}, "restricted_roles": [], "tags": [], "type": "query alert"}
150161
When the request is sent
151162
Then the response status is 400 Bad Request
152163

packages/datadog-api-client-v1/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,8 @@ export { MonitorGroupSearchResponseCounts } from "./models/MonitorGroupSearchRes
608608
export { MonitorGroupSearchResult } from "./models/MonitorGroupSearchResult";
609609
export { MonitorOptions } from "./models/MonitorOptions";
610610
export { MonitorOptionsAggregation } from "./models/MonitorOptionsAggregation";
611+
export { MonitorOptionsCustomSchedule } from "./models/MonitorOptionsCustomSchedule";
612+
export { MonitorOptionsCustomScheduleRecurrence } from "./models/MonitorOptionsCustomScheduleRecurrence";
611613
export { MonitorOptionsNotificationPresets } from "./models/MonitorOptionsNotificationPresets";
612614
export { MonitorOptionsSchedulingOptions } from "./models/MonitorOptionsSchedulingOptions";
613615
export { MonitorOptionsSchedulingOptionsEvaluationWindow } from "./models/MonitorOptionsSchedulingOptionsEvaluationWindow";
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
3+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
* Copyright 2020-Present Datadog, Inc.
5+
*/
6+
import { MonitorOptionsCustomScheduleRecurrence } from "./MonitorOptionsCustomScheduleRecurrence";
7+
8+
import { AttributeTypeMap } from "../../datadog-api-client-common/util";
9+
10+
/**
11+
* Configuration options for the custom schedule. **This feature is in private beta.**
12+
*/
13+
export class MonitorOptionsCustomSchedule {
14+
/**
15+
* Array of custom schedule recurrences.
16+
*/
17+
"recurrences"?: Array<MonitorOptionsCustomScheduleRecurrence>;
18+
19+
/**
20+
* @ignore
21+
*/
22+
"_unparsed"?: boolean;
23+
24+
/**
25+
* @ignore
26+
*/
27+
static readonly attributeTypeMap: AttributeTypeMap = {
28+
recurrences: {
29+
baseName: "recurrences",
30+
type: "Array<MonitorOptionsCustomScheduleRecurrence>",
31+
},
32+
};
33+
34+
/**
35+
* @ignore
36+
*/
37+
static getAttributeTypeMap(): AttributeTypeMap {
38+
return MonitorOptionsCustomSchedule.attributeTypeMap;
39+
}
40+
41+
public constructor() {}
42+
}

0 commit comments

Comments
 (0)