Debian Codegraph @

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