Debian Codegraph @

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