Repository navigation
Expand file tree
/
Copy pathmodel_create_application_request.go
More file actions
210 lines (173 loc) · 5.82 KB
/
Copy pathmodel_create_application_request.go
File metadata and controls
210 lines (173 loc) · 5.82 KB
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
/*
Check Point - SASE Public API
The YAML for Check Points SASE Public API
API version: 3.0.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package perimeter81sdk
import (
"encoding/json"
"fmt"
)
// CreateApplicationRequest - struct for CreateApplicationRequest
type CreateApplicationRequest struct {
HttpCreateApplication *HttpCreateApplication
HttpsCreateApplication *HttpsCreateApplication
RdpCreateApplication *RdpCreateApplication
}
// HttpCreateApplicationAsCreateApplicationRequest is a convenience function that returns HttpCreateApplication wrapped in CreateApplicationRequest
func HttpCreateApplicationAsCreateApplicationRequest(v *HttpCreateApplication) CreateApplicationRequest {
return CreateApplicationRequest{
HttpCreateApplication: v,
}
}
// HttpsCreateApplicationAsCreateApplicationRequest is a convenience function that returns HttpsCreateApplication wrapped in CreateApplicationRequest
func HttpsCreateApplicationAsCreateApplicationRequest(v *HttpsCreateApplication) CreateApplicationRequest {
return CreateApplicationRequest{
HttpsCreateApplication: v,
}
}
// RdpCreateApplicationAsCreateApplicationRequest is a convenience function that returns RdpCreateApplication wrapped in CreateApplicationRequest
func RdpCreateApplicationAsCreateApplicationRequest(v *RdpCreateApplication) CreateApplicationRequest {
return CreateApplicationRequest{
RdpCreateApplication: v,
}
}
// Unmarshal JSON data into one of the pointers in the struct
func (dst *CreateApplicationRequest) UnmarshalJSON(data []byte) error {
var err error
match := 0
// try to unmarshal data into HttpCreateApplication
err = json.Unmarshal(data, &dst.HttpCreateApplication)
if err == nil {
jsonHttpCreateApplication, _ := json.Marshal(dst.HttpCreateApplication)
if string(jsonHttpCreateApplication) == "{}" { // empty struct
dst.HttpCreateApplication = nil
} else {
match++
}
} else {
dst.HttpCreateApplication = nil
}
// try to unmarshal data into HttpsCreateApplication
err = json.Unmarshal(data, &dst.HttpsCreateApplication)
if err == nil {
jsonHttpsCreateApplication, _ := json.Marshal(dst.HttpsCreateApplication)
if string(jsonHttpsCreateApplication) == "{}" { // empty struct
dst.HttpsCreateApplication = nil
} else {
match++
}
} else {
dst.HttpsCreateApplication = nil
}
// try to unmarshal data into RdpCreateApplication
err = json.Unmarshal(data, &dst.RdpCreateApplication)
if err == nil {
jsonRdpCreateApplication, _ := json.Marshal(dst.RdpCreateApplication)
if string(jsonRdpCreateApplication) == "{}" { // empty struct
dst.RdpCreateApplication = nil
} else {
match++
}
} else {
dst.RdpCreateApplication = nil
}
if match > 1 { // more than 1 match
// reset to nil
dst.HttpCreateApplication = nil
dst.HttpsCreateApplication = nil
dst.RdpCreateApplication = nil
return fmt.Errorf("data matches more than one schema in oneOf(CreateApplicationRequest)")
} else if match == 1 {
return nil // exactly one match
} else { // no match
if err != nil {
return fmt.Errorf("data failed to match schemas in oneOf(CreateApplicationRequest): %v", err)
} else {
return fmt.Errorf("data failed to match schemas in oneOf(CreateApplicationRequest)")
}
if err != nil {
return fmt.Errorf("data failed to match schemas in oneOf(CreateApplicationRequest): %v", err)
} else {
return fmt.Errorf("data failed to match schemas in oneOf(CreateApplicationRequest)")
}
if err != nil {
return fmt.Errorf("data failed to match schemas in oneOf(CreateApplicationRequest): %v", err)
} else {
return fmt.Errorf("data failed to match schemas in oneOf(CreateApplicationRequest)")
}
}
}
// Marshal data from the first non-nil pointers in the struct to JSON
func (src CreateApplicationRequest) MarshalJSON() ([]byte, error) {
if src.HttpCreateApplication != nil {
return json.Marshal(&src.HttpCreateApplication)
}
if src.HttpsCreateApplication != nil {
return json.Marshal(&src.HttpsCreateApplication)
}
if src.RdpCreateApplication != nil {
return json.Marshal(&src.RdpCreateApplication)
}
return nil, nil // no data in oneOf schemas
}
// Get the actual instance
func (obj *CreateApplicationRequest) GetActualInstance() (interface{}) {
if obj == nil {
return nil
}
if obj.HttpCreateApplication != nil {
return obj.HttpCreateApplication
}
if obj.HttpsCreateApplication != nil {
return obj.HttpsCreateApplication
}
if obj.RdpCreateApplication != nil {
return obj.RdpCreateApplication
}
// all schemas are nil
return nil
}
// Get the actual instance value
func (obj CreateApplicationRequest) GetActualInstanceValue() (interface{}) {
if obj.HttpCreateApplication != nil {
return *obj.HttpCreateApplication
}
if obj.HttpsCreateApplication != nil {
return *obj.HttpsCreateApplication
}
if obj.RdpCreateApplication != nil {
return *obj.RdpCreateApplication
}
// all schemas are nil
return nil
}
type NullableCreateApplicationRequest struct {
value *CreateApplicationRequest
isSet bool
}
func (v NullableCreateApplicationRequest) Get() *CreateApplicationRequest {
return v.value
}
func (v *NullableCreateApplicationRequest) Set(val *CreateApplicationRequest) {
v.value = val
v.isSet = true
}
func (v NullableCreateApplicationRequest) IsSet() bool {
return v.isSet
}
func (v *NullableCreateApplicationRequest) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCreateApplicationRequest(val *CreateApplicationRequest) *NullableCreateApplicationRequest {
return &NullableCreateApplicationRequest{value: val, isSet: true}
}
func (v NullableCreateApplicationRequest) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCreateApplicationRequest) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}