-
Notifications
You must be signed in to change notification settings - Fork 52
/
model_organization_settings.go
451 lines (397 loc) · 18.1 KB
/
model_organization_settings.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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
// 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"
)
// OrganizationSettings A JSON array of settings.
type OrganizationSettings struct {
// Whether or not the organization users can share widgets outside of Datadog.
PrivateWidgetShare *bool `json:"private_widget_share,omitempty"`
// Set the boolean property enabled to enable or disable single sign on with SAML.
// See the SAML documentation for more information about all SAML settings.
Saml *OrganizationSettingsSaml `json:"saml,omitempty"`
// The access role of the user. Options are **st** (standard user), **adm** (admin user), or **ro** (read-only user).
SamlAutocreateAccessRole NullableAccessRole `json:"saml_autocreate_access_role,omitempty"`
// Has two properties, `enabled` (boolean) and `domains`, which is a list of domains without the @ symbol.
SamlAutocreateUsersDomains *OrganizationSettingsSamlAutocreateUsersDomains `json:"saml_autocreate_users_domains,omitempty"`
// Whether or not SAML can be enabled for this organization.
SamlCanBeEnabled *bool `json:"saml_can_be_enabled,omitempty"`
// Identity provider endpoint for SAML authentication.
SamlIdpEndpoint *string `json:"saml_idp_endpoint,omitempty"`
// Has one property enabled (boolean).
SamlIdpInitiatedLogin *OrganizationSettingsSamlIdpInitiatedLogin `json:"saml_idp_initiated_login,omitempty"`
// Whether or not a SAML identity provider metadata file was provided to the Datadog organization.
SamlIdpMetadataUploaded *bool `json:"saml_idp_metadata_uploaded,omitempty"`
// URL for SAML logging.
SamlLoginUrl *string `json:"saml_login_url,omitempty"`
// Has one property enabled (boolean).
SamlStrictMode *OrganizationSettingsSamlStrictMode `json:"saml_strict_mode,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{}
}
// NewOrganizationSettings instantiates a new OrganizationSettings 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 NewOrganizationSettings() *OrganizationSettings {
this := OrganizationSettings{}
return &this
}
// NewOrganizationSettingsWithDefaults instantiates a new OrganizationSettings 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 NewOrganizationSettingsWithDefaults() *OrganizationSettings {
this := OrganizationSettings{}
return &this
}
// GetPrivateWidgetShare returns the PrivateWidgetShare field value if set, zero value otherwise.
func (o *OrganizationSettings) GetPrivateWidgetShare() bool {
if o == nil || o.PrivateWidgetShare == nil {
var ret bool
return ret
}
return *o.PrivateWidgetShare
}
// GetPrivateWidgetShareOk returns a tuple with the PrivateWidgetShare field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *OrganizationSettings) GetPrivateWidgetShareOk() (*bool, bool) {
if o == nil || o.PrivateWidgetShare == nil {
return nil, false
}
return o.PrivateWidgetShare, true
}
// HasPrivateWidgetShare returns a boolean if a field has been set.
func (o *OrganizationSettings) HasPrivateWidgetShare() bool {
return o != nil && o.PrivateWidgetShare != nil
}
// SetPrivateWidgetShare gets a reference to the given bool and assigns it to the PrivateWidgetShare field.
func (o *OrganizationSettings) SetPrivateWidgetShare(v bool) {
o.PrivateWidgetShare = &v
}
// GetSaml returns the Saml field value if set, zero value otherwise.
func (o *OrganizationSettings) GetSaml() OrganizationSettingsSaml {
if o == nil || o.Saml == nil {
var ret OrganizationSettingsSaml
return ret
}
return *o.Saml
}
// GetSamlOk returns a tuple with the Saml field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *OrganizationSettings) GetSamlOk() (*OrganizationSettingsSaml, bool) {
if o == nil || o.Saml == nil {
return nil, false
}
return o.Saml, true
}
// HasSaml returns a boolean if a field has been set.
func (o *OrganizationSettings) HasSaml() bool {
return o != nil && o.Saml != nil
}
// SetSaml gets a reference to the given OrganizationSettingsSaml and assigns it to the Saml field.
func (o *OrganizationSettings) SetSaml(v OrganizationSettingsSaml) {
o.Saml = &v
}
// GetSamlAutocreateAccessRole returns the SamlAutocreateAccessRole field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *OrganizationSettings) GetSamlAutocreateAccessRole() AccessRole {
if o == nil || o.SamlAutocreateAccessRole.Get() == nil {
var ret AccessRole
return ret
}
return *o.SamlAutocreateAccessRole.Get()
}
// GetSamlAutocreateAccessRoleOk returns a tuple with the SamlAutocreateAccessRole 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 *OrganizationSettings) GetSamlAutocreateAccessRoleOk() (*AccessRole, bool) {
if o == nil {
return nil, false
}
return o.SamlAutocreateAccessRole.Get(), o.SamlAutocreateAccessRole.IsSet()
}
// HasSamlAutocreateAccessRole returns a boolean if a field has been set.
func (o *OrganizationSettings) HasSamlAutocreateAccessRole() bool {
return o != nil && o.SamlAutocreateAccessRole.IsSet()
}
// SetSamlAutocreateAccessRole gets a reference to the given NullableAccessRole and assigns it to the SamlAutocreateAccessRole field.
func (o *OrganizationSettings) SetSamlAutocreateAccessRole(v AccessRole) {
o.SamlAutocreateAccessRole.Set(&v)
}
// SetSamlAutocreateAccessRoleNil sets the value for SamlAutocreateAccessRole to be an explicit nil.
func (o *OrganizationSettings) SetSamlAutocreateAccessRoleNil() {
o.SamlAutocreateAccessRole.Set(nil)
}
// UnsetSamlAutocreateAccessRole ensures that no value is present for SamlAutocreateAccessRole, not even an explicit nil.
func (o *OrganizationSettings) UnsetSamlAutocreateAccessRole() {
o.SamlAutocreateAccessRole.Unset()
}
// GetSamlAutocreateUsersDomains returns the SamlAutocreateUsersDomains field value if set, zero value otherwise.
func (o *OrganizationSettings) GetSamlAutocreateUsersDomains() OrganizationSettingsSamlAutocreateUsersDomains {
if o == nil || o.SamlAutocreateUsersDomains == nil {
var ret OrganizationSettingsSamlAutocreateUsersDomains
return ret
}
return *o.SamlAutocreateUsersDomains
}
// GetSamlAutocreateUsersDomainsOk returns a tuple with the SamlAutocreateUsersDomains field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *OrganizationSettings) GetSamlAutocreateUsersDomainsOk() (*OrganizationSettingsSamlAutocreateUsersDomains, bool) {
if o == nil || o.SamlAutocreateUsersDomains == nil {
return nil, false
}
return o.SamlAutocreateUsersDomains, true
}
// HasSamlAutocreateUsersDomains returns a boolean if a field has been set.
func (o *OrganizationSettings) HasSamlAutocreateUsersDomains() bool {
return o != nil && o.SamlAutocreateUsersDomains != nil
}
// SetSamlAutocreateUsersDomains gets a reference to the given OrganizationSettingsSamlAutocreateUsersDomains and assigns it to the SamlAutocreateUsersDomains field.
func (o *OrganizationSettings) SetSamlAutocreateUsersDomains(v OrganizationSettingsSamlAutocreateUsersDomains) {
o.SamlAutocreateUsersDomains = &v
}
// GetSamlCanBeEnabled returns the SamlCanBeEnabled field value if set, zero value otherwise.
func (o *OrganizationSettings) GetSamlCanBeEnabled() bool {
if o == nil || o.SamlCanBeEnabled == nil {
var ret bool
return ret
}
return *o.SamlCanBeEnabled
}
// GetSamlCanBeEnabledOk returns a tuple with the SamlCanBeEnabled field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *OrganizationSettings) GetSamlCanBeEnabledOk() (*bool, bool) {
if o == nil || o.SamlCanBeEnabled == nil {
return nil, false
}
return o.SamlCanBeEnabled, true
}
// HasSamlCanBeEnabled returns a boolean if a field has been set.
func (o *OrganizationSettings) HasSamlCanBeEnabled() bool {
return o != nil && o.SamlCanBeEnabled != nil
}
// SetSamlCanBeEnabled gets a reference to the given bool and assigns it to the SamlCanBeEnabled field.
func (o *OrganizationSettings) SetSamlCanBeEnabled(v bool) {
o.SamlCanBeEnabled = &v
}
// GetSamlIdpEndpoint returns the SamlIdpEndpoint field value if set, zero value otherwise.
func (o *OrganizationSettings) GetSamlIdpEndpoint() string {
if o == nil || o.SamlIdpEndpoint == nil {
var ret string
return ret
}
return *o.SamlIdpEndpoint
}
// GetSamlIdpEndpointOk returns a tuple with the SamlIdpEndpoint field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *OrganizationSettings) GetSamlIdpEndpointOk() (*string, bool) {
if o == nil || o.SamlIdpEndpoint == nil {
return nil, false
}
return o.SamlIdpEndpoint, true
}
// HasSamlIdpEndpoint returns a boolean if a field has been set.
func (o *OrganizationSettings) HasSamlIdpEndpoint() bool {
return o != nil && o.SamlIdpEndpoint != nil
}
// SetSamlIdpEndpoint gets a reference to the given string and assigns it to the SamlIdpEndpoint field.
func (o *OrganizationSettings) SetSamlIdpEndpoint(v string) {
o.SamlIdpEndpoint = &v
}
// GetSamlIdpInitiatedLogin returns the SamlIdpInitiatedLogin field value if set, zero value otherwise.
func (o *OrganizationSettings) GetSamlIdpInitiatedLogin() OrganizationSettingsSamlIdpInitiatedLogin {
if o == nil || o.SamlIdpInitiatedLogin == nil {
var ret OrganizationSettingsSamlIdpInitiatedLogin
return ret
}
return *o.SamlIdpInitiatedLogin
}
// GetSamlIdpInitiatedLoginOk returns a tuple with the SamlIdpInitiatedLogin field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *OrganizationSettings) GetSamlIdpInitiatedLoginOk() (*OrganizationSettingsSamlIdpInitiatedLogin, bool) {
if o == nil || o.SamlIdpInitiatedLogin == nil {
return nil, false
}
return o.SamlIdpInitiatedLogin, true
}
// HasSamlIdpInitiatedLogin returns a boolean if a field has been set.
func (o *OrganizationSettings) HasSamlIdpInitiatedLogin() bool {
return o != nil && o.SamlIdpInitiatedLogin != nil
}
// SetSamlIdpInitiatedLogin gets a reference to the given OrganizationSettingsSamlIdpInitiatedLogin and assigns it to the SamlIdpInitiatedLogin field.
func (o *OrganizationSettings) SetSamlIdpInitiatedLogin(v OrganizationSettingsSamlIdpInitiatedLogin) {
o.SamlIdpInitiatedLogin = &v
}
// GetSamlIdpMetadataUploaded returns the SamlIdpMetadataUploaded field value if set, zero value otherwise.
func (o *OrganizationSettings) GetSamlIdpMetadataUploaded() bool {
if o == nil || o.SamlIdpMetadataUploaded == nil {
var ret bool
return ret
}
return *o.SamlIdpMetadataUploaded
}
// GetSamlIdpMetadataUploadedOk returns a tuple with the SamlIdpMetadataUploaded field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *OrganizationSettings) GetSamlIdpMetadataUploadedOk() (*bool, bool) {
if o == nil || o.SamlIdpMetadataUploaded == nil {
return nil, false
}
return o.SamlIdpMetadataUploaded, true
}
// HasSamlIdpMetadataUploaded returns a boolean if a field has been set.
func (o *OrganizationSettings) HasSamlIdpMetadataUploaded() bool {
return o != nil && o.SamlIdpMetadataUploaded != nil
}
// SetSamlIdpMetadataUploaded gets a reference to the given bool and assigns it to the SamlIdpMetadataUploaded field.
func (o *OrganizationSettings) SetSamlIdpMetadataUploaded(v bool) {
o.SamlIdpMetadataUploaded = &v
}
// GetSamlLoginUrl returns the SamlLoginUrl field value if set, zero value otherwise.
func (o *OrganizationSettings) GetSamlLoginUrl() string {
if o == nil || o.SamlLoginUrl == nil {
var ret string
return ret
}
return *o.SamlLoginUrl
}
// GetSamlLoginUrlOk returns a tuple with the SamlLoginUrl field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *OrganizationSettings) GetSamlLoginUrlOk() (*string, bool) {
if o == nil || o.SamlLoginUrl == nil {
return nil, false
}
return o.SamlLoginUrl, true
}
// HasSamlLoginUrl returns a boolean if a field has been set.
func (o *OrganizationSettings) HasSamlLoginUrl() bool {
return o != nil && o.SamlLoginUrl != nil
}
// SetSamlLoginUrl gets a reference to the given string and assigns it to the SamlLoginUrl field.
func (o *OrganizationSettings) SetSamlLoginUrl(v string) {
o.SamlLoginUrl = &v
}
// GetSamlStrictMode returns the SamlStrictMode field value if set, zero value otherwise.
func (o *OrganizationSettings) GetSamlStrictMode() OrganizationSettingsSamlStrictMode {
if o == nil || o.SamlStrictMode == nil {
var ret OrganizationSettingsSamlStrictMode
return ret
}
return *o.SamlStrictMode
}
// GetSamlStrictModeOk returns a tuple with the SamlStrictMode field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *OrganizationSettings) GetSamlStrictModeOk() (*OrganizationSettingsSamlStrictMode, bool) {
if o == nil || o.SamlStrictMode == nil {
return nil, false
}
return o.SamlStrictMode, true
}
// HasSamlStrictMode returns a boolean if a field has been set.
func (o *OrganizationSettings) HasSamlStrictMode() bool {
return o != nil && o.SamlStrictMode != nil
}
// SetSamlStrictMode gets a reference to the given OrganizationSettingsSamlStrictMode and assigns it to the SamlStrictMode field.
func (o *OrganizationSettings) SetSamlStrictMode(v OrganizationSettingsSamlStrictMode) {
o.SamlStrictMode = &v
}
// MarshalJSON serializes the struct using spec logic.
func (o OrganizationSettings) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
if o.PrivateWidgetShare != nil {
toSerialize["private_widget_share"] = o.PrivateWidgetShare
}
if o.Saml != nil {
toSerialize["saml"] = o.Saml
}
if o.SamlAutocreateAccessRole.IsSet() {
toSerialize["saml_autocreate_access_role"] = o.SamlAutocreateAccessRole.Get()
}
if o.SamlAutocreateUsersDomains != nil {
toSerialize["saml_autocreate_users_domains"] = o.SamlAutocreateUsersDomains
}
if o.SamlCanBeEnabled != nil {
toSerialize["saml_can_be_enabled"] = o.SamlCanBeEnabled
}
if o.SamlIdpEndpoint != nil {
toSerialize["saml_idp_endpoint"] = o.SamlIdpEndpoint
}
if o.SamlIdpInitiatedLogin != nil {
toSerialize["saml_idp_initiated_login"] = o.SamlIdpInitiatedLogin
}
if o.SamlIdpMetadataUploaded != nil {
toSerialize["saml_idp_metadata_uploaded"] = o.SamlIdpMetadataUploaded
}
if o.SamlLoginUrl != nil {
toSerialize["saml_login_url"] = o.SamlLoginUrl
}
if o.SamlStrictMode != nil {
toSerialize["saml_strict_mode"] = o.SamlStrictMode
}
for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return datadog.Marshal(toSerialize)
}
// UnmarshalJSON deserializes the given payload.
func (o *OrganizationSettings) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
PrivateWidgetShare *bool `json:"private_widget_share,omitempty"`
Saml *OrganizationSettingsSaml `json:"saml,omitempty"`
SamlAutocreateAccessRole NullableAccessRole `json:"saml_autocreate_access_role,omitempty"`
SamlAutocreateUsersDomains *OrganizationSettingsSamlAutocreateUsersDomains `json:"saml_autocreate_users_domains,omitempty"`
SamlCanBeEnabled *bool `json:"saml_can_be_enabled,omitempty"`
SamlIdpEndpoint *string `json:"saml_idp_endpoint,omitempty"`
SamlIdpInitiatedLogin *OrganizationSettingsSamlIdpInitiatedLogin `json:"saml_idp_initiated_login,omitempty"`
SamlIdpMetadataUploaded *bool `json:"saml_idp_metadata_uploaded,omitempty"`
SamlLoginUrl *string `json:"saml_login_url,omitempty"`
SamlStrictMode *OrganizationSettingsSamlStrictMode `json:"saml_strict_mode,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{"private_widget_share", "saml", "saml_autocreate_access_role", "saml_autocreate_users_domains", "saml_can_be_enabled", "saml_idp_endpoint", "saml_idp_initiated_login", "saml_idp_metadata_uploaded", "saml_login_url", "saml_strict_mode"})
} else {
return err
}
hasInvalidField := false
o.PrivateWidgetShare = all.PrivateWidgetShare
if all.Saml != nil && all.Saml.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.Saml = all.Saml
if all.SamlAutocreateAccessRole.Get() != nil && !all.SamlAutocreateAccessRole.Get().IsValid() {
hasInvalidField = true
} else {
o.SamlAutocreateAccessRole = all.SamlAutocreateAccessRole
}
if all.SamlAutocreateUsersDomains != nil && all.SamlAutocreateUsersDomains.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.SamlAutocreateUsersDomains = all.SamlAutocreateUsersDomains
o.SamlCanBeEnabled = all.SamlCanBeEnabled
o.SamlIdpEndpoint = all.SamlIdpEndpoint
if all.SamlIdpInitiatedLogin != nil && all.SamlIdpInitiatedLogin.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.SamlIdpInitiatedLogin = all.SamlIdpInitiatedLogin
o.SamlIdpMetadataUploaded = all.SamlIdpMetadataUploaded
o.SamlLoginUrl = all.SamlLoginUrl
if all.SamlStrictMode != nil && all.SamlStrictMode.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
o.SamlStrictMode = all.SamlStrictMode
if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}
if hasInvalidField {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
return nil
}