-
Notifications
You must be signed in to change notification settings - Fork 52
/
model_shared_dashboard_update_request.go
287 lines (249 loc) · 11.5 KB
/
model_shared_dashboard_update_request.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
// 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 (
"fmt"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)
// SharedDashboardUpdateRequest Update a shared dashboard's settings.
type SharedDashboardUpdateRequest struct {
// Timeframe setting for the shared dashboard.
GlobalTime NullableSharedDashboardUpdateRequestGlobalTime `json:"global_time"`
// Whether to allow viewers to select a different global time setting for the shared dashboard.
GlobalTimeSelectableEnabled datadog.NullableBool `json:"global_time_selectable_enabled,omitempty"`
// List of objects representing template variables on the shared dashboard which can have selectable values.
SelectableTemplateVars []SelectableTemplateVariableItems `json:"selectable_template_vars,omitempty"`
// List of email addresses that can be given access to the shared dashboard.
ShareList datadog.NullableList[string] `json:"share_list,omitempty"`
// Type of sharing access (either open to anyone who has the public URL or invite-only).
ShareType NullableDashboardShareType `json:"share_type,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{}
}
// NewSharedDashboardUpdateRequest instantiates a new SharedDashboardUpdateRequest 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 NewSharedDashboardUpdateRequest(globalTime NullableSharedDashboardUpdateRequestGlobalTime) *SharedDashboardUpdateRequest {
this := SharedDashboardUpdateRequest{}
this.GlobalTime = globalTime
return &this
}
// NewSharedDashboardUpdateRequestWithDefaults instantiates a new SharedDashboardUpdateRequest 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 NewSharedDashboardUpdateRequestWithDefaults() *SharedDashboardUpdateRequest {
this := SharedDashboardUpdateRequest{}
return &this
}
// GetGlobalTime returns the GlobalTime field value.
// If the value is explicit nil, the zero value for SharedDashboardUpdateRequestGlobalTime will be returned.
func (o *SharedDashboardUpdateRequest) GetGlobalTime() SharedDashboardUpdateRequestGlobalTime {
if o == nil || o.GlobalTime.Get() == nil {
var ret SharedDashboardUpdateRequestGlobalTime
return ret
}
return *o.GlobalTime.Get()
}
// GetGlobalTimeOk returns a tuple with the GlobalTime field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned.
func (o *SharedDashboardUpdateRequest) GetGlobalTimeOk() (*SharedDashboardUpdateRequestGlobalTime, bool) {
if o == nil {
return nil, false
}
return o.GlobalTime.Get(), o.GlobalTime.IsSet()
}
// SetGlobalTime sets field value.
func (o *SharedDashboardUpdateRequest) SetGlobalTime(v SharedDashboardUpdateRequestGlobalTime) {
o.GlobalTime.Set(&v)
}
// GetGlobalTimeSelectableEnabled returns the GlobalTimeSelectableEnabled field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *SharedDashboardUpdateRequest) GetGlobalTimeSelectableEnabled() bool {
if o == nil || o.GlobalTimeSelectableEnabled.Get() == nil {
var ret bool
return ret
}
return *o.GlobalTimeSelectableEnabled.Get()
}
// GetGlobalTimeSelectableEnabledOk returns a tuple with the GlobalTimeSelectableEnabled field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned.
func (o *SharedDashboardUpdateRequest) GetGlobalTimeSelectableEnabledOk() (*bool, bool) {
if o == nil {
return nil, false
}
return o.GlobalTimeSelectableEnabled.Get(), o.GlobalTimeSelectableEnabled.IsSet()
}
// HasGlobalTimeSelectableEnabled returns a boolean if a field has been set.
func (o *SharedDashboardUpdateRequest) HasGlobalTimeSelectableEnabled() bool {
return o != nil && o.GlobalTimeSelectableEnabled.IsSet()
}
// SetGlobalTimeSelectableEnabled gets a reference to the given datadog.NullableBool and assigns it to the GlobalTimeSelectableEnabled field.
func (o *SharedDashboardUpdateRequest) SetGlobalTimeSelectableEnabled(v bool) {
o.GlobalTimeSelectableEnabled.Set(&v)
}
// SetGlobalTimeSelectableEnabledNil sets the value for GlobalTimeSelectableEnabled to be an explicit nil.
func (o *SharedDashboardUpdateRequest) SetGlobalTimeSelectableEnabledNil() {
o.GlobalTimeSelectableEnabled.Set(nil)
}
// UnsetGlobalTimeSelectableEnabled ensures that no value is present for GlobalTimeSelectableEnabled, not even an explicit nil.
func (o *SharedDashboardUpdateRequest) UnsetGlobalTimeSelectableEnabled() {
o.GlobalTimeSelectableEnabled.Unset()
}
// GetSelectableTemplateVars returns the SelectableTemplateVars field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *SharedDashboardUpdateRequest) GetSelectableTemplateVars() []SelectableTemplateVariableItems {
if o == nil {
var ret []SelectableTemplateVariableItems
return ret
}
return o.SelectableTemplateVars
}
// GetSelectableTemplateVarsOk returns a tuple with the SelectableTemplateVars field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned.
func (o *SharedDashboardUpdateRequest) GetSelectableTemplateVarsOk() (*[]SelectableTemplateVariableItems, bool) {
if o == nil || o.SelectableTemplateVars == nil {
return nil, false
}
return &o.SelectableTemplateVars, true
}
// HasSelectableTemplateVars returns a boolean if a field has been set.
func (o *SharedDashboardUpdateRequest) HasSelectableTemplateVars() bool {
return o != nil && o.SelectableTemplateVars != nil
}
// SetSelectableTemplateVars gets a reference to the given []SelectableTemplateVariableItems and assigns it to the SelectableTemplateVars field.
func (o *SharedDashboardUpdateRequest) SetSelectableTemplateVars(v []SelectableTemplateVariableItems) {
o.SelectableTemplateVars = v
}
// GetShareList returns the ShareList field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *SharedDashboardUpdateRequest) GetShareList() []string {
if o == nil || o.ShareList.Get() == nil {
var ret []string
return ret
}
return *o.ShareList.Get()
}
// GetShareListOk returns a tuple with the ShareList field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned.
func (o *SharedDashboardUpdateRequest) GetShareListOk() (*[]string, bool) {
if o == nil {
return nil, false
}
return o.ShareList.Get(), o.ShareList.IsSet()
}
// HasShareList returns a boolean if a field has been set.
func (o *SharedDashboardUpdateRequest) HasShareList() bool {
return o != nil && o.ShareList.IsSet()
}
// SetShareList gets a reference to the given datadog.NullableList[string] and assigns it to the ShareList field.
func (o *SharedDashboardUpdateRequest) SetShareList(v []string) {
o.ShareList.Set(&v)
}
// SetShareListNil sets the value for ShareList to be an explicit nil.
func (o *SharedDashboardUpdateRequest) SetShareListNil() {
o.ShareList.Set(nil)
}
// UnsetShareList ensures that no value is present for ShareList, not even an explicit nil.
func (o *SharedDashboardUpdateRequest) UnsetShareList() {
o.ShareList.Unset()
}
// GetShareType returns the ShareType field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *SharedDashboardUpdateRequest) GetShareType() DashboardShareType {
if o == nil || o.ShareType.Get() == nil {
var ret DashboardShareType
return ret
}
return *o.ShareType.Get()
}
// GetShareTypeOk returns a tuple with the ShareType field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned.
func (o *SharedDashboardUpdateRequest) GetShareTypeOk() (*DashboardShareType, bool) {
if o == nil {
return nil, false
}
return o.ShareType.Get(), o.ShareType.IsSet()
}
// HasShareType returns a boolean if a field has been set.
func (o *SharedDashboardUpdateRequest) HasShareType() bool {
return o != nil && o.ShareType.IsSet()
}
// SetShareType gets a reference to the given NullableDashboardShareType and assigns it to the ShareType field.
func (o *SharedDashboardUpdateRequest) SetShareType(v DashboardShareType) {
o.ShareType.Set(&v)
}
// SetShareTypeNil sets the value for ShareType to be an explicit nil.
func (o *SharedDashboardUpdateRequest) SetShareTypeNil() {
o.ShareType.Set(nil)
}
// UnsetShareType ensures that no value is present for ShareType, not even an explicit nil.
func (o *SharedDashboardUpdateRequest) UnsetShareType() {
o.ShareType.Unset()
}
// MarshalJSON serializes the struct using spec logic.
func (o SharedDashboardUpdateRequest) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
toSerialize["global_time"] = o.GlobalTime.Get()
if o.GlobalTimeSelectableEnabled.IsSet() {
toSerialize["global_time_selectable_enabled"] = o.GlobalTimeSelectableEnabled.Get()
}
if o.SelectableTemplateVars != nil {
toSerialize["selectable_template_vars"] = o.SelectableTemplateVars
}
if o.ShareList.IsSet() {
toSerialize["share_list"] = o.ShareList.Get()
}
if o.ShareType.IsSet() {
toSerialize["share_type"] = o.ShareType.Get()
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return datadog.Marshal(toSerialize)
}
// UnmarshalJSON deserializes the given payload.
func (o *SharedDashboardUpdateRequest) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
GlobalTime NullableSharedDashboardUpdateRequestGlobalTime `json:"global_time"`
GlobalTimeSelectableEnabled datadog.NullableBool `json:"global_time_selectable_enabled,omitempty"`
SelectableTemplateVars []SelectableTemplateVariableItems `json:"selectable_template_vars,omitempty"`
ShareList datadog.NullableList[string] `json:"share_list,omitempty"`
ShareType NullableDashboardShareType `json:"share_type,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
if !all.GlobalTime.IsSet() {
return fmt.Errorf("required field global_time missing")
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"global_time", "global_time_selectable_enabled", "selectable_template_vars", "share_list", "share_type"})
} else {
return err
}
hasInvalidField := false
o.GlobalTime = all.GlobalTime
o.GlobalTimeSelectableEnabled = all.GlobalTimeSelectableEnabled
o.SelectableTemplateVars = all.SelectableTemplateVars
o.ShareList = all.ShareList
if all.ShareType.Get() != nil && !all.ShareType.Get().IsValid() {
hasInvalidField = true
} else {
o.ShareType = all.ShareType
}
if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}
if hasInvalidField {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
return nil
}