Debian Codegraph @

envoy/extensions/access_loggers/fluentd/v3/fluentd.pb.validate.go

raw
1 //go:build !disable_pgv
2 // Code generated by protoc-gen-validate. DO NOT EDIT.
3 // source: envoy/extensions/access_loggers/fluentd/v3/fluentd.proto
4
5 package fluentdv3
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 FluentdAccessLogConfig 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 *FluentdAccessLogConfig) Validate() error {
43 return m.validate(false)
44 }
45
46 // ValidateAll checks the field values on FluentdAccessLogConfig 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 // FluentdAccessLogConfigMultiError, or nil if none found.
50 func (m *FluentdAccessLogConfig) ValidateAll() error {
51 return m.validate(true)
52 }
53
54 func (m *FluentdAccessLogConfig) validate(all bool) error {
55 if m == nil {
56 return nil
57 }
58
59 var errors []error
60
61 if utf8.RuneCountInString(m.GetCluster()) < 1 {
62 err := FluentdAccessLogConfigValidationError{
63 field: "Cluster",
64 reason: "value length must be at least 1 runes",
65 }
66 if !all {
67 return err
68 }
69 errors = append(errors, err)
70 }
71
72 if utf8.RuneCountInString(m.GetTag()) < 1 {
73 err := FluentdAccessLogConfigValidationError{
74 field: "Tag",
75 reason: "value length must be at least 1 runes",
76 }
77 if !all {
78 return err
79 }
80 errors = append(errors, err)
81 }
82
83 if utf8.RuneCountInString(m.GetStatPrefix()) < 1 {
84 err := FluentdAccessLogConfigValidationError{
85 field: "StatPrefix",
86 reason: "value length must be at least 1 runes",
87 }
88 if !all {
89 return err
90 }
91 errors = append(errors, err)
92 }
93
94 if d := m.GetBufferFlushInterval(); d != nil {
95 dur, err := d.AsDuration(), d.CheckValid()
96 if err != nil {
97 err = FluentdAccessLogConfigValidationError{
98 field: "BufferFlushInterval",
99 reason: "value is not a valid duration",
100 cause: err,
101 }
102 if !all {
103 return err
104 }
105 errors = append(errors, err)
106 } else {
107
108 gt := time.Duration(0*time.Second + 0*time.Nanosecond)
109
110 if dur <= gt {
111 err := FluentdAccessLogConfigValidationError{
112 field: "BufferFlushInterval",
113 reason: "value must be greater than 0s",
114 }
115 if !all {
116 return err
117 }
118 errors = append(errors, err)
119 }
120
121 }
122 }
123
124 if all {
125 switch v := interface{}(m.GetBufferSizeBytes()).(type) {
126 case interface{ ValidateAll() error }:
127 if err := v.ValidateAll(); err != nil {
128 errors = append(errors, FluentdAccessLogConfigValidationError{
129 field: "BufferSizeBytes",
130 reason: "embedded message failed validation",
131 cause: err,
132 })
133 }
134 case interface{ Validate() error }:
135 if err := v.Validate(); err != nil {
136 errors = append(errors, FluentdAccessLogConfigValidationError{
137 field: "BufferSizeBytes",
138 reason: "embedded message failed validation",
139 cause: err,
140 })
141 }
142 }
143 } else if v, ok := interface{}(m.GetBufferSizeBytes()).(interface{ Validate() error }); ok {
144 if err := v.Validate(); err != nil {
145 return FluentdAccessLogConfigValidationError{
146 field: "BufferSizeBytes",
147 reason: "embedded message failed validation",
148 cause: err,
149 }
150 }
151 }
152
153 if m.GetRecord() == nil {
154 err := FluentdAccessLogConfigValidationError{
155 field: "Record",
156 reason: "value is required",
157 }
158 if !all {
159 return err
160 }
161 errors = append(errors, err)
162 }
163
164 if all {
165 switch v := interface{}(m.GetRecord()).(type) {
166 case interface{ ValidateAll() error }:
167 if err := v.ValidateAll(); err != nil {
168 errors = append(errors, FluentdAccessLogConfigValidationError{
169 field: "Record",
170 reason: "embedded message failed validation",
171 cause: err,
172 })
173 }
174 case interface{ Validate() error }:
175 if err := v.Validate(); err != nil {
176 errors = append(errors, FluentdAccessLogConfigValidationError{
177 field: "Record",
178 reason: "embedded message failed validation",
179 cause: err,
180 })
181 }
182 }
183 } else if v, ok := interface{}(m.GetRecord()).(interface{ Validate() error }); ok {
184 if err := v.Validate(); err != nil {
185 return FluentdAccessLogConfigValidationError{
186 field: "Record",
187 reason: "embedded message failed validation",
188 cause: err,
189 }
190 }
191 }
192
193 if all {
194 switch v := interface{}(m.GetRetryOptions()).(type) {
195 case interface{ ValidateAll() error }:
196 if err := v.ValidateAll(); err != nil {
197 errors = append(errors, FluentdAccessLogConfigValidationError{
198 field: "RetryOptions",
199 reason: "embedded message failed validation",
200 cause: err,
201 })
202 }
203 case interface{ Validate() error }:
204 if err := v.Validate(); err != nil {
205 errors = append(errors, FluentdAccessLogConfigValidationError{
206 field: "RetryOptions",
207 reason: "embedded message failed validation",
208 cause: err,
209 })
210 }
211 }
212 } else if v, ok := interface{}(m.GetRetryOptions()).(interface{ Validate() error }); ok {
213 if err := v.Validate(); err != nil {
214 return FluentdAccessLogConfigValidationError{
215 field: "RetryOptions",
216 reason: "embedded message failed validation",
217 cause: err,
218 }
219 }
220 }
221
222 for idx, item := range m.GetFormatters() {
223 _, _ = idx, item
224
225 if all {
226 switch v := interface{}(item).(type) {
227 case interface{ ValidateAll() error }:
228 if err := v.ValidateAll(); err != nil {
229 errors = append(errors, FluentdAccessLogConfigValidationError{
230 field: fmt.Sprintf("Formatters[%v]", idx),
231 reason: "embedded message failed validation",
232 cause: err,
233 })
234 }
235 case interface{ Validate() error }:
236 if err := v.Validate(); err != nil {
237 errors = append(errors, FluentdAccessLogConfigValidationError{
238 field: fmt.Sprintf("Formatters[%v]", idx),
239 reason: "embedded message failed validation",
240 cause: err,
241 })
242 }
243 }
244 } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
245 if err := v.Validate(); err != nil {
246 return FluentdAccessLogConfigValidationError{
247 field: fmt.Sprintf("Formatters[%v]", idx),
248 reason: "embedded message failed validation",
249 cause: err,
250 }
251 }
252 }
253
254 }
255
256 if len(errors) > 0 {
257 return FluentdAccessLogConfigMultiError(errors)
258 }
259
260 return nil
261 }
262
263 // FluentdAccessLogConfigMultiError is an error wrapping multiple validation
264 // errors returned by FluentdAccessLogConfig.ValidateAll() if the designated
265 // constraints aren't met.
266 type FluentdAccessLogConfigMultiError []error
267
268 // Error returns a concatenation of all the error messages it wraps.
269 func (m FluentdAccessLogConfigMultiError) Error() string {
270 var msgs []string
271 for _, err := range m {
272 msgs = append(msgs, err.Error())
273 }
274 return strings.Join(msgs, "; ")
275 }
276
277 // AllErrors returns a list of validation violation errors.
278 func (m FluentdAccessLogConfigMultiError) AllErrors() []error { return m }
279
280 // FluentdAccessLogConfigValidationError is the validation error returned by
281 // FluentdAccessLogConfig.Validate if the designated constraints aren't met.
282 type FluentdAccessLogConfigValidationError struct {
283 field string
284 reason string
285 cause error
286 key bool
287 }
288
289 // Field function returns field value.
290 func (e FluentdAccessLogConfigValidationError) Field() string { return e.field }
291
292 // Reason function returns reason value.
293 func (e FluentdAccessLogConfigValidationError) Reason() string { return e.reason }
294
295 // Cause function returns cause value.
296 func (e FluentdAccessLogConfigValidationError) Cause() error { return e.cause }
297
298 // Key function returns key value.
299 func (e FluentdAccessLogConfigValidationError) Key() bool { return e.key }
300
301 // ErrorName returns error name.
302 func (e FluentdAccessLogConfigValidationError) ErrorName() string {
303 return "FluentdAccessLogConfigValidationError"
304 }
305
306 // Error satisfies the builtin error interface
307 func (e FluentdAccessLogConfigValidationError) Error() string {
308 cause := ""
309 if e.cause != nil {
310 cause = fmt.Sprintf(" | caused by: %v", e.cause)
311 }
312
313 key := ""
314 if e.key {
315 key = "key for "
316 }
317
318 return fmt.Sprintf(
319 "invalid %sFluentdAccessLogConfig.%s: %s%s",
320 key,
321 e.field,
322 e.reason,
323 cause)
324 }
325
326 var _ error = FluentdAccessLogConfigValidationError{}
327
328 var _ interface {
329 Field() string
330 Reason() string
331 Key() bool
332 Cause() error
333 ErrorName() string
334 } = FluentdAccessLogConfigValidationError{}
335
336 // Validate checks the field values on FluentdAccessLogConfig_RetryOptions with
337 // the rules defined in the proto definition for this message. If any rules
338 // are violated, the first error encountered is returned, or nil if there are
339 // no violations.
340 func (m *FluentdAccessLogConfig_RetryOptions) Validate() error {
341 return m.validate(false)
342 }
343
344 // ValidateAll checks the field values on FluentdAccessLogConfig_RetryOptions
345 // with the rules defined in the proto definition for this message. If any
346 // rules are violated, the result is a list of violation errors wrapped in
347 // FluentdAccessLogConfig_RetryOptionsMultiError, or nil if none found.
348 func (m *FluentdAccessLogConfig_RetryOptions) ValidateAll() error {
349 return m.validate(true)
350 }
351
352 func (m *FluentdAccessLogConfig_RetryOptions) validate(all bool) error {
353 if m == nil {
354 return nil
355 }
356
357 var errors []error
358
359 if all {
360 switch v := interface{}(m.GetMaxConnectAttempts()).(type) {
361 case interface{ ValidateAll() error }:
362 if err := v.ValidateAll(); err != nil {
363 errors = append(errors, FluentdAccessLogConfig_RetryOptionsValidationError{
364 field: "MaxConnectAttempts",
365 reason: "embedded message failed validation",
366 cause: err,
367 })
368 }
369 case interface{ Validate() error }:
370 if err := v.Validate(); err != nil {
371 errors = append(errors, FluentdAccessLogConfig_RetryOptionsValidationError{
372 field: "MaxConnectAttempts",
373 reason: "embedded message failed validation",
374 cause: err,
375 })
376 }
377 }
378 } else if v, ok := interface{}(m.GetMaxConnectAttempts()).(interface{ Validate() error }); ok {
379 if err := v.Validate(); err != nil {
380 return FluentdAccessLogConfig_RetryOptionsValidationError{
381 field: "MaxConnectAttempts",
382 reason: "embedded message failed validation",
383 cause: err,
384 }
385 }
386 }
387
388 if all {
389 switch v := interface{}(m.GetBackoffOptions()).(type) {
390 case interface{ ValidateAll() error }:
391 if err := v.ValidateAll(); err != nil {
392 errors = append(errors, FluentdAccessLogConfig_RetryOptionsValidationError{
393 field: "BackoffOptions",
394 reason: "embedded message failed validation",
395 cause: err,
396 })
397 }
398 case interface{ Validate() error }:
399 if err := v.Validate(); err != nil {
400 errors = append(errors, FluentdAccessLogConfig_RetryOptionsValidationError{
401 field: "BackoffOptions",
402 reason: "embedded message failed validation",
403 cause: err,
404 })
405 }
406 }
407 } else if v, ok := interface{}(m.GetBackoffOptions()).(interface{ Validate() error }); ok {
408 if err := v.Validate(); err != nil {
409 return FluentdAccessLogConfig_RetryOptionsValidationError{
410 field: "BackoffOptions",
411 reason: "embedded message failed validation",
412 cause: err,
413 }
414 }
415 }
416
417 if len(errors) > 0 {
418 return FluentdAccessLogConfig_RetryOptionsMultiError(errors)
419 }
420
421 return nil
422 }
423
424 // FluentdAccessLogConfig_RetryOptionsMultiError is an error wrapping multiple
425 // validation errors returned by
426 // FluentdAccessLogConfig_RetryOptions.ValidateAll() if the designated
427 // constraints aren't met.
428 type FluentdAccessLogConfig_RetryOptionsMultiError []error
429
430 // Error returns a concatenation of all the error messages it wraps.
431 func (m FluentdAccessLogConfig_RetryOptionsMultiError) Error() string {
432 var msgs []string
433 for _, err := range m {
434 msgs = append(msgs, err.Error())
435 }
436 return strings.Join(msgs, "; ")
437 }
438
439 // AllErrors returns a list of validation violation errors.
440 func (m FluentdAccessLogConfig_RetryOptionsMultiError) AllErrors() []error { return m }
441
442 // FluentdAccessLogConfig_RetryOptionsValidationError is the validation error
443 // returned by FluentdAccessLogConfig_RetryOptions.Validate if the designated
444 // constraints aren't met.
445 type FluentdAccessLogConfig_RetryOptionsValidationError struct {
446 field string
447 reason string
448 cause error
449 key bool
450 }
451
452 // Field function returns field value.
453 func (e FluentdAccessLogConfig_RetryOptionsValidationError) Field() string { return e.field }
454
455 // Reason function returns reason value.
456 func (e FluentdAccessLogConfig_RetryOptionsValidationError) Reason() string { return e.reason }
457
458 // Cause function returns cause value.
459 func (e FluentdAccessLogConfig_RetryOptionsValidationError) Cause() error { return e.cause }
460
461 // Key function returns key value.
462 func (e FluentdAccessLogConfig_RetryOptionsValidationError) Key() bool { return e.key }
463
464 // ErrorName returns error name.
465 func (e FluentdAccessLogConfig_RetryOptionsValidationError) ErrorName() string {
466 return "FluentdAccessLogConfig_RetryOptionsValidationError"
467 }
468
469 // Error satisfies the builtin error interface
470 func (e FluentdAccessLogConfig_RetryOptionsValidationError) Error() string {
471 cause := ""
472 if e.cause != nil {
473 cause = fmt.Sprintf(" | caused by: %v", e.cause)
474 }
475
476 key := ""
477 if e.key {
478 key = "key for "
479 }
480
481 return fmt.Sprintf(
482 "invalid %sFluentdAccessLogConfig_RetryOptions.%s: %s%s",
483 key,
484 e.field,
485 e.reason,
486 cause)
487 }
488
489 var _ error = FluentdAccessLogConfig_RetryOptionsValidationError{}
490
491 var _ interface {
492 Field() string
493 Reason() string
494 Key() bool
495 Cause() error
496 ErrorName() string
497 } = FluentdAccessLogConfig_RetryOptionsValidationError{}