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
19 changes: 18 additions & 1 deletion .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19247,6 +19247,23 @@ components:
x-enum-varnames:
- BARS
- AREA
TimeseriesRequestStyle:
description: Define request widget style for timeseries widgets.
properties:
has_value_labels:
description: If true, the value is displayed as a label relative to the
data point.
type: boolean
line_type:
$ref: '#/components/schemas/WidgetLineType'
line_width:
$ref: '#/components/schemas/WidgetLineWidth'
order_by:
$ref: '#/components/schemas/WidgetStyleOrderBy'
palette:
description: Color palette to apply to the widget.
type: string
type: object
TimeseriesWidgetDefinition:
description: The timeseries visualization allows you to display the evolution
of one or more metrics, log events, or Indexed Spans over time.
Expand Down Expand Up @@ -19401,7 +19418,7 @@ components:
security_query:
$ref: '#/components/schemas/LogQueryDefinition'
style:
$ref: '#/components/schemas/WidgetRequestStyle'
$ref: '#/components/schemas/TimeseriesRequestStyle'
type: object
ToplistWidgetDefinition:
description: The top list visualization enables you to display a list of Tag
Expand Down
262 changes: 262 additions & 0 deletions api/datadogV1/model_timeseries_request_style.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
// 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"
)

// TimeseriesRequestStyle Define request widget style for timeseries widgets.
type TimeseriesRequestStyle struct {
// If true, the value is displayed as a label relative to the data point.
HasValueLabels *bool `json:"has_value_labels,omitempty"`
// Type of lines displayed.
LineType *WidgetLineType `json:"line_type,omitempty"`
// Width of line displayed.
LineWidth *WidgetLineWidth `json:"line_width,omitempty"`
// How to order series in timeseries visualizations.
// - `tags`: Order series alphabetically by tag name (default behavior)
// - `values`: Order series by their current metric values (typically descending)
OrderBy *WidgetStyleOrderBy `json:"order_by,omitempty"`
// Color palette to apply to the widget.
Palette *string `json:"palette,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
AdditionalProperties map[string]interface{} `json:"-"`
}

// NewTimeseriesRequestStyle instantiates a new TimeseriesRequestStyle object.
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed.
func NewTimeseriesRequestStyle() *TimeseriesRequestStyle {
this := TimeseriesRequestStyle{}
return &this
}

// NewTimeseriesRequestStyleWithDefaults instantiates a new TimeseriesRequestStyle object.
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set.
func NewTimeseriesRequestStyleWithDefaults() *TimeseriesRequestStyle {
this := TimeseriesRequestStyle{}
return &this
}

// GetHasValueLabels returns the HasValueLabels field value if set, zero value otherwise.
func (o *TimeseriesRequestStyle) GetHasValueLabels() bool {
if o == nil || o.HasValueLabels == nil {
var ret bool
return ret
}
return *o.HasValueLabels
}

// GetHasValueLabelsOk returns a tuple with the HasValueLabels field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TimeseriesRequestStyle) GetHasValueLabelsOk() (*bool, bool) {
if o == nil || o.HasValueLabels == nil {
return nil, false
}
return o.HasValueLabels, true
}

// HasHasValueLabels returns a boolean if a field has been set.
func (o *TimeseriesRequestStyle) HasHasValueLabels() bool {
return o != nil && o.HasValueLabels != nil
}

// SetHasValueLabels gets a reference to the given bool and assigns it to the HasValueLabels field.
func (o *TimeseriesRequestStyle) SetHasValueLabels(v bool) {
o.HasValueLabels = &v
}

// GetLineType returns the LineType field value if set, zero value otherwise.
func (o *TimeseriesRequestStyle) GetLineType() WidgetLineType {
if o == nil || o.LineType == nil {
var ret WidgetLineType
return ret
}
return *o.LineType
}

// GetLineTypeOk returns a tuple with the LineType field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TimeseriesRequestStyle) GetLineTypeOk() (*WidgetLineType, bool) {
if o == nil || o.LineType == nil {
return nil, false
}
return o.LineType, true
}

// HasLineType returns a boolean if a field has been set.
func (o *TimeseriesRequestStyle) HasLineType() bool {
return o != nil && o.LineType != nil
}

// SetLineType gets a reference to the given WidgetLineType and assigns it to the LineType field.
func (o *TimeseriesRequestStyle) SetLineType(v WidgetLineType) {
o.LineType = &v
}

// GetLineWidth returns the LineWidth field value if set, zero value otherwise.
func (o *TimeseriesRequestStyle) GetLineWidth() WidgetLineWidth {
if o == nil || o.LineWidth == nil {
var ret WidgetLineWidth
return ret
}
return *o.LineWidth
}

// GetLineWidthOk returns a tuple with the LineWidth field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TimeseriesRequestStyle) GetLineWidthOk() (*WidgetLineWidth, bool) {
if o == nil || o.LineWidth == nil {
return nil, false
}
return o.LineWidth, true
}

// HasLineWidth returns a boolean if a field has been set.
func (o *TimeseriesRequestStyle) HasLineWidth() bool {
return o != nil && o.LineWidth != nil
}

// SetLineWidth gets a reference to the given WidgetLineWidth and assigns it to the LineWidth field.
func (o *TimeseriesRequestStyle) SetLineWidth(v WidgetLineWidth) {
o.LineWidth = &v
}

// GetOrderBy returns the OrderBy field value if set, zero value otherwise.
func (o *TimeseriesRequestStyle) GetOrderBy() WidgetStyleOrderBy {
if o == nil || o.OrderBy == nil {
var ret WidgetStyleOrderBy
return ret
}
return *o.OrderBy
}

// GetOrderByOk returns a tuple with the OrderBy field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TimeseriesRequestStyle) GetOrderByOk() (*WidgetStyleOrderBy, bool) {
if o == nil || o.OrderBy == nil {
return nil, false
}
return o.OrderBy, true
}

// HasOrderBy returns a boolean if a field has been set.
func (o *TimeseriesRequestStyle) HasOrderBy() bool {
return o != nil && o.OrderBy != nil
}

// SetOrderBy gets a reference to the given WidgetStyleOrderBy and assigns it to the OrderBy field.
func (o *TimeseriesRequestStyle) SetOrderBy(v WidgetStyleOrderBy) {
o.OrderBy = &v
}

// GetPalette returns the Palette field value if set, zero value otherwise.
func (o *TimeseriesRequestStyle) GetPalette() string {
if o == nil || o.Palette == nil {
var ret string
return ret
}
return *o.Palette
}

// GetPaletteOk returns a tuple with the Palette field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TimeseriesRequestStyle) GetPaletteOk() (*string, bool) {
if o == nil || o.Palette == nil {
return nil, false
}
return o.Palette, true
}

// HasPalette returns a boolean if a field has been set.
func (o *TimeseriesRequestStyle) HasPalette() bool {
return o != nil && o.Palette != nil
}

// SetPalette gets a reference to the given string and assigns it to the Palette field.
func (o *TimeseriesRequestStyle) SetPalette(v string) {
o.Palette = &v
}

// MarshalJSON serializes the struct using spec logic.
func (o TimeseriesRequestStyle) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
if o.HasValueLabels != nil {
toSerialize["has_value_labels"] = o.HasValueLabels
}
if o.LineType != nil {
toSerialize["line_type"] = o.LineType
}
if o.LineWidth != nil {
toSerialize["line_width"] = o.LineWidth
}
if o.OrderBy != nil {
toSerialize["order_by"] = o.OrderBy
}
if o.Palette != nil {
toSerialize["palette"] = o.Palette
}

for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return datadog.Marshal(toSerialize)
}

// UnmarshalJSON deserializes the given payload.
func (o *TimeseriesRequestStyle) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
HasValueLabels *bool `json:"has_value_labels,omitempty"`
LineType *WidgetLineType `json:"line_type,omitempty"`
LineWidth *WidgetLineWidth `json:"line_width,omitempty"`
OrderBy *WidgetStyleOrderBy `json:"order_by,omitempty"`
Palette *string `json:"palette,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"has_value_labels", "line_type", "line_width", "order_by", "palette"})
} else {
return err
}

