Debian Codegraph @

envoy/extensions/access_loggers/stream/v3/stream.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/stream/v3/stream.proto
4
5 package streamv3
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 StdoutAccessLog with the rules defined
40 // in the proto definition for this message. If any rules are violated, the
41 // first error encountered is returned, or nil if there are no violations.
42 func (m *StdoutAccessLog) Validate() error {
43 return m.validate(false)
44 }
45
46 // ValidateAll checks the field values on StdoutAccessLog 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 // StdoutAccessLogMultiError, or nil if none found.
50 func (m *StdoutAccessLog) ValidateAll() error {
51 return m.validate(true)
52 }
53
54 func (m *StdoutAccessLog) validate(all bool) error {
55 if m == nil {
56 return nil
57 }
58
59 var errors []error
60
61 switch v := m.AccessLogFormat.(type) {
62 case *StdoutAccessLog_LogFormat:
63 if v == nil {
64 err := StdoutAccessLogValidationError{
65 field: "AccessLogFormat",
66 reason: "oneof value cannot be a typed-nil",
67 }
68 if !all {
69 return err
70 }
71 errors = append(errors, err)
72 }
73
74 if m.GetLogFormat() == nil {
75 err := StdoutAccessLogValidationError{
76 field: "LogFormat",
77 reason: "value is required",
78 }
79 if !all {
80 return err
81 }
82 errors = append(errors, err)
83 }
84
85 if all {
86 switch v := interface{}(m.GetLogFormat()).(type) {
87 case interface{ ValidateAll() error }:
88 if err := v.ValidateAll(); err != nil {
89 errors = append(errors, StdoutAccessLogValidationError{
90 field: "LogFormat",
91 reason: "embedded message failed validation",
92 cause: err,
93 })
94 }
95 case interface{ Validate() error }:
96 if err := v.Validate(); err != nil {
97 errors = append(errors, StdoutAccessLogValidationError{
98 field: "LogFormat",
99 reason: "embedded message failed validation",
100 cause: err,
101 })
102 }
103 }
104 } else if v, ok := interface{}(m.GetLogFormat()).(interface{ Validate() error }); ok {
105 if err := v.Validate(); err != nil {
106 return StdoutAccessLogValidationError{
107 field: "LogFormat",
108 reason: "embedded message failed validation",
109 cause: err,
110 }
111 }
112 }
113
114 default:
115 _ = v // ensures v is used
116 }
117
118 if len(errors) > 0 {
119 return StdoutAccessLogMultiError(errors)
120 }
121
122 return nil
123 }
124
125 // StdoutAccessLogMultiError is an error wrapping multiple validation errors
126 // returned by StdoutAccessLog.ValidateAll() if the designated constraints
127 // aren't met.
128 type StdoutAccessLogMultiError []error
129
130 // Error returns a concatenation of all the error messages it wraps.
131 func (m StdoutAccessLogMultiError) Error() string {
132 var msgs []string
133 for _, err := range m {
134 msgs = append(msgs, err.Error())
135 }
136 return strings.Join(msgs, "; ")
137 }
138
139 // AllErrors returns a list of validation violation errors.
140 func (m StdoutAccessLogMultiError) AllErrors() []error { return m }
141
142 // StdoutAccessLogValidationError is the validation error returned by
143 // StdoutAccessLog.Validate if the designated constraints aren't met.
144 type StdoutAccessLogValidationError struct {
145 field string
146 reason string
147 cause error
148 key bool
149 }
150
151 // Field function returns field value.
152 func (e StdoutAccessLogValidationError) Field() string { return e.field }
153
154 // Reason function returns reason value.
155 func (e StdoutAccessLogValidationError) Reason() string { return e.reason }
156
157 // Cause function returns cause value.
158 func (e StdoutAccessLogValidationError) Cause() error { return e.cause }
159
160 // Key function returns key value.
161 func (e StdoutAccessLogValidationError) Key() bool { return e.key }
162
163 // ErrorName returns error name.
164 func (e StdoutAccessLogValidationError) ErrorName() string { return "StdoutAccessLogValidationError" }
165
166 // Error satisfies the builtin error interface
167 func (e StdoutAccessLogValidationError) Error() string {
168 cause := ""
169 if e.cause != nil {
170 cause = fmt.Sprintf(" | caused by: %v", e.cause)
171 }
172
173 key := ""
174 if e.key {
175 key = "key for "
176 }
177
178 return fmt.Sprintf(
179 "invalid %sStdoutAccessLog.%s: %s%s",
180 key,
181 e.field,
182 e.reason,
183 cause)
184 }
185
186 var _ error = StdoutAccessLogValidationError{}
187
188 var _ interface {
189 Field() string
190 Reason() string
191 Key() bool
192 Cause() error
193 ErrorName() string
194 } = StdoutAccessLogValidationError{}
195
196 // Validate checks the field values on StderrAccessLog with the rules defined
197 // in the proto definition for this message. If any rules are violated, the
198 // first error encountered is returned, or nil if there are no violations.
199 func (m *StderrAccessLog) Validate() error {
200 return m.validate(false)
201 }
202
203 // ValidateAll checks the field values on StderrAccessLog with the rules
204 // defined in the proto definition for this message. If any rules are
205 // violated, the result is a list of violation errors wrapped in
206 // StderrAccessLogMultiError, or nil if none found.
207 func (m *StderrAccessLog) ValidateAll() error {
208 return m.validate(true)
209 }
210
211 func (m *StderrAccessLog) validate(all bool) error {
212 if m == nil {
213 return nil
214 }
215
216 var errors []error
217
218 switch v := m.AccessLogFormat.(type) {
219 case *StderrAccessLog_LogFormat:
220 if v == nil {
221 err := StderrAccessLogValidationError{
222 field: "AccessLogFormat",
223 reason: "oneof value cannot be a typed-nil",
224 }
225 if !all {
226 return err
227 }
228 errors = append(errors, err)
229 }
230
231 if m.GetLogFormat() == nil {
232 err := StderrAccessLogValidationError{
233 field: "LogFormat",
234 reason: "value is required",
235 }
236 if !all {
237 return err
238 }
239 errors = append(errors, err)
240 }
241
242 if all {
243 switch v := interface{}(m.GetLogFormat()).(type) {
244 case interface{ ValidateAll() error }:
245 if err := v.ValidateAll(); err != nil {
246 errors = append(errors, StderrAccessLogValidationError{
247 field: "LogFormat",
248 reason: "embedded message failed validation",
249 cause: err,
250 })
251 }
252 case interface{ Validate() error }:
253 if err := v.Validate(); err != nil {
254 errors = append(errors, StderrAccessLogValidationError{
255 field: "LogFormat",
256 reason: "embedded message failed validation",
257 cause: err,
258 })
259 }
260 }
261 } else if v, ok := interface{}(m.GetLogFormat()).(interface{ Validate() error }); ok {
262 if err := v.Validate(); err != nil {
263 return StderrAccessLogValidationError{
264 field: "LogFormat",
265 reason: "embedded message failed validation",
266 cause: err,
267 }
268 }
269 }
270
271 default:
272 _ = v // ensures v is used
273 }
274
275 if len(errors) > 0 {
276 return StderrAccessLogMultiError(errors)
277 }
278
279 return nil
280 }
281
282 // StderrAccessLogMultiError is an error wrapping multiple validation errors
283 // returned by StderrAccessLog.ValidateAll() if the designated constraints
284 // aren't met.
285 type StderrAccessLogMultiError []error
286
287 // Error returns a concatenation of all the error messages it wraps.
288 func (m StderrAccessLogMultiError) Error() string {
289 var msgs []string
290 for _, err := range m {
291 msgs = append(msgs, err.Error())
292 }
293 return strings.Join(msgs, "; ")
294 }
295
296 // AllErrors returns a list of validation violation errors.
297 func (m StderrAccessLogMultiError) AllErrors() []error { return m }
298
299 // StderrAccessLogValidationError is the validation error returned by
300 // StderrAccessLog.Validate if the designated constraints aren't met.
301 type StderrAccessLogValidationError struct {
302 field string
303 reason string
304 cause error
305 key bool
306 }
307
308 // Field function returns field value.
309 func (e StderrAccessLogValidationError) Field() string { return e.field }
310
311 // Reason function returns reason value.
312 func (e StderrAccessLogValidationError) Reason() string { return e.reason }
313
314 // Cause function returns cause value.
315 func (e StderrAccessLogValidationError) Cause() error { return e.cause }
316
317 // Key function returns key value.
318 func (e StderrAccessLogValidationError) Key() bool { return e.key }
319
320 // ErrorName returns error name.
321 func (e StderrAccessLogValidationError) ErrorName() string { return "StderrAccessLogValidationError" }
322
323 // Error satisfies the builtin error interface
324 func (e StderrAccessLogValidationError) Error() string {
325 cause := ""
326 if e.cause != nil {
327 cause = fmt.Sprintf(" | caused by: %v", e.cause)
328 }
329
330 key := ""
331 if e.key {
332 key = "key for "
333 }
334
335 return fmt.Sprintf(
336 "invalid %sStderrAccessLog.%s: %s%s",
337 key,
338 e.field,
339 e.reason,
340 cause)
341 }
342
343 var _ error = StderrAccessLogValidationError{}
344
345 var _ interface {
346 Field() string
347 Reason() string
348 Key() bool
349 Cause() error
350 ErrorName() string
351 } = StderrAccessLogValidationError{}