Skip to content

Commit d01ac67

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit 09cb5b9 of spec repo (#3439)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent bfcbf2f commit d01ac67

12 files changed

Lines changed: 624 additions & 4 deletions

.generator/schemas/v1/openapi.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,6 +1443,10 @@ components:
14431443
format: date-time
14441444
readOnly: true
14451445
type: string
1446+
default_timeframe:
1447+
$ref: "#/components/schemas/DashboardDefaultTimeframeSetting"
1448+
description: The default timeframe applied when opening the dashboard. Set to `null` to clear.
1449+
nullable: true
14461450
description:
14471451
description: Description of the dashboard.
14481452
nullable: true
@@ -1557,13 +1561,48 @@ components:
15571561
required:
15581562
- data
15591563
type: object
1564+
DashboardDefaultTimeframeSetting:
1565+
description: The default timeframe applied when opening the dashboard. Set to `null` to clear the dashboard's default timeframe.
1566+
oneOf:
1567+
- $ref: "#/components/schemas/DashboardLiveTimeframe"
1568+
- $ref: "#/components/schemas/DashboardFixedTimeframe"
15601569
DashboardDeleteResponse:
15611570
description: Response from the delete dashboard call.
15621571
properties:
15631572
deleted_dashboard_id:
15641573
description: ID of the deleted dashboard.
15651574
type: string
15661575
type: object
1576+
DashboardFixedTimeframe:
1577+
description: A fixed dashboard timeframe.
1578+
properties:
1579+
from:
1580+
description: Start time in milliseconds since epoch.
1581+
example: 1712080128000
1582+
format: int64
1583+
minimum: 0
1584+
type: integer
1585+
to:
1586+
description: End time in milliseconds since epoch.
1587+
example: 1712083128000
1588+
format: int64
1589+
minimum: 0
1590+
type: integer
1591+
type:
1592+
$ref: "#/components/schemas/DashboardFixedTimeframeType"
1593+
required:
1594+
- type
1595+
- from
1596+
- to
1597+
type: object
1598+
DashboardFixedTimeframeType:
1599+
description: Type of fixed timeframe.
1600+
enum:
1601+
- fixed
1602+
example: fixed
1603+
type: string
1604+
x-enum-varnames:
1605+
- FIXED
15671606
DashboardGlobalTime:
15681607
description: Object containing the live span selection for the dashboard.
15691608
properties:
@@ -1672,6 +1711,32 @@ components:
16721711
$ref: "#/components/schemas/DashboardList"
16731712
type: array
16741713
type: object
1714+
DashboardLiveTimeframe:
1715+
description: A live dashboard timeframe.
1716+
properties:
1717+
type:
1718+
$ref: "#/components/schemas/DashboardLiveTimeframeType"
1719+
unit:
1720+
$ref: "#/components/schemas/WidgetLiveSpanUnit"
1721+
value:
1722+
description: Value of the live timeframe span.
1723+
example: 4
1724+
format: int64
1725+
minimum: 1
1726+
type: integer
1727+
required:
1728+
- type
1729+
- value
1730+
- unit
1731+
type: object
1732+
DashboardLiveTimeframeType:
1733+
description: Type of live timeframe.
1734+
enum:
1735+
- live
1736+
example: live
1737+
type: string
1738+
x-enum-varnames:
1739+
- LIVE
16751740
DashboardReflowType:
16761741
description: |-
16771742
Reflow type for a **new dashboard layout** dashboard. Set this only when layout type is 'ordered'.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2026-06-22T17:48:02.651Z

cassettes/features/v1/dashboards/Create-a-new-dashboard-with-a-live-default-timeframe-returns-OK-response.yml

Lines changed: 43 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Create a new dashboard with a live default_timeframe returns "OK" response
2+
3+
require "datadog_api_client"
4+
api_instance = DatadogAPIClient::V1::DashboardsAPI.new
5+
6+
body = DatadogAPIClient::V1::Dashboard.new({
7+
title: "Example-Dashboard",
8+
layout_type: DatadogAPIClient::V1::DashboardLayoutType::ORDERED,
9+
widgets: [
10+
DatadogAPIClient::V1::Widget.new({
11+
definition: DatadogAPIClient::V1::NoteWidgetDefinition.new({
12+
type: DatadogAPIClient::V1::NoteWidgetDefinitionType::NOTE,
13+
content: "test",
14+
background_color: "white",
15+
font_size: "14",
16+
text_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT,
17+
show_tick: false,
18+
tick_pos: "50%",
19+
tick_edge: DatadogAPIClient::V1::WidgetTickEdge::LEFT,
20+
}),
21+
}),
22+
],
23+
default_timeframe: DatadogAPIClient::V1::DashboardLiveTimeframe.new({
24+
type: DatadogAPIClient::V1::DashboardLiveTimeframeType::LIVE,
25+
unit: DatadogAPIClient::V1::WidgetLiveSpanUnit::HOUR,
26+
value: 4,
27+
}),
28+
})
29+
p api_instance.create_dashboard(body)

features/v1/dashboards.feature

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Feature: Dashboards
9090
@generated @skip @team:DataDog/dashboards-backend
9191
Scenario: Create a new dashboard returns "Bad Request" response
9292
Given new "CreateDashboard" request
93-
And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]}
93+
And body with value {"default_timeframe": {"type": "live", "unit": "minute", "value": 4}, "description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]}
9494
When the request is sent
9595
Then the response status is 400 Bad Request
9696

@@ -171,6 +171,16 @@ Feature: Dashboards
171171
And the response "widgets[0].definition.requests[0].formulas[0].formula" is equal to "hour_before(query1)"
172172
And the response "widgets[0].definition.requests[0].formulas[1].formula" is equal to "query1"
173173

174+
@team:DataDog/dashboards-backend
175+
Scenario: Create a new dashboard with a live default_timeframe returns "OK" response
176+
Given new "CreateDashboard" request
177+
And body with value {"title": "{{ unique }}", "layout_type": "ordered", "widgets": [{"definition": {"type": "note", "content": "test", "background_color": "white", "font_size": "14", "text_align": "left", "show_tick": false, "tick_pos": "50%", "tick_edge": "left"}}], "default_timeframe": {"type": "live", "unit": "hour", "value": 4}}
178+
When the request is sent
179+
Then the response status is 200 OK
180+
And the response "default_timeframe.type" is equal to "live"
181+
And the response "default_timeframe.unit" is equal to "hour"
182+
And the response "default_timeframe.value" is equal to 4
183+
174184
@team:DataDog/dashboards-backend
175185
Scenario: Create a new dashboard with a query value widget using the percentile aggregator
176186
Given new "CreateDashboard" request
@@ -1481,15 +1491,15 @@ Feature: Dashboards
14811491
Scenario: Update a dashboard returns "Bad Request" response
14821492
Given new "UpdateDashboard" request
14831493
And request contains "dashboard_id" parameter from "REPLACE.ME"
1484-
And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]}
1494+
And body with value {"default_timeframe": {"type": "live", "unit": "minute", "value": 4}, "description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]}
14851495
When the request is sent
14861496
Then the response status is 400 Bad Request
14871497

14881498
@generated @skip @team:DataDog/dashboards-backend
14891499
Scenario: Update a dashboard returns "Item Not Found" response
14901500
Given new "UpdateDashboard" request
14911501
And request contains "dashboard_id" parameter from "REPLACE.ME"
1492-
And body with value {"description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]}
1502+
And body with value {"default_timeframe": {"type": "live", "unit": "minute", "value": 4}, "description": null, "is_read_only": false, "layout_type": "ordered", "notify_list": [], "reflow_type": "auto", "restricted_roles": [], "tabs": [{"id": "", "name": "L", "widget_ids": [0]}], "tags": [], "template_variable_presets": [{"template_variables": [{"values": []}]}], "template_variables": [{"available_values": ["my-host", "host1", "host2"], "default": "my-host", "defaults": ["my-host-1", "my-host-2"], "name": "host1", "prefix": "host", "type": "group"}], "title": "", "widgets": [{"definition": {"requests": {"fill": {"q": "avg:system.cpu.user{*}"}}, "type": "hostmap"}}]}
14931503
When the request is sent
14941504
Then the response status is 404 Item Not Found
14951505

lib/datadog_api_client/inflector.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,19 @@ def overrides
8787
"v1.dashboard" => "Dashboard",
8888
"v1.dashboard_bulk_action_data" => "DashboardBulkActionData",
8989
"v1.dashboard_bulk_delete_request" => "DashboardBulkDeleteRequest",
90+
"v1.dashboard_default_timeframe_setting" => "DashboardDefaultTimeframeSetting",
9091
"v1.dashboard_delete_response" => "DashboardDeleteResponse",
92+
"v1.dashboard_fixed_timeframe" => "DashboardFixedTimeframe",
93+
"v1.dashboard_fixed_timeframe_type" => "DashboardFixedTimeframeType",
9194
"v1.dashboard_global_time" => "DashboardGlobalTime",
9295
"v1.dashboard_global_time_live_span" => "DashboardGlobalTimeLiveSpan",
9396
"v1.dashboard_invite_type" => "DashboardInviteType",
9497
"v1.dashboard_layout_type" => "DashboardLayoutType",
9598
"v1.dashboard_list" => "DashboardList",
9699
"v1.dashboard_list_delete_response" => "DashboardListDeleteResponse",
97100
"v1.dashboard_list_list_response" => "DashboardListListResponse",
101+
"v1.dashboard_live_timeframe" => "DashboardLiveTimeframe",
102+
"v1.dashboard_live_timeframe_type" => "DashboardLiveTimeframeType",
98103
"v1.dashboard_reflow_type" => "DashboardReflowType",
99104
"v1.dashboard_resource_type" => "DashboardResourceType",
100105
"v1.dashboard_restore_request" => "DashboardRestoreRequest",

lib/datadog_api_client/v1/models/dashboard.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ class Dashboard
3131
# Creation date of the dashboard.
3232
attr_accessor :created_at
3333

34+
# The default timeframe applied when opening the dashboard. Set to `null` to clear the dashboard's default timeframe.
35+
attr_accessor :default_timeframe
36+
3437
# Description of the dashboard.
3538
attr_accessor :description
3639

@@ -89,6 +92,7 @@ def self.attribute_map
8992
:'author_handle' => :'author_handle',
9093
:'author_name' => :'author_name',
9194
:'created_at' => :'created_at',
95+
:'default_timeframe' => :'default_timeframe',
9296
:'description' => :'description',
9397
:'id' => :'id',
9498
:'is_read_only' => :'is_read_only',
@@ -114,6 +118,7 @@ def self.openapi_types
114118
:'author_handle' => :'String',
115119
:'author_name' => :'String',
116120
:'created_at' => :'Time',
121+
:'default_timeframe' => :'DashboardDefaultTimeframeSetting',
117122
:'description' => :'String',
118123
:'id' => :'String',
119124
:'is_read_only' => :'Boolean',
@@ -176,6 +181,10 @@ def initialize(attributes = {})
176181
self.created_at = attributes[:'created_at']
177182
end
178183

184+
if attributes.key?(:'default_timeframe')
185+
self.default_timeframe = attributes[:'default_timeframe']
186+
end
187+
179188
if attributes.key?(:'description')
180189
self.description = attributes[:'description']
181190
end
@@ -342,6 +351,7 @@ def ==(o)
342351
author_handle == o.author_handle &&
343352
author_name == o.author_name &&
344353
created_at == o.created_at &&
354+
default_timeframe == o.default_timeframe &&
345355
description == o.description &&
346356
id == o.id &&
347357
is_read_only == o.is_read_only &&
@@ -364,7 +374,7 @@ def ==(o)
364374
# @return [Integer] Hash code
365375
# @!visibility private
366376
def hash
367-
[author_handle, author_name, created_at, description, id, is_read_only, layout_type, modified_at, notify_list, reflow_type, restricted_roles, tabs, tags, template_variable_presets, template_variables, title, url, widgets, additional_properties].hash
377+
[author_handle, author_name, created_at, default_timeframe, description, id, is_read_only, layout_type, modified_at, notify_list, reflow_type, restricted_roles, tabs, tags, template_variable_presets, template_variables, title, url, widgets, additional_properties].hash
368378
end
369379
end
370380
end
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
=begin
2+
#Datadog API V1 Collection
3+
4+
#Collection of all Datadog Public endpoints.
5+
6+
The version of the OpenAPI document: 1.0
7+
Contact: support@datadoghq.com
8+
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator
9+
10+
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
11+
This product includes software developed at Datadog (https://www.datadoghq.com/).
12+
Copyright 2020-Present Datadog, Inc.
13+
14+
=end
15+
16+
require 'date'
17+
require 'time'
18+
19+
module DatadogAPIClient::V1
20+
# The default timeframe applied when opening the dashboard. Set to `null` to clear the dashboard's default timeframe.
21+
module DashboardDefaultTimeframeSetting
22+
class << self
23+
include BaseOneOfModel
24+
include BaseOneOfModelNoDiscriminator
25+
26+
# List of class defined in oneOf (OpenAPI v3)
27+
def openapi_one_of
28+
[
29+
:'DashboardLiveTimeframe',
30+
:'DashboardFixedTimeframe'
31+
]
32+
end
33+
# Builds the object
34+
# @param data [Mixed] Data to be matched against the list of oneOf items
35+
# @return [Object] Returns the model or the data itself
36+
def build(data)
37+
# Go through the list of oneOf items and attempt to identify the appropriate one.
38+
# Note:
39+
# - We do not attempt to check whether exactly one item matches.
40+
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
41+
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
42+
# - TODO: scalar values are de facto behaving as if they were nullable.
43+
# - TODO: logging when debugging is set.
44+
openapi_one_of.each do |klass|
45+
begin
46+
next if klass == :AnyType # "nullable: true"
47+
typed_data = find_and_cast_into_type(klass, data)
48+
next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed
49+
return typed_data if typed_data
50+
rescue # rescue all errors so we keep iterating even if the current item lookup raises
51+
end
52+
end
53+
54+
if openapi_one_of.include?(:AnyType)
55+
data
56+
else
57+
self._unparsed = true
58+
DatadogAPIClient::UnparsedObject.new(data)
59+
end
60+
end
61+
end
62+
end
63+
end

0 commit comments

Comments
 (0)