-
Notifications
You must be signed in to change notification settings - Fork 0
/
model_create_filter_400_response.go
179 lines (146 loc) · 5.15 KB
/
model_create_filter_400_response.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
/*
Ambar OpenAPI Specification
Details about communicating with Ambar.cloud public endpoints. Supported HTTP rest endpoints and their request and response details.
API version: 2024-06-11
Contact: contact@ambar.cloud
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package Ambar
import (
"encoding/json"
"fmt"
)
// CreateFilter400Response - struct for CreateFilter400Response
type CreateFilter400Response struct {
InvalidFilterException *InvalidFilterException
InvalidParameterException *InvalidParameterException
ResourceInvalidStateException *ResourceInvalidStateException
}
// InvalidFilterExceptionAsCreateFilter400Response is a convenience function that returns InvalidFilterException wrapped in CreateFilter400Response
func InvalidFilterExceptionAsCreateFilter400Response(v *InvalidFilterException) CreateFilter400Response {
return CreateFilter400Response{
InvalidFilterException: v,
}
}
// InvalidParameterExceptionAsCreateFilter400Response is a convenience function that returns InvalidParameterException wrapped in CreateFilter400Response
func InvalidParameterExceptionAsCreateFilter400Response(v *InvalidParameterException) CreateFilter400Response {
return CreateFilter400Response{
InvalidParameterException: v,
}
}
// ResourceInvalidStateExceptionAsCreateFilter400Response is a convenience function that returns ResourceInvalidStateException wrapped in CreateFilter400Response
func ResourceInvalidStateExceptionAsCreateFilter400Response(v *ResourceInvalidStateException) CreateFilter400Response {
return CreateFilter400Response{
ResourceInvalidStateException: v,
}
}
// Unmarshal JSON data into one of the pointers in the struct
func (dst *CreateFilter400Response) UnmarshalJSON(data []byte) error {
var err error
match := 0
// try to unmarshal data into InvalidFilterException
err = newStrictDecoder(data).Decode(&dst.InvalidFilterException)
if err == nil {
jsonInvalidFilterException, _ := json.Marshal(dst.InvalidFilterException)
if string(jsonInvalidFilterException) == "{}" { // empty struct
dst.InvalidFilterException = nil
} else {
match++
}
} else {
dst.InvalidFilterException = nil
}
// try to unmarshal data into InvalidParameterException
err = newStrictDecoder(data).Decode(&dst.InvalidParameterException)
if err == nil {
jsonInvalidParameterException, _ := json.Marshal(dst.InvalidParameterException)
if string(jsonInvalidParameterException) == "{}" { // empty struct
dst.InvalidParameterException = nil
} else {
match++
}
} else {
dst.InvalidParameterException = nil
}
// try to unmarshal data into ResourceInvalidStateException
err = newStrictDecoder(data).Decode(&dst.ResourceInvalidStateException)
if err == nil {
jsonResourceInvalidStateException, _ := json.Marshal(dst.ResourceInvalidStateException)
if string(jsonResourceInvalidStateException) == "{}" { // empty struct
dst.ResourceInvalidStateException = nil
} else {
match++
}
} else {
dst.ResourceInvalidStateException = nil
}
if match > 1 { // more than 1 match
// reset to nil
dst.InvalidFilterException = nil
dst.InvalidParameterException = nil
dst.ResourceInvalidStateException = nil
return fmt.Errorf("data matches more than one schema in oneOf(CreateFilter400Response)")
} else if match == 1 {
return nil // exactly one match
} else { // no match
return fmt.Errorf("data failed to match schemas in oneOf(CreateFilter400Response)")
}
}
// Marshal data from the first non-nil pointers in the struct to JSON
func (src CreateFilter400Response) MarshalJSON() ([]byte, error) {
if src.InvalidFilterException != nil {
return json.Marshal(&src.InvalidFilterException)
}
if src.InvalidParameterException != nil {
return json.Marshal(&src.InvalidParameterException)
}
if src.ResourceInvalidStateException != nil {
return json.Marshal(&src.ResourceInvalidStateException)
}
return nil, nil // no data in oneOf schemas
}
// Get the actual instance
func (obj *CreateFilter400Response) GetActualInstance() (interface{}) {
if obj == nil {
return nil
}
if obj.InvalidFilterException != nil {
return obj.InvalidFilterException
}
if obj.InvalidParameterException != nil {
return obj.InvalidParameterException
}
if obj.ResourceInvalidStateException != nil {
return obj.ResourceInvalidStateException
}
// all schemas are nil
return nil
}
type NullableCreateFilter400Response struct {
value *CreateFilter400Response
isSet bool
}
func (v NullableCreateFilter400Response) Get() *CreateFilter400Response {
return v.value
}
func (v *NullableCreateFilter400Response) Set(val *CreateFilter400Response) {
v.value = val
v.isSet = true
}
func (v NullableCreateFilter400Response) IsSet() bool {
return v.isSet
}
func (v *NullableCreateFilter400Response) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCreateFilter400Response(val *CreateFilter400Response) *NullableCreateFilter400Response {
return &NullableCreateFilter400Response{value: val, isSet: true}
}
func (v NullableCreateFilter400Response) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCreateFilter400Response) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}