Debian Codegraph @

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