diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 4fc8dbe3785..75e200f730a 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -1741,6 +1741,9 @@ components: type: string markers: description: List of markers. + example: + - display_type: percentile + value: '90' items: $ref: '#/components/schemas/WidgetMarker' type: array @@ -1816,6 +1819,11 @@ components: $ref: '#/components/schemas/ApmStatsQueryDefinition' event_query: $ref: '#/components/schemas/LogQueryDefinition' + formulas: + description: List of formulas that operate on queries. + items: + $ref: '#/components/schemas/WidgetFormula' + type: array log_query: $ref: '#/components/schemas/LogQueryDefinition' network_query: @@ -1827,10 +1835,17 @@ components: q: description: Widget query. type: string + queries: + description: List of queries that can be returned directly or used in formulas. + items: + $ref: '#/components/schemas/FormulaAndFunctionQueryDefinition' + type: array query: $ref: '#/components/schemas/DistributionWidgetHistogramRequestQuery' request_type: $ref: '#/components/schemas/DistributionWidgetHistogramRequestType' + response_format: + $ref: '#/components/schemas/FormulaAndFunctionResponseFormat' rum_query: $ref: '#/components/schemas/LogQueryDefinition' security_query: @@ -1854,6 +1869,12 @@ components: description: Specifies minimum value to show on the x-axis. It takes a number, percentile (p90 === 90th percentile), or auto for default behavior. type: string + num_buckets: + description: Number of value buckets to target, aka the resolution of the + value bins. + example: 100 + format: int64 + type: integer scale: default: linear description: Specifies the scale type. Possible values are `linear`. @@ -3714,6 +3735,14 @@ components: type: array legend_size: $ref: '#/components/schemas/WidgetLegendSize' + markers: + description: List of markers. + example: + - display_type: percentile + value: '90' + items: + $ref: '#/components/schemas/WidgetMarker' + type: array requests: description: List of widget types. example: @@ -3738,8 +3767,10 @@ components: type: string type: $ref: '#/components/schemas/HeatMapWidgetDefinitionType' + xaxis: + $ref: '#/components/schemas/HeatMapWidgetXAxis' yaxis: - $ref: '#/components/schemas/WidgetAxis' + $ref: '#/components/schemas/HeatMapWidgetYAxis' required: - type - requests @@ -3781,6 +3812,10 @@ components: items: $ref: '#/components/schemas/FormulaAndFunctionQueryDefinition' type: array + query: + $ref: '#/components/schemas/DistributionWidgetHistogramRequestQuery' + request_type: + $ref: '#/components/schemas/DistributionWidgetHistogramRequestType' response_format: $ref: '#/components/schemas/FormulaAndFunctionResponseFormat' rum_query: @@ -3790,6 +3825,49 @@ components: style: $ref: '#/components/schemas/WidgetStyle' type: object + HeatMapWidgetXAxis: + description: X Axis controls for the heat map widget. + properties: + num_buckets: + description: Number of time buckets to target, aka the resolution of the + time bins. This is only applicable for distribution of points (group distributions + use the roll-up modifier). + example: 50 + format: int64 + type: integer + type: object + HeatMapWidgetYAxis: + description: Y Axis controls for the heat map widget. + properties: + include_zero: + description: Set to `true` to include zero. + type: boolean + label: + description: The label of the axis to display on the graph. Only usable + on Scatterplot Widgets. + type: string + max: + default: auto + description: Specifies maximum numeric value to show on the axis. Defaults + to `auto`. + type: string + min: + default: auto + description: Specifies minimum numeric value to show on the axis. Defaults + to `auto`. + type: string + num_buckets: + description: Number of value buckets to target, aka the resolution of the + value bins. + example: 50 + format: int64 + type: integer + scale: + default: linear + description: Specifies the scale type. Possible values are `linear`, `log`, + `sqrt`, and `pow##` (for example `pow2` or `pow0.5`). + type: string + type: object Host: description: Object representing a host. properties: @@ -25147,7 +25225,7 @@ components: display_type: description: "Combination of:\n - A severity error, warning, ok, or info\n \ - A line type: dashed, solid, or bold\nIn this case of a Distribution - widget, this can be set to be `x_axis_percentile`." + widget, this can be set to be `percentile`." example: error dashed type: string label: @@ -25158,8 +25236,11 @@ components: description: Timestamp for the widget. type: string value: - description: Value to apply. Can be a single value y = 15 or a range of + description: 'Value to apply. Can be a single value y = 15 or a range of values 0 < y < 10. + + For Distribution widgets with `display_type` set to `percentile`, this + should be a numeric percentile value (e.g., "90" for P90).' example: y = 15 type: string required: diff --git a/api/datadogV1/model_distribution_widget_request.go b/api/datadogV1/model_distribution_widget_request.go index bd2df10f825..03568f38043 100644 --- a/api/datadogV1/model_distribution_widget_request.go +++ b/api/datadogV1/model_distribution_widget_request.go @@ -16,6 +16,8 @@ type DistributionWidgetRequest struct { ApmStatsQuery *ApmStatsQueryDefinition `json:"apm_stats_query,omitempty"` // The log query. EventQuery *LogQueryDefinition `json:"event_query,omitempty"` + // List of formulas that operate on queries. + Formulas []WidgetFormula `json:"formulas,omitempty"` // The log query. LogQuery *LogQueryDefinition `json:"log_query,omitempty"` // The log query. @@ -26,10 +28,14 @@ type DistributionWidgetRequest struct { ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` // Widget query. Q *string `json:"q,omitempty"` + // List of queries that can be returned directly or used in formulas. + Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` // Query definition for Distribution Widget Histogram Request Query *DistributionWidgetHistogramRequestQuery `json:"query,omitempty"` // Request type for the histogram request. RequestType *DistributionWidgetHistogramRequestType `json:"request_type,omitempty"` + // Timeseries, scalar, or event list response. Event list response formats are supported by Geomap widgets. + ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` // The log query. RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` // The log query. @@ -142,6 +148,34 @@ func (o *DistributionWidgetRequest) SetEventQuery(v LogQueryDefinition) { o.EventQuery = &v } +// GetFormulas returns the Formulas field value if set, zero value otherwise. +func (o *DistributionWidgetRequest) GetFormulas() []WidgetFormula { + if o == nil || o.Formulas == nil { + var ret []WidgetFormula + return ret + } + return o.Formulas +} + +// GetFormulasOk returns a tuple with the Formulas field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetRequest) GetFormulasOk() (*[]WidgetFormula, bool) { + if o == nil || o.Formulas == nil { + return nil, false + } + return &o.Formulas, true +} + +// HasFormulas returns a boolean if a field has been set. +func (o *DistributionWidgetRequest) HasFormulas() bool { + return o != nil && o.Formulas != nil +} + +// SetFormulas gets a reference to the given []WidgetFormula and assigns it to the Formulas field. +func (o *DistributionWidgetRequest) SetFormulas(v []WidgetFormula) { + o.Formulas = v +} + // GetLogQuery returns the LogQuery field value if set, zero value otherwise. func (o *DistributionWidgetRequest) GetLogQuery() LogQueryDefinition { if o == nil || o.LogQuery == nil { @@ -282,6 +316,34 @@ func (o *DistributionWidgetRequest) SetQ(v string) { o.Q = &v } +// GetQueries returns the Queries field value if set, zero value otherwise. +func (o *DistributionWidgetRequest) GetQueries() []FormulaAndFunctionQueryDefinition { + if o == nil || o.Queries == nil { + var ret []FormulaAndFunctionQueryDefinition + return ret + } + return o.Queries +} + +// GetQueriesOk returns a tuple with the Queries field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetRequest) GetQueriesOk() (*[]FormulaAndFunctionQueryDefinition, bool) { + if o == nil || o.Queries == nil { + return nil, false + } + return &o.Queries, true +} + +// HasQueries returns a boolean if a field has been set. +func (o *DistributionWidgetRequest) HasQueries() bool { + return o != nil && o.Queries != nil +} + +// SetQueries gets a reference to the given []FormulaAndFunctionQueryDefinition and assigns it to the Queries field. +func (o *DistributionWidgetRequest) SetQueries(v []FormulaAndFunctionQueryDefinition) { + o.Queries = v +} + // GetQuery returns the Query field value if set, zero value otherwise. func (o *DistributionWidgetRequest) GetQuery() DistributionWidgetHistogramRequestQuery { if o == nil || o.Query == nil { @@ -338,6 +400,34 @@ func (o *DistributionWidgetRequest) SetRequestType(v DistributionWidgetHistogram o.RequestType = &v } +// GetResponseFormat returns the ResponseFormat field value if set, zero value otherwise. +func (o *DistributionWidgetRequest) GetResponseFormat() FormulaAndFunctionResponseFormat { + if o == nil || o.ResponseFormat == nil { + var ret FormulaAndFunctionResponseFormat + return ret + } + return *o.ResponseFormat +} + +// GetResponseFormatOk returns a tuple with the ResponseFormat field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetRequest) GetResponseFormatOk() (*FormulaAndFunctionResponseFormat, bool) { + if o == nil || o.ResponseFormat == nil { + return nil, false + } + return o.ResponseFormat, true +} + +// HasResponseFormat returns a boolean if a field has been set. +func (o *DistributionWidgetRequest) HasResponseFormat() bool { + return o != nil && o.ResponseFormat != nil +} + +// SetResponseFormat gets a reference to the given FormulaAndFunctionResponseFormat and assigns it to the ResponseFormat field. +func (o *DistributionWidgetRequest) SetResponseFormat(v FormulaAndFunctionResponseFormat) { + o.ResponseFormat = &v +} + // GetRumQuery returns the RumQuery field value if set, zero value otherwise. func (o *DistributionWidgetRequest) GetRumQuery() LogQueryDefinition { if o == nil || o.RumQuery == nil { @@ -437,6 +527,9 @@ func (o DistributionWidgetRequest) MarshalJSON() ([]byte, error) { if o.EventQuery != nil { toSerialize["event_query"] = o.EventQuery } + if o.Formulas != nil { + toSerialize["formulas"] = o.Formulas + } if o.LogQuery != nil { toSerialize["log_query"] = o.LogQuery } @@ -452,12 +545,18 @@ func (o DistributionWidgetRequest) MarshalJSON() ([]byte, error) { if o.Q != nil { toSerialize["q"] = o.Q } + if o.Queries != nil { + toSerialize["queries"] = o.Queries + } if o.Query != nil { toSerialize["query"] = o.Query } if o.RequestType != nil { toSerialize["request_type"] = o.RequestType } + if o.ResponseFormat != nil { + toSerialize["response_format"] = o.ResponseFormat + } if o.RumQuery != nil { toSerialize["rum_query"] = o.RumQuery } @@ -480,13 +579,16 @@ func (o *DistributionWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` ApmStatsQuery *ApmStatsQueryDefinition `json:"apm_stats_query,omitempty"` EventQuery *LogQueryDefinition `json:"event_query,omitempty"` + Formulas []WidgetFormula `json:"formulas,omitempty"` LogQuery *LogQueryDefinition `json:"log_query,omitempty"` NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` Q *string `json:"q,omitempty"` + Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` Query *DistributionWidgetHistogramRequestQuery `json:"query,omitempty"` RequestType *DistributionWidgetHistogramRequestType `json:"request_type,omitempty"` + ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` Style *WidgetStyle `json:"style,omitempty"` @@ -496,7 +598,7 @@ func (o *DistributionWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"apm_query", "apm_stats_query", "event_query", "log_query", "network_query", "process_query", "profile_metrics_query", "q", "query", "request_type", "rum_query", "security_query", "style"}) + datadog.DeleteKeys(additionalProperties, &[]string{"apm_query", "apm_stats_query", "event_query", "formulas", "log_query", "network_query", "process_query", "profile_metrics_query", "q", "queries", "query", "request_type", "response_format", "rum_query", "security_query", "style"}) } else { return err } @@ -514,6 +616,7 @@ func (o *DistributionWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { hasInvalidField = true } o.EventQuery = all.EventQuery + o.Formulas = all.Formulas if all.LogQuery != nil && all.LogQuery.UnparsedObject != nil && o.UnparsedObject == nil { hasInvalidField = true } @@ -531,12 +634,18 @@ func (o *DistributionWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { } o.ProfileMetricsQuery = all.ProfileMetricsQuery o.Q = all.Q + o.Queries = all.Queries o.Query = all.Query if all.RequestType != nil && !all.RequestType.IsValid() { hasInvalidField = true } else { o.RequestType = all.RequestType } + if all.ResponseFormat != nil && !all.ResponseFormat.IsValid() { + hasInvalidField = true + } else { + o.ResponseFormat = all.ResponseFormat + } if all.RumQuery != nil && all.RumQuery.UnparsedObject != nil && o.UnparsedObject == nil { hasInvalidField = true } diff --git a/api/datadogV1/model_distribution_widget_x_axis.go b/api/datadogV1/model_distribution_widget_x_axis.go index 8645a98e813..e0885dc90da 100644 --- a/api/datadogV1/model_distribution_widget_x_axis.go +++ b/api/datadogV1/model_distribution_widget_x_axis.go @@ -16,6 +16,8 @@ type DistributionWidgetXAxis struct { Max *string `json:"max,omitempty"` // Specifies minimum value to show on the x-axis. It takes a number, percentile (p90 === 90th percentile), or auto for default behavior. Min *string `json:"min,omitempty"` + // Number of value buckets to target, aka the resolution of the value bins. + NumBuckets *int64 `json:"num_buckets,omitempty"` // Specifies the scale type. Possible values are `linear`. Scale *string `json:"scale,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct @@ -136,6 +138,34 @@ func (o *DistributionWidgetXAxis) SetMin(v string) { o.Min = &v } +// GetNumBuckets returns the NumBuckets field value if set, zero value otherwise. +func (o *DistributionWidgetXAxis) GetNumBuckets() int64 { + if o == nil || o.NumBuckets == nil { + var ret int64 + return ret + } + return *o.NumBuckets +} + +// GetNumBucketsOk returns a tuple with the NumBuckets field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DistributionWidgetXAxis) GetNumBucketsOk() (*int64, bool) { + if o == nil || o.NumBuckets == nil { + return nil, false + } + return o.NumBuckets, true +} + +// HasNumBuckets returns a boolean if a field has been set. +func (o *DistributionWidgetXAxis) HasNumBuckets() bool { + return o != nil && o.NumBuckets != nil +} + +// SetNumBuckets gets a reference to the given int64 and assigns it to the NumBuckets field. +func (o *DistributionWidgetXAxis) SetNumBuckets(v int64) { + o.NumBuckets = &v +} + // GetScale returns the Scale field value if set, zero value otherwise. func (o *DistributionWidgetXAxis) GetScale() string { if o == nil || o.Scale == nil { @@ -179,6 +209,9 @@ func (o DistributionWidgetXAxis) MarshalJSON() ([]byte, error) { if o.Min != nil { toSerialize["min"] = o.Min } + if o.NumBuckets != nil { + toSerialize["num_buckets"] = o.NumBuckets + } if o.Scale != nil { toSerialize["scale"] = o.Scale } @@ -195,6 +228,7 @@ func (o *DistributionWidgetXAxis) UnmarshalJSON(bytes []byte) (err error) { IncludeZero *bool `json:"include_zero,omitempty"` Max *string `json:"max,omitempty"` Min *string `json:"min,omitempty"` + NumBuckets *int64 `json:"num_buckets,omitempty"` Scale *string `json:"scale,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { @@ -202,13 +236,14 @@ func (o *DistributionWidgetXAxis) UnmarshalJSON(bytes []byte) (err error) { } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"include_zero", "max", "min", "scale"}) + datadog.DeleteKeys(additionalProperties, &[]string{"include_zero", "max", "min", "num_buckets", "scale"}) } else { return err } o.IncludeZero = all.IncludeZero o.Max = all.Max o.Min = all.Min + o.NumBuckets = all.NumBuckets o.Scale = all.Scale if len(additionalProperties) > 0 { diff --git a/api/datadogV1/model_heat_map_widget_definition.go b/api/datadogV1/model_heat_map_widget_definition.go index f196ea510ec..fdc35888a75 100644 --- a/api/datadogV1/model_heat_map_widget_definition.go +++ b/api/datadogV1/model_heat_map_widget_definition.go @@ -18,6 +18,8 @@ type HeatMapWidgetDefinition struct { Events []WidgetEvent `json:"events,omitempty"` // Available legend sizes for a widget. Should be one of "0", "2", "4", "8", "16", or "auto". LegendSize *string `json:"legend_size,omitempty"` + // List of markers. + Markers []WidgetMarker `json:"markers,omitempty"` // List of widget types. Requests []HeatMapWidgetRequest `json:"requests"` // Whether or not to display the legend on this widget. @@ -32,8 +34,10 @@ type HeatMapWidgetDefinition struct { TitleSize *string `json:"title_size,omitempty"` // Type of the heat map widget. Type HeatMapWidgetDefinitionType `json:"type"` - // Axis controls for the widget. - Yaxis *WidgetAxis `json:"yaxis,omitempty"` + // X Axis controls for the heat map widget. + Xaxis *HeatMapWidgetXAxis `json:"xaxis,omitempty"` + // Y Axis controls for the heat map widget. + Yaxis *HeatMapWidgetYAxis `json:"yaxis,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:"-"` @@ -144,6 +148,34 @@ func (o *HeatMapWidgetDefinition) SetLegendSize(v string) { o.LegendSize = &v } +// GetMarkers returns the Markers field value if set, zero value otherwise. +func (o *HeatMapWidgetDefinition) GetMarkers() []WidgetMarker { + if o == nil || o.Markers == nil { + var ret []WidgetMarker + return ret + } + return o.Markers +} + +// GetMarkersOk returns a tuple with the Markers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetDefinition) GetMarkersOk() (*[]WidgetMarker, bool) { + if o == nil || o.Markers == nil { + return nil, false + } + return &o.Markers, true +} + +// HasMarkers returns a boolean if a field has been set. +func (o *HeatMapWidgetDefinition) HasMarkers() bool { + return o != nil && o.Markers != nil +} + +// SetMarkers gets a reference to the given []WidgetMarker and assigns it to the Markers field. +func (o *HeatMapWidgetDefinition) SetMarkers(v []WidgetMarker) { + o.Markers = v +} + // GetRequests returns the Requests field value. func (o *HeatMapWidgetDefinition) GetRequests() []HeatMapWidgetRequest { if o == nil { @@ -330,10 +362,38 @@ func (o *HeatMapWidgetDefinition) SetType(v HeatMapWidgetDefinitionType) { o.Type = v } +// GetXaxis returns the Xaxis field value if set, zero value otherwise. +func (o *HeatMapWidgetDefinition) GetXaxis() HeatMapWidgetXAxis { + if o == nil || o.Xaxis == nil { + var ret HeatMapWidgetXAxis + return ret + } + return *o.Xaxis +} + +// GetXaxisOk returns a tuple with the Xaxis field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetDefinition) GetXaxisOk() (*HeatMapWidgetXAxis, bool) { + if o == nil || o.Xaxis == nil { + return nil, false + } + return o.Xaxis, true +} + +// HasXaxis returns a boolean if a field has been set. +func (o *HeatMapWidgetDefinition) HasXaxis() bool { + return o != nil && o.Xaxis != nil +} + +// SetXaxis gets a reference to the given HeatMapWidgetXAxis and assigns it to the Xaxis field. +func (o *HeatMapWidgetDefinition) SetXaxis(v HeatMapWidgetXAxis) { + o.Xaxis = &v +} + // GetYaxis returns the Yaxis field value if set, zero value otherwise. -func (o *HeatMapWidgetDefinition) GetYaxis() WidgetAxis { +func (o *HeatMapWidgetDefinition) GetYaxis() HeatMapWidgetYAxis { if o == nil || o.Yaxis == nil { - var ret WidgetAxis + var ret HeatMapWidgetYAxis return ret } return *o.Yaxis @@ -341,7 +401,7 @@ func (o *HeatMapWidgetDefinition) GetYaxis() WidgetAxis { // GetYaxisOk returns a tuple with the Yaxis field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *HeatMapWidgetDefinition) GetYaxisOk() (*WidgetAxis, bool) { +func (o *HeatMapWidgetDefinition) GetYaxisOk() (*HeatMapWidgetYAxis, bool) { if o == nil || o.Yaxis == nil { return nil, false } @@ -353,8 +413,8 @@ func (o *HeatMapWidgetDefinition) HasYaxis() bool { return o != nil && o.Yaxis != nil } -// SetYaxis gets a reference to the given WidgetAxis and assigns it to the Yaxis field. -func (o *HeatMapWidgetDefinition) SetYaxis(v WidgetAxis) { +// SetYaxis gets a reference to the given HeatMapWidgetYAxis and assigns it to the Yaxis field. +func (o *HeatMapWidgetDefinition) SetYaxis(v HeatMapWidgetYAxis) { o.Yaxis = &v } @@ -373,6 +433,9 @@ func (o HeatMapWidgetDefinition) MarshalJSON() ([]byte, error) { if o.LegendSize != nil { toSerialize["legend_size"] = o.LegendSize } + if o.Markers != nil { + toSerialize["markers"] = o.Markers + } toSerialize["requests"] = o.Requests if o.ShowLegend != nil { toSerialize["show_legend"] = o.ShowLegend @@ -390,6 +453,9 @@ func (o HeatMapWidgetDefinition) MarshalJSON() ([]byte, error) { toSerialize["title_size"] = o.TitleSize } toSerialize["type"] = o.Type + if o.Xaxis != nil { + toSerialize["xaxis"] = o.Xaxis + } if o.Yaxis != nil { toSerialize["yaxis"] = o.Yaxis } @@ -406,6 +472,7 @@ func (o *HeatMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { CustomLinks []WidgetCustomLink `json:"custom_links,omitempty"` Events []WidgetEvent `json:"events,omitempty"` LegendSize *string `json:"legend_size,omitempty"` + Markers []WidgetMarker `json:"markers,omitempty"` Requests *[]HeatMapWidgetRequest `json:"requests"` ShowLegend *bool `json:"show_legend,omitempty"` Time *WidgetTime `json:"time,omitempty"` @@ -413,7 +480,8 @@ func (o *HeatMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { TitleAlign *WidgetTextAlign `json:"title_align,omitempty"` TitleSize *string `json:"title_size,omitempty"` Type *HeatMapWidgetDefinitionType `json:"type"` - Yaxis *WidgetAxis `json:"yaxis,omitempty"` + Xaxis *HeatMapWidgetXAxis `json:"xaxis,omitempty"` + Yaxis *HeatMapWidgetYAxis `json:"yaxis,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) @@ -426,7 +494,7 @@ func (o *HeatMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"custom_links", "events", "legend_size", "requests", "show_legend", "time", "title", "title_align", "title_size", "type", "yaxis"}) + datadog.DeleteKeys(additionalProperties, &[]string{"custom_links", "events", "legend_size", "markers", "requests", "show_legend", "time", "title", "title_align", "title_size", "type", "xaxis", "yaxis"}) } else { return err } @@ -435,6 +503,7 @@ func (o *HeatMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { o.CustomLinks = all.CustomLinks o.Events = all.Events o.LegendSize = all.LegendSize + o.Markers = all.Markers o.Requests = *all.Requests o.ShowLegend = all.ShowLegend o.Time = all.Time @@ -450,6 +519,10 @@ func (o *HeatMapWidgetDefinition) UnmarshalJSON(bytes []byte) (err error) { } else { o.Type = *all.Type } + if all.Xaxis != nil && all.Xaxis.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Xaxis = all.Xaxis if all.Yaxis != nil && all.Yaxis.UnparsedObject != nil && o.UnparsedObject == nil { hasInvalidField = true } diff --git a/api/datadogV1/model_heat_map_widget_request.go b/api/datadogV1/model_heat_map_widget_request.go index 457467c7359..d4d398972ee 100644 --- a/api/datadogV1/model_heat_map_widget_request.go +++ b/api/datadogV1/model_heat_map_widget_request.go @@ -28,6 +28,10 @@ type HeatMapWidgetRequest struct { Q *string `json:"q,omitempty"` // List of queries that can be returned directly or used in formulas. Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` + // Query definition for Distribution Widget Histogram Request + Query *DistributionWidgetHistogramRequestQuery `json:"query,omitempty"` + // Request type for the histogram request. + RequestType *DistributionWidgetHistogramRequestType `json:"request_type,omitempty"` // Timeseries, scalar, or event list response. Event list response formats are supported by Geomap widgets. ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` // The log query. @@ -310,6 +314,62 @@ func (o *HeatMapWidgetRequest) SetQueries(v []FormulaAndFunctionQueryDefinition) o.Queries = v } +// GetQuery returns the Query field value if set, zero value otherwise. +func (o *HeatMapWidgetRequest) GetQuery() DistributionWidgetHistogramRequestQuery { + if o == nil || o.Query == nil { + var ret DistributionWidgetHistogramRequestQuery + return ret + } + return *o.Query +} + +// GetQueryOk returns a tuple with the Query field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetRequest) GetQueryOk() (*DistributionWidgetHistogramRequestQuery, bool) { + if o == nil || o.Query == nil { + return nil, false + } + return o.Query, true +} + +// HasQuery returns a boolean if a field has been set. +func (o *HeatMapWidgetRequest) HasQuery() bool { + return o != nil && o.Query != nil +} + +// SetQuery gets a reference to the given DistributionWidgetHistogramRequestQuery and assigns it to the Query field. +func (o *HeatMapWidgetRequest) SetQuery(v DistributionWidgetHistogramRequestQuery) { + o.Query = &v +} + +// GetRequestType returns the RequestType field value if set, zero value otherwise. +func (o *HeatMapWidgetRequest) GetRequestType() DistributionWidgetHistogramRequestType { + if o == nil || o.RequestType == nil { + var ret DistributionWidgetHistogramRequestType + return ret + } + return *o.RequestType +} + +// GetRequestTypeOk returns a tuple with the RequestType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetRequest) GetRequestTypeOk() (*DistributionWidgetHistogramRequestType, bool) { + if o == nil || o.RequestType == nil { + return nil, false + } + return o.RequestType, true +} + +// HasRequestType returns a boolean if a field has been set. +func (o *HeatMapWidgetRequest) HasRequestType() bool { + return o != nil && o.RequestType != nil +} + +// SetRequestType gets a reference to the given DistributionWidgetHistogramRequestType and assigns it to the RequestType field. +func (o *HeatMapWidgetRequest) SetRequestType(v DistributionWidgetHistogramRequestType) { + o.RequestType = &v +} + // GetResponseFormat returns the ResponseFormat field value if set, zero value otherwise. func (o *HeatMapWidgetRequest) GetResponseFormat() FormulaAndFunctionResponseFormat { if o == nil || o.ResponseFormat == nil { @@ -455,6 +515,12 @@ func (o HeatMapWidgetRequest) MarshalJSON() ([]byte, error) { if o.Queries != nil { toSerialize["queries"] = o.Queries } + if o.Query != nil { + toSerialize["query"] = o.Query + } + if o.RequestType != nil { + toSerialize["request_type"] = o.RequestType + } if o.ResponseFormat != nil { toSerialize["response_format"] = o.ResponseFormat } @@ -477,26 +543,28 @@ func (o HeatMapWidgetRequest) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *HeatMapWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { all := struct { - ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` - EventQuery *EventQueryDefinition `json:"event_query,omitempty"` - Formulas []WidgetFormula `json:"formulas,omitempty"` - LogQuery *LogQueryDefinition `json:"log_query,omitempty"` - NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` - ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` - ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` - Q *string `json:"q,omitempty"` - Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` - ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` - RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` - SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` - Style *WidgetStyle `json:"style,omitempty"` + ApmQuery *LogQueryDefinition `json:"apm_query,omitempty"` + EventQuery *EventQueryDefinition `json:"event_query,omitempty"` + Formulas []WidgetFormula `json:"formulas,omitempty"` + LogQuery *LogQueryDefinition `json:"log_query,omitempty"` + NetworkQuery *LogQueryDefinition `json:"network_query,omitempty"` + ProcessQuery *ProcessQueryDefinition `json:"process_query,omitempty"` + ProfileMetricsQuery *LogQueryDefinition `json:"profile_metrics_query,omitempty"` + Q *string `json:"q,omitempty"` + Queries []FormulaAndFunctionQueryDefinition `json:"queries,omitempty"` + Query *DistributionWidgetHistogramRequestQuery `json:"query,omitempty"` + RequestType *DistributionWidgetHistogramRequestType `json:"request_type,omitempty"` + ResponseFormat *FormulaAndFunctionResponseFormat `json:"response_format,omitempty"` + RumQuery *LogQueryDefinition `json:"rum_query,omitempty"` + SecurityQuery *LogQueryDefinition `json:"security_query,omitempty"` + Style *WidgetStyle `json:"style,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{"apm_query", "event_query", "formulas", "log_query", "network_query", "process_query", "profile_metrics_query", "q", "queries", "response_format", "rum_query", "security_query", "style"}) + datadog.DeleteKeys(additionalProperties, &[]string{"apm_query", "event_query", "formulas", "log_query", "network_query", "process_query", "profile_metrics_query", "q", "queries", "query", "request_type", "response_format", "rum_query", "security_query", "style"}) } else { return err } @@ -529,6 +597,12 @@ func (o *HeatMapWidgetRequest) UnmarshalJSON(bytes []byte) (err error) { o.ProfileMetricsQuery = all.ProfileMetricsQuery o.Q = all.Q o.Queries = all.Queries + o.Query = all.Query + if all.RequestType != nil && !all.RequestType.IsValid() { + hasInvalidField = true + } else { + o.RequestType = all.RequestType + } if all.ResponseFormat != nil && !all.ResponseFormat.IsValid() { hasInvalidField = true } else { diff --git a/api/datadogV1/model_heat_map_widget_x_axis.go b/api/datadogV1/model_heat_map_widget_x_axis.go new file mode 100644 index 00000000000..7301984fa8f --- /dev/null +++ b/api/datadogV1/model_heat_map_widget_x_axis.go @@ -0,0 +1,102 @@ +// 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" +) + +// HeatMapWidgetXAxis X Axis controls for the heat map widget. +type HeatMapWidgetXAxis struct { + // Number of time buckets to target, aka the resolution of the time bins. This is only applicable for distribution of points (group distributions use the roll-up modifier). + NumBuckets *int64 `json:"num_buckets,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:"-"` +} + +// NewHeatMapWidgetXAxis instantiates a new HeatMapWidgetXAxis 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 NewHeatMapWidgetXAxis() *HeatMapWidgetXAxis { + this := HeatMapWidgetXAxis{} + return &this +} + +// NewHeatMapWidgetXAxisWithDefaults instantiates a new HeatMapWidgetXAxis 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 NewHeatMapWidgetXAxisWithDefaults() *HeatMapWidgetXAxis { + this := HeatMapWidgetXAxis{} + return &this +} + +// GetNumBuckets returns the NumBuckets field value if set, zero value otherwise. +func (o *HeatMapWidgetXAxis) GetNumBuckets() int64 { + if o == nil || o.NumBuckets == nil { + var ret int64 + return ret + } + return *o.NumBuckets +} + +// GetNumBucketsOk returns a tuple with the NumBuckets field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetXAxis) GetNumBucketsOk() (*int64, bool) { + if o == nil || o.NumBuckets == nil { + return nil, false + } + return o.NumBuckets, true +} + +// HasNumBuckets returns a boolean if a field has been set. +func (o *HeatMapWidgetXAxis) HasNumBuckets() bool { + return o != nil && o.NumBuckets != nil +} + +// SetNumBuckets gets a reference to the given int64 and assigns it to the NumBuckets field. +func (o *HeatMapWidgetXAxis) SetNumBuckets(v int64) { + o.NumBuckets = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HeatMapWidgetXAxis) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.NumBuckets != nil { + toSerialize["num_buckets"] = o.NumBuckets + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HeatMapWidgetXAxis) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + NumBuckets *int64 `json:"num_buckets,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{"num_buckets"}) + } else { + return err + } + o.NumBuckets = all.NumBuckets + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV1/model_heat_map_widget_y_axis.go b/api/datadogV1/model_heat_map_widget_y_axis.go new file mode 100644 index 00000000000..84ac0135a89 --- /dev/null +++ b/api/datadogV1/model_heat_map_widget_y_axis.go @@ -0,0 +1,289 @@ +// 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" +) + +// HeatMapWidgetYAxis Y Axis controls for the heat map widget. +type HeatMapWidgetYAxis struct { + // Set to `true` to include zero. + IncludeZero *bool `json:"include_zero,omitempty"` + // The label of the axis to display on the graph. Only usable on Scatterplot Widgets. + Label *string `json:"label,omitempty"` + // Specifies maximum numeric value to show on the axis. Defaults to `auto`. + Max *string `json:"max,omitempty"` + // Specifies minimum numeric value to show on the axis. Defaults to `auto`. + Min *string `json:"min,omitempty"` + // Number of value buckets to target, aka the resolution of the value bins. + NumBuckets *int64 `json:"num_buckets,omitempty"` + // Specifies the scale type. Possible values are `linear`, `log`, `sqrt`, and `pow##` (for example `pow2` or `pow0.5`). + Scale *string `json:"scale,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:"-"` +} + +// NewHeatMapWidgetYAxis instantiates a new HeatMapWidgetYAxis 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 NewHeatMapWidgetYAxis() *HeatMapWidgetYAxis { + this := HeatMapWidgetYAxis{} + var max string = "auto" + this.Max = &max + var min string = "auto" + this.Min = &min + var scale string = "linear" + this.Scale = &scale + return &this +} + +// NewHeatMapWidgetYAxisWithDefaults instantiates a new HeatMapWidgetYAxis 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 NewHeatMapWidgetYAxisWithDefaults() *HeatMapWidgetYAxis { + this := HeatMapWidgetYAxis{} + var max string = "auto" + this.Max = &max + var min string = "auto" + this.Min = &min + var scale string = "linear" + this.Scale = &scale + return &this +} + +// GetIncludeZero returns the IncludeZero field value if set, zero value otherwise. +func (o *HeatMapWidgetYAxis) GetIncludeZero() bool { + if o == nil || o.IncludeZero == nil { + var ret bool + return ret + } + return *o.IncludeZero +} + +// GetIncludeZeroOk returns a tuple with the IncludeZero field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetYAxis) GetIncludeZeroOk() (*bool, bool) { + if o == nil || o.IncludeZero == nil { + return nil, false + } + return o.IncludeZero, true +} + +// HasIncludeZero returns a boolean if a field has been set. +func (o *HeatMapWidgetYAxis) HasIncludeZero() bool { + return o != nil && o.IncludeZero != nil +} + +// SetIncludeZero gets a reference to the given bool and assigns it to the IncludeZero field. +func (o *HeatMapWidgetYAxis) SetIncludeZero(v bool) { + o.IncludeZero = &v +} + +// GetLabel returns the Label field value if set, zero value otherwise. +func (o *HeatMapWidgetYAxis) GetLabel() string { + if o == nil || o.Label == nil { + var ret string + return ret + } + return *o.Label +} + +// GetLabelOk returns a tuple with the Label field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetYAxis) GetLabelOk() (*string, bool) { + if o == nil || o.Label == nil { + return nil, false + } + return o.Label, true +} + +// HasLabel returns a boolean if a field has been set. +func (o *HeatMapWidgetYAxis) HasLabel() bool { + return o != nil && o.Label != nil +} + +// SetLabel gets a reference to the given string and assigns it to the Label field. +func (o *HeatMapWidgetYAxis) SetLabel(v string) { + o.Label = &v +} + +// GetMax returns the Max field value if set, zero value otherwise. +func (o *HeatMapWidgetYAxis) GetMax() string { + if o == nil || o.Max == nil { + var ret string + return ret + } + return *o.Max +} + +// GetMaxOk returns a tuple with the Max field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetYAxis) GetMaxOk() (*string, bool) { + if o == nil || o.Max == nil { + return nil, false + } + return o.Max, true +} + +// HasMax returns a boolean if a field has been set. +func (o *HeatMapWidgetYAxis) HasMax() bool { + return o != nil && o.Max != nil +} + +// SetMax gets a reference to the given string and assigns it to the Max field. +func (o *HeatMapWidgetYAxis) SetMax(v string) { + o.Max = &v +} + +// GetMin returns the Min field value if set, zero value otherwise. +func (o *HeatMapWidgetYAxis) GetMin() string { + if o == nil || o.Min == nil { + var ret string + return ret + } + return *o.Min +} + +// GetMinOk returns a tuple with the Min field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetYAxis) GetMinOk() (*string, bool) { + if o == nil || o.Min == nil { + return nil, false + } + return o.Min, true +} + +// HasMin returns a boolean if a field has been set. +func (o *HeatMapWidgetYAxis) HasMin() bool { + return o != nil && o.Min != nil +} + +// SetMin gets a reference to the given string and assigns it to the Min field. +func (o *HeatMapWidgetYAxis) SetMin(v string) { + o.Min = &v +} + +// GetNumBuckets returns the NumBuckets field value if set, zero value otherwise. +func (o *HeatMapWidgetYAxis) GetNumBuckets() int64 { + if o == nil || o.NumBuckets == nil { + var ret int64 + return ret + } + return *o.NumBuckets +} + +// GetNumBucketsOk returns a tuple with the NumBuckets field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetYAxis) GetNumBucketsOk() (*int64, bool) { + if o == nil || o.NumBuckets == nil { + return nil, false + } + return o.NumBuckets, true +} + +// HasNumBuckets returns a boolean if a field has been set. +func (o *HeatMapWidgetYAxis) HasNumBuckets() bool { + return o != nil && o.NumBuckets != nil +} + +// SetNumBuckets gets a reference to the given int64 and assigns it to the NumBuckets field. +func (o *HeatMapWidgetYAxis) SetNumBuckets(v int64) { + o.NumBuckets = &v +} + +// GetScale returns the Scale field value if set, zero value otherwise. +func (o *HeatMapWidgetYAxis) GetScale() string { + if o == nil || o.Scale == nil { + var ret string + return ret + } + return *o.Scale +} + +// GetScaleOk returns a tuple with the Scale field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HeatMapWidgetYAxis) GetScaleOk() (*string, bool) { + if o == nil || o.Scale == nil { + return nil, false + } + return o.Scale, true +} + +// HasScale returns a boolean if a field has been set. +func (o *HeatMapWidgetYAxis) HasScale() bool { + return o != nil && o.Scale != nil +} + +// SetScale gets a reference to the given string and assigns it to the Scale field. +func (o *HeatMapWidgetYAxis) SetScale(v string) { + o.Scale = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o HeatMapWidgetYAxis) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.IncludeZero != nil { + toSerialize["include_zero"] = o.IncludeZero + } + if o.Label != nil { + toSerialize["label"] = o.Label + } + if o.Max != nil { + toSerialize["max"] = o.Max + } + if o.Min != nil { + toSerialize["min"] = o.Min + } + if o.NumBuckets != nil { + toSerialize["num_buckets"] = o.NumBuckets + } + if o.Scale != nil { + toSerialize["scale"] = o.Scale + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *HeatMapWidgetYAxis) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + IncludeZero *bool `json:"include_zero,omitempty"` + Label *string `json:"label,omitempty"` + Max *string `json:"max,omitempty"` + Min *string `json:"min,omitempty"` + NumBuckets *int64 `json:"num_buckets,omitempty"` + Scale *string `json:"scale,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{"include_zero", "label", "max", "min", "num_buckets", "scale"}) + } else { + return err + } + o.IncludeZero = all.IncludeZero + o.Label = all.Label + o.Max = all.Max + o.Min = all.Min + o.NumBuckets = all.NumBuckets + o.Scale = all.Scale + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV1/model_widget_marker.go b/api/datadogV1/model_widget_marker.go index eb0e28c9356..d8721226e86 100644 --- a/api/datadogV1/model_widget_marker.go +++ b/api/datadogV1/model_widget_marker.go @@ -15,13 +15,14 @@ type WidgetMarker struct { // Combination of: // - A severity error, warning, ok, or info // - A line type: dashed, solid, or bold - // In this case of a Distribution widget, this can be set to be `x_axis_percentile`. + // In this case of a Distribution widget, this can be set to be `percentile`. DisplayType *string `json:"display_type,omitempty"` // Label to display over the marker. Label *string `json:"label,omitempty"` // Timestamp for the widget. Time *string `json:"time,omitempty"` // Value to apply. Can be a single value y = 15 or a range of values 0 < y < 10. + // For Distribution widgets with `display_type` set to `percentile`, this should be a numeric percentile value (e.g., "90" for P90). Value string `json:"value"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` diff --git a/examples/v1/dashboards/CreateDashboard_1093147852.go b/examples/v1/dashboards/CreateDashboard_1093147852.go new file mode 100644 index 00000000000..ec53b84dab9 --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_1093147852.go @@ -0,0 +1,91 @@ +// Create a new dashboard with distribution widget with markers and num_buckets + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV1" +) + +func main() { + body := datadogV1.Dashboard{ + Title: "Example-Dashboard", + Widgets: []datadogV1.Widget{ + { + Definition: datadogV1.WidgetDefinition{ + DistributionWidgetDefinition: &datadogV1.DistributionWidgetDefinition{ + Title: datadog.PtrString(""), + TitleSize: datadog.PtrString("16"), + TitleAlign: datadogV1.WIDGETTEXTALIGN_LEFT.Ptr(), + Type: datadogV1.DISTRIBUTIONWIDGETDEFINITIONTYPE_DISTRIBUTION, + Xaxis: &datadogV1.DistributionWidgetXAxis{ + Scale: datadog.PtrString("linear"), + Min: datadog.PtrString("auto"), + Max: datadog.PtrString("auto"), + IncludeZero: datadog.PtrBool(true), + NumBuckets: datadog.PtrInt64(55), + }, + Yaxis: &datadogV1.DistributionWidgetYAxis{ + Scale: datadog.PtrString("linear"), + Min: datadog.PtrString("auto"), + Max: datadog.PtrString("auto"), + IncludeZero: datadog.PtrBool(true), + }, + Markers: []datadogV1.WidgetMarker{ + { + DisplayType: datadog.PtrString("percentile"), + Value: "50", + }, + { + DisplayType: datadog.PtrString("percentile"), + Value: "99", + }, + { + DisplayType: datadog.PtrString("percentile"), + Value: "90", + }, + }, + Requests: []datadogV1.DistributionWidgetRequest{ + { + ResponseFormat: datadogV1.FORMULAANDFUNCTIONRESPONSEFORMAT_SCALAR.Ptr(), + Queries: []datadogV1.FormulaAndFunctionQueryDefinition{ + datadogV1.FormulaAndFunctionQueryDefinition{ + FormulaAndFunctionMetricQueryDefinition: &datadogV1.FormulaAndFunctionMetricQueryDefinition{ + DataSource: datadogV1.FORMULAANDFUNCTIONMETRICDATASOURCE_METRICS, + Name: "query1", + Query: "avg:system.cpu.user{*} by {service}", + Aggregator: datadogV1.FORMULAANDFUNCTIONMETRICAGGREGATION_AVG.Ptr(), + }}, + }, + }, + }, + }}, + Layout: &datadogV1.WidgetLayout{ + X: 0, + Y: 0, + Width: 4, + Height: 4, + }, + }, + }, + LayoutType: datadogV1.DASHBOARDLAYOUTTYPE_ORDERED, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV1.NewDashboardsApi(apiClient) + resp, r, err := api.CreateDashboard(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DashboardsApi.CreateDashboard`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.CreateDashboard`:\n%s\n", responseContent) +} diff --git a/examples/v1/dashboards/CreateDashboard_2823363212.go b/examples/v1/dashboards/CreateDashboard_2823363212.go new file mode 100644 index 00000000000..332f2756619 --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_2823363212.go @@ -0,0 +1,81 @@ +// Create a new dashboard with heatmap widget with markers and num_buckets + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV1" +) + +func main() { + body := datadogV1.Dashboard{ + Title: "Example-Dashboard", + Widgets: []datadogV1.Widget{ + { + Definition: datadogV1.WidgetDefinition{ + HeatMapWidgetDefinition: &datadogV1.HeatMapWidgetDefinition{ + Title: datadog.PtrString(""), + TitleSize: datadog.PtrString("16"), + TitleAlign: datadogV1.WIDGETTEXTALIGN_LEFT.Ptr(), + Type: datadogV1.HEATMAPWIDGETDEFINITIONTYPE_HEATMAP, + Xaxis: &datadogV1.HeatMapWidgetXAxis{ + NumBuckets: datadog.PtrInt64(75), + }, + Yaxis: &datadogV1.HeatMapWidgetYAxis{ + Scale: datadog.PtrString("linear"), + Min: datadog.PtrString("auto"), + Max: datadog.PtrString("auto"), + IncludeZero: datadog.PtrBool(true), + NumBuckets: datadog.PtrInt64(55), + }, + Markers: []datadogV1.WidgetMarker{ + { + DisplayType: datadog.PtrString("percentile"), + Value: "50", + }, + { + DisplayType: datadog.PtrString("percentile"), + Value: "99", + }, + }, + Requests: []datadogV1.HeatMapWidgetRequest{ + { + RequestType: datadogV1.DISTRIBUTIONWIDGETHISTOGRAMREQUESTTYPE_HISTOGRAM.Ptr(), + Query: &datadogV1.DistributionWidgetHistogramRequestQuery{ + FormulaAndFunctionMetricQueryDefinition: &datadogV1.FormulaAndFunctionMetricQueryDefinition{ + DataSource: datadogV1.FORMULAANDFUNCTIONMETRICDATASOURCE_METRICS, + Name: "query1", + Query: "histogram:trace.servlet.request{*}", + }}, + }, + }, + }}, + Layout: &datadogV1.WidgetLayout{ + X: 0, + Y: 0, + Width: 4, + Height: 4, + }, + }, + }, + LayoutType: datadogV1.DASHBOARDLAYOUTTYPE_ORDERED, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV1.NewDashboardsApi(apiClient) + resp, r, err := api.CreateDashboard(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `DashboardsApi.CreateDashboard`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.CreateDashboard`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Dashboards/Scenario_Create_a_new_dashboard_with_distribution_widget_with_markers_and_num_buckets.freeze b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Dashboards/Scenario_Create_a_new_dashboard_with_distribution_widget_with_markers_and_num_buckets.freeze new file mode 100644 index 00000000000..957e38ac24a --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Dashboards/Scenario_Create_a_new_dashboard_with_distribution_widget_with_markers_and_num_buckets.freeze @@ -0,0 +1 @@ +2025-12-04T23:08:04.708Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Dashboards/Scenario_Create_a_new_dashboard_with_distribution_widget_with_markers_and_num_buckets.yaml b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Dashboards/Scenario_Create_a_new_dashboard_with_distribution_widget_with_markers_and_num_buckets.yaml new file mode 100644 index 00000000000..daeafebf4df --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Dashboards/Scenario_Create_a_new_dashboard_with_distribution_widget_with_markers_and_num_buckets.yaml @@ -0,0 +1,41 @@ +interactions: +- request: + body: | + {"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_distribution_widget_with_markers_and_num_buckets-1764889684","widgets":[{"definition":{"markers":[{"display_type":"percentile","value":"50"},{"display_type":"percentile","value":"99"},{"display_type":"percentile","value":"90"}],"requests":[{"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} by {service}"}],"response_format":"scalar"}],"title":"","title_align":"left","title_size":"16","type":"distribution","xaxis":{"include_zero":true,"max":"auto","min":"auto","num_buckets":55,"scale":"linear"},"yaxis":{"include_zero":true,"max":"auto","min":"auto","scale":"linear"}},"layout":{"height":4,"width":4,"x":0,"y":0}}]} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v1/dashboard + response: + body: '{"id":"ved-atm-2g5","title":"Test-Create_a_new_dashboard_with_distribution_widget_with_markers_and_num_buckets-1764889684","description":null,"author_handle":"shishi.liu@datadoghq.com","author_name":"Shishi + Liu","layout_type":"ordered","url":"/dashboard/ved-atm-2g5/test-createanewdashboardwithdistributionwidgetwithmarkersandnumbuckets-176488968","template_variables":null,"widgets":[{"definition":{"markers":[{"display_type":"percentile","value":"50"},{"display_type":"percentile","value":"99"},{"display_type":"percentile","value":"90"}],"requests":[{"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} + by {service}"}],"response_format":"scalar"}],"title":"","title_align":"left","title_size":"16","type":"distribution","xaxis":{"include_zero":true,"max":"auto","min":"auto","num_buckets":55,"scale":"linear"},"yaxis":{"include_zero":true,"max":"auto","min":"auto","scale":"linear"}},"layout":{"height":4,"width":4,"x":0,"y":0},"id":984443192078703}],"notify_list":null,"created_at":"2025-12-04T23:08:05.111437+00:00","modified_at":"2025-12-04T23:08:05.111437+00:00","restricted_roles":[]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 1 + method: DELETE + url: https://api.datadoghq.com/api/v1/dashboard/ved-atm-2g5 + response: + body: '{"deleted_dashboard_id":"ved-atm-2g5"}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Dashboards/Scenario_Create_a_new_dashboard_with_heatmap_widget_with_markers_and_num_buckets.freeze b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Dashboards/Scenario_Create_a_new_dashboard_with_heatmap_widget_with_markers_and_num_buckets.freeze new file mode 100644 index 00000000000..73e0948438b --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Dashboards/Scenario_Create_a_new_dashboard_with_heatmap_widget_with_markers_and_num_buckets.freeze @@ -0,0 +1 @@ +2025-12-08T13:44:04.899Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v1/Feature_Dashboards/Scenario_Create_a_new_dashboard_with_heatmap_widget_with_markers_and_num_buckets.yaml b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Dashboards/Scenario_Create_a_new_dashboard_with_heatmap_widget_with_markers_and_num_buckets.yaml new file mode 100644 index 00000000000..795cce9ddb8 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v1/Feature_Dashboards/Scenario_Create_a_new_dashboard_with_heatmap_widget_with_markers_and_num_buckets.yaml @@ -0,0 +1,40 @@ +interactions: +- request: + body: | + {"layout_type":"ordered","title":"Test-Create_a_new_dashboard_with_heatmap_widget_with_markers_and_num_buckets-1765201444","widgets":[{"definition":{"markers":[{"display_type":"percentile","value":"50"},{"display_type":"percentile","value":"99"}],"requests":[{"query":{"data_source":"metrics","name":"query1","query":"histogram:trace.servlet.request{*}"},"request_type":"histogram"}],"title":"","title_align":"left","title_size":"16","type":"heatmap","xaxis":{"num_buckets":75},"yaxis":{"include_zero":true,"max":"auto","min":"auto","num_buckets":55,"scale":"linear"}},"layout":{"height":4,"width":4,"x":0,"y":0}}]} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v1/dashboard + response: + body: '{"id":"47i-rsj-bdw","title":"Test-Create_a_new_dashboard_with_heatmap_widget_with_markers_and_num_buckets-1765201444","description":null,"author_handle":"shishi.liu@datadoghq.com","author_name":"Shishi + Liu","layout_type":"ordered","url":"/dashboard/47i-rsj-bdw/test-createanewdashboardwithheatmapwidgetwithmarkersandnumbuckets-1765201444","template_variables":null,"widgets":[{"definition":{"markers":[{"display_type":"percentile","value":"50"},{"display_type":"percentile","value":"99"}],"requests":[{"query":{"data_source":"metrics","name":"query1","query":"histogram:trace.servlet.request{*}"},"request_type":"histogram"}],"title":"","title_align":"left","title_size":"16","type":"heatmap","xaxis":{"num_buckets":75},"yaxis":{"include_zero":true,"max":"auto","min":"auto","num_buckets":55,"scale":"linear"}},"layout":{"height":4,"width":4,"x":0,"y":0},"id":5710247626201242}],"notify_list":null,"created_at":"2025-12-08T13:44:05.403199+00:00","modified_at":"2025-12-08T13:44:05.403199+00:00","restricted_roles":[]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 1 + method: DELETE + url: https://api.datadoghq.com/api/v1/dashboard/47i-rsj-bdw + response: + body: '{"deleted_dashboard_id":"47i-rsj-bdw"}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/json + status: 200 OK +version: 2 diff --git a/tests/scenarios/features/v1/dashboards.feature b/tests/scenarios/features/v1/dashboards.feature index 0d161522e95..02c9c40bf85 100644 --- a/tests/scenarios/features/v1/dashboards.feature +++ b/tests/scenarios/features/v1/dashboards.feature @@ -328,6 +328,15 @@ Feature: Dashboards And the response "widgets[0].definition.requests[0].apm_stats_query.service" is equal to "cassandra" And the response "widgets[0].definition.requests[0].apm_stats_query.name" is equal to "cassandra.query" + @team:DataDog/dashboards-backend + Scenario: Create a new dashboard with distribution widget with markers and num_buckets + Given new "CreateDashboard" request + And body with value { "title": "{{ unique }}", "widgets": [{"definition": { "title": "", "title_size": "16", "title_align": "left", "type": "distribution", "xaxis": { "scale": "linear", "min": "auto", "max": "auto", "include_zero": true, "num_buckets": 55 }, "yaxis": { "scale": "linear", "min": "auto", "max": "auto", "include_zero": true }, "markers": [{ "display_type": "percentile", "value": "50" }, { "display_type": "percentile", "value": "99" }, { "display_type": "percentile", "value": "90" }], "requests": [{ "response_format": "scalar", "queries": [{ "data_source": "metrics", "name": "query1", "query": "avg:system.cpu.user{*} by {service}", "aggregator": "avg" }] }] }, "layout": { "x": 0, "y": 0, "width": 4, "height": 4 } } ], "layout_type": "ordered" } + When the request is sent + Then the response status is 200 OK + And the response "widgets[0].definition.xaxis.num_buckets" is equal to 55 + And the response "widgets[0].definition.markers" is equal to [{"display_type": "percentile", "value": "50"}, {"display_type": "percentile", "value": "99"}, {"display_type": "percentile", "value": "90"}] + @team:DataDog/dashboards-backend Scenario: Create a new dashboard with event_stream list_stream widget Given new "CreateDashboard" request @@ -431,6 +440,16 @@ Feature: Dashboards And the response "widgets[0].definition.type" is equal to "heatmap" And the response "widgets[0].definition.requests[0].q" is equal to "avg:system.cpu.user{*} by {service}" + @team:DataDog/dashboards-backend + Scenario: Create a new dashboard with heatmap widget with markers and num_buckets + Given new "CreateDashboard" request + And body with value { "title": "{{ unique }}", "widgets": [{"definition": { "title": "", "title_size": "16", "title_align": "left", "type": "heatmap", "xaxis": { "num_buckets": 75 }, "yaxis": { "scale": "linear", "min": "auto", "max": "auto", "include_zero": true, "num_buckets": 55 }, "markers": [{ "display_type": "percentile", "value": "50" }, { "display_type": "percentile", "value": "99" }], "requests": [{ "request_type": "histogram", "query": { "data_source": "metrics", "name": "query1", "query": "histogram:trace.servlet.request{*}"} }] }, "layout": { "x": 0, "y": 0, "width": 4, "height": 4 } }], "layout_type": "ordered" } + When the request is sent + Then the response status is 200 OK + And the response "widgets[0].definition.xaxis.num_buckets" is equal to 75 + And the response "widgets[0].definition.yaxis.num_buckets" is equal to 55 + And the response "widgets[0].definition.markers" is equal to [{"display_type": "percentile", "value": "50"}, {"display_type": "percentile", "value": "99"}] + @team:DataDog/dashboards-backend Scenario: Create a new dashboard with hostmap widget Given new "CreateDashboard" request