Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1443,6 +1443,8 @@ components:
format: date-time
readOnly: true
type: string
default_timeframe:
$ref: "#/components/schemas/DashboardDefaultTimeframeSetting"
description:
description: Description of the dashboard.
nullable: true
Expand Down Expand Up @@ -1557,13 +1559,55 @@ components:
required:
- data
type: object
DashboardDefaultTimeframeSetting:
description: The default timeframe applied when opening the dashboard. Set to `null` to clear the dashboard's default timeframe.
discriminator:
mapping:
fixed: "#/components/schemas/DashboardFixedTimeframe"
live: "#/components/schemas/DashboardLiveTimeframe"
propertyName: type
nullable: true
oneOf:
- $ref: "#/components/schemas/DashboardLiveTimeframe"
- $ref: "#/components/schemas/DashboardFixedTimeframe"
type: object
DashboardDeleteResponse:
description: Response from the delete dashboard call.
properties:
deleted_dashboard_id:
description: ID of the deleted dashboard.
type: string
type: object
DashboardFixedTimeframe:
description: A fixed dashboard timeframe.
properties:
from:
description: Start time in milliseconds since epoch.
example: 1712080128000
format: int64
minimum: 0
type: integer
to:
description: End time in milliseconds since epoch.
example: 1712083128000
format: int64
minimum: 0
type: integer
type:
$ref: "#/components/schemas/DashboardFixedTimeframeType"
required:
- type
- from
- to
type: object
DashboardFixedTimeframeType:
description: Type of fixed timeframe.
enum:
- fixed
example: fixed
type: string
x-enum-varnames:
- FIXED
DashboardGlobalTime:
description: Object containing the live span selection for the dashboard.
properties:
Expand Down Expand Up @@ -1672,6 +1716,32 @@ components:
$ref: "#/components/schemas/DashboardList"
type: array
type: object
DashboardLiveTimeframe:
description: A live dashboard timeframe.
properties:
type:
$ref: "#/components/schemas/DashboardLiveTimeframeType"
unit:
$ref: "#/components/schemas/WidgetLiveSpanUnit"
value:
description: Value of the live timeframe span.
example: 4
format: int64
minimum: 1
type: integer
required:
- type
- value
- unit
type: object
DashboardLiveTimeframeType:
description: Type of live timeframe.
enum:
- live
example: live
type: string
x-enum-varnames:
- LIVE
DashboardReflowType:
description: |-
Reflow type for a **new dashboard layout** dashboard. Set this only when layout type is 'ordered'.
Expand Down
84 changes: 65 additions & 19 deletions api/datadogV1/model_dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ type Dashboard struct {
AuthorName datadog.NullableString `json:"author_name,omitempty"`
// Creation date of the dashboard.
CreatedAt *time.Time `json:"created_at,omitempty"`
// The default timeframe applied when opening the dashboard. Set to `null` to clear the dashboard's default timeframe.
DefaultTimeframe NullableDashboardDefaultTimeframeSetting `json:"default_timeframe,omitempty"`
// Description of the dashboard.
Description datadog.NullableString `json:"description,omitempty"`
// ID of the dashboard.
Expand Down Expand Up @@ -175,6 +177,45 @@ func (o *Dashboard) SetCreatedAt(v time.Time) {
o.CreatedAt = &v
}

// GetDefaultTimeframe returns the DefaultTimeframe field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *Dashboard) GetDefaultTimeframe() DashboardDefaultTimeframeSetting {
if o == nil || o.DefaultTimeframe.Get() == nil {
var ret DashboardDefaultTimeframeSetting
return ret
}
return *o.DefaultTimeframe.Get()
}

// GetDefaultTimeframeOk returns a tuple with the DefaultTimeframe field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned.
func (o *Dashboard) GetDefaultTimeframeOk() (*DashboardDefaultTimeframeSetting, bool) {
if o == nil {
return nil, false
}
return o.DefaultTimeframe.Get(), o.DefaultTimeframe.IsSet()
}

// HasDefaultTimeframe returns a boolean if a field has been set.
func (o *Dashboard) HasDefaultTimeframe() bool {
return o != nil && o.DefaultTimeframe.IsSet()
}

// SetDefaultTimeframe gets a reference to the given NullableDashboardDefaultTimeframeSetting and assigns it to the DefaultTimeframe field.
func (o *Dashboard) SetDefaultTimeframe(v DashboardDefaultTimeframeSetting) {
o.DefaultTimeframe.Set(&v)
}

