Debian Codegraph @

envoy/extensions/transport_sockets/quic/v3/quic_transport.pb.validate.go

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