Skip to content

Commit a3e881b

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 6905dc7 of spec repo
1 parent 06c10e9 commit a3e881b

8 files changed

Lines changed: 733 additions & 22 deletions

.generator/schemas/v1/openapi.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,6 +1443,8 @@ components:
14431443
format: date-time
14441444
readOnly: true
14451445
type: string
1446+
default_timeframe:
1447+
$ref: "#/components/schemas/DashboardDefaultTimeframeSetting"
14461448
description:
14471449
description: Description of the dashboard.
14481450
nullable: true
@@ -1557,13 +1559,55 @@ components:
15571559
required:
15581560
- data
15591561
type: object
1562+
DashboardDefaultTimeframeSetting:
1563+
description: The default timeframe applied when opening the dashboard. Set to `null` to clear the dashboard's default timeframe.
1564+
discriminator:
1565+
mapping:
1566+
fixed: "#/components/schemas/DashboardFixedTimeframe"
1567+
live: "#/components/schemas/DashboardLiveTimeframe"
1568+
propertyName: type
1569+
nullable: true
1570+
oneOf:
1571+
- $ref: "#/components/schemas/DashboardLiveTimeframe"
1572+
- $ref: "#/components/schemas/DashboardFixedTimeframe"
1573+
type: object
15601574
DashboardDeleteResponse:
15611575
description: Response from the delete dashboard call.
15621576
properties:
15631577
deleted_dashboard_id:
15641578
description: ID of the deleted dashboard.
15651579
type: string
15661580
type: object
1581+
DashboardFixedTimeframe:
1582+
description: A fixed dashboard timeframe.
1583+
properties:
1584+
from:
1585+
description: Start time in milliseconds since epoch.
1586+
example: 1712080128000
1587+
format: int64
1588+
minimum: 0
1589+
type: integer
1590+
to:
1591+
description: End time in milliseconds since epoch.
1592+
example: 1712083128000
1593+
format: int64
1594+
minimum: 0
1595+
type: integer
1596+
type:
1597+
$ref: "#/components/schemas/DashboardFixedTimeframeType"
1598+
required:
1599+
- type
1600+
- from
1601+
- to
1602+
type: object
1603+
DashboardFixedTimeframeType:
1604+
description: Type of fixed timeframe.
1605+
enum:
1606+
- fixed
1607+
example: fixed
1608+
type: string
1609+
x-enum-varnames:
1610+
- FIXED
15671611
DashboardGlobalTime:
15681612
description: Object containing the live span selection for the dashboard.
15691613
properties:
@@ -1672,6 +1716,32 @@ components:
16721716
$ref: "#/components/schemas/DashboardList"
16731717
type: array
16741718
type: object
1719+
DashboardLiveTimeframe:
1720+
description: A live dashboard timeframe.
1721+
properties:
1722+
type:
1723+
$ref: "#/components/schemas/DashboardLiveTimeframeType"
1724+
unit:
1725+
$ref: "#/components/schemas/WidgetLiveSpanUnit"
1726+
value:
1727+
description: Value of the live timeframe span.
1728+
example: 4
1729+
format: int64
1730+
minimum: 1
1731+
type: integer
1732+
required:
1733+
- type
1734+
- value
1735+
- unit
1736+
type: object
1737+
DashboardLiveTimeframeType:
1738+
description: Type of live timeframe.
1739+
enum:
1740+
- live
1741+
example: live
1742+
type: string
1743+
x-enum-varnames:
1744+
- LIVE
16751745
DashboardReflowType:
16761746
description: |-
16771747
Reflow type for a **new dashboard layout** dashboard. Set this only when layout type is 'ordered'.

api/datadogV1/model_dashboard.go

