Skip to content

Commit a4646a7

Browse files
api-clients-generation-pipeline[bot]beccajellinekci.datadog-api-spec
authored
Timeseries Request Style supports value labels field (#3678)
* fix tests * Regenerate client from commit 7a70f56 of spec repo --------- Co-authored-by: Becca Jellinek <becca.jellinek@datadoghq.com> Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent e199042 commit a4646a7

26 files changed

Lines changed: 417 additions & 31 deletions

.generator/schemas/v1/openapi.yaml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19536,6 +19536,23 @@ components:
1953619536
x-enum-varnames:
1953719537
- BARS
1953819538
- AREA
19539+
TimeseriesRequestStyle:
19540+
description: Define request widget style for timeseries widgets.
19541+
properties:
19542+
has_value_labels:
19543+
description: If true, the value is displayed as a label relative to the
19544+
data point.
19545+
type: boolean
19546+
line_type:
19547+
$ref: '#/components/schemas/WidgetLineType'
19548+
line_width:
19549+
$ref: '#/components/schemas/WidgetLineWidth'
19550+
order_by:
19551+
$ref: '#/components/schemas/WidgetStyleOrderBy'
19552+
palette:
19553+
description: Color palette to apply to the widget.
19554+
type: string
19555+
type: object
1953919556
TimeseriesWidgetDefinition:
1954019557
description: The timeseries visualization allows you to display the evolution
1954119558
of one or more metrics, log events, or Indexed Spans over time.
@@ -19711,7 +19728,7 @@ components:
1971119728
deprecated: true
1971219729
description: Deprecated - Use `queries` and `formulas` instead.
1971319730
style:
19714-
$ref: '#/components/schemas/WidgetRequestStyle'
19731+
$ref: '#/components/schemas/TimeseriesRequestStyle'
1971519732
type: object
1971619733
ToplistWidgetDefinition:
1971719734
description: The top list visualization enables you to display a list of Tag
Lines changed: 262 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,262 @@
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+
// TimeseriesRequestStyle Define request widget style for timeseries widgets.
12+
type TimeseriesRequestStyle struct {
13+
// If true, the value is displayed as a label relative to the data point.
14+
HasValueLabels *bool `json:"has_value_labels,omitempty"`
15+
// Type of lines displayed.
16+
LineType *WidgetLineType `json:"line_type,omitempty"`
17+
// Width of line displayed.
18+
LineWidth *WidgetLineWidth `json:"line_width,omitempty"`
19+
// How to order series in timeseries visualizations.
20+
// - `tags`: Order series alphabetically by tag name (default behavior)
21+
// - `values`: Order series by their current metric values (typically descending)
22+
OrderBy *WidgetStyleOrderBy `json:"order_by,omitempty"`
23+
// Color palette to apply to the widget.
24+
Palette *string `json:"palette,omitempty"`
25+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
26+
UnparsedObject map[string]interface{} `json:"-"`
27+
AdditionalProperties map[string]interface{} `json:"-"`
28+
}
29+
30+
// NewTimeseriesRequestStyle instantiates a new TimeseriesRequestStyle object.
31+
// This constructor will assign default values to properties that have it defined,
32+
// and makes sure properties required by API are set, but the set of arguments
33+
// will change when the set of required properties is changed.
34+
func NewTimeseriesRequestStyle() *TimeseriesRequestStyle {
35+
this := TimeseriesRequestStyle{}
36+
return &this
37+
}
38+
39+
// NewTimeseriesRequestStyleWithDefaults instantiates a new TimeseriesRequestStyle object.
40+
// This constructor will only assign default values to properties that have it defined,
41+
// but it doesn't guarantee that properties required by API are set.
42+
func NewTimeseriesRequestStyleWithDefaults() *TimeseriesRequestStyle {
43+
this := TimeseriesRequestStyle{}
44+
return &this
45+
}
46+
47+
// GetHasValueLabels returns the HasValueLabels field value if set, zero value otherwise.
48+
func (o *TimeseriesRequestStyle) GetHasValueLabels() bool {
49+
if o == nil || o.HasValueLabels == nil {
50+
var ret bool
51+
return ret
52+
}
53+
return *o.HasValueLabels
54+
}
55+
56+
// GetHasValueLabelsOk returns a tuple with the HasValueLabels field value if set, nil otherwise
57+
// and a boolean to check if the value has been set.
58+
func (o *TimeseriesRequestStyle) GetHasValueLabelsOk() (*bool, bool) {
59+
if o == nil || o.HasValueLabels == nil {
60+
return nil, false
61+
}
62+
return o.HasValueLabels, true
63+
}
64+
65+
// HasHasValueLabels returns a boolean if a field has been set.
66+
func (o *TimeseriesRequestStyle) HasHasValueLabels() bool {
67+
return o != nil && o.HasValueLabels != nil
68+
}
69+
70+
// SetHasValueLabels gets a reference to the given bool and assigns it to the HasValueLabels field.
71+
func (o *TimeseriesRequestStyle) SetHasValueLabels(v bool) {
72+
o.HasValueLabels = &v
73+
}
74+
75+
// GetLineType returns the LineType field value if set, zero value otherwise.
76+
func (o *TimeseriesRequestStyle) GetLineType() WidgetLineType {
77+
if o == nil || o.LineType == nil {
78+
var ret WidgetLineType
79+
return ret
80+
}
81+
return *o.LineType
82+
}
83+
84+
// GetLineTypeOk returns a tuple with the LineType field value if set, nil otherwise
85+
// and a boolean to check if the value has been set.
86+
func (o *TimeseriesRequestStyle) GetLineTypeOk() (*WidgetLineType, bool) {
87+
if o == nil || o.LineType == nil {
88+
return nil, false
89+
}
90+
return o.LineType, true
91+
}
92+
93+
// HasLineType returns a boolean if a field has been set.
94+
func (o *TimeseriesRequestStyle) HasLineType() bool {
95+
return o != nil && o.LineType != nil
96+
}
97+
98+
// SetLineType gets a reference to the given WidgetLineType and assigns it to the LineType field.
99+
func (o *TimeseriesRequestStyle) SetLineType(v WidgetLineType) {
100+
o.LineType = &v
101+
}
102+
103+
// GetLineWidth returns the LineWidth field value if set, zero value otherwise.
104+
func (o *TimeseriesRequestStyle) GetLineWidth() WidgetLineWidth {
105+
if o == nil || o.LineWidth == nil {
106+
var ret WidgetLineWidth
107+
return ret
108+
}
109+
return *o.LineWidth
110+
}
111+
112+
// GetLineWidthOk returns a tuple with the LineWidth field value if set, nil otherwise
113+
// and a boolean to check if the value has been set.
114+
func (o *TimeseriesRequestStyle) GetLineWidthOk() (*WidgetLineWidth, bool) {
115+
if o == nil || o.LineWidth == nil {
116+
return nil, false
117+
}
118+
return o.LineWidth, true
119+
}
120+
121+
// HasLineWidth returns a boolean if a field has been set.
122+
func (o *TimeseriesRequestStyle) HasLineWidth() bool {
123+
return o != nil && o.LineWidth != nil
124+
}
125+
126+
// SetLineWidth gets a reference to the given WidgetLineWidth and assigns it to the LineWidth field.
127+
func (o *TimeseriesRequestStyle) SetLineWidth(v WidgetLineWidth) {
128+
o.LineWidth = &v
129+
}
130+
131+
// GetOrderBy returns the OrderBy field value if set, zero value otherwise.
132+
func (o *TimeseriesRequestStyle) GetOrderBy() WidgetStyleOrderBy {
133+
if o == nil || o.OrderBy == nil {
134+
var ret WidgetStyleOrderBy
135+
return ret
136+
}
137+
return *o.OrderBy
138+
}
139+
140+
// GetOrderByOk returns a tuple with the OrderBy field value if set, nil otherwise
141+
// and a boolean to check if the value has been set.
142+
func (o *TimeseriesRequestStyle) GetOrderByOk() (*WidgetStyleOrderBy, bool) {
143+
if o == nil || o.OrderBy == nil {
144+
return nil, false
145+
}
146+
return o.OrderBy, true
147+
}
148+
149+
// HasOrderBy returns a boolean if a field has been set.
150+
func (o *TimeseriesRequestStyle) HasOrderBy() bool {
151+
return o != nil && o.OrderBy != nil
152+
}
153+
154+
// SetOrderBy gets a reference to the given WidgetStyleOrderBy and assigns it to the OrderBy field.
155+
func (o *TimeseriesRequestStyle) SetOrderBy(v WidgetStyleOrderBy) {
156+
o.OrderBy = &v
157+
}
158+
159+
// GetPalette returns the Palette field value if set, zero value otherwise.
160+
func (o *TimeseriesRequestStyle) GetPalette() string {
161+
if o == nil || o.Palette == nil {
162+
var ret string
163+
return ret
164+
}
165+
return *o.Palette
166+
}
167+
168+
// GetPaletteOk returns a tuple with the Palette field value if set, nil otherwise
169+
// and a boolean to check if the value has been set.
170+
func (o *TimeseriesRequestStyle) GetPaletteOk() (*string, bool) {
171+
if o == nil || o.Palette == nil {
172+
return nil, false
173+
}
174+
return o.Palette, true
175+
}
176+
177+
// HasPalette returns a boolean if a field has been set.
178+
func (o *TimeseriesRequestStyle) HasPalette() bool {
179+
return o != nil && o.Palette != nil
180+
}
181+
182+
// SetPalette gets a reference to the given string and assigns it to the Palette field.
183+
func (o *TimeseriesRequestStyle) SetPalette(v string) {
184+
o.Palette = &v
185+
}
186+
187+
// MarshalJSON serializes the struct using spec logic.
188+
func (o TimeseriesRequestStyle) MarshalJSON() ([]byte, error) {
189+
toSerialize := map[string]interface{}{}
190+
if o.UnparsedObject != nil {
191+
return datadog.Marshal(o.UnparsedObject)
192+
}
193+
if o.HasValueLabels != nil {
194+
toSerialize["has_value_labels"] = o.HasValueLabels
195+
}
196+
if o.LineType != nil {
197+
toSerialize["line_type"] = o.LineType
198+
}
199+
if o.LineWidth != nil {
200+
toSerialize["line_width"] = o.LineWidth
201+
}
202+
if o.OrderBy != nil {
203+
toSerialize["order_by"] = o.OrderBy
204+
}
205+
if o.Palette != nil {
206+
toSerialize["palette"] = o.Palette
207+
}
208+
209+
for key, value := range o.AdditionalProperties {
210+
toSerialize[key] = value
211+
}
212+
return datadog.Marshal(toSerialize)
213+
}
214+
215+
// UnmarshalJSON deserializes the given payload.
216+
func (o *TimeseriesRequestStyle) UnmarshalJSON(bytes []byte) (err error) {
217+
all := struct {
218+
HasValueLabels *bool `json:"has_value_labels,omitempty"`
219+
LineType *WidgetLineType `json:"line_type,omitempty"`
220+
LineWidth *WidgetLineWidth `json:"line_width,omitempty"`
221+
OrderBy *WidgetStyleOrderBy `json:"order_by,omitempty"`
222+
Palette *string `json:"palette,omitempty"`
223+
}{}
224+
if err = datadog.Unmarshal(bytes, &all); err != nil {
225+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
226+
}
227+
additionalProperties := make(map[string]interface{})
228+
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
229+
datadog.DeleteKeys(additionalProperties, &[]string{"has_value_labels", "line_type", "line_width", "order_by", "palette"})
230+
} else {
231+
return err
232+
}
233+
234+
hasInvalidField := false
235+
o.HasValueLabels = all.HasValueLabels
236+
if all.LineType != nil && !all.LineType.IsValid() {
237+
hasInvalidField = true
238+
} else {
239+
o.LineType = all.LineType
240+
}
241+
if all.LineWidth != nil && !all.LineWidth.IsValid() {
242+
hasInvalidField = true
243+
} else {
244+
o.LineWidth = all.LineWidth
245+
}
246+
if all.OrderBy != nil && !all.OrderBy.IsValid() {
247+
hasInvalidField = true
248+
} else {
249+
o.OrderBy = all.OrderBy
250+
}
251+
o.Palette = all.Palette
252+
253+
if len(additionalProperties) > 0 {
254+
o.AdditionalProperties = additionalProperties
255+
}
256+
257+
if hasInvalidField {
258+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
259+
}
260+
261+
return nil
262+
}

