Skip to content

Commit e36014a

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit b951844 of spec repo (DataDog#3852)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 3f3956a commit e36014a

7 files changed

Lines changed: 909 additions & 0 deletions

.generator/schemas/v1/openapi.yaml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24274,6 +24274,7 @@ components:
2427424274
- $ref: "#/components/schemas/ToplistWidgetDefinition"
2427524275
- $ref: "#/components/schemas/TopologyMapWidgetDefinition"
2427624276
- $ref: "#/components/schemas/TreeMapWidgetDefinition"
24277+
- $ref: "#/components/schemas/WildcardWidgetDefinition"
2427724278
WidgetDisplayType:
2427824279
description: Type of display to use for the request.
2427924280
enum:
@@ -25045,6 +25046,81 @@ components:
2504525046
x-enum-varnames:
2504625047
- TIMESERIES
2504725048
- TOPLIST
25049+
WildcardWidgetDefinition:
25050+
description: >-
25051+
Custom visualization widget using Vega or Vega-Lite specifications. Combines standard Datadog data requests with a Vega or Vega-Lite JSON specification for flexible, custom visualizations.
25052+
properties:
25053+
custom_links:
25054+
description: List of custom links.
25055+
items:
25056+
$ref: "#/components/schemas/WidgetCustomLink"
25057+
type: array
25058+
requests:
25059+
description: List of data requests for the wildcard widget.
25060+
example: [{"formulas": ["formula": "query1"], "queries": [{"aggregator": "avg", "data_source": "metrics", "name": "query1", "query": "avg:system.cpu.user{*} by {env}"}], "response_format": "scalar"}]
25061+
items:
25062+
$ref: "#/components/schemas/WildcardWidgetRequest"
25063+
type: array
25064+
specification:
25065+
$ref: "#/components/schemas/WildcardWidgetSpecification"
25066+
time:
25067+
$ref: "#/components/schemas/WidgetTime"
25068+
title:
25069+
description: Title of the widget.
25070+
type: string
25071+
title_align:
25072+
$ref: "#/components/schemas/WidgetTextAlign"
25073+
title_size:
25074+
description: Size of the title.
25075+
type: string
25076+
type:
25077+
$ref: "#/components/schemas/WildcardWidgetDefinitionType"
25078+
required:
25079+
- type
25080+
- requests
25081+
- specification
25082+
type: object
25083+
WildcardWidgetDefinitionType:
25084+
default: wildcard
25085+
description: Type of the wildcard widget.
25086+
enum:
25087+
- wildcard
25088+
example: wildcard
25089+
type: string
25090+
x-enum-varnames:
25091+
- WILDCARD
25092+
WildcardWidgetRequest:
25093+
description: >-
25094+
Request object for the wildcard widget. Each variant represents a distinct data-fetching pattern: scalar formulas, timeseries formulas, list streams, and histograms.
25095+
oneOf:
25096+
- $ref: "#/components/schemas/TreeMapWidgetRequest"
25097+
- $ref: "#/components/schemas/TimeseriesWidgetRequest"
25098+
- $ref: "#/components/schemas/ListStreamWidgetRequest"
25099+
- $ref: "#/components/schemas/DistributionWidgetRequest"
25100+
WildcardWidgetSpecification:
25101+
description: >-
25102+
Vega or Vega-Lite specification for custom visualization rendering. See https://vega.github.io/vega-lite/ for the full grammar reference.
25103+
properties:
25104+
contents:
25105+
description: The Vega or Vega-Lite JSON specification object.
25106+
example: {"$schema": "https://vega.github.io/schema/vega-lite/v5.json", "data": {"name": "table1"}, "description": "A simple bar chart", "encoding": {"x": {"field": "env", "sort": "-y", "type": "nominal"}, "y": {"field": "query1", "type": "quantitative"}}, "mark": "bar"}
25107+
type: object
25108+
type:
25109+
$ref: "#/components/schemas/WildcardWidgetSpecificationType"
25110+
required:
25111+
- type
25112+
- contents
25113+
type: object
25114+
WildcardWidgetSpecificationType:
25115+
description: Type of specification used by the wildcard widget.
25116+
enum:
25117+
- vega
25118+
- vega-lite
25119+
example: vega-lite
25120+
type: string
25121+
x-enum-varnames:
25122+
- VEGA
25123+
- VEGA_LITE
2504825124
securitySchemes:
2504925125
AuthZ:
2505025126
description: This API uses OAuth 2 with the implicit grant flow.

api/datadogV1/model_widget_definition.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ type WidgetDefinition struct {
4646
ToplistWidgetDefinition *ToplistWidgetDefinition
4747
TopologyMapWidgetDefinition *TopologyMapWidgetDefinition
4848
TreeMapWidgetDefinition *TreeMapWidgetDefinition
49+
WildcardWidgetDefinition *WildcardWidgetDefinition
4950

5051
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
5152
UnparsedObject interface{}
@@ -231,6 +232,11 @@ func TreeMapWidgetDefinitionAsWidgetDefinition(v *TreeMapWidgetDefinition) Widge
231232
return WidgetDefinition{TreeMapWidgetDefinition: v}
232233
}
233234

235+
// WildcardWidgetDefinitionAsWidgetDefinition is a convenience function that returns WildcardWidgetDefinition wrapped in WidgetDefinition.
236+
func WildcardWidgetDefinitionAsWidgetDefinition(v *WildcardWidgetDefinition) WidgetDefinition {
237+
return WidgetDefinition{WildcardWidgetDefinition: v}
238+
}
239+
234240
// UnmarshalJSON turns data into one of the pointers in the struct.
235241
func (obj *WidgetDefinition) UnmarshalJSON(data []byte) error {
236242
var err error
@@ -847,6 +853,23 @@ func (obj *WidgetDefinition) UnmarshalJSON(data []byte) error {
847853
obj.TreeMapWidgetDefinition = nil
848854
}
849855

856+
// try to unmarshal data into WildcardWidgetDefinition
857+
err = datadog.Unmarshal(data, &obj.WildcardWidgetDefinition)
858+
if err == nil {
859+
if obj.WildcardWidgetDefinition != nil && obj.WildcardWidgetDefinition.UnparsedObject == nil {
860+
jsonWildcardWidgetDefinition, _ := datadog.Marshal(obj.WildcardWidgetDefinition)
861+
if string(jsonWildcardWidgetDefinition) == "{}" { // empty struct
862+
obj.WildcardWidgetDefinition = nil
863+
} else {
864+
match++
865+
}
866+
} else {
867+
obj.WildcardWidgetDefinition = nil
868+
}
869+
} else {
870+
obj.WildcardWidgetDefinition = nil
871+
}
872+
850873
if match != 1 { // more than 1 match
851874
// reset to nil
852875
obj.AlertGraphWidgetDefinition = nil
@@ -885,6 +908,7 @@ func (obj *WidgetDefinition) UnmarshalJSON(data []byte) error {
885908
obj.ToplistWidgetDefinition = nil
886909
obj.TopologyMapWidgetDefinition = nil
887910
obj.TreeMapWidgetDefinition = nil
911+
obj.WildcardWidgetDefinition = nil
888912
return datadog.Unmarshal(data, &obj.UnparsedObject)
889913
}
890914
return nil // exactly one match
@@ -1036,6 +1060,10 @@ func (obj WidgetDefinition) MarshalJSON() ([]byte, error) {
10361060
return datadog.Marshal(&obj.TreeMapWidgetDefinition)
10371061
}
10381062

1063+
if obj.WildcardWidgetDefinition != nil {
1064+
return datadog.Marshal(&obj.WildcardWidgetDefinition)
1065+
}
1066+
10391067
if obj.UnparsedObject != nil {
10401068
return datadog.Marshal(obj.UnparsedObject)
10411069
}
@@ -1188,6 +1216,10 @@ func (obj *WidgetDefinition) GetActualInstance() interface{} {
11881216
return obj.TreeMapWidgetDefinition
11891217
}
11901218

1219+
if obj.WildcardWidgetDefinition != nil {
1220+
return obj.WildcardWidgetDefinition
1221+
}
1222+
11911223
// all schemas are nil
11921224
return nil
11931225
}

0 commit comments

Comments
 (0)