Skip to content

Commit d6b8f8d

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 6cba7b1 of spec repo
1 parent b25c67e commit d6b8f8d

15 files changed

+449
-17
lines changed

.generator/schemas/v1/openapi.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7255,6 +7255,12 @@ components:
72557255
Monitor:
72567256
description: Object describing a monitor.
72577257
properties:
7258+
assets:
7259+
description: The list of monitor assets tied to a monitor, which represents
7260+
key links for users to take action on monitor alerts (for example, runbooks).
7261+
items:
7262+
$ref: '#/components/schemas/MonitorAsset'
7263+
type: array
72587264
created:
72597265
description: Timestamp of the monitor creation.
72607266
format: date-time
@@ -7338,6 +7344,52 @@ components:
73387344
- type
73397345
- query
73407346
type: object
7347+
MonitorAsset:
7348+
description: 'Represents key links tied to a monitor to help users take action
7349+
on alerts.
7350+
7351+
This feature is in Preview and only available to users with the feature enabled.'
7352+
properties:
7353+
category:
7354+
$ref: '#/components/schemas/MonitorAssetCategory'
7355+
name:
7356+
description: Name for the monitor asset
7357+
example: Monitor Runbook
7358+
type: string
7359+
resource_key:
7360+
description: Represents the identifier of the internal Datadog resource
7361+
that this asset represents. IDs in this field should be passed in as strings.
7362+
example: '12345'
7363+
type: string
7364+
resource_type:
7365+
$ref: '#/components/schemas/MonitorAssetResourceType'
7366+
url:
7367+
description: URL link for the asset. For links with an internal resource
7368+
type set, this should be the relative path to where the Datadog domain
7369+
is appended internally. For external links, this should be the full URL
7370+
path.
7371+
example: /notebooks/12345
7372+
type: string
7373+
required:
7374+
- name
7375+
- url
7376+
- category
7377+
type: object
7378+
MonitorAssetCategory:
7379+
description: Indicates the type of asset this entity represents on a monitor.
7380+
enum:
7381+
- runbook
7382+
example: runbook
7383+
type: string
7384+
x-enum-varnames:
7385+
- RUNBOOK
7386+
MonitorAssetResourceType:
7387+
description: Type of internal Datadog resource associated with a monitor asset.
7388+
enum:
7389+
- notebook
7390+
type: string
7391+
x-enum-varnames:
7392+
- NOTEBOOK
73417393
MonitorDeviceID:
73427394
description: ID of the device the Synthetics monitor is running on. Same as
73437395
`SyntheticsDeviceID`.
@@ -8452,6 +8504,13 @@ components:
84528504
MonitorUpdateRequest:
84538505
description: Object describing a monitor update request.
84548506
properties:
8507+
assets:
8508+
description: The list of monitor assets tied to a monitor, which represents
8509+
key links for users to take action on monitor alerts (for example, runbooks).
8510+
items:
8511+
$ref: '#/components/schemas/MonitorAsset'
8512+
nullable: true
8513+
type: array
84558514
created:
84568515
description: Timestamp of the monitor creation.
84578516
format: date-time
@@ -31584,6 +31643,13 @@ paths:
3158431643
required: false
3158531644
schema:
3158631645
type: boolean
31646+
- description: If this argument is set to `true`, the returned data includes
31647+
all assets tied to this monitor.
31648+
in: query
31649+
name: with_assets
31650+
required: false
31651+
schema:
31652+
type: boolean
3158731653
responses:
3158831654
'200':
3158931655
content:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2024-10-10T16:41:03.364Z
1+
2025-11-21T18:03:25.715Z

cassettes/features/v1/monitors/Check-if-a-monitor-can-be-deleted-returns-OK-response.yml

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2025-11-21T19:04:55.769Z

cassettes/features/v1/monitors/Create-a-monitor-with-assets-returns-OK-response.yml

Lines changed: 52 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Create a monitor with assets returns "OK" response
2+
3+
require "datadog_api_client"
4+
api_instance = DatadogAPIClient::V1::MonitorsAPI.new
5+
6+
body = DatadogAPIClient::V1::Monitor.new({
7+
assets: [
8+
DatadogAPIClient::V1::MonitorAsset.new({
9+
category: DatadogAPIClient::V1::MonitorAssetCategory::RUNBOOK,
10+
name: "Monitor Runbook",
11+
resource_key: "12345",
12+
resource_type: DatadogAPIClient::V1::MonitorAssetResourceType::NOTEBOOK,
13+
url: "/notebooks/12345",
14+
}),
15+
],
16+
name: "Example-Monitor",
17+
type: DatadogAPIClient::V1::MonitorType::METRIC_ALERT,
18+
query: "avg(current_1mo):avg:system.load.5{*} > 0.5",
19+
message: "some message Notify: @hipchat-channel",
20+
options: DatadogAPIClient::V1::MonitorOptions.new({
21+
thresholds: DatadogAPIClient::V1::MonitorThresholds.new({
22+
critical: 0.5,
23+
}),
24+
scheduling_options: DatadogAPIClient::V1::MonitorOptionsSchedulingOptions.new({
25+
evaluation_window: DatadogAPIClient::V1::MonitorOptionsSchedulingOptionsEvaluationWindow.new({
26+
day_starts: "04:00",
27+
month_starts: 1,
28+
}),
29+
}),
30+
}),
31+
})
32+
p api_instance.create_monitor(body)

