Skip to content

Commit a258573

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 86e5dc8 of spec repo
1 parent 0a0cde4 commit a258573

4 files changed

Lines changed: 248 additions & 17 deletions

File tree

.generator/schemas/v1/openapi.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20186,9 +20186,27 @@ components:
2018620186
description: Color palette to apply to the widget.
2018720187
type: string
2018820188
type: object
20189+
TimeseriesWidgetAnomalyDetection:
20190+
description: Anomaly detection configuration for a timeseries widget.
20191+
properties:
20192+
detection_sensitivity:
20193+
$ref: "#/components/schemas/TimeseriesWidgetAnomalyDetectionSensitivity"
20194+
required:
20195+
- detection_sensitivity
20196+
type: object
20197+
TimeseriesWidgetAnomalyDetectionSensitivity:
20198+
description: Sensitivity level for anomaly detection. Use `never_detect` to disable anomaly detection.
20199+
enum:
20200+
- never_detect
20201+
example: never_detect
20202+
type: string
20203+
x-enum-varnames:
20204+
- NEVER_DETECT
2018920205
TimeseriesWidgetDefinition:
2019020206
description: The timeseries visualization allows you to display the evolution of one or more metrics, log events, or Indexed Spans over time.
2019120207
properties:
20208+
anomaly_detection:
20209+
$ref: "#/components/schemas/TimeseriesWidgetAnomalyDetection"
2019220210
custom_links:
2019320211
description: List of custom links.
2019420212
items:
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
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+
"fmt"
9+
10+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
11+
)
12+
13+
// TimeseriesWidgetAnomalyDetection Anomaly detection configuration for a timeseries widget.
14+
type TimeseriesWidgetAnomalyDetection struct {
15+
// Sensitivity level for anomaly detection. Use `never_detect` to disable anomaly detection.
16+
DetectionSensitivity TimeseriesWidgetAnomalyDetectionSensitivity `json:"detection_sensitivity"`
17+
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
18+
UnparsedObject map[string]interface{} `json:"-"`
19+
AdditionalProperties map[string]interface{} `json:"-"`
20+
}
21+
22+
// NewTimeseriesWidgetAnomalyDetection instantiates a new TimeseriesWidgetAnomalyDetection object.
23+
// This constructor will assign default values to properties that have it defined,
24+
// and makes sure properties required by API are set, but the set of arguments
25+
// will change when the set of required properties is changed.
26+
func NewTimeseriesWidgetAnomalyDetection(detectionSensitivity TimeseriesWidgetAnomalyDetectionSensitivity) *TimeseriesWidgetAnomalyDetection {
27+
this := TimeseriesWidgetAnomalyDetection{}
28+
this.DetectionSensitivity = detectionSensitivity
29+
return &this
30+
}
31+
32+
// NewTimeseriesWidgetAnomalyDetectionWithDefaults instantiates a new TimeseriesWidgetAnomalyDetection object.
33+
// This constructor will only assign default values to properties that have it defined,
34+
// but it doesn't guarantee that properties required by API are set.
35+
func NewTimeseriesWidgetAnomalyDetectionWithDefaults() *TimeseriesWidgetAnomalyDetection {
36+
this := TimeseriesWidgetAnomalyDetection{}
37+
return &this
38+
}
39+
40+
// GetDetectionSensitivity returns the DetectionSensitivity field value.
41+
func (o *TimeseriesWidgetAnomalyDetection) GetDetectionSensitivity() TimeseriesWidgetAnomalyDetectionSensitivity {
42+
if o == nil {
43+
var ret TimeseriesWidgetAnomalyDetectionSensitivity
44+
return ret
45+
}
46+
return o.DetectionSensitivity
47+
}
48+
49+
// GetDetectionSensitivityOk returns a tuple with the DetectionSensitivity field value
50+
// and a boolean to check if the value has been set.
51+
func (o *TimeseriesWidgetAnomalyDetection) GetDetectionSensitivityOk() (*TimeseriesWidgetAnomalyDetectionSensitivity, bool) {
52+
if o == nil {
53+
return nil, false
54+
}
55+
return &o.DetectionSensitivity, true
56+
}
57+
58+
// SetDetectionSensitivity sets field value.
59+
func (o *TimeseriesWidgetAnomalyDetection) SetDetectionSensitivity(v TimeseriesWidgetAnomalyDetectionSensitivity) {
60+
o.DetectionSensitivity = v
61+
}
62+
63+
// MarshalJSON serializes the struct using spec logic.
64+
func (o TimeseriesWidgetAnomalyDetection) MarshalJSON() ([]byte, error) {
65+
toSerialize := map[string]interface{}{}
66+
if o.UnparsedObject != nil {
67+
return datadog.Marshal(o.UnparsedObject)
68+
}
69+
toSerialize["detection_sensitivity"] = o.DetectionSensitivity
70+
71+
for key, value := range o.AdditionalProperties {
72+
toSerialize[key] = value
73+
}
74+
return datadog.Marshal(toSerialize)
75+
}
76+
77+
// UnmarshalJSON deserializes the given payload.
78+
func (o *TimeseriesWidgetAnomalyDetection) UnmarshalJSON(bytes []byte) (err error) {
79+
all := struct {
80+
DetectionSensitivity *TimeseriesWidgetAnomalyDetectionSensitivity `json:"detection_sensitivity"`
81+
}{}
82+
if err = datadog.Unmarshal(bytes, &all); err != nil {
83+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
84+
}
85+
if all.DetectionSensitivity == nil {
86+
return fmt.Errorf("required field detection_sensitivity missing")
87+
}
88+
additionalProperties := make(map[string]interface{})
89+
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
90+
datadog.DeleteKeys(additionalProperties, &[]string{"detection_sensitivity"})
91+
} else {
92+
return err
93+
}
94+
95+
hasInvalidField := false
96+
if !all.DetectionSensitivity.IsValid() {
97+
hasInvalidField = true
98+
} else {
99+
o.DetectionSensitivity = *all.DetectionSensitivity
100+
}
101+
102+
if len(additionalProperties) > 0 {
103+
o.AdditionalProperties = additionalProperties
104+
}
105+
106+
if hasInvalidField {
107+
return datadog.Unmarshal(bytes, &o.UnparsedObject)
108+
}
109+
110+
return nil
111+
}
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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+
"fmt"
9+
10+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
11+
)
12+
13+
// TimeseriesWidgetAnomalyDetectionSensitivity Sensitivity level for anomaly detection. Use `never_detect` to disable anomaly detection.
14+
type TimeseriesWidgetAnomalyDetectionSensitivity string
15+
16+
// List of TimeseriesWidgetAnomalyDetectionSensitivity.
17+
const (
18+
TIMESERIESWIDGETANOMALYDETECTIONSENSITIVITY_NEVER_DETECT TimeseriesWidgetAnomalyDetectionSensitivity = "never_detect"
19+
)
20+
21+
var allowedTimeseriesWidgetAnomalyDetectionSensitivityEnumValues = []TimeseriesWidgetAnomalyDetectionSensitivity{
22+
TIMESERIESWIDGETANOMALYDETECTIONSENSITIVITY_NEVER_DETECT,
23+
}
24+
25+
// GetAllowedValues reeturns the list of possible values.
26+
func (v *TimeseriesWidgetAnomalyDetectionSensitivity) GetAllowedValues() []TimeseriesWidgetAnomalyDetectionSensitivity {
27+
return allowedTimeseriesWidgetAnomalyDetectionSensitivityEnumValues
28+
}
29+
30+
// UnmarshalJSON deserializes the given payload.
31+
func (v *TimeseriesWidgetAnomalyDetectionSensitivity) UnmarshalJSON(src []byte) error {
32+
var value string
33+
err := datadog.Unmarshal(src, &value)
34+
if err != nil {
35+
return err
36+
}
37+
*v = TimeseriesWidgetAnomalyDetectionSensitivity(value)
38+
return nil
39+
}
40+
41+
// NewTimeseriesWidgetAnomalyDetectionSensitivityFromValue returns a pointer to a valid TimeseriesWidgetAnomalyDetectionSensitivity
42+
// for the value passed as argument, or an error if the value passed is not allowed by the enum.
43+
func NewTimeseriesWidgetAnomalyDetectionSensitivityFromValue(v string) (*TimeseriesWidgetAnomalyDetectionSensitivity, error) {
44+
ev := TimeseriesWidgetAnomalyDetectionSensitivity(v)
45+
if ev.IsValid() {
46+
return &ev, nil
47+
}
48+
return nil, fmt.Errorf("invalid value '%v' for TimeseriesWidgetAnomalyDetectionSensitivity: valid values are %v", v, allowedTimeseriesWidgetAnomalyDetectionSensitivityEnumValues)
49+
}
50+
51+
// IsValid return true if the value is valid for the enum, false otherwise.
52+
func (v TimeseriesWidgetAnomalyDetectionSensitivity) IsValid() bool {
53+
for _, existing := range allowedTimeseriesWidgetAnomalyDetectionSensitivityEnumValues {
54+
if existing == v {
55+
return true
56+
}
57+
}
58+
return false
59+
}
60+
61+
// Ptr returns reference to TimeseriesWidgetAnomalyDetectionSensitivity value.
62+
func (v TimeseriesWidgetAnomalyDetectionSensitivity) Ptr() *TimeseriesWidgetAnomalyDetectionSensitivity {
63+
return &v
64+
}

