Debian Codegraph @

envoy/service/event_reporting/v2alpha/event_reporting_service.pb.validate.go

raw
1 //go:build !disable_pgv
2 // Code generated by protoc-gen-validate. DO NOT EDIT.
3 // source: envoy/service/event_reporting/v2alpha/event_reporting_service.proto
4
5 package v2alpha
6
7 import (
8 "bytes"
9 "errors"
10 "fmt"
11 "net"
12 "net/mail"
13 "net/url"
14 "regexp"
15 "sort"
16 "strings"
17 "time"
18 "unicode/utf8"
19
20 "google.golang.org/protobuf/types/known/anypb"
21 )
22
23 // ensure the imports are used
24 var (
25 _ = bytes.MinRead
26 _ = errors.New("")
27 _ = fmt.Print
28 _ = utf8.UTFMax
29 _ = (*regexp.Regexp)(nil)
30 _ = (*strings.Reader)(nil)
31 _ = net.IPv4len
32 _ = time.Duration(0)
33 _ = (*url.URL)(nil)
34 _ = (*mail.Address)(nil)
35 _ = anypb.Any{}
36 _ = sort.Sort
37 )
38
39 // Validate checks the field values on StreamEventsRequest with the rules
40 // defined in the proto definition for this message. If any rules are
41 // violated, the first error encountered is returned, or nil if there are no violations.
42 func (m *StreamEventsRequest) Validate() error {
43 return m.validate(false)
44 }
45
46 // ValidateAll checks the field values on StreamEventsRequest with the rules
47 // defined in the proto definition for this message. If any rules are
48 // violated, the result is a list of violation errors wrapped in
49 // StreamEventsRequestMultiError, or nil if none found.
50 func (m *StreamEventsRequest) ValidateAll() error {
51 return m.validate(true)
52 }
53
54 func (m *StreamEventsRequest) validate(all bool) error {
55 if m == nil {
56 return nil
57 }
58
59 var errors []error
60
61 if all {
62 switch v := interface{}(m.GetIdentifier()).(type) {
63 case interface{ ValidateAll() error }:
64 if err := v.ValidateAll(); err != nil {
65 errors = append(errors, StreamEventsRequestValidationError{
66 field: "Identifier",
67 reason: "embedded message failed validation",
68 cause: err,
69 })
70 }
71 case interface{ Validate() error }:
72 if err := v.Validate(); err != nil {
73 errors = append(errors, StreamEventsRequestValidationError{
74 field: "Identifier",
75 reason: "embedded message failed validation",
76 cause: err,
77 })
78 }
79 }
80 } else if v, ok := interface{}(m.GetIdentifier()).(interface{ Validate() error }); ok {
81 if err := v.Validate(); err != nil {
82 return StreamEventsRequestValidationError{
83 field: "Identifier",
84 reason: "embedded message failed validation",
85 cause: err,
86 }
87 }
88 }
89
90 if len(m.GetEvents()) < 1 {
91 err := StreamEventsRequestValidationError{
92 field: "Events",
93 reason: "value must contain at least 1 item(s)",
94 }
95 if !all {
96 return err
97 }
98 errors = append(errors, err)
99 }
100
101 for idx, item := range m.GetEvents() {
102 _, _ = idx, item
103
104 if all {
105 switch v := interface{}(item).(type) {
106 case interface{ ValidateAll() error }:
107 if err := v.ValidateAll(); err != nil {
108 errors = append(errors, StreamEventsRequestValidationError{
109 field: fmt.Sprintf("Events[%v]", idx),
110 reason: "embedded message failed validation",
111 cause: err,
112 })
113 }
114 case interface{ Validate() error }:
115 if err := v.Validate(); err != nil {
116 errors = append(errors, StreamEventsRequestValidationError{
117 field: fmt.Sprintf("Events[%v]", idx),
118 reason: "embedded message failed validation",
119 cause: err,
120 })
121 }
122 }
123 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
124 if err := v.Validate(); err != nil {
125 return StreamEventsRequestValidationError{
126 field: fmt.Sprintf("Events[%v]", idx),
127 reason: "embedded message failed validation",
128 cause: err,
129 }
130 }
131 }
132
133 }
134
135 if len(errors) > 0 {
136 return StreamEventsRequestMultiError(errors)
137 }
138
139 return nil
140 }
141
142 // StreamEventsRequestMultiError is an error wrapping multiple validation
143 // errors returned by StreamEventsRequest.ValidateAll() if the designated
144 // constraints aren't met.
145 type StreamEventsRequestMultiError []error
146
147 // Error returns a concatenation of all the error messages it wraps.
148 func (m StreamEventsRequestMultiError) Error() string {
149 var msgs []string
150 for _, err := range m {
151 msgs = append(msgs, err.Error())
152 }
153 return strings.Join(msgs, "; ")
154 }
155
156 // AllErrors returns a list of validation violation errors.
157 func (m StreamEventsRequestMultiError) AllErrors() []error { return m }
158
159 // StreamEventsRequestValidationError is the validation error returned by
160 // StreamEventsRequest.Validate if the designated constraints aren't met.
161 type StreamEventsRequestValidationError struct {
162 field string
163 reason string
164 cause error
165 key bool
166 }
167
168 // Field function returns field value.
169 func (e StreamEventsRequestValidationError) Field() string { return e.field }
170
171 // Reason function returns reason value.
172 func (e StreamEventsRequestValidationError) Reason() string { return e.reason }
173
174 // Cause function returns cause value.
175 func (e StreamEventsRequestValidationError) Cause() error { return e.cause }
176
177 // Key function returns key value.
178 func (e StreamEventsRequestValidationError) Key() bool { return e.key }
179
180 // ErrorName returns error name.
181 func (e StreamEventsRequestValidationError) ErrorName() string {
182 return "StreamEventsRequestValidationError"
183 }
184
185 // Error satisfies the builtin error interface
186 func (e StreamEventsRequestValidationError) Error() string {
187 cause := ""
188 if e.cause != nil {
189 cause = fmt.Sprintf(" | caused by: %v", e.cause)
190 }
191
192 key := ""
193 if e.key {
194 key = "key for "
195 }
196
197 return fmt.Sprintf(
198 "invalid %sStreamEventsRequest.%s: %s%s",
199 key,
200 e.field,
201 e.reason,
202 cause)
203 }
204
205 var _ error = StreamEventsRequestValidationError{}
206
207 var _ interface {
208 Field() string
209 Reason() string
210 Key() bool
211 Cause() error
212 ErrorName() string
213 } = StreamEventsRequestValidationError{}
214
215 // Validate checks the field values on StreamEventsResponse with the rules
216 // defined in the proto definition for this message. If any rules are
217 // violated, the first error encountered is returned, or nil if there are no violations.
218 func (m *StreamEventsResponse) Validate() error {
219 return m.validate(false)
220 }
221
222 // ValidateAll checks the field values on StreamEventsResponse with the rules
223 // defined in the proto definition for this message. If any rules are
224 // violated, the result is a list of violation errors wrapped in
225 // StreamEventsResponseMultiError, or nil if none found.
226 func (m *StreamEventsResponse) ValidateAll() error {
227 return m.validate(true)
228 }
229
230 func (m *StreamEventsResponse) validate(all bool) error {
231 if m == nil {
232 return nil
233 }
234
235 var errors []error
236
237 if len(errors) > 0 {
238 return StreamEventsResponseMultiError(errors)
239 }
240
241 return nil
242 }
243
244 // StreamEventsResponseMultiError is an error wrapping multiple validation
245 // errors returned by StreamEventsResponse.ValidateAll() if the designated
246 // constraints aren't met.
247 type StreamEventsResponseMultiError []error
248
249 // Error returns a concatenation of all the error messages it wraps.
250 func (m StreamEventsResponseMultiError) Error() string {
251 var msgs []string
252 for _, err := range m {
253 msgs = append(msgs, err.Error())
254 }
255 return strings.Join(msgs, "; ")
256 }
257
258 // AllErrors returns a list of validation violation errors.
259 func (m StreamEventsResponseMultiError) AllErrors() []error { return m }
260
261 // StreamEventsResponseValidationError is the validation error returned by
262 // StreamEventsResponse.Validate if the designated constraints aren't met.
263 type StreamEventsResponseValidationError struct {
264 field string
265 reason string
266 cause error
267 key bool
268 }
269
270 // Field function returns field value.
271 func (e StreamEventsResponseValidationError) Field() string { return e.field }
272
273 // Reason function returns reason value.
274 func (e StreamEventsResponseValidationError) Reason() string { return e.reason }
275
276 // Cause function returns cause value.
277 func (e StreamEventsResponseValidationError) Cause() error { return e.cause }
278
279 // Key function returns key value.
280 func (e StreamEventsResponseValidationError) Key() bool { return e.key }
281
282 // ErrorName returns error name.
283 func (e StreamEventsResponseValidationError) ErrorName() string {
284 return "StreamEventsResponseValidationError"
285 }
286
287 // Error satisfies the builtin error interface
288 func (e StreamEventsResponseValidationError) Error() string {
289 cause := ""
290 if e.cause != nil {
291 cause = fmt.Sprintf(" | caused by: %v", e.cause)
292 }
293
294 key := ""
295 if e.key {
296 key = "key for "
297 }
298
299 return fmt.Sprintf(
300 "invalid %sStreamEventsResponse.%s: %s%s",
301 key,
302 e.field,
303 e.reason,
304 cause)
305 }
306
307 var _ error = StreamEventsResponseValidationError{}
308
309 var _ interface {
310 Field() string
311 Reason() string
312 Key() bool
313 Cause() error
314 ErrorName() string
315 } = StreamEventsResponseValidationError{}
316
317 // Validate checks the field values on StreamEventsRequest_Identifier with the
318 // rules defined in the proto definition for this message. If any rules are
319 // violated, the first error encountered is returned, or nil if there are no violations.
320 func (m *StreamEventsRequest_Identifier) Validate() error {
321 return m.validate(false)
322 }
323
324 // ValidateAll checks the field values on StreamEventsRequest_Identifier with
325 // the rules defined in the proto definition for this message. If any rules
326 // are violated, the result is a list of violation errors wrapped in
327 // StreamEventsRequest_IdentifierMultiError, or nil if none found.
328 func (m *StreamEventsRequest_Identifier) ValidateAll() error {
329 return m.validate(true)
330 }
331
332 func (m *StreamEventsRequest_Identifier) validate(all bool) error {
333 if m == nil {
334 return nil
335 }
336
337 var errors []error
338
339 if m.GetNode() == nil {
340 err := StreamEventsRequest_IdentifierValidationError{
341 field: "Node",
342 reason: "value is required",
343 }
344 if !all {
345 return err
346 }
347 errors = append(errors, err)
348 }
349
350 if all {
351 switch v := interface{}(m.GetNode()).(type) {
352 case interface{ ValidateAll() error }:
353 if err := v.ValidateAll(); err != nil {
354 errors = append(errors, StreamEventsRequest_IdentifierValidationError{
355 field: "Node",
356 reason: "embedded message failed validation",
357 cause: err,
358 })
359 }
360 case interface{ Validate() error }:
361 if err := v.Validate(); err != nil {
362 errors = append(errors, StreamEventsRequest_IdentifierValidationError{
363 field: "Node",
364 reason: "embedded message failed validation",
365 cause: err,
366 })
367 }
368 }
369 } else if v, ok := interface{}(m.GetNode()).(interface{ Validate() error }); ok {
370 if err := v.Validate(); err != nil {
371 return StreamEventsRequest_IdentifierValidationError{
372 field: "Node",
373 reason: "embedded message failed validation",
374 cause: err,
375 }
376 }
377 }
378
379 if len(errors) > 0 {
380 return StreamEventsRequest_IdentifierMultiError(errors)
381 }
382
383 return nil
384 }
385
386 // StreamEventsRequest_IdentifierMultiError is an error wrapping multiple
387 // validation errors returned by StreamEventsRequest_Identifier.ValidateAll()
388 // if the designated constraints aren't met.
389 type StreamEventsRequest_IdentifierMultiError []error
390
391 // Error returns a concatenation of all the error messages it wraps.
392 func (m StreamEventsRequest_IdentifierMultiError) Error() string {
393 var msgs []string
394 for _, err := range m {
395 msgs = append(msgs, err.Error())
396 }
397 return strings.Join(msgs, "; ")
398 }
399
400 // AllErrors returns a list of validation violation errors.
401 func (m StreamEventsRequest_IdentifierMultiError) AllErrors() []error { return m }
402
403 // StreamEventsRequest_IdentifierValidationError is the validation error
404 // returned by StreamEventsRequest_Identifier.Validate if the designated
405 // constraints aren't met.
406 type StreamEventsRequest_IdentifierValidationError struct {
407 field string
408 reason string
409 cause error
410 key bool
411 }
412
413 // Field function returns field value.
414 func (e StreamEventsRequest_IdentifierValidationError) Field() string { return e.field }
415
416 // Reason function returns reason value.
417 func (e StreamEventsRequest_IdentifierValidationError) Reason() string { return e.reason }
418
419 // Cause function returns cause value.
420 func (e StreamEventsRequest_IdentifierValidationError) Cause() error { return e.cause }
421
422 // Key function returns key value.
423 func (e StreamEventsRequest_IdentifierValidationError) Key() bool { return e.key }
424
425 // ErrorName returns error name.
426 func (e StreamEventsRequest_IdentifierValidationError) ErrorName() string {
427 return "StreamEventsRequest_IdentifierValidationError"
428 }
429
430 // Error satisfies the builtin error interface
431 func (e StreamEventsRequest_IdentifierValidationError) Error() string {
432 cause := ""
433 if e.cause != nil {
434 cause = fmt.Sprintf(" | caused by: %v", e.cause)
435 }
436
437 key := ""
438 if e.key {
439 key = "key for "
440 }
441
442 return fmt.Sprintf(
443 "invalid %sStreamEventsRequest_Identifier.%s: %s%s",
444 key,
445 e.field,
446 e.reason,
447 cause)
448 }
449
450 var _ error = StreamEventsRequest_IdentifierValidationError{}
451
452 var _ interface {
453 Field() string
454 Reason() string
455 Key() bool
456 Cause() error
457 ErrorName() string
458 } = StreamEventsRequest_IdentifierValidationError{}