1
2
3 package schema
4
5 import "fmt"
6 import "encoding/json"
7 import "reflect"
8
9 type LogListSchemaJson struct {
10
11 LogListTimestamp *string `json:"log_list_timestamp,omitempty"`
12
13
14 Operators []LogListSchemaJsonOperatorsElem `json:"operators"`
15
16
17 Version *string `json:"version,omitempty"`
18 }
19
20 type LogListSchemaJsonOperatorsElem struct {
21
22 Email []string `json:"email"`
23
24
25 Logs []LogListSchemaJsonOperatorsElemLogsElem `json:"logs"`
26
27
28 Name string `json:"name"`
29 }
30
31 type LogListSchemaJsonOperatorsElemLogsElem struct {
32
33 Description *string `json:"description,omitempty"`
34
35
36
37 Dns *string `json:"dns,omitempty"`
38
39
40
41 Key string `json:"key"`
42
43
44
45 LogId string `json:"log_id"`
46
47
48 LogType *LogListSchemaJsonOperatorsElemLogsElemLogType `json:"log_type,omitempty"`
49
50
51
52 Mmd float64 `json:"mmd"`
53
54
55
56 PreviousOperators []LogListSchemaJsonOperatorsElemLogsElemPreviousOperatorsElem `json:"previous_operators,omitempty"`
57
58
59 State *LogListSchemaJsonOperatorsElemLogsElemState `json:"state,omitempty"`
60
61
62
63 TemporalInterval *LogListSchemaJsonOperatorsElemLogsElemTemporalInterval `json:"temporal_interval,omitempty"`
64
65
66 Url string `json:"url"`
67 }
68
69 type LogListSchemaJsonOperatorsElemLogsElemLogType string
70
71 const LogListSchemaJsonOperatorsElemLogsElemLogTypeProd LogListSchemaJsonOperatorsElemLogsElemLogType = "prod"
72 const LogListSchemaJsonOperatorsElemLogsElemLogTypeTest LogListSchemaJsonOperatorsElemLogsElemLogType = "test"
73
74 type LogListSchemaJsonOperatorsElemLogsElemPreviousOperatorsElem struct {
75
76 EndTime string `json:"end_time"`
77
78
79 Name string `json:"name"`
80 }
81
82 type LogListSchemaJsonOperatorsElemLogsElemState struct {
83
84 Pending *State `json:"pending,omitempty"`
85
86
87 Qualified *State `json:"qualified,omitempty"`
88
89
90 Readonly interface{} `json:"readonly,omitempty"`
91
92
93 Rejected *State `json:"rejected,omitempty"`
94
95
96 Retired *State `json:"retired,omitempty"`
97
98
99 Usable *State `json:"usable,omitempty"`
100 }
101
102
103
104 type LogListSchemaJsonOperatorsElemLogsElemTemporalInterval struct {
105
106 EndExclusive string `json:"end_exclusive"`
107
108
109 StartInclusive string `json:"start_inclusive"`
110 }
111
112 type State struct {
113
114 Timestamp string `json:"timestamp"`
115 }
116
117
118 func (j *LogListSchemaJsonOperatorsElemLogsElemPreviousOperatorsElem) UnmarshalJSON(b []byte) error {
119 var raw map[string]interface{}
120 if err := json.Unmarshal(b, &raw); err != nil {
121 return err
122 }
123 if v, ok := raw["end_time"]; !ok || v == nil {
124 return fmt.Errorf("field end_time: required")
125 }
126 if v, ok := raw["name"]; !ok || v == nil {
127 return fmt.Errorf("field name: required")
128 }
129 type Plain LogListSchemaJsonOperatorsElemLogsElemPreviousOperatorsElem
130 var plain Plain
131 if err := json.Unmarshal(b, &plain); err != nil {
132 return err
133 }
134 *j = LogListSchemaJsonOperatorsElemLogsElemPreviousOperatorsElem(plain)
135 return nil
136 }
137
138
139 func (j *LogListSchemaJsonOperatorsElemLogsElemTemporalInterval) UnmarshalJSON(b []byte) error {
140 var raw map[string]interface{}
141 if err := json.Unmarshal(b, &raw); err != nil {
142 return err
143 }
144 if v, ok := raw["end_exclusive"]; !ok || v == nil {
145 return fmt.Errorf("field end_exclusive: required")
146 }
147 if v, ok := raw["start_inclusive"]; !ok || v == nil {
148 return fmt.Errorf("field start_inclusive: required")
149 }
150 type Plain LogListSchemaJsonOperatorsElemLogsElemTemporalInterval
151 var plain Plain
152 if err := json.Unmarshal(b, &plain); err != nil {
153 return err
154 }
155 *j = LogListSchemaJsonOperatorsElemLogsElemTemporalInterval(plain)
156 return nil
157 }
158
159
160 func (j *LogListSchemaJsonOperatorsElemLogsElemLogType) UnmarshalJSON(b []byte) error {
161 var v string
162 if err := json.Unmarshal(b, &v); err != nil {
163 return err
164 }
165 var ok bool
166 for _, expected := range enumValues_LogListSchemaJsonOperatorsElemLogsElemLogType {
167 if reflect.DeepEqual(v, expected) {
168 ok = true
169 break
170 }
171 }
172 if !ok {
173 return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LogListSchemaJsonOperatorsElemLogsElemLogType, v)
174 }
175 *j = LogListSchemaJsonOperatorsElemLogsElemLogType(v)
176 return nil
177 }
178
179
180 func (j *LogListSchemaJsonOperatorsElemLogsElem) UnmarshalJSON(b []byte) error {
181 var raw map[string]interface{}
182 if err := json.Unmarshal(b, &raw); err != nil {
183 return err
184 }
185 if v, ok := raw["key"]; !ok || v == nil {
186 return fmt.Errorf("field key: required")
187 }
188 if v, ok := raw["log_id"]; !ok || v == nil {
189 return fmt.Errorf("field log_id: required")
190 }
191 if v, ok := raw["url"]; !ok || v == nil {
192 return fmt.Errorf("field url: required")
193 }
194 type Plain LogListSchemaJsonOperatorsElemLogsElem
195 var plain Plain
196 if err := json.Unmarshal(b, &plain); err != nil {
197 return err
198 }
199 if v, ok := raw["mmd"]; !ok || v == nil {
200 plain.Mmd = 86400
201 }
202 *j = LogListSchemaJsonOperatorsElemLogsElem(plain)
203 return nil
204 }
205
206
207 func (j *State) UnmarshalJSON(b []byte) error {
208 var raw map[string]interface{}
209 if err := json.Unmarshal(b, &raw); err != nil {
210 return err
211 }
212 if v, ok := raw["timestamp"]; !ok || v == nil {
213 return fmt.Errorf("field timestamp: required")
214 }
215 type Plain State
216 var plain Plain
217 if err := json.Unmarshal(b, &plain); err != nil {
218 return err
219 }
220 *j = State(plain)
221 return nil
222 }
223
224
225 func (j *LogListSchemaJsonOperatorsElem) UnmarshalJSON(b []byte) error {
226 var raw map[string]interface{}
227 if err := json.Unmarshal(b, &raw); err != nil {
228 return err
229 }
230 if v, ok := raw["email"]; !ok || v == nil {
231 return fmt.Errorf("field email: required")
232 }
233 if v, ok := raw["logs"]; !ok || v == nil {
234 return fmt.Errorf("field logs: required")
235 }
236 if v, ok := raw["name"]; !ok || v == nil {
237 return fmt.Errorf("field name: required")
238 }
239 type Plain LogListSchemaJsonOperatorsElem
240 var plain Plain
241 if err := json.Unmarshal(b, &plain); err != nil {
242 return err
243 }
244 *j = LogListSchemaJsonOperatorsElem(plain)
245 return nil
246 }
247
248 var enumValues_LogListSchemaJsonOperatorsElemLogsElemLogType = []interface{}{
249 "prod",
250 "test",
251 }
252
253
254 func (j *LogListSchemaJson) UnmarshalJSON(b []byte) error {
255 var raw map[string]interface{}
256 if err := json.Unmarshal(b, &raw); err != nil {
257 return err
258 }
259 if v, ok := raw["operators"]; !ok || v == nil {
260 return fmt.Errorf("field operators: required")
261 }
262 type Plain LogListSchemaJson
263 var plain Plain
264 if err := json.Unmarshal(b, &plain); err != nil {
265 return err
266 }
267 *j = LogListSchemaJson(plain)
268 return nil
269 }
270
View as plain text