api/datadogV1/model_timeseries_widget_definition.go

Lines changed: 55 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import (
1212

1313
// TimeseriesWidgetDefinition The timeseries visualization allows you to display the evolution of one or more metrics, log events, or Indexed Spans over time.
1414
type TimeseriesWidgetDefinition struct {
15+
// Anomaly detection configuration for a timeseries widget.
16+
AnomalyDetection *TimeseriesWidgetAnomalyDetection `json:"anomaly_detection,omitempty"`
1517
// List of custom links.
1618
CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"`
1719
// The description of the widget.
@@ -71,6 +73,34 @@ func NewTimeseriesWidgetDefinitionWithDefaults() *TimeseriesWidgetDefinition {
7173
return &this
7274
}
7375

76+
// GetAnomalyDetection returns the AnomalyDetection field value if set, zero value otherwise.
77+
func (o *TimeseriesWidgetDefinition) GetAnomalyDetection() TimeseriesWidgetAnomalyDetection {
78+
if o == nil || o.AnomalyDetection == nil {
79+
var ret TimeseriesWidgetAnomalyDetection
80+
return ret
81+
}
82+
return *o.AnomalyDetection
83+
}
84+
85+
// GetAnomalyDetectionOk returns a tuple with the AnomalyDetection field value if set, nil otherwise
86+
// and a boolean to check if the value has been set.
87+
func (o *TimeseriesWidgetDefinition) GetAnomalyDetectionOk() (*TimeseriesWidgetAnomalyDetection, bool) {
88+
if o == nil || o.AnomalyDetection == nil {
89+
return nil, false
90+
}
91+
return o.AnomalyDetection, true
92+
}
93+
94+
// HasAnomalyDetection returns a boolean if a field has been set.
95+
func (o *TimeseriesWidgetDefinition) HasAnomalyDetection() bool {
96+
return o != nil && o.AnomalyDetection != nil
97+
}
98+
99+
// SetAnomalyDetection gets a reference to the given TimeseriesWidgetAnomalyDetection and assigns it to the AnomalyDetection field.
100+
func (o *TimeseriesWidgetDefinition) SetAnomalyDetection(v TimeseriesWidgetAnomalyDetection) {
101+
o.AnomalyDetection = &v
102+
}
103+
74104
// GetCustomLinks returns the CustomLinks field value if set, zero value otherwise.
75105
func (o *TimeseriesWidgetDefinition) GetCustomLinks() []WidgetCustomLink {
76106
if o == nil || o.CustomLinks == nil {
@@ -518,6 +548,9 @@ func (o TimeseriesWidgetDefinition) MarshalJSON() ([]byte, error) {
518548
if o.UnparsedObject != nil {
519549
return datadog.Marshal(o.UnparsedObject)
520550
}
551+
if o.AnomalyDetection != nil {
552+
toSerialize["anomaly_detection"] = o.AnomalyDetection
553+
}
521554
if o.CustomLinks != nil {
522555
toSerialize["custom_links"] = o.CustomLinks
523556
}
@@ -572,22 +605,23 @@ func (o TimeseriesWidgetDefinition) MarshalJSON() ([]byte, error) {
572605
// UnmarshalJSON deserializes the given payload.
573606
func (o *TimeseriesWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) {
574607
all := struct {
575-
CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"`
576-
Description *string `json:"description,omitempty"`
577-
Events []WidgetEvent `json:"events,omitempty"`
578-
LegendColumns []TimeseriesWidgetLegendColumn `json:"legend_columns,omitempty"`
579-
LegendLayout *TimeseriesWidgetLegendLayout `json:"legend_layout,omitempty"`
580-
LegendSize *string `json:"legend_size,omitempty"`
581-
Markers []WidgetMarker `json:"markers,omitempty"`
582-
Requests *[]TimeseriesWidgetRequest `json:"requests"`
583-
RightYaxis *WidgetAxis `json:"right_yaxis,omitempty"`
584-
ShowLegend *bool `json:"show_legend,omitempty"`
585-
Time *WidgetTime `json:"time,omitempty"`
586-
Title *string `json:"title,omitempty"`
587-
TitleAlign *WidgetTextAlign `json:"title_align,omitempty"`
588-
TitleSize *string `json:"title_size,omitempty"`
589-
Type *TimeseriesWidgetDefinitionType `json:"type"`
590-
Yaxis *WidgetAxis `json:"yaxis,omitempty"`
608+
AnomalyDetection *TimeseriesWidgetAnomalyDetection `json:"anomaly_detection,omitempty"`
609+
CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"`
610+
Description *string `json:"description,omitempty"`
611+
Events []WidgetEvent `json:"events,omitempty"`
612+
LegendColumns []TimeseriesWidgetLegendColumn `json:"legend_columns,omitempty"`
613+
LegendLayout *TimeseriesWidgetLegendLayout `json:"legend_layout,omitempty"`
614+
LegendSize *string `json:"legend_size,omitempty"`
615+
Markers []WidgetMarker `json:"markers,omitempty"`
616+
Requests *[]TimeseriesWidgetRequest `json:"requests"`
617+
RightYaxis *WidgetAxis `json:"right_yaxis,omitempty"`
618+
ShowLegend *bool `json:"show_legend,omitempty"`
619+
Time *WidgetTime `json:"time,omitempty"`
620+
Title *string `json:"title,omitempty"`
621+
TitleAlign *WidgetTextAlign `json:"title_align,omitempty"`
622+
TitleSize *string `json:"title_size,omitempty"`
623+
Type *TimeseriesWidgetDefinitionType `json:"type"`
624+
Yaxis *WidgetAxis `json:"yaxis,omitempty"`
591625
}{}
592626
if err = datadog.Unmarshal(bytes, &all); err != nil {
593627
return datadog.Unmarshal(bytes, &o.UnparsedObject)
@@ -600,12 +634,16 @@ func (o *TimeseriesWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) {
600634
}
601635
additionalProperties := make(map[string]interface{})
602636
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
603-
datadog.DeleteKeys(additionalProperties, &[]string{"custom_links", "description", "events", "legend_columns", "legend_layout", "legend_size", "markers", "requests", "right_yaxis", "show_legend", "time", "title", "title_align", "title_size", "type", "yaxis"})
637+
datadog.DeleteKeys(additionalProperties, &[]string{"anomaly_detection", "custom_links", "description", "events", "legend_columns", "legend_layout", "legend_size", "markers", "requests", "right_yaxis", "show_legend", "time", "title", "title_align", "title_size", "type", "yaxis"})
604638
} else {
605639
return err
606640
}
607641

608642
hasInvalidField := false
643+
if all.AnomalyDetection != nil && all.AnomalyDetection.UnparsedObject != nil && o.UnparsedObject == nil {
644+
hasInvalidField = true
645+
}
646+
o.AnomalyDetection = all.AnomalyDetection
609647
o.CustomLinks = all.CustomLinks
610648
o.Description = all.Description
611649
o.Events = all.Events

0 commit comments

Comments
 (0)