hasInvalidField := false
o.HasValueLabels = all.HasValueLabels
if all.LineType != nil && !all.LineType.IsValid() {
hasInvalidField = true
} else {
o.LineType = all.LineType
}
if all.LineWidth != nil && !all.LineWidth.IsValid() {
hasInvalidField = true
} else {
o.LineWidth = all.LineWidth
}
if all.OrderBy != nil && !all.OrderBy.IsValid() {
hasInvalidField = true
} else {
o.OrderBy = all.OrderBy
}
o.Palette = all.Palette

if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}

if hasInvalidField {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}

return nil
}
16 changes: 8 additions & 8 deletions api/datadogV1/model_timeseries_widget_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ type TimeseriesWidgetRequest struct {
RumQuery *LogQueryDefinition `json:"rum_query,omitempty"`
// The log query.
SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"`
// Define request widget style.
Style *WidgetRequestStyle `json:"style,omitempty"`
// Define request widget style for timeseries widgets.
Style *TimeseriesRequestStyle `json:"style,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
AdditionalProperties map[string]interface{} `json:"-"`
Expand Down Expand Up @@ -515,17 +515,17 @@ func (o *TimeseriesWidgetRequest) SetSecurityQuery(v LogQueryDefinition) {
}

// GetStyle returns the Style field value if set, zero value otherwise.
func (o *TimeseriesWidgetRequest) GetStyle() WidgetRequestStyle {
func (o *TimeseriesWidgetRequest) GetStyle() TimeseriesRequestStyle {
if o == nil || o.Style == nil {
var ret WidgetRequestStyle
var ret TimeseriesRequestStyle
return ret
}
return *o.Style
}

// GetStyleOk returns a tuple with the Style field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TimeseriesWidgetRequest) GetStyleOk() (*WidgetRequestStyle, bool) {
func (o *TimeseriesWidgetRequest) GetStyleOk() (*TimeseriesRequestStyle, bool) {
if o == nil || o.Style == nil {
return nil, false
}
Expand All @@ -537,8 +537,8 @@ func (o *TimeseriesWidgetRequest) HasStyle() bool {
return o != nil && o.Style != nil
}

// SetStyle gets a reference to the given WidgetRequestStyle and assigns it to the Style field.
func (o *TimeseriesWidgetRequest) SetStyle(v WidgetRequestStyle) {
// SetStyle gets a reference to the given TimeseriesRequestStyle and assigns it to the Style field.
func (o *TimeseriesWidgetRequest) SetStyle(v TimeseriesRequestStyle) {
o.Style = &v
}

Expand Down Expand Up @@ -625,7 +625,7 @@ func (o *TimeseriesWidgetRequest) UnmarshalJSON(bytes []byte) (err error) {
ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"`
RumQuery *LogQueryDefinition `json:"rum_query,omitempty"`
SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"`
Style *WidgetRequestStyle `json:"style,omitempty"`
Style *TimeseriesRequestStyle `json:"style,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
Expand Down
2 changes: 1 addition & 1 deletion examples/v1/dashboards/CreateDashboard_1259346254.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func main() {
Requests: []datadogV1.TimeseriesWidgetRequest{
{
Q: datadog.PtrString("avg:system.cpu.user{*} by {host}"),
Style: &datadogV1.WidgetRequestStyle{
Style: &datadogV1.TimeseriesRequestStyle{
Palette: datadog.PtrString("warm"),
OrderBy: datadogV1.WIDGETSTYLEORDERBY_VALUES.Ptr(),
},
Expand Down
2 changes: 1 addition & 1 deletion examples/v1/dashboards/CreateDashboard_1284514532.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func main() {
}},
},
ResponseFormat: datadogV1.FORMULAANDFUNCTIONRESPONSEFORMAT_TIMESERIES.Ptr(),
Style: &datadogV1.WidgetRequestStyle{
Style: &datadogV1.TimeseriesRequestStyle{
Palette: datadog.PtrString("dog_classic"),
LineType: datadogV1.WIDGETLINETYPE_SOLID.Ptr(),
LineWidth: datadogV1.WIDGETLINEWIDTH_NORMAL.Ptr(),
Expand Down
2 changes: 1 addition & 1 deletion examples/v1/dashboards/CreateDashboard_1307120899.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func main() {
}},
},
ResponseFormat: datadogV1.FORMULAANDFUNCTIONRESPONSEFORMAT_TIMESERIES.Ptr(),
Style: &datadogV1.WidgetRequestStyle{
Style: &datadogV1.TimeseriesRequestStyle{
Palette: datadog.PtrString("dog_classic"),
LineType: datadogV1.WIDGETLINETYPE_SOLID.Ptr(),
LineWidth: datadogV1.WIDGETLINEWIDTH_NORMAL.Ptr(),
Expand Down
2 changes: 1 addition & 1 deletion examples/v1/dashboards/CreateDashboard_1433408735.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func main() {
}},
},
ResponseFormat: datadogV1.FORMULAANDFUNCTIONRESPONSEFORMAT_TIMESERIES.Ptr(),
Style: &datadogV1.WidgetRequestStyle{
Style: &datadogV1.TimeseriesRequestStyle{
Palette: datadog.PtrString("dog_classic"),
LineType: datadogV1.WIDGETLINETYPE_SOLID.Ptr(),
LineWidth: datadogV1.WIDGETLINEWIDTH_NORMAL.Ptr(),
Expand Down
2 changes: 1 addition & 1 deletion examples/v1/dashboards/CreateDashboard_2261785072.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func main() {
Query: "avg:system.cpu.user{*}",
}},
},
Style: &datadogV1.WidgetRequestStyle{
Style: &datadogV1.TimeseriesRequestStyle{
Palette: datadog.PtrString("purple"),
LineType: datadogV1.WIDGETLINETYPE_SOLID.Ptr(),
LineWidth: datadogV1.WIDGETLINEWIDTH_NORMAL.Ptr(),
Expand Down
Loading