-
Notifications
You must be signed in to change notification settings - Fork 0
/
model_secret_meta_response_payload.go
179 lines (146 loc) · 5.42 KB
/
model_secret_meta_response_payload.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
/*
Chaos
Central Management API - publicly exposed set of APIs for managing deployments
API version: 1.0.0
Contact: support@qernal.com
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package openapi_chaos_client
import (
"encoding/json"
"fmt"
)
// SecretMetaResponsePayload - struct for SecretMetaResponsePayload
type SecretMetaResponsePayload struct {
SecretMetaResponseCertificatePayload *SecretMetaResponseCertificatePayload
SecretMetaResponseDek *SecretMetaResponseDek
SecretMetaResponseRegistryPayload *SecretMetaResponseRegistryPayload
}
// SecretMetaResponseCertificatePayloadAsSecretMetaResponsePayload is a convenience function that returns SecretMetaResponseCertificatePayload wrapped in SecretMetaResponsePayload
func SecretMetaResponseCertificatePayloadAsSecretMetaResponsePayload(v *SecretMetaResponseCertificatePayload) SecretMetaResponsePayload {
return SecretMetaResponsePayload{
SecretMetaResponseCertificatePayload: v,
}
}
// SecretMetaResponseDekAsSecretMetaResponsePayload is a convenience function that returns SecretMetaResponseDek wrapped in SecretMetaResponsePayload
func SecretMetaResponseDekAsSecretMetaResponsePayload(v *SecretMetaResponseDek) SecretMetaResponsePayload {
return SecretMetaResponsePayload{
SecretMetaResponseDek: v,
}
}
// SecretMetaResponseRegistryPayloadAsSecretMetaResponsePayload is a convenience function that returns SecretMetaResponseRegistryPayload wrapped in SecretMetaResponsePayload
func SecretMetaResponseRegistryPayloadAsSecretMetaResponsePayload(v *SecretMetaResponseRegistryPayload) SecretMetaResponsePayload {
return SecretMetaResponsePayload{
SecretMetaResponseRegistryPayload: v,
}
}
// Unmarshal JSON data into one of the pointers in the struct
func (dst *SecretMetaResponsePayload) UnmarshalJSON(data []byte) error {
var err error
match := 0
// try to unmarshal data into SecretMetaResponseCertificatePayload
err = newStrictDecoder(data).Decode(&dst.SecretMetaResponseCertificatePayload)
if err == nil {
jsonSecretMetaResponseCertificatePayload, _ := json.Marshal(dst.SecretMetaResponseCertificatePayload)
if string(jsonSecretMetaResponseCertificatePayload) == "{}" { // empty struct
dst.SecretMetaResponseCertificatePayload = nil
} else {
match++
}
} else {
dst.SecretMetaResponseCertificatePayload = nil
}
// try to unmarshal data into SecretMetaResponseDek
err = newStrictDecoder(data).Decode(&dst.SecretMetaResponseDek)
if err == nil {
jsonSecretMetaResponseDek, _ := json.Marshal(dst.SecretMetaResponseDek)
if string(jsonSecretMetaResponseDek) == "{}" { // empty struct
dst.SecretMetaResponseDek = nil
} else {
match++
}
} else {
dst.SecretMetaResponseDek = nil
}
// try to unmarshal data into SecretMetaResponseRegistryPayload
err = newStrictDecoder(data).Decode(&dst.SecretMetaResponseRegistryPayload)
if err == nil {
jsonSecretMetaResponseRegistryPayload, _ := json.Marshal(dst.SecretMetaResponseRegistryPayload)
if string(jsonSecretMetaResponseRegistryPayload) == "{}" { // empty struct
dst.SecretMetaResponseRegistryPayload = nil
} else {
match++
}
} else {
dst.SecretMetaResponseRegistryPayload = nil
}
if match > 1 { // more than 1 match
// reset to nil
dst.SecretMetaResponseCertificatePayload = nil
dst.SecretMetaResponseDek = nil
dst.SecretMetaResponseRegistryPayload = nil
return fmt.Errorf("data matches more than one schema in oneOf(SecretMetaResponsePayload)")
} else if match == 1 {
return nil // exactly one match
} else { // no match
return fmt.Errorf("data failed to match schemas in oneOf(SecretMetaResponsePayload)")
}
}
// Marshal data from the first non-nil pointers in the struct to JSON
func (src SecretMetaResponsePayload) MarshalJSON() ([]byte, error) {
if src.SecretMetaResponseCertificatePayload != nil {
return json.Marshal(&src.SecretMetaResponseCertificatePayload)
}
if src.SecretMetaResponseDek != nil {
return json.Marshal(&src.SecretMetaResponseDek)
}
if src.SecretMetaResponseRegistryPayload != nil {
return json.Marshal(&src.SecretMetaResponseRegistryPayload)
}
return nil, nil // no data in oneOf schemas
}
// Get the actual instance
func (obj *SecretMetaResponsePayload) GetActualInstance() (interface{}) {
if obj == nil {
return nil
}
if obj.SecretMetaResponseCertificatePayload != nil {
return obj.SecretMetaResponseCertificatePayload
}
if obj.SecretMetaResponseDek != nil {
return obj.SecretMetaResponseDek
}
if obj.SecretMetaResponseRegistryPayload != nil {
return obj.SecretMetaResponseRegistryPayload
}
// all schemas are nil
return nil
}
type NullableSecretMetaResponsePayload struct {
value *SecretMetaResponsePayload
isSet bool
}
func (v NullableSecretMetaResponsePayload) Get() *SecretMetaResponsePayload {
return v.value
}
func (v *NullableSecretMetaResponsePayload) Set(val *SecretMetaResponsePayload) {
v.value = val
v.isSet = true
}
func (v NullableSecretMetaResponsePayload) IsSet() bool {
return v.isSet
}
func (v *NullableSecretMetaResponsePayload) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableSecretMetaResponsePayload(val *SecretMetaResponsePayload) *NullableSecretMetaResponsePayload {
return &NullableSecretMetaResponsePayload{value: val, isSet: true}
}
func (v NullableSecretMetaResponsePayload) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableSecretMetaResponsePayload) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}