Skip to content

Commit e1923f5

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 2e8d553d of spec repo
1 parent 413fb07 commit e1923f5

8 files changed

Lines changed: 345 additions & 21 deletions

File tree

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2025-06-26 17:56:23.043504",
8-
"spec_repo_commit": "76086f13"
7+
"regenerated": "2025-06-27 20:17:45.514605",
8+
"spec_repo_commit": "2e8d553d"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-06-26 17:56:23.062756",
13-
"spec_repo_commit": "76086f13"
12+
"regenerated": "2025-06-27 20:17:45.532533",
13+
"spec_repo_commit": "2e8d553d"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,6 +1550,13 @@ components:
15501550
example: host
15511551
nullable: true
15521552
type: string
1553+
type:
1554+
description: The type of variable. This is to differentiate between filter
1555+
variables (interpolated in query) and group by variables (interpolated
1556+
into group by).
1557+
example: group
1558+
nullable: true
1559+
type: string
15531560
required:
15541561
- name
15551562
type: object
@@ -12577,6 +12584,13 @@ components:
1257712584
type: string
1257812585
prefix:
1257912586
description: The tag/attribute key associated with the template variable.
12587+
nullable: true
12588+
type: string
12589+
type:
12590+
description: The type of variable. This is to differentiate between filter
12591+
variables (interpolated in query) and group by variables (interpolated
12592+
into group by).
12593+
nullable: true
1258012594
type: string
1258112595
visible_tags:
1258212596
description: List of visible tag values on the shared dashboard.