Lines changed: 65 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ type Dashboard struct {
2020
AuthorName datadog.NullableString `json:"author_name,omitempty"`
2121
// Creation date of the dashboard.
2222
CreatedAt *time.Time `json:"created_at,omitempty"`
23+
// The default timeframe applied when opening the dashboard. Set to `null` to clear the dashboard's default timeframe.
24+
DefaultTimeframe NullableDashboardDefaultTimeframeSetting `json:"default_timeframe,omitempty"`
2325
// Description of the dashboard.
2426
Description datadog.NullableString `json:"description,omitempty"`
2527
// ID of the dashboard.
@@ -175,6 +177,45 @@ func (o *Dashboard) SetCreatedAt(v time.Time) {
175177
o.CreatedAt = &v
176178
}
177179

180+
// GetDefaultTimeframe returns the DefaultTimeframe field value if set, zero value otherwise (both if not set or set to explicit null).
181+
func (o *Dashboard) GetDefaultTimeframe() DashboardDefaultTimeframeSetting {
182+
if o == nil || o.DefaultTimeframe.Get() == nil {
183+
var ret DashboardDefaultTimeframeSetting
184+
return ret
185+
}
186+
return *o.DefaultTimeframe.Get()
187+
}
188+
189+
// GetDefaultTimeframeOk returns a tuple with the DefaultTimeframe field value if set, nil otherwise
190+
// and a boolean to check if the value has been set.
191+
// NOTE: If the value is an explicit nil, `nil, true` will be returned.
192+
func (o *Dashboard) GetDefaultTimeframeOk() (*DashboardDefaultTimeframeSetting, bool) {
193+
if o == nil {
194+
return nil, false
195+
}
196+
return o.DefaultTimeframe.Get(), o.DefaultTimeframe.IsSet()
197+
}
198+
199+
// HasDefaultTimeframe returns a boolean if a field has been set.
200+
func (o *Dashboard) HasDefaultTimeframe() bool {
201+
return o != nil && o.DefaultTimeframe.IsSet()
202+
}
203+
204+
// SetDefaultTimeframe gets a reference to the given NullableDashboardDefaultTimeframeSetting and assigns it to the DefaultTimeframe field.
205+
func (o *Dashboard) SetDefaultTimeframe(v DashboardDefaultTimeframeSetting) {
206+
o.DefaultTimeframe.Set(&v)
207+
}
208+
209+
// SetDefaultTimeframeNil sets the value for DefaultTimeframe to be an explicit nil.
210+
func (o *Dashboard) SetDefaultTimeframeNil() {
211+
o.DefaultTimeframe.Set(nil)
212+
}
213+
214+
// UnsetDefaultTimeframe ensures that no value is present for DefaultTimeframe, not even an explicit nil.
215+
func (o *Dashboard) UnsetDefaultTimeframe() {
216+
o.DefaultTimeframe.Unset()
217+
}
218+
178219
// GetDescription returns the Description field value if set, zero value otherwise (both if not set or set to explicit null).
179220
func (o *Dashboard) GetDescription() string {
180221
if o == nil || o.Description.Get() == nil {
@@ -638,6 +679,9 @@ func (o Dashboard) MarshalJSON() ([]byte, error) {
638679
toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00")
639680
}
640681
}
682+
if o.DefaultTimeframe.IsSet() {
683+
toSerialize["default_timeframe"] = o.DefaultTimeframe.Get()
684+
}
641685
if o.Description.IsSet() {
642686
toSerialize["description"] = o.Description.Get()
643687
}
@@ -691,24 +735,25 @@ func (o Dashboard) MarshalJSON() ([]byte, error) {
691735
// UnmarshalJSON deserializes the given payload.
692736
func (o *Dashboard) UnmarshalJSON(bytes []byte) (err error) {
693737
all := struct {
694-
AuthorHandle *string `json:"author_handle,omitempty"`
695-
AuthorName datadog.NullableString `json:"author_name,omitempty"`
696-
CreatedAt *time.Time `json:"created_at,omitempty"`
697-
Description datadog.NullableString `json:"description,omitempty"`
698-
Id *string `json:"id,omitempty"`
699-
IsReadOnly *bool `json:"is_read_only,omitempty"`
700-
LayoutType *DashboardLayoutType `json:"layout_type"`
701-
ModifiedAt *time.Time `json:"modified_at,omitempty"`
702-
NotifyList datadog.NullableList[string] `json:"notify_list,omitempty"`
703-
ReflowType *DashboardReflowType `json:"reflow_type,omitempty"`
704-
RestrictedRoles []string `json:"restricted_roles,omitempty"`
705-
Tabs []DashboardTab `json:"tabs,omitempty"`
706-
Tags datadog.NullableList[string] `json:"tags,omitempty"`
707-
TemplateVariablePresets []DashboardTemplateVariablePreset `json:"template_variable_presets,omitempty"`
708-
TemplateVariables []DashboardTemplateVariable `json:"template_variables,omitempty"`
709-
Title *string `json:"title"`
710-
Url *string `json:"url,omitempty"`
711-
Widgets *[]Widget `json:"widgets"`
738+
AuthorHandle *string `json:"author_handle,omitempty"`
739+
AuthorName datadog.NullableString `json:"author_name,omitempty"`
740+
CreatedAt *time.Time `json:"created_at,omitempty"`
741+
DefaultTimeframe NullableDashboardDefaultTimeframeSetting `json:"default_timeframe,omitempty"`
742+
Description datadog.NullableString `json:"description,omitempty"`
743+
Id *string `json:"id,omitempty"`
744+
IsReadOnly *bool `json:"is_read_only,omitempty"`
745+
LayoutType *DashboardLayoutType `json:"layout_type"`
746+
ModifiedAt *time.Time `json:"modified_at,omitempty"`
747+
NotifyList datadog.NullableList[string] `json:"notify_list,omitempty"`
748+
ReflowType *DashboardReflowType `json:"reflow_type,omitempty"`
749+
RestrictedRoles []string `json:"restricted_roles,omitempty"`
750+
Tabs []DashboardTab `json:"tabs,omitempty"`
751+
Tags datadog.NullableList[string] `json:"tags,omitempty"`
752+
TemplateVariablePresets []DashboardTemplateVariablePreset `json:"template_variable_presets,omitempty"`
753+
TemplateVariables []DashboardTemplateVariable `json:"template_variables,omitempty"`
754+
Title *string `json:"title"`
755+
Url *string `json:"url,omitempty"`
756+
Widgets *[]Widget `json:"widgets"`
712757
}{}
713758
if err = datadog.Unmarshal(bytes, &all); err != nil {
714759
return datadog.Unmarshal(bytes, &o.UnparsedObject)
@@ -724,7 +769,7 @@ func (o *Dashboard) UnmarshalJSON(bytes []byte) (err error) {
724769
}
725770
additionalProperties := make(map[string]interface{})
726771
if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil {
727-
datadog.DeleteKeys(additionalProperties, &[]string{"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"})
772+
datadog.DeleteKeys(additionalProperties, &[]string{"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"})
728773
} else {
729774
return err
730775
}
@@ -733,6 +778,7 @@ func (o *Dashboard) UnmarshalJSON(bytes []byte) (err error) {
733778
o.AuthorHandle = all.AuthorHandle
734779
o.AuthorName = all.AuthorName
735780
o.CreatedAt = all.CreatedAt
781+
o.DefaultTimeframe = all.DefaultTimeframe
736782
o.Description = all.Description
737783
o.Id = all.Id
738784
o.IsReadOnly = all.IsReadOnly
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
// This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
// Copyright 2019-Present Datadog, Inc.
4+
5+
package datadogV1
6+
7+
import (
8+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
9+
)
10+
11+
// DashboardDefaultTimeframeSetting - The default timeframe applied when opening the dashboard. Set to `null` to clear the dashboard's default timeframe.
12+
type DashboardDefaultTimeframeSetting struct {
13+
DashboardLiveTimeframe *DashboardLiveTimeframe
14+
DashboardFixedTimeframe *DashboardFixedTimeframe
15+
16+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
17+
UnparsedObject interface{}
18+
}
19+
20+
// DashboardLiveTimeframeAsDashboardDefaultTimeframeSetting is a convenience function that returns DashboardLiveTimeframe wrapped in DashboardDefaultTimeframeSetting.
21+
func DashboardLiveTimeframeAsDashboardDefaultTimeframeSetting(v *DashboardLiveTimeframe) DashboardDefaultTimeframeSetting {
22+
return DashboardDefaultTimeframeSetting{DashboardLiveTimeframe: v}
23+
}
24+
25+
// DashboardFixedTimeframeAsDashboardDefaultTimeframeSetting is a convenience function that returns DashboardFixedTimeframe wrapped in DashboardDefaultTimeframeSetting.
26+
func DashboardFixedTimeframeAsDashboardDefaultTimeframeSetting(v *DashboardFixedTimeframe) DashboardDefaultTimeframeSetting {
27+
return DashboardDefaultTimeframeSetting{DashboardFixedTimeframe: v}
28+
}
29+
30+
// UnmarshalJSON turns data into one of the pointers in the struct.
31+
func (obj *DashboardDefaultTimeframeSetting) UnmarshalJSON(data []byte) error {
32+
var err error
33+
}
34+
35+
// MarshalJSON turns data from the first non-nil pointers in the struct to JSON.
36+
func (obj DashboardDefaultTimeframeSetting) MarshalJSON() ([]byte, error) {
37+
if obj.DashboardLiveTimeframe != nil {
38+
return datadog.Marshal(&obj.DashboardLiveTimeframe)
39+
}
40+
41+
if obj.DashboardFixedTimeframe != nil {
42+
return datadog.Marshal(&obj.DashboardFixedTimeframe)
43+
}
44+
45+
if obj.UnparsedObject != nil {
46+
return datadog.Marshal(obj.UnparsedObject)
47+
}
48+
return nil, nil // no data in oneOf schemas
49+
}
50+
51+
// GetActualInstance returns the actual instance.
52+
func (obj *DashboardDefaultTimeframeSetting) GetActualInstance() interface{} {
53+
if obj.DashboardLiveTimeframe != nil {
54+
return obj.DashboardLiveTimeframe
55+
}
56+
57+
if obj.DashboardFixedTimeframe != nil {
58+
return obj.DashboardFixedTimeframe
59+
}
60+
61+
// all schemas are nil
62+
return nil
63+
}
64+
65+
// NullableDashboardDefaultTimeframeSetting handles when a null is used for DashboardDefaultTimeframeSetting.
66+
type NullableDashboardDefaultTimeframeSetting struct {
67+
value *DashboardDefaultTimeframeSetting
68+
isSet bool
69+
}
70+
71+
// Get returns the associated value.
72+
func (v NullableDashboardDefaultTimeframeSetting) Get() *DashboardDefaultTimeframeSetting {
73+
return v.value
74+
}
75+
76+
// Set changes the value and indicates it's been called.
77+
func (v *NullableDashboardDefaultTimeframeSetting) Set(val *DashboardDefaultTimeframeSetting) {
78+
v.value = val
79+
v.isSet = true
80+
}
81+
82+
// IsSet returns whether Set has been called.
83+
func (v NullableDashboardDefaultTimeframeSetting) IsSet() bool {
84+
return v.isSet
85+
}
86+
87+
// Unset sets the value to nil and resets the set flag/
88+
func (v *NullableDashboardDefaultTimeframeSetting) Unset() {
89+
v.value = nil
90+
v.isSet = false
91+
}
92+
93+
// NewNullableDashboardDefaultTimeframeSetting initializes the struct as if Set has been called.
94+
func NewNullableDashboardDefaultTimeframeSetting(val *DashboardDefaultTimeframeSetting) *NullableDashboardDefaultTimeframeSetting {
95+
return &NullableDashboardDefaultTimeframeSetting{value: val, isSet: true}
96+
}
97+
98+
// MarshalJSON serializes the associated value.
99+
func (v NullableDashboardDefaultTimeframeSetting) MarshalJSON() ([]byte, error) {
100+
return datadog.Marshal(v.value)
101+
}
102+
103+
// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called.
104+
func (v *NullableDashboardDefaultTimeframeSetting) UnmarshalJSON(src []byte) error {
105+
v.isSet = true
106+
107+
// this object is nullable so check if the payload is null or empty string
108+
if string(src) == "" || string(src) == "{}" {
109+
return nil
110+
}
111+
112+
return datadog.Unmarshal(src, &v.value)
113+
}

0 commit comments

Comments
 (0)