Debian Codegraph @

envoy/config/trace/v3/xray.pb.validate.go

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