api/datadogV1/model_timeseries_widget_request.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ type TimeseriesWidgetRequest struct {
4343
RumQuery *LogQueryDefinition `json:"rum_query,omitempty"`
4444
// The log query.
4545
SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"`
46-
// Define request widget style.
47-
Style *WidgetRequestStyle `json:"style,omitempty"`
46+
// Define request widget style for timeseries widgets.
47+
Style *TimeseriesRequestStyle `json:"style,omitempty"`
4848
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
4949
UnparsedObject map[string]interface{} `json:"-"`
5050
AdditionalProperties map[string]interface{} `json:"-"`
@@ -519,17 +519,17 @@ func (o *TimeseriesWidgetRequest) SetSecurityQuery(v LogQueryDefinition) {
519519
}
520520

521521
// GetStyle returns the Style field value if set, zero value otherwise.
522-
func (o *TimeseriesWidgetRequest) GetStyle() WidgetRequestStyle {
522+
func (o *TimeseriesWidgetRequest) GetStyle() TimeseriesRequestStyle {
523523
if o == nil || o.Style == nil {
524-
var ret WidgetRequestStyle
524+
var ret TimeseriesRequestStyle
525525
return ret
526526
}
527527
return *o.Style
528528
}
529529

530530
// GetStyleOk returns a tuple with the Style field value if set, nil otherwise
531531
// and a boolean to check if the value has been set.
532-
func (o *TimeseriesWidgetRequest) GetStyleOk() (*WidgetRequestStyle, bool) {
532+
func (o *TimeseriesWidgetRequest) GetStyleOk() (*TimeseriesRequestStyle, bool) {
533533
if o == nil || o.Style == nil {
534534
return nil, false
535535
}
@@ -541,8 +541,8 @@ func (o *TimeseriesWidgetRequest) HasStyle() bool {
541541
return o != nil && o.Style != nil
542542
}
543543

544-
// SetStyle gets a reference to the given WidgetRequestStyle and assigns it to the Style field.
545-
func (o *TimeseriesWidgetRequest) SetStyle(v WidgetRequestStyle) {
544+
// SetStyle gets a reference to the given TimeseriesRequestStyle and assigns it to the Style field.
545+
func (o *TimeseriesWidgetRequest) SetStyle(v TimeseriesRequestStyle) {
546546
o.Style = &v
547547
}
548548

@@ -629,7 +629,7 @@ func (o *TimeseriesWidgetRequest) UnmarshalJSON(bytes []byte) (err error) {
629629
ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"`
630630
RumQuery *LogQueryDefinition `json:"rum_query,omitempty"`
631631
SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"`
632-
Style *WidgetRequestStyle `json:"style,omitempty"`
632+
Style *TimeseriesRequestStyle `json:"style,omitempty"`
633633
}{}
634634
if err = datadog.Unmarshal(bytes, &all); err != nil {
635635
return datadog.Unmarshal(bytes, &o.UnparsedObject)

examples/v1/dashboards/CreateDashboard_1259346254.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func main() {
2424
Requests: []datadogV1.TimeseriesWidgetRequest{
2525
{
2626
Q: datadog.PtrString("avg:system.cpu.user{*} by {host}"),
27-
Style: &datadogV1.WidgetRequestStyle{
27+
Style: &datadogV1.TimeseriesRequestStyle{
2828
Palette: datadog.PtrString("warm"),
2929
OrderBy: datadogV1.WIDGETSTYLEORDERBY_VALUES.Ptr(),
3030
},

examples/v1/dashboards/CreateDashboard_1284514532.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func main() {
3939
}},
4040
},
4141
ResponseFormat: datadogV1.FORMULAANDFUNCTIONRESPONSEFORMAT_TIMESERIES.Ptr(),
42-
Style: &datadogV1.WidgetRequestStyle{
42+
Style: &datadogV1.TimeseriesRequestStyle{
4343
Palette: datadog.PtrString("dog_classic"),
4444
LineType: datadogV1.WIDGETLINETYPE_SOLID.Ptr(),
4545
LineWidth: datadogV1.WIDGETLINEWIDTH_NORMAL.Ptr(),

examples/v1/dashboards/CreateDashboard_1307120899.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func main() {
5656
}},
5757
},
5858
ResponseFormat: datadogV1.FORMULAANDFUNCTIONRESPONSEFORMAT_TIMESERIES.Ptr(),
59-
Style: &datadogV1.WidgetRequestStyle{
59+
Style: &datadogV1.TimeseriesRequestStyle{
6060
Palette: datadog.PtrString("dog_classic"),
6161
LineType: datadogV1.WIDGETLINETYPE_SOLID.Ptr(),
6262
LineWidth: datadogV1.WIDGETLINEWIDTH_NORMAL.Ptr(),

examples/v1/dashboards/CreateDashboard_1433408735.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func main() {
3939
}},
4040
},
4141
ResponseFormat: datadogV1.FORMULAANDFUNCTIONRESPONSEFORMAT_TIMESERIES.Ptr(),
42-
Style: &datadogV1.WidgetRequestStyle{
42+
Style: &datadogV1.TimeseriesRequestStyle{
4343
Palette: datadog.PtrString("dog_classic"),
4444
LineType: datadogV1.WIDGETLINETYPE_SOLID.Ptr(),
4545
LineWidth: datadogV1.WIDGETLINEWIDTH_NORMAL.Ptr(),

0 commit comments

Comments
 (0)