features/scenarios_model_mapping.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,7 @@
565565
"monitor_id" => "Integer",
566566
"group_states" => "String",
567567
"with_downtimes" => "Boolean",
568+
"with_assets" => "Boolean",
568569
},
569570
"v1.UpdateMonitor" => {
570571
"monitor_id" => "Integer",

features/v1/monitors.feature

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,18 @@ Feature: Monitors
131131
And the response "type" is equal to "log alert"
132132
And the response "query" is equal to "logs(\"service:foo AND type:error\").index(\"main\").rollup(\"count\").by(\"source\").last(\"5m\") > 2"
133133

134+
@team:DataDog/monitor-app
135+
Scenario: Create a monitor with assets returns "OK" response
136+
Given new "CreateMonitor" request
137+
And body with value {"assets": [{"category": "runbook", "name": "Monitor Runbook", "resource_key": "12345", "resource_type": "notebook", "url": "/notebooks/12345"}], "name": "{{ unique }}", "type": "metric alert", "query": "avg(current_1mo):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}}}}
138+
When the request is sent
139+
Then the response status is 200 OK
140+
And the response "assets[0].category" is equal to "runbook"
141+
And the response "assets[0].name" is equal to "Monitor Runbook"
142+
And the response "assets[0].resource_key" is equal to "12345"
143+
And the response "assets[0].resource_type" is equal to "notebook"
144+
And the response "assets[0].url" is equal to "/notebooks/12345"
145+
134146
@team:DataDog/monitor-app
135147
Scenario: Create an Error Tracking monitor returns "OK" response
136148
Given new "CreateMonitor" request
@@ -169,7 +181,7 @@ Feature: Monitors
169181
Scenario: Edit a monitor returns "Bad Request" response
170182
Given new "UpdateMonitor" request
171183
And request contains "monitor_id" parameter from "REPLACE.ME"
172-
And body with value {"draft_status": "published", "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"}
184+
And body with value {"assets": [{"category": "runbook", "name": "Monitor Runbook", "resource_key": "12345", "resource_type": "notebook", "url": "/notebooks/12345"}], "draft_status": "published", "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"}
173185
When the request is sent
174186
Then the response status is 400 Bad Request
175187

lib/datadog_api_client/inflector.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,9 @@ def overrides
321321
"v1.metrics_query_response" => "MetricsQueryResponse",
322322
"v1.metrics_query_unit" => "MetricsQueryUnit",
323323
"v1.monitor" => "Monitor",
324+
"v1.monitor_asset" => "MonitorAsset",
325+
"v1.monitor_asset_category" => "MonitorAssetCategory",
326+
"v1.monitor_asset_resource_type" => "MonitorAssetResourceType",
324327
"v1.monitor_device_id" => "MonitorDeviceID",
325328
"v1.monitor_draft_status" => "MonitorDraftStatus",
326329
"v1.monitor_formula_and_function_cost_aggregator" => "MonitorFormulaAndFunctionCostAggregator",

lib/datadog_api_client/v1/api/monitors_api.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ def get_monitor(monitor_id, opts = {})
456456
# @param opts [Hash] the optional parameters
457457
# @option opts [String] :group_states When specified, shows additional information about the group states. Choose one or more from `all`, `alert`, `warn`, and `no data`.
458458
# @option opts [Boolean] :with_downtimes If this argument is set to true, then the returned data includes all current active downtimes for the monitor.
459+
# @option opts [Boolean] :with_assets If this argument is set to `true`, the returned data includes all assets tied to this monitor.
459460
# @return [Array<(Monitor, Integer, Hash)>] Monitor data, response status code and response headers
460461
def get_monitor_with_http_info(monitor_id, opts = {})
461462

@@ -473,6 +474,7 @@ def get_monitor_with_http_info(monitor_id, opts = {})
473474
query_params = opts[:query_params] || {}
474475
query_params[:'group_states'] = opts[:'group_states'] if !opts[:'group_states'].nil?
475476
query_params[:'with_downtimes'] = opts[:'with_downtimes'] if !opts[:'with_downtimes'].nil?
477+
query_params[:'with_assets'] = opts[:'with_assets'] if !opts[:'with_assets'].nil?
476478

477479
# header parameters
478480
header_params = opts[:header_params] || {}

0 commit comments

Comments
 (0)