// SetDefaultTimeframeNil sets the value for DefaultTimeframe to be an explicit nil.
func (o *Dashboard) SetDefaultTimeframeNil() {
o.DefaultTimeframe.Set(nil)
}

// UnsetDefaultTimeframe ensures that no value is present for DefaultTimeframe, not even an explicit nil.
func (o *Dashboard) UnsetDefaultTimeframe() {
o.DefaultTimeframe.Unset()
}

// GetDescription returns the Description field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *Dashboard) GetDescription() string {
if o == nil || o.Description.Get() == nil {
Expand Down Expand Up @@ -638,6 +679,9 @@ func (o Dashboard) MarshalJSON() ([]byte, error) {
toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00")
}
}
if o.DefaultTimeframe.IsSet() {
toSerialize["default_timeframe"] = o.DefaultTimeframe.Get()
}
if o.Description.IsSet() {
toSerialize["description"] = o.Description.Get()
}
Expand Down Expand Up @@ -691,24 +735,25 @@ func (o Dashboard) MarshalJSON() ([]byte, error) {
// UnmarshalJSON deserializes the given payload.
func (o *Dashboard) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
AuthorHandle *string `json:"author_handle,omitempty"`
AuthorName datadog.NullableString `json:"author_name,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
Description datadog.NullableString `json:"description,omitempty"`
Id *string `json:"id,omitempty"`
IsReadOnly *bool `json:"is_read_only,omitempty"`
LayoutType *DashboardLayoutType `json:"layout_type"`
ModifiedAt *time.Time `json:"modified_at,omitempty"`
NotifyList datadog.NullableList[string] `json:"notify_list,omitempty"`
ReflowType *DashboardReflowType `json:"reflow_type,omitempty"`
RestrictedRoles []string `json:"restricted_roles,omitempty"`
Tabs []DashboardTab `json:"tabs,omitempty"`
Tags datadog.NullableList[string] `json:"tags,omitempty"`
TemplateVariablePresets []DashboardTemplateVariablePreset `json:"template_variable_presets,omitempty"`
TemplateVariables []DashboardTemplateVariable `json:"template_variables,omitempty"`
Title *string `json:"title"`
Url *string `json:"url,omitempty"`
Widgets *[]Widget `json:"widgets"`
AuthorHandle *string `json:"author_handle,omitempty"`
AuthorName datadog.NullableString `json:"author_name,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
DefaultTimeframe NullableDashboardDefaultTimeframeSetting `json:"default_timeframe,omitempty"`
Description datadog.NullableString `json:"description,omitempty"`
Id *string `json:"id,omitempty"`
IsReadOnly *bool `json:"is_read_only,omitempty"`
LayoutType *DashboardLayoutType `json:"layout_type"`
ModifiedAt *time.Time `json:"modified_at,omitempty"`
NotifyList datadog.NullableList[string] `json:"notify_list,omitempty"`
ReflowType *DashboardReflowType `json:"reflow_type,omitempty"`
RestrictedRoles []string `json:"restricted_roles,omitempty"`
Tabs []DashboardTab `json:"tabs,omitempty"`
Tags datadog.NullableList[string] `json:"tags,omitempty"`
TemplateVariablePresets []DashboardTemplateVariablePreset `json:"template_variable_presets,omitempty"`
TemplateVariables []DashboardTemplateVariable `json:"template_variables,omitempty"`
Title *string `json:"title"`
Url *string `json:"url,omitempty"`
Widgets *[]Widget `json:"widgets"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
Expand All @@ -724,7 +769,7 @@ func (o *Dashboard) UnmarshalJSON(bytes []byte) (err error) {
}
additionalProperties := make(map[string]interface{})
if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil {
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"})
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"})
} else {
return err
}
Expand All @@ -733,6 +778,7 @@ func (o *Dashboard) UnmarshalJSON(bytes []byte) (err error) {
o.AuthorHandle = all.AuthorHandle
o.AuthorName = all.AuthorName
o.CreatedAt = all.CreatedAt
o.DefaultTimeframe = all.DefaultTimeframe
o.Description = all.Description
o.Id = all.Id
o.IsReadOnly = all.IsReadOnly
Expand Down
113 changes: 113 additions & 0 deletions api/datadogV1/model_dashboard_default_timeframe_setting.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.

package datadogV1

import (
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// DashboardDefaultTimeframeSetting - The default timeframe applied when opening the dashboard. Set to `null` to clear the dashboard's default timeframe.
type DashboardDefaultTimeframeSetting struct {
DashboardLiveTimeframe *DashboardLiveTimeframe
DashboardFixedTimeframe *DashboardFixedTimeframe

// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject interface{}
}

// DashboardLiveTimeframeAsDashboardDefaultTimeframeSetting is a convenience function that returns DashboardLiveTimeframe wrapped in DashboardDefaultTimeframeSetting.
func DashboardLiveTimeframeAsDashboardDefaultTimeframeSetting(v *DashboardLiveTimeframe) DashboardDefaultTimeframeSetting {
return DashboardDefaultTimeframeSetting{DashboardLiveTimeframe: v}
}

// DashboardFixedTimeframeAsDashboardDefaultTimeframeSetting is a convenience function that returns DashboardFixedTimeframe wrapped in DashboardDefaultTimeframeSetting.
func DashboardFixedTimeframeAsDashboardDefaultTimeframeSetting(v *DashboardFixedTimeframe) DashboardDefaultTimeframeSetting {
return DashboardDefaultTimeframeSetting{DashboardFixedTimeframe: v}
}

// UnmarshalJSON turns data into one of the pointers in the struct.
func (obj *DashboardDefaultTimeframeSetting) UnmarshalJSON(data []byte) error {
var err error

Check failure on line 32 in api/datadogV1/model_dashboard_default_timeframe_setting.go

View workflow job for this annotation

GitHub Actions / examples / build (1)

err declared and not used

Check failure on line 32 in api/datadogV1/model_dashboard_default_timeframe_setting.go

View workflow job for this annotation

GitHub Actions / examples / build (2)

err declared and not used
}

Check failure on line 33 in api/datadogV1/model_dashboard_default_timeframe_setting.go

View workflow job for this annotation

GitHub Actions / examples / build (1)

missing return

Check failure on line 33 in api/datadogV1/model_dashboard_default_timeframe_setting.go

View workflow job for this annotation

GitHub Actions / examples / build (2)

missing return

// MarshalJSON turns data from the first non-nil pointers in the struct to JSON.
func (obj DashboardDefaultTimeframeSetting) MarshalJSON() ([]byte, error) {
if obj.DashboardLiveTimeframe != nil {
return datadog.Marshal(&obj.DashboardLiveTimeframe)
}

if obj.DashboardFixedTimeframe != nil {
return datadog.Marshal(&obj.DashboardFixedTimeframe)
}

if obj.UnparsedObject != nil {
return datadog.Marshal(obj.UnparsedObject)
}
return nil, nil // no data in oneOf schemas
}

// GetActualInstance returns the actual instance.
func (obj *DashboardDefaultTimeframeSetting) GetActualInstance() interface{} {
if obj.DashboardLiveTimeframe != nil {
return obj.DashboardLiveTimeframe
}

if obj.DashboardFixedTimeframe != nil {
return obj.DashboardFixedTimeframe
}

// all schemas are nil
return nil
}

// NullableDashboardDefaultTimeframeSetting handles when a null is used for DashboardDefaultTimeframeSetting.
type NullableDashboardDefaultTimeframeSetting struct {
value *DashboardDefaultTimeframeSetting
isSet bool
}

// Get returns the associated value.
func (v NullableDashboardDefaultTimeframeSetting) Get() *DashboardDefaultTimeframeSetting {
return v.value
}

// Set changes the value and indicates it's been called.
func (v *NullableDashboardDefaultTimeframeSetting) Set(val *DashboardDefaultTimeframeSetting) {
v.value = val
v.isSet = true
}

// IsSet returns whether Set has been called.
func (v NullableDashboardDefaultTimeframeSetting) IsSet() bool {
return v.isSet
}

// Unset sets the value to nil and resets the set flag/
func (v *NullableDashboardDefaultTimeframeSetting) Unset() {
v.value = nil
v.isSet = false
}

// NewNullableDashboardDefaultTimeframeSetting initializes the struct as if Set has been called.
func NewNullableDashboardDefaultTimeframeSetting(val *DashboardDefaultTimeframeSetting) *NullableDashboardDefaultTimeframeSetting {
return &NullableDashboardDefaultTimeframeSetting{value: val, isSet: true}
}

// MarshalJSON serializes the associated value.
func (v NullableDashboardDefaultTimeframeSetting) MarshalJSON() ([]byte, error) {
return datadog.Marshal(v.value)
}

// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called.
func (v *NullableDashboardDefaultTimeframeSetting) UnmarshalJSON(src []byte) error {
v.isSet = true

// this object is nullable so check if the payload is null or empty string
if string(src) == "" || string(src) == "{}" {
return nil
}

return datadog.Unmarshal(src, &v.value)
}
Loading
Loading