api/datadogV1/model_dashboard_template_variable.go

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ type DashboardTemplateVariable struct {
2323
Name string `json:"name"`
2424
// The tag prefix associated with the variable. Only tags with this prefix appear in the variable drop-down.
2525
Prefix datadog.NullableString `json:"prefix,omitempty"`
26+
// The type of variable. This is to differentiate between filter variables (interpolated in query) and group by variables (interpolated into group by).
27+
Type datadog.NullableString `json:"type,omitempty"`
2628
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
2729
UnparsedObject map[string]interface{} `json:"-"`
2830
AdditionalProperties map[string]interface{} `json:"-"`
@@ -217,6 +219,45 @@ func (o *DashboardTemplateVariable) UnsetPrefix() {
217219
o.Prefix.Unset()
218220
}
219221

222+
// GetType returns the Type field value if set, zero value otherwise (both if not set or set to explicit null).
223+
func (o *DashboardTemplateVariable) GetType() string {
224+
if o == nil || o.Type.Get() == nil {
225+
var ret string
226+
return ret
227+
}
228+
return *o.Type.Get()
229+
}
230+
231+
// GetTypeOk returns a tuple with the Type field value if set, nil otherwise
232+
// and a boolean to check if the value has been set.
233+
// NOTE: If the value is an explicit nil, `nil, true` will be returned.
234+
func (o *DashboardTemplateVariable) GetTypeOk() (*string, bool) {
235+
if o == nil {
236+
return nil, false
237+
}
238+
return o.Type.Get(), o.Type.IsSet()
239+
}
240+
241+
// HasType returns a boolean if a field has been set.
242+
func (o *DashboardTemplateVariable) HasType() bool {
243+
return o != nil && o.Type.IsSet()
244+
}
245+
246+
// SetType gets a reference to the given datadog.NullableString and assigns it to the Type field.
247+
func (o *DashboardTemplateVariable) SetType(v string) {
248+
o.Type.Set(&v)
249+
}
250+
251+
// SetTypeNil sets the value for Type to be an explicit nil.
252+
func (o *DashboardTemplateVariable) SetTypeNil() {
253+
o.Type.Set(nil)
254+
}
255+
256+
// UnsetType ensures that no value is present for Type, not even an explicit nil.
257+
func (o *DashboardTemplateVariable) UnsetType() {
258+
o.Type.Unset()
259+
}
260+
220261
// MarshalJSON serializes the struct using spec logic.
221262
func (o DashboardTemplateVariable) MarshalJSON() ([]byte, error) {
222263
toSerialize := map[string]interface{}{}
@@ -236,6 +277,9 @@ func (o DashboardTemplateVariable) MarshalJSON() ([]byte, error) {
236277
if o.Prefix.IsSet() {
237278
toSerialize["prefix"] = o.Prefix.Get()
238279
}
280+
if o.Type.IsSet() {
281+
toSerialize["type"] = o.Type.Get()
282+
}
239283

240284
for key, value := range o.AdditionalProperties {
241285
toSerialize[key] = value
@@ -251,6 +295,7 @@ func (o *DashboardTemplateVariable) UnmarshalJSON(bytes []byte) (err error) {
251295
Defaults []string `json:"defaults,omitempty"`
252296
Name *string `json:"name"`
253297
Prefix datadog.NullableString `json:"prefix,omitempty"`
298+
Type datadog.NullableString `json:"type,omitempty"`
254299
}{}
255300
if err = datadog.Unmarshal(bytes, &all); err != nil {
256301
return datadog.Unmarshal(bytes, &o.UnparsedObject)
@@ -260,7 +305,7 @@ func (o *DashboardTemplateVariable) UnmarshalJSON(bytes []byte) (err error) {
260305
}
261306
additionalProperties := make(map[string]interface{})
262307
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
263-
datadog.DeleteKeys(additionalProperties, &[]string{"available_values", "default", "defaults", "name", "prefix"})
308+
datadog.DeleteKeys(additionalProperties, &[]string{"available_values", "default", "defaults", "name", "prefix", "type"})
264309
} else {
265310
return err
266311
}
@@ -269,6 +314,7 @@ func (o *DashboardTemplateVariable) UnmarshalJSON(bytes []byte) (err error) {
269314
o.Defaults = all.Defaults
270315
o.Name = *all.Name
271316
o.Prefix = all.Prefix
317+
o.Type = all.Type
272318

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

api/datadogV1/model_selectable_template_variable_items.go

Lines changed: 70 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ type SelectableTemplateVariableItems struct {
1515
// Name of the template variable.
1616
Name *string `json:"name,omitempty"`
1717
// The tag/attribute key associated with the template variable.
18-
Prefix *string `json:"prefix,omitempty"`
18+
Prefix datadog.NullableString `json:"prefix,omitempty"`
19+
// The type of variable. This is to differentiate between filter variables (interpolated in query) and group by variables (interpolated into group by).
20+
Type datadog.NullableString `json:"type,omitempty"`
1921
// List of visible tag values on the shared dashboard.
2022
VisibleTags datadog.NullableList[string] `json:"visible_tags,omitempty"`
2123
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
@@ -96,32 +98,82 @@ func (o *SelectableTemplateVariableItems) SetName(v string) {
9698
o.Name = &v
9799
}
98100

99-
// GetPrefix returns the Prefix field value if set, zero value otherwise.
101+
// GetPrefix returns the Prefix field value if set, zero value otherwise (both if not set or set to explicit null).
100102
func (o *SelectableTemplateVariableItems) GetPrefix() string {
101-
if o == nil || o.Prefix == nil {
103+
if o == nil || o.Prefix.Get() == nil {
102104
var ret string
103105
return ret
104106
}
105-
return *o.Prefix
107+
return *o.Prefix.Get()
106108
}
107109

108110
// GetPrefixOk returns a tuple with the Prefix field value if set, nil otherwise
109111
// and a boolean to check if the value has been set.
112+
// NOTE: If the value is an explicit nil, `nil, true` will be returned.
110113
func (o *SelectableTemplateVariableItems) GetPrefixOk() (*string, bool) {
111-
if o == nil || o.Prefix == nil {
114+
if o == nil {
112115
return nil, false
113116
}
114-
return o.Prefix, true
117+
return o.Prefix.Get(), o.Prefix.IsSet()
115118
}
116119

117120
// HasPrefix returns a boolean if a field has been set.
118121
func (o *SelectableTemplateVariableItems) HasPrefix() bool {
119-
return o != nil && o.Prefix != nil
122+
return o != nil && o.Prefix.IsSet()
120123
}
121124

122-
// SetPrefix gets a reference to the given string and assigns it to the Prefix field.
125+
// SetPrefix gets a reference to the given datadog.NullableString and assigns it to the Prefix field.
123126
func (o *SelectableTemplateVariableItems) SetPrefix(v string) {
124-
o.Prefix = &v
127+
o.Prefix.Set(&v)
128+
}
129+
130+
// SetPrefixNil sets the value for Prefix to be an explicit nil.
131+
func (o *SelectableTemplateVariableItems) SetPrefixNil() {
132+
o.Prefix.Set(nil)
133+
}
134+
135+
// UnsetPrefix ensures that no value is present for Prefix, not even an explicit nil.
136+
func (o *SelectableTemplateVariableItems) UnsetPrefix() {
137+
o.Prefix.Unset()
138+
}
139+
140+
// GetType returns the Type field value if set, zero value otherwise (both if not set or set to explicit null).
141+
func (o *SelectableTemplateVariableItems) GetType() string {
142+
if o == nil || o.Type.Get() == nil {
143+
var ret string
144+
return ret
145+
}
146+
return *o.Type.Get()
147+
}
148+
149+
// GetTypeOk returns a tuple with the Type field value if set, nil otherwise
150+
// and a boolean to check if the value has been set.
151+
// NOTE: If the value is an explicit nil, `nil, true` will be returned.
152+
func (o *SelectableTemplateVariableItems) GetTypeOk() (*string, bool) {
153+
if o == nil {
154+
return nil, false
155+
}
156+
return o.Type.Get(), o.Type.IsSet()
157+
}
158+
159+
// HasType returns a boolean if a field has been set.
160+
func (o *SelectableTemplateVariableItems) HasType() bool {
161+
return o != nil && o.Type.IsSet()
162+
}
163+
164+
// SetType gets a reference to the given datadog.NullableString and assigns it to the Type field.
165+
func (o *SelectableTemplateVariableItems) SetType(v string) {
166+
o.Type.Set(&v)
167+
}
168+
169+
// SetTypeNil sets the value for Type to be an explicit nil.
170+
func (o *SelectableTemplateVariableItems) SetTypeNil() {
171+
o.Type.Set(nil)
172+
}
173+
174+
// UnsetType ensures that no value is present for Type, not even an explicit nil.
175+
func (o *SelectableTemplateVariableItems) UnsetType() {
176+
o.Type.Unset()
125177
}
126178

127179
// GetVisibleTags returns the VisibleTags field value if set, zero value otherwise (both if not set or set to explicit null).
@@ -175,8 +227,11 @@ func (o SelectableTemplateVariableItems) MarshalJSON() ([]byte, error) {
175227
if o.Name != nil {
176228
toSerialize["name"] = o.Name
177229
}
178-
if o.Prefix != nil {
179-
toSerialize["prefix"] = o.Prefix
230+
if o.Prefix.IsSet() {
231+
toSerialize["prefix"] = o.Prefix.Get()
232+
}
233+
if o.Type.IsSet() {
234+
toSerialize["type"] = o.Type.Get()
180235
}
181236
if o.VisibleTags.IsSet() {
182237
toSerialize["visible_tags"] = o.VisibleTags.Get()
@@ -193,21 +248,23 @@ func (o *SelectableTemplateVariableItems) UnmarshalJSON(bytes []byte) (err error
193248
all := struct {
194249
DefaultValue *string `json:"default_value,omitempty"`
195250
Name *string `json:"name,omitempty"`
196-
Prefix *string `json:"prefix,omitempty"`
251+
Prefix datadog.NullableString `json:"prefix,omitempty"`
252+
Type datadog.NullableString `json:"type,omitempty"`
197253
VisibleTags datadog.NullableList[string] `json:"visible_tags,omitempty"`
198254
}{}
199255
if err = datadog.Unmarshal(bytes, &all); err != nil {
200256
return datadog.Unmarshal(bytes, &o.UnparsedObject)
201257
}
202258
additionalProperties := make(map[string]interface{})
203259
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
204-
datadog.DeleteKeys(additionalProperties, &[]string{"default_value", "name", "prefix", "visible_tags"})
260+
datadog.DeleteKeys(additionalProperties, &[]string{"default_value", "name", "prefix", "type", "visible_tags"})
205261
} else {
206262
return err
207263
}
208264
o.DefaultValue = all.DefaultValue
209265
o.Name = all.Name
210266
o.Prefix = all.Prefix
267+
o.Type = all.Type
211268
o.VisibleTags = all.VisibleTags
212269

213270
if len(additionalProperties) > 0 {
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// Create a new dashboard with template variable type field returns "OK" response
2+
3+
package main
4+
5+
import (
6+
"context"
7+
"encoding/json"
8+
"fmt"
9+
"os"
10+
11+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
12+
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1"
13+
)
14+
15+
func main() {
16+
body := datadogV1.Dashboard{
17+
Description: *datadog.NewNullableString(nil),
18+
LayoutType: datadogV1.DASHBOARDLAYOUTTYPE_ORDERED,
19+
NotifyList: *datadog.NewNullableList(&[]string{}),
20+
ReflowType: datadogV1.DASHBOARDREFLOWTYPE_AUTO.Ptr(),
21+
RestrictedRoles: []string{},
22+
TemplateVariables: []datadogV1.DashboardTemplateVariable{
23+
{
24+
AvailableValues: *datadog.NewNullableList(&[]string{
25+
"service",
26+
"datacenter",
27+
"env",
28+
}),
29+
Default: *datadog.NewNullableString(datadog.PtrString("service")),
30+
Defaults: []string{
31+
"service",
32+
"datacenter",
33+
},
34+
Name: "group_by_var",
35+
Type: *datadog.NewNullableString(datadog.PtrString("group")),
36+
},
37+
},
38+
Title: "",
39+
Widgets: []datadogV1.Widget{
40+
{
41+
Definition: datadogV1.WidgetDefinition{
42+
HostMapWidgetDefinition: &datadogV1.HostMapWidgetDefinition{
43+
Requests: datadogV1.HostMapWidgetDefinitionRequests{
44+
Fill: &datadogV1.HostMapRequest{
45+
Q: datadog.PtrString("avg:system.cpu.user{*}"),
46+
},
47+
},
48+
Type: datadogV1.HOSTMAPWIDGETDEFINITIONTYPE_HOSTMAP,
49+
}},
50+
},
51+
},
52+
}
53+
ctx := datadog.NewDefaultContext(context.Background())
54+
configuration := datadog.NewConfiguration()
55+
apiClient := datadog.NewAPIClient(configuration)
56+
api := datadogV1.NewDashboardsApi(apiClient)
57+
resp, r, err := api.CreateDashboard(ctx, body)
58+
59+
if err != nil {
60+
fmt.Fprintf(os.Stderr, "Error when calling `DashboardsApi.CreateDashboard`: %v\n", err)
61+
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
62+
}
63+
64+
responseContent, _ := json.MarshalIndent(resp, "", " ")
65+
fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.CreateDashboard`:\n%s\n", responseContent)
66+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Create a shared dashboard with a group template variable returns "OK" response
2+
3+
package main
4+
5+
import (
6+
"context"
7+
"encoding/json"
8+
"fmt"
9+
"os"
10+
11+
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
12+
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV1"
13+
)
14+
15+
func main() {
16+
// there is a valid "dashboard" in the system
17+
DashboardID := os.Getenv("DASHBOARD_ID")
18+
19+
body := datadogV1.SharedDashboard{
20+
DashboardId: DashboardID,
21+
DashboardType: datadogV1.DASHBOARDTYPE_CUSTOM_TIMEBOARD,
22+
ShareType: *datadogV1.NewNullableDashboardShareType(datadogV1.DASHBOARDSHARETYPE_OPEN.Ptr()),
23+
GlobalTime: &datadogV1.DashboardGlobalTime{
24+
LiveSpan: datadogV1.DASHBOARDGLOBALTIMELIVESPAN_PAST_ONE_HOUR.Ptr(),
25+
},
26+
SelectableTemplateVars: []datadogV1.SelectableTemplateVariableItems{
27+
{
28+
DefaultValue: datadog.PtrString("*"),
29+
Name: datadog.PtrString("group_by_var"),
30+
Type: *datadog.NewNullableString(datadog.PtrString("group")),
31+
VisibleTags: *datadog.NewNullableList(&[]string{
32+
"selectableValue1",
33+
"selectableValue2",
34+
}),
35+
},
36+
},
37+
}
38+
ctx := datadog.NewDefaultContext(context.Background())
39+
configuration := datadog.NewConfiguration()
40+
apiClient := datadog.NewAPIClient(configuration)
41+
api := datadogV1.NewDashboardsApi(apiClient)
42+
resp, r, err := api.CreatePublicDashboard(ctx, body)
43+
44+
if err != nil {
45+
fmt.Fprintf(os.Stderr, "Error when calling `DashboardsApi.CreatePublicDashboard`: %v\n", err)
46+
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
47+
}
48+
49+
responseContent, _ := json.MarshalIndent(resp, "", " ")
50+
fmt.Fprintf(os.Stdout, "Response from `DashboardsApi.CreatePublicDashboard`:\n%s\n", responseContent)
51+
}

0 commit comments

Comments
 (0)