forked from okta/okta-sdk-golang
/
model_list_applications_200_response_inner.go
430 lines (368 loc) · 15.8 KB
/
model_list_applications_200_response_inner.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
/*
Okta Admin Management
Allows customers to easily access the Okta Management APIs
Copyright 2018 - Present Okta, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
API version: 5.1.0
Contact: devex-public@okta.com
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package okta
import (
"encoding/json"
"fmt"
)
// model_oneof.mustache
// ListApplications200ResponseInner - struct for ListApplications200ResponseInner
type ListApplications200ResponseInner struct {
AutoLoginApplication *AutoLoginApplication
BasicAuthApplication *BasicAuthApplication
BookmarkApplication *BookmarkApplication
BrowserPluginApplication *BrowserPluginApplication
OpenIdConnectApplication *OpenIdConnectApplication
SamlApplication *SamlApplication
SecurePasswordStoreApplication *SecurePasswordStoreApplication
WsFederationApplication *WsFederationApplication
}
// AutoLoginApplicationAsListApplications200ResponseInner is a convenience function that returns AutoLoginApplication wrapped in ListApplications200ResponseInner
func AutoLoginApplicationAsListApplications200ResponseInner(v *AutoLoginApplication) ListApplications200ResponseInner {
return ListApplications200ResponseInner{
AutoLoginApplication: v,
}
}
// BasicAuthApplicationAsListApplications200ResponseInner is a convenience function that returns BasicAuthApplication wrapped in ListApplications200ResponseInner
func BasicAuthApplicationAsListApplications200ResponseInner(v *BasicAuthApplication) ListApplications200ResponseInner {
return ListApplications200ResponseInner{
BasicAuthApplication: v,
}
}
// BookmarkApplicationAsListApplications200ResponseInner is a convenience function that returns BookmarkApplication wrapped in ListApplications200ResponseInner
func BookmarkApplicationAsListApplications200ResponseInner(v *BookmarkApplication) ListApplications200ResponseInner {
return ListApplications200ResponseInner{
BookmarkApplication: v,
}
}
// BrowserPluginApplicationAsListApplications200ResponseInner is a convenience function that returns BrowserPluginApplication wrapped in ListApplications200ResponseInner
func BrowserPluginApplicationAsListApplications200ResponseInner(v *BrowserPluginApplication) ListApplications200ResponseInner {
return ListApplications200ResponseInner{
BrowserPluginApplication: v,
}
}
// OpenIdConnectApplicationAsListApplications200ResponseInner is a convenience function that returns OpenIdConnectApplication wrapped in ListApplications200ResponseInner
func OpenIdConnectApplicationAsListApplications200ResponseInner(v *OpenIdConnectApplication) ListApplications200ResponseInner {
return ListApplications200ResponseInner{
OpenIdConnectApplication: v,
}
}
// SamlApplicationAsListApplications200ResponseInner is a convenience function that returns SamlApplication wrapped in ListApplications200ResponseInner
func SamlApplicationAsListApplications200ResponseInner(v *SamlApplication) ListApplications200ResponseInner {
return ListApplications200ResponseInner{
SamlApplication: v,
}
}
// SecurePasswordStoreApplicationAsListApplications200ResponseInner is a convenience function that returns SecurePasswordStoreApplication wrapped in ListApplications200ResponseInner
func SecurePasswordStoreApplicationAsListApplications200ResponseInner(v *SecurePasswordStoreApplication) ListApplications200ResponseInner {
return ListApplications200ResponseInner{
SecurePasswordStoreApplication: v,
}
}
// WsFederationApplicationAsListApplications200ResponseInner is a convenience function that returns WsFederationApplication wrapped in ListApplications200ResponseInner
func WsFederationApplicationAsListApplications200ResponseInner(v *WsFederationApplication) ListApplications200ResponseInner {
return ListApplications200ResponseInner{
WsFederationApplication: v,
}
}
// Unmarshal JSON data into one of the pointers in the struct CUSTOM
func (dst *ListApplications200ResponseInner) UnmarshalJSON(data []byte) error {
var err error
// use discriminator value to speed up the lookup
var jsonDict map[string]interface{}
err = newStrictDecoder(data).Decode(&jsonDict)
if err != nil {
return fmt.Errorf("Failed to unmarshal JSON into map for the discriminator lookup.")
}
// check if the discriminator value is 'AUTO_LOGIN'
if jsonDict["signOnMode"] == "AUTO_LOGIN" {
// try to unmarshal JSON data into AutoLoginApplication
err = json.Unmarshal(data, &dst.AutoLoginApplication)
if err == nil {
return nil // data stored in dst.AutoLoginApplication, return on the first match
} else {
dst.AutoLoginApplication = nil
return fmt.Errorf("Failed to unmarshal ListApplications200ResponseInner as AutoLoginApplication: %s", err.Error())
}
}
// check if the discriminator value is 'AutoLoginApplication'
if jsonDict["signOnMode"] == "AutoLoginApplication" {
// try to unmarshal JSON data into AutoLoginApplication
err = json.Unmarshal(data, &dst.AutoLoginApplication)
if err == nil {
return nil // data stored in dst.AutoLoginApplication, return on the first match
} else {
dst.AutoLoginApplication = nil
return fmt.Errorf("Failed to unmarshal ListApplications200ResponseInner as AutoLoginApplication: %s", err.Error())
}
}
// check if the discriminator value is 'BASIC_AUTH'
if jsonDict["signOnMode"] == "BASIC_AUTH" {
// try to unmarshal JSON data into BasicAuthApplication
err = json.Unmarshal(data, &dst.BasicAuthApplication)
if err == nil {
return nil // data stored in dst.BasicAuthApplication, return on the first match
} else {
dst.BasicAuthApplication = nil
return fmt.Errorf("Failed to unmarshal ListApplications200ResponseInner as BasicAuthApplication: %s", err.Error())
}
}
// check if the discriminator value is 'BOOKMARK'
if jsonDict["signOnMode"] == "BOOKMARK" {
// try to unmarshal JSON data into BookmarkApplication
err = json.Unmarshal(data, &dst.BookmarkApplication)
if err == nil {
return nil // data stored in dst.BookmarkApplication, return on the first match
} else {
dst.BookmarkApplication = nil
return fmt.Errorf("Failed to unmarshal ListApplications200ResponseInner as BookmarkApplication: %s", err.Error())
}
}
// check if the discriminator value is 'BROWSER_PLUGIN'
if jsonDict["signOnMode"] == "BROWSER_PLUGIN" {
// try to unmarshal JSON data into BrowserPluginApplication
err = json.Unmarshal(data, &dst.BrowserPluginApplication)
if err == nil {
return nil // data stored in dst.BrowserPluginApplication, return on the first match
} else {
dst.BrowserPluginApplication = nil
return fmt.Errorf("Failed to unmarshal ListApplications200ResponseInner as BrowserPluginApplication: %s", err.Error())
}
}
// check if the discriminator value is 'BasicAuthApplication'
if jsonDict["signOnMode"] == "BasicAuthApplication" {
// try to unmarshal JSON data into BasicAuthApplication
err = json.Unmarshal(data, &dst.BasicAuthApplication)
if err == nil {
return nil // data stored in dst.BasicAuthApplication, return on the first match
} else {
dst.BasicAuthApplication = nil
return fmt.Errorf("Failed to unmarshal ListApplications200ResponseInner as BasicAuthApplication: %s", err.Error())
}
}
// check if the discriminator value is 'BookmarkApplication'
if jsonDict["signOnMode"] == "BookmarkApplication" {
// try to unmarshal JSON data into BookmarkApplication
err = json.Unmarshal(data, &dst.BookmarkApplication)
if err == nil {
return nil // data stored in dst.BookmarkApplication, return on the first match
} else {
dst.BookmarkApplication = nil
return fmt.Errorf("Failed to unmarshal ListApplications200ResponseInner as BookmarkApplication: %s", err.Error())
}
}
// check if the discriminator value is 'BrowserPluginApplication'
if jsonDict["signOnMode"] == "BrowserPluginApplication" {
// try to unmarshal JSON data into BrowserPluginApplication
err = json.Unmarshal(data, &dst.BrowserPluginApplication)
if err == nil {
return nil // data stored in dst.BrowserPluginApplication, return on the first match
} else {
dst.BrowserPluginApplication = nil
return fmt.Errorf("Failed to unmarshal ListApplications200ResponseInner as BrowserPluginApplication: %s", err.Error())
}
}
// check if the discriminator value is 'OPENID_CONNECT'
if jsonDict["signOnMode"] == "OPENID_CONNECT" {
// try to unmarshal JSON data into OpenIdConnectApplication
err = json.Unmarshal(data, &dst.OpenIdConnectApplication)
if err == nil {
return nil // data stored in dst.OpenIdConnectApplication, return on the first match
} else {
dst.OpenIdConnectApplication = nil
return fmt.Errorf("Failed to unmarshal ListApplications200ResponseInner as OpenIdConnectApplication: %s", err.Error())
}
}
// check if the discriminator value is 'OpenIdConnectApplication'
if jsonDict["signOnMode"] == "OpenIdConnectApplication" {
// try to unmarshal JSON data into OpenIdConnectApplication
err = json.Unmarshal(data, &dst.OpenIdConnectApplication)
if err == nil {
return nil // data stored in dst.OpenIdConnectApplication, return on the first match
} else {
dst.OpenIdConnectApplication = nil
return fmt.Errorf("Failed to unmarshal ListApplications200ResponseInner as OpenIdConnectApplication: %s", err.Error())
}
}
// check if the discriminator value is 'SAML_1_1'
if jsonDict["signOnMode"] == "SAML_1_1" {
// try to unmarshal JSON data into SamlApplication
err = json.Unmarshal(data, &dst.SamlApplication)
if err == nil {
return nil // data stored in dst.SamlApplication, return on the first match
} else {
dst.SamlApplication = nil
return fmt.Errorf("Failed to unmarshal ListApplications200ResponseInner as SamlApplication: %s", err.Error())
}
}
// check if the discriminator value is 'SAML_2_0'
if jsonDict["signOnMode"] == "SAML_2_0" {
// try to unmarshal JSON data into SamlApplication
err = json.Unmarshal(data, &dst.SamlApplication)
if err == nil {
return nil // data stored in dst.SamlApplication, return on the first match
} else {
dst.SamlApplication = nil
return fmt.Errorf("Failed to unmarshal ListApplications200ResponseInner as SamlApplication: %s", err.Error())
}
}
// check if the discriminator value is 'SECURE_PASSWORD_STORE'
if jsonDict["signOnMode"] == "SECURE_PASSWORD_STORE" {
// try to unmarshal JSON data into SecurePasswordStoreApplication
err = json.Unmarshal(data, &dst.SecurePasswordStoreApplication)
if err == nil {
return nil // data stored in dst.SecurePasswordStoreApplication, return on the first match
} else {
dst.SecurePasswordStoreApplication = nil
return fmt.Errorf("Failed to unmarshal ListApplications200ResponseInner as SecurePasswordStoreApplication: %s", err.Error())
}
}
// check if the discriminator value is 'SamlApplication'
if jsonDict["signOnMode"] == "SamlApplication" {
// try to unmarshal JSON data into SamlApplication
err = json.Unmarshal(data, &dst.SamlApplication)
if err == nil {
return nil // data stored in dst.SamlApplication, return on the first match
} else {
dst.SamlApplication = nil
return fmt.Errorf("Failed to unmarshal ListApplications200ResponseInner as SamlApplication: %s", err.Error())
}
}
// check if the discriminator value is 'SecurePasswordStoreApplication'
if jsonDict["signOnMode"] == "SecurePasswordStoreApplication" {
// try to unmarshal JSON data into SecurePasswordStoreApplication
err = json.Unmarshal(data, &dst.SecurePasswordStoreApplication)
if err == nil {
return nil // data stored in dst.SecurePasswordStoreApplication, return on the first match
} else {
dst.SecurePasswordStoreApplication = nil
return fmt.Errorf("Failed to unmarshal ListApplications200ResponseInner as SecurePasswordStoreApplication: %s", err.Error())
}
}
// check if the discriminator value is 'WS_FEDERATION'
if jsonDict["signOnMode"] == "WS_FEDERATION" {
// try to unmarshal JSON data into WsFederationApplication
err = json.Unmarshal(data, &dst.WsFederationApplication)
if err == nil {
return nil // data stored in dst.WsFederationApplication, return on the first match
} else {
dst.WsFederationApplication = nil
return fmt.Errorf("Failed to unmarshal ListApplications200ResponseInner as WsFederationApplication: %s", err.Error())
}
}
// check if the discriminator value is 'WsFederationApplication'
if jsonDict["signOnMode"] == "WsFederationApplication" {
// try to unmarshal JSON data into WsFederationApplication
err = json.Unmarshal(data, &dst.WsFederationApplication)
if err == nil {
return nil // data stored in dst.WsFederationApplication, return on the first match
} else {
dst.WsFederationApplication = nil
return fmt.Errorf("Failed to unmarshal ListApplications200ResponseInner as WsFederationApplication: %s", err.Error())
}
}
return nil
}
// Marshal data from the first non-nil pointers in the struct to JSON
func (src ListApplications200ResponseInner) MarshalJSON() ([]byte, error) {
if src.AutoLoginApplication != nil {
return json.Marshal(&src.AutoLoginApplication)
}
if src.BasicAuthApplication != nil {
return json.Marshal(&src.BasicAuthApplication)
}
if src.BookmarkApplication != nil {
return json.Marshal(&src.BookmarkApplication)
}
if src.BrowserPluginApplication != nil {
return json.Marshal(&src.BrowserPluginApplication)
}
if src.OpenIdConnectApplication != nil {
return json.Marshal(&src.OpenIdConnectApplication)
}
if src.SamlApplication != nil {
return json.Marshal(&src.SamlApplication)
}
if src.SecurePasswordStoreApplication != nil {
return json.Marshal(&src.SecurePasswordStoreApplication)
}
if src.WsFederationApplication != nil {
return json.Marshal(&src.WsFederationApplication)
}
return nil, nil // no data in oneOf schemas
}
// Get the actual instance
func (obj *ListApplications200ResponseInner) GetActualInstance() interface{} {
if obj == nil {
return nil
}
if obj.AutoLoginApplication != nil {
return obj.AutoLoginApplication
}
if obj.BasicAuthApplication != nil {
return obj.BasicAuthApplication
}
if obj.BookmarkApplication != nil {
return obj.BookmarkApplication
}
if obj.BrowserPluginApplication != nil {
return obj.BrowserPluginApplication
}
if obj.OpenIdConnectApplication != nil {
return obj.OpenIdConnectApplication
}
if obj.SamlApplication != nil {
return obj.SamlApplication
}
if obj.SecurePasswordStoreApplication != nil {
return obj.SecurePasswordStoreApplication
}
if obj.WsFederationApplication != nil {
return obj.WsFederationApplication
}
// all schemas are nil
return nil
}
type NullableListApplications200ResponseInner struct {
value *ListApplications200ResponseInner
isSet bool
}
func (v NullableListApplications200ResponseInner) Get() *ListApplications200ResponseInner {
return v.value
}
func (v *NullableListApplications200ResponseInner) Set(val *ListApplications200ResponseInner) {
v.value = val
v.isSet = true
}
func (v NullableListApplications200ResponseInner) IsSet() bool {
return v.isSet
}
func (v *NullableListApplications200ResponseInner) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableListApplications200ResponseInner(val *ListApplications200ResponseInner) *NullableListApplications200ResponseInner {
return &NullableListApplications200ResponseInner{value: val, isSet: true}
}
func (v NullableListApplications200ResponseInner) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableListApplications200ResponseInner) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}