| 1 |
//go:build !disable_pgv |
| 2 |
// Code generated by protoc-gen-validate. DO NOT EDIT. |
| 3 |
// source: envoy/config/accesslog/v3/accesslog.proto |
| 4 |
|
| 5 |
package accesslogv3 |
| 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 |
v3 "github.com/envoyproxy/go-control-plane/envoy/data/accesslog/v3" |
| 23 |
) |
| 24 |
|
| 25 |
// ensure the imports are used |
| 26 |
var ( |
| 27 |
_ = bytes.MinRead |
| 28 |
_ = errors.New("") |
| 29 |
_ = fmt.Print |
| 30 |
_ = utf8.UTFMax |
| 31 |
_ = (*regexp.Regexp)(nil) |
| 32 |
_ = (*strings.Reader)(nil) |
| 33 |
_ = net.IPv4len |
| 34 |
_ = time.Duration(0) |
| 35 |
_ = (*url.URL)(nil) |
| 36 |
_ = (*mail.Address)(nil) |
| 37 |
_ = anypb.Any{} |
| 38 |
_ = sort.Sort |
| 39 |
|
| 40 |
_ = v3.AccessLogType(0) |
| 41 |
) |
| 42 |
|
| 43 |
// Validate checks the field values on AccessLog with the rules defined in the |
| 44 |
// proto definition for this message. If any rules are violated, the first |
| 45 |
// error encountered is returned, or nil if there are no violations. |
| 46 |
func (m *AccessLog) Validate() error { |
| 47 |
return m.validate(false) |
| 48 |
} |
| 49 |
|
| 50 |
// ValidateAll checks the field values on AccessLog with the rules defined in |
| 51 |
// the proto definition for this message. If any rules are violated, the |
| 52 |
// result is a list of violation errors wrapped in AccessLogMultiError, or nil |
| 53 |
// if none found. |
| 54 |
func (m *AccessLog) ValidateAll() error { |
| 55 |
return m.validate(true) |
| 56 |
} |
| 57 |
|
| 58 |
func (m *AccessLog) validate(all bool) error { |
| 59 |
if m == nil { |
| 60 |
return nil |
| 61 |
} |
| 62 |
|
| 63 |
var errors []error |
| 64 |
|
| 65 |
// no validation rules for Name |
| 66 |
|
| 67 |
if all { |
| 68 |
switch v := interface{}(m.GetFilter()).(type) { |
| 69 |
case interface{ ValidateAll() error }: |
| 70 |
if err := v.ValidateAll(); err != nil { |
| 71 |
errors = append(errors, AccessLogValidationError{ |
| 72 |
field: "Filter", |
| 73 |
reason: "embedded message failed validation", |
| 74 |
cause: err, |
| 75 |
}) |
| 76 |
} |
| 77 |
case interface{ Validate() error }: |
| 78 |
if err := v.Validate(); err != nil { |
| 79 |
errors = append(errors, AccessLogValidationError{ |
| 80 |
field: "Filter", |
| 81 |
reason: "embedded message failed validation", |
| 82 |
cause: err, |
| 83 |
}) |
| 84 |
} |
| 85 |
} |
| 86 |
} else if v, ok := interface{}(m.GetFilter()).(interface{ Validate() error }); ok { |
| 87 |
if err := v.Validate(); err != nil { |
| 88 |
return AccessLogValidationError{ |
| 89 |
field: "Filter", |
| 90 |
reason: "embedded message failed validation", |
| 91 |
cause: err, |
| 92 |
} |
| 93 |
} |
| 94 |
} |
| 95 |
|
| 96 |
switch v := m.ConfigType.(type) { |
| 97 |
case *AccessLog_TypedConfig: |
| 98 |
if v == nil { |
| 99 |
err := AccessLogValidationError{ |
| 100 |
field: "ConfigType", |
| 101 |
reason: "oneof value cannot be a typed-nil", |
| 102 |
} |
| 103 |
if !all { |
| 104 |
return err |
| 105 |
} |
| 106 |
errors = append(errors, err) |
| 107 |
} |
| 108 |
|
| 109 |
if all { |
| 110 |
switch v := interface{}(m.GetTypedConfig()).(type) { |
| 111 |
case interface{ ValidateAll() error }: |
| 112 |
if err := v.ValidateAll(); err != nil { |
| 113 |
errors = append(errors, AccessLogValidationError{ |
| 114 |
field: "TypedConfig", |
| 115 |
reason: "embedded message failed validation", |
| 116 |
cause: err, |
| 117 |
}) |
| 118 |
} |
| 119 |
case interface{ Validate() error }: |
| 120 |
if err := v.Validate(); err != nil { |
| 121 |
errors = append(errors, AccessLogValidationError{ |
| 122 |
field: "TypedConfig", |
| 123 |
reason: "embedded message failed validation", |
| 124 |
cause: err, |
| 125 |
}) |
| 126 |
} |
| 127 |
} |
| 128 |
} else if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok { |
| 129 |
if err := v.Validate(); err != nil { |
| 130 |
return AccessLogValidationError{ |
| 131 |
field: "TypedConfig", |
| 132 |
reason: "embedded message failed validation", |
| 133 |
cause: err, |
| 134 |
} |
| 135 |
} |
| 136 |
} |
| 137 |
|
| 138 |
default: |
| 139 |
_ = v // ensures v is used |
| 140 |
} |
| 141 |
|
| 142 |
if len(errors) > 0 { |
| 143 |
return AccessLogMultiError(errors) |
| 144 |
} |
| 145 |
|
| 146 |
return nil |
| 147 |
} |
| 148 |
|
| 149 |
// AccessLogMultiError is an error wrapping multiple validation errors returned |
| 150 |
// by AccessLog.ValidateAll() if the designated constraints aren't met. |
| 151 |
type AccessLogMultiError []error |
| 152 |
|
| 153 |
// Error returns a concatenation of all the error messages it wraps. |
| 154 |
func (m AccessLogMultiError) Error() string { |
| 155 |
var msgs []string |
| 156 |
for _, err := range m { |
| 157 |
msgs = append(msgs, err.Error()) |
| 158 |
} |
| 159 |
return strings.Join(msgs, "; ") |
| 160 |
} |
| 161 |
|
| 162 |
// AllErrors returns a list of validation violation errors. |
| 163 |
func (m AccessLogMultiError) AllErrors() []error { return m } |
| 164 |
|
| 165 |
// AccessLogValidationError is the validation error returned by |
| 166 |
// AccessLog.Validate if the designated constraints aren't met. |
| 167 |
type AccessLogValidationError struct { |
| 168 |
field string |
| 169 |
reason string |
| 170 |
cause error |
| 171 |
key bool |
| 172 |
} |
| 173 |
|
| 174 |
// Field function returns field value. |
| 175 |
func (e AccessLogValidationError) Field() string { return e.field } |
| 176 |
|
| 177 |
// Reason function returns reason value. |
| 178 |
func (e AccessLogValidationError) Reason() string { return e.reason } |
| 179 |
|
| 180 |
// Cause function returns cause value. |
| 181 |
func (e AccessLogValidationError) Cause() error { return e.cause } |
| 182 |
|
| 183 |
// Key function returns key value. |
| 184 |
func (e AccessLogValidationError) Key() bool { return e.key } |
| 185 |
|
| 186 |
// ErrorName returns error name. |
| 187 |
func (e AccessLogValidationError) ErrorName() string { return "AccessLogValidationError" } |
| 188 |
|
| 189 |
// Error satisfies the builtin error interface |
| 190 |
func (e AccessLogValidationError) Error() string { |
| 191 |
cause := "" |
| 192 |
if e.cause != nil { |
| 193 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 194 |
} |
| 195 |
|
| 196 |
key := "" |
| 197 |
if e.key { |
| 198 |
key = "key for " |
| 199 |
} |
| 200 |
|
| 201 |
return fmt.Sprintf( |
| 202 |
"invalid %sAccessLog.%s: %s%s", |
| 203 |
key, |
| 204 |
e.field, |
| 205 |
e.reason, |
| 206 |
cause) |
| 207 |
} |
| 208 |
|
| 209 |
var _ error = AccessLogValidationError{} |
| 210 |
|
| 211 |
var _ interface { |
| 212 |
Field() string |
| 213 |
Reason() string |
| 214 |
Key() bool |
| 215 |
Cause() error |
| 216 |
ErrorName() string |
| 217 |
} = AccessLogValidationError{} |
| 218 |
|
| 219 |
// Validate checks the field values on AccessLogFilter with the rules defined |
| 220 |
// in the proto definition for this message. If any rules are violated, the |
| 221 |
// first error encountered is returned, or nil if there are no violations. |
| 222 |
func (m *AccessLogFilter) Validate() error { |
| 223 |
return m.validate(false) |
| 224 |
} |
| 225 |
|
| 226 |
// ValidateAll checks the field values on AccessLogFilter with the rules |
| 227 |
// defined in the proto definition for this message. If any rules are |
| 228 |
// violated, the result is a list of violation errors wrapped in |
| 229 |
// AccessLogFilterMultiError, or nil if none found. |
| 230 |
func (m *AccessLogFilter) ValidateAll() error { |
| 231 |
return m.validate(true) |
| 232 |
} |
| 233 |
|
| 234 |
func (m *AccessLogFilter) validate(all bool) error { |
| 235 |
if m == nil { |
| 236 |
return nil |
| 237 |
} |
| 238 |
|
| 239 |
var errors []error |
| 240 |
|
| 241 |
oneofFilterSpecifierPresent := false |
| 242 |
switch v := m.FilterSpecifier.(type) { |
| 243 |
case *AccessLogFilter_StatusCodeFilter: |
| 244 |
if v == nil { |
| 245 |
err := AccessLogFilterValidationError{ |
| 246 |
field: "FilterSpecifier", |
| 247 |
reason: "oneof value cannot be a typed-nil", |
| 248 |
} |
| 249 |
if !all { |
| 250 |
return err |
| 251 |
} |
| 252 |
errors = append(errors, err) |
| 253 |
} |
| 254 |
oneofFilterSpecifierPresent = true |
| 255 |
|
| 256 |
if all { |
| 257 |
switch v := interface{}(m.GetStatusCodeFilter()).(type) { |
| 258 |
case interface{ ValidateAll() error }: |
| 259 |
if err := v.ValidateAll(); err != nil { |
| 260 |
errors = append(errors, AccessLogFilterValidationError{ |
| 261 |
field: "StatusCodeFilter", |
| 262 |
reason: "embedded message failed validation", |
| 263 |
cause: err, |
| 264 |
}) |
| 265 |
} |
| 266 |
case interface{ Validate() error }: |
| 267 |
if err := v.Validate(); err != nil { |
| 268 |
errors = append(errors, AccessLogFilterValidationError{ |
| 269 |
field: "StatusCodeFilter", |
| 270 |
reason: "embedded message failed validation", |
| 271 |
cause: err, |
| 272 |
}) |
| 273 |
} |
| 274 |
} |
| 275 |
} else if v, ok := interface{}(m.GetStatusCodeFilter()).(interface{ Validate() error }); ok { |
| 276 |
if err := v.Validate(); err != nil { |
| 277 |
return AccessLogFilterValidationError{ |
| 278 |
field: "StatusCodeFilter", |
| 279 |
reason: "embedded message failed validation", |
| 280 |
cause: err, |
| 281 |
} |
| 282 |
} |
| 283 |
} |
| 284 |
|
| 285 |
case *AccessLogFilter_DurationFilter: |
| 286 |
if v == nil { |
| 287 |
err := AccessLogFilterValidationError{ |
| 288 |
field: "FilterSpecifier", |
| 289 |
reason: "oneof value cannot be a typed-nil", |
| 290 |
} |
| 291 |
if !all { |
| 292 |
return err |
| 293 |
} |
| 294 |
errors = append(errors, err) |
| 295 |
} |
| 296 |
oneofFilterSpecifierPresent = true |
| 297 |
|
| 298 |
if all { |
| 299 |
switch v := interface{}(m.GetDurationFilter()).(type) { |
| 300 |
case interface{ ValidateAll() error }: |
| 301 |
if err := v.ValidateAll(); err != nil { |
| 302 |
errors = append(errors, AccessLogFilterValidationError{ |
| 303 |
field: "DurationFilter", |
| 304 |
reason: "embedded message failed validation", |
| 305 |
cause: err, |
| 306 |
}) |
| 307 |
} |
| 308 |
case interface{ Validate() error }: |
| 309 |
if err := v.Validate(); err != nil { |
| 310 |
errors = append(errors, AccessLogFilterValidationError{ |
| 311 |
field: "DurationFilter", |
| 312 |
reason: "embedded message failed validation", |
| 313 |
cause: err, |
| 314 |
}) |
| 315 |
} |
| 316 |
} |
| 317 |
} else if v, ok := interface{}(m.GetDurationFilter()).(interface{ Validate() error }); ok { |
| 318 |
if err := v.Validate(); err != nil { |
| 319 |
return AccessLogFilterValidationError{ |
| 320 |
field: "DurationFilter", |
| 321 |
reason: "embedded message failed validation", |
| 322 |
cause: err, |
| 323 |
} |
| 324 |
} |
| 325 |
} |
| 326 |
|
| 327 |
case *AccessLogFilter_NotHealthCheckFilter: |
| 328 |
if v == nil { |
| 329 |
err := AccessLogFilterValidationError{ |
| 330 |
field: "FilterSpecifier", |
| 331 |
reason: "oneof value cannot be a typed-nil", |
| 332 |
} |
| 333 |
if !all { |
| 334 |
return err |
| 335 |
} |
| 336 |
errors = append(errors, err) |
| 337 |
} |
| 338 |
oneofFilterSpecifierPresent = true |
| 339 |
|
| 340 |
if all { |
| 341 |
switch v := interface{}(m.GetNotHealthCheckFilter()).(type) { |
| 342 |
case interface{ ValidateAll() error }: |
| 343 |
if err := v.ValidateAll(); err != nil { |
| 344 |
errors = append(errors, AccessLogFilterValidationError{ |
| 345 |
field: "NotHealthCheckFilter", |
| 346 |
reason: "embedded message failed validation", |
| 347 |
cause: err, |
| 348 |
}) |
| 349 |
} |
| 350 |
case interface{ Validate() error }: |
| 351 |
if err := v.Validate(); err != nil { |
| 352 |
errors = append(errors, AccessLogFilterValidationError{ |
| 353 |
field: "NotHealthCheckFilter", |
| 354 |
reason: "embedded message failed validation", |
| 355 |
cause: err, |
| 356 |
}) |
| 357 |
} |
| 358 |
} |
| 359 |
} else if v, ok := interface{}(m.GetNotHealthCheckFilter()).(interface{ Validate() error }); ok { |
| 360 |
if err := v.Validate(); err != nil { |
| 361 |
return AccessLogFilterValidationError{ |
| 362 |
field: "NotHealthCheckFilter", |
| 363 |
reason: "embedded message failed validation", |
| 364 |
cause: err, |
| 365 |
} |
| 366 |
} |
| 367 |
} |
| 368 |
|
| 369 |
case *AccessLogFilter_TraceableFilter: |
| 370 |
if v == nil { |
| 371 |
err := AccessLogFilterValidationError{ |
| 372 |
field: "FilterSpecifier", |
| 373 |
reason: "oneof value cannot be a typed-nil", |
| 374 |
} |
| 375 |
if !all { |
| 376 |
return err |
| 377 |
} |
| 378 |
errors = append(errors, err) |
| 379 |
} |
| 380 |
oneofFilterSpecifierPresent = true |
| 381 |
|
| 382 |
if all { |
| 383 |
switch v := interface{}(m.GetTraceableFilter()).(type) { |
| 384 |
case interface{ ValidateAll() error }: |
| 385 |
if err := v.ValidateAll(); err != nil { |
| 386 |
errors = append(errors, AccessLogFilterValidationError{ |
| 387 |
field: "TraceableFilter", |
| 388 |
reason: "embedded message failed validation", |
| 389 |
cause: err, |
| 390 |
}) |
| 391 |
} |
| 392 |
case interface{ Validate() error }: |
| 393 |
if err := v.Validate(); err != nil { |
| 394 |
errors = append(errors, AccessLogFilterValidationError{ |
| 395 |
field: "TraceableFilter", |
| 396 |
reason: "embedded message failed validation", |
| 397 |
cause: err, |
| 398 |
}) |
| 399 |
} |
| 400 |
} |
| 401 |
} else if v, ok := interface{}(m.GetTraceableFilter()).(interface{ Validate() error }); ok { |
| 402 |
if err := v.Validate(); err != nil { |
| 403 |
return AccessLogFilterValidationError{ |
| 404 |
field: "TraceableFilter", |
| 405 |
reason: "embedded message failed validation", |
| 406 |
cause: err, |
| 407 |
} |
| 408 |
} |
| 409 |
} |
| 410 |
|
| 411 |
case *AccessLogFilter_RuntimeFilter: |
| 412 |
if v == nil { |
| 413 |
err := AccessLogFilterValidationError{ |
| 414 |
field: "FilterSpecifier", |
| 415 |
reason: "oneof value cannot be a typed-nil", |
| 416 |
} |
| 417 |
if !all { |
| 418 |
return err |
| 419 |
} |
| 420 |
errors = append(errors, err) |
| 421 |
} |
| 422 |
oneofFilterSpecifierPresent = true |
| 423 |
|
| 424 |
if all { |
| 425 |
switch v := interface{}(m.GetRuntimeFilter()).(type) { |
| 426 |
case interface{ ValidateAll() error }: |
| 427 |
if err := v.ValidateAll(); err != nil { |
| 428 |
errors = append(errors, AccessLogFilterValidationError{ |
| 429 |
field: "RuntimeFilter", |
| 430 |
reason: "embedded message failed validation", |
| 431 |
cause: err, |
| 432 |
}) |
| 433 |
} |
| 434 |
case interface{ Validate() error }: |
| 435 |
if err := v.Validate(); err != nil { |
| 436 |
errors = append(errors, AccessLogFilterValidationError{ |
| 437 |
field: "RuntimeFilter", |
| 438 |
reason: "embedded message failed validation", |
| 439 |
cause: err, |
| 440 |
}) |
| 441 |
} |
| 442 |
} |
| 443 |
} else if v, ok := interface{}(m.GetRuntimeFilter()).(interface{ Validate() error }); ok { |
| 444 |
if err := v.Validate(); err != nil { |
| 445 |
return AccessLogFilterValidationError{ |
| 446 |
field: "RuntimeFilter", |
| 447 |
reason: "embedded message failed validation", |
| 448 |
cause: err, |
| 449 |
} |
| 450 |
} |
| 451 |
} |
| 452 |
|
| 453 |
case *AccessLogFilter_AndFilter: |
| 454 |
if v == nil { |
| 455 |
err := AccessLogFilterValidationError{ |
| 456 |
field: "FilterSpecifier", |
| 457 |
reason: "oneof value cannot be a typed-nil", |
| 458 |
} |
| 459 |
if !all { |
| 460 |
return err |
| 461 |
} |
| 462 |
errors = append(errors, err) |
| 463 |
} |
| 464 |
oneofFilterSpecifierPresent = true |
| 465 |
|
| 466 |
if all { |
| 467 |
switch v := interface{}(m.GetAndFilter()).(type) { |
| 468 |
case interface{ ValidateAll() error }: |
| 469 |
if err := v.ValidateAll(); err != nil { |
| 470 |
errors = append(errors, AccessLogFilterValidationError{ |
| 471 |
field: "AndFilter", |
| 472 |
reason: "embedded message failed validation", |
| 473 |
cause: err, |
| 474 |
}) |
| 475 |
} |
| 476 |
case interface{ Validate() error }: |
| 477 |
if err := v.Validate(); err != nil { |
| 478 |
errors = append(errors, AccessLogFilterValidationError{ |
| 479 |
field: "AndFilter", |
| 480 |
reason: "embedded message failed validation", |
| 481 |
cause: err, |
| 482 |
}) |
| 483 |
} |
| 484 |
} |
| 485 |
} else if v, ok := interface{}(m.GetAndFilter()).(interface{ Validate() error }); ok { |
| 486 |
if err := v.Validate(); err != nil { |
| 487 |
return AccessLogFilterValidationError{ |
| 488 |
field: "AndFilter", |
| 489 |
reason: "embedded message failed validation", |
| 490 |
cause: err, |
| 491 |
} |
| 492 |
} |
| 493 |
} |
| 494 |
|
| 495 |
case *AccessLogFilter_OrFilter: |
| 496 |
if v == nil { |
| 497 |
err := AccessLogFilterValidationError{ |
| 498 |
field: "FilterSpecifier", |
| 499 |
reason: "oneof value cannot be a typed-nil", |
| 500 |
} |
| 501 |
if !all { |
| 502 |
return err |
| 503 |
} |
| 504 |
errors = append(errors, err) |
| 505 |
} |
| 506 |
oneofFilterSpecifierPresent = true |
| 507 |
|
| 508 |
if all { |
| 509 |
switch v := interface{}(m.GetOrFilter()).(type) { |
| 510 |
case interface{ ValidateAll() error }: |
| 511 |
if err := v.ValidateAll(); err != nil { |
| 512 |
errors = append(errors, AccessLogFilterValidationError{ |
| 513 |
field: "OrFilter", |
| 514 |
reason: "embedded message failed validation", |
| 515 |
cause: err, |
| 516 |
}) |
| 517 |
} |
| 518 |
case interface{ Validate() error }: |
| 519 |
if err := v.Validate(); err != nil { |
| 520 |
errors = append(errors, AccessLogFilterValidationError{ |
| 521 |
field: "OrFilter", |
| 522 |
reason: "embedded message failed validation", |
| 523 |
cause: err, |
| 524 |
}) |
| 525 |
} |
| 526 |
} |
| 527 |
} else if v, ok := interface{}(m.GetOrFilter()).(interface{ Validate() error }); ok { |
| 528 |
if err := v.Validate(); err != nil { |
| 529 |
return AccessLogFilterValidationError{ |
| 530 |
field: "OrFilter", |
| 531 |
reason: "embedded message failed validation", |
| 532 |
cause: err, |
| 533 |
} |
| 534 |
} |
| 535 |
} |
| 536 |
|
| 537 |
case *AccessLogFilter_HeaderFilter: |
| 538 |
if v == nil { |
| 539 |
err := AccessLogFilterValidationError{ |
| 540 |
field: "FilterSpecifier", |
| 541 |
reason: "oneof value cannot be a typed-nil", |
| 542 |
} |
| 543 |
if !all { |
| 544 |
return err |
| 545 |
} |
| 546 |
errors = append(errors, err) |
| 547 |
} |
| 548 |
oneofFilterSpecifierPresent = true |
| 549 |
|
| 550 |
if all { |
| 551 |
switch v := interface{}(m.GetHeaderFilter()).(type) { |
| 552 |
case interface{ ValidateAll() error }: |
| 553 |
if err := v.ValidateAll(); err != nil { |
| 554 |
errors = append(errors, AccessLogFilterValidationError{ |
| 555 |
field: "HeaderFilter", |
| 556 |
reason: "embedded message failed validation", |
| 557 |
cause: err, |
| 558 |
}) |
| 559 |
} |
| 560 |
case interface{ Validate() error }: |
| 561 |
if err := v.Validate(); err != nil { |
| 562 |
errors = append(errors, AccessLogFilterValidationError{ |
| 563 |
field: "HeaderFilter", |
| 564 |
reason: "embedded message failed validation", |
| 565 |
cause: err, |
| 566 |
}) |
| 567 |
} |
| 568 |
} |
| 569 |
} else if v, ok := interface{}(m.GetHeaderFilter()).(interface{ Validate() error }); ok { |
| 570 |
if err := v.Validate(); err != nil { |
| 571 |
return AccessLogFilterValidationError{ |
| 572 |
field: "HeaderFilter", |
| 573 |
reason: "embedded message failed validation", |
| 574 |
cause: err, |
| 575 |
} |
| 576 |
} |
| 577 |
} |
| 578 |
|
| 579 |
case *AccessLogFilter_ResponseFlagFilter: |
| 580 |
if v == nil { |
| 581 |
err := AccessLogFilterValidationError{ |
| 582 |
field: "FilterSpecifier", |
| 583 |
reason: "oneof value cannot be a typed-nil", |
| 584 |
} |
| 585 |
if !all { |
| 586 |
return err |
| 587 |
} |
| 588 |
errors = append(errors, err) |
| 589 |
} |
| 590 |
oneofFilterSpecifierPresent = true |
| 591 |
|
| 592 |
if all { |
| 593 |
switch v := interface{}(m.GetResponseFlagFilter()).(type) { |
| 594 |
case interface{ ValidateAll() error }: |
| 595 |
if err := v.ValidateAll(); err != nil { |
| 596 |
errors = append(errors, AccessLogFilterValidationError{ |
| 597 |
field: "ResponseFlagFilter", |
| 598 |
reason: "embedded message failed validation", |
| 599 |
cause: err, |
| 600 |
}) |
| 601 |
} |
| 602 |
case interface{ Validate() error }: |
| 603 |
if err := v.Validate(); err != nil { |
| 604 |
errors = append(errors, AccessLogFilterValidationError{ |
| 605 |
field: "ResponseFlagFilter", |
| 606 |
reason: "embedded message failed validation", |
| 607 |
cause: err, |
| 608 |
}) |
| 609 |
} |
| 610 |
} |
| 611 |
} else if v, ok := interface{}(m.GetResponseFlagFilter()).(interface{ Validate() error }); ok { |
| 612 |
if err := v.Validate(); err != nil { |
| 613 |
return AccessLogFilterValidationError{ |
| 614 |
field: "ResponseFlagFilter", |
| 615 |
reason: "embedded message failed validation", |
| 616 |
cause: err, |
| 617 |
} |
| 618 |
} |
| 619 |
} |
| 620 |
|
| 621 |
case *AccessLogFilter_GrpcStatusFilter: |
| 622 |
if v == nil { |
| 623 |
err := AccessLogFilterValidationError{ |
| 624 |
field: "FilterSpecifier", |
| 625 |
reason: "oneof value cannot be a typed-nil", |
| 626 |
} |
| 627 |
if !all { |
| 628 |
return err |
| 629 |
} |
| 630 |
errors = append(errors, err) |
| 631 |
} |
| 632 |
oneofFilterSpecifierPresent = true |
| 633 |
|
| 634 |
if all { |
| 635 |
switch v := interface{}(m.GetGrpcStatusFilter()).(type) { |
| 636 |
case interface{ ValidateAll() error }: |
| 637 |
if err := v.ValidateAll(); err != nil { |
| 638 |
errors = append(errors, AccessLogFilterValidationError{ |
| 639 |
field: "GrpcStatusFilter", |
| 640 |
reason: "embedded message failed validation", |
| 641 |
cause: err, |
| 642 |
}) |
| 643 |
} |
| 644 |
case interface{ Validate() error }: |
| 645 |
if err := v.Validate(); err != nil { |
| 646 |
errors = append(errors, AccessLogFilterValidationError{ |
| 647 |
field: "GrpcStatusFilter", |
| 648 |
reason: "embedded message failed validation", |
| 649 |
cause: err, |
| 650 |
}) |
| 651 |
} |
| 652 |
} |
| 653 |
} else if v, ok := interface{}(m.GetGrpcStatusFilter()).(interface{ Validate() error }); ok { |
| 654 |
if err := v.Validate(); err != nil { |
| 655 |
return AccessLogFilterValidationError{ |
| 656 |
field: "GrpcStatusFilter", |
| 657 |
reason: "embedded message failed validation", |
| 658 |
cause: err, |
| 659 |
} |
| 660 |
} |
| 661 |
} |
| 662 |
|
| 663 |
case *AccessLogFilter_ExtensionFilter: |
| 664 |
if v == nil { |
| 665 |
err := AccessLogFilterValidationError{ |
| 666 |
field: "FilterSpecifier", |
| 667 |
reason: "oneof value cannot be a typed-nil", |
| 668 |
} |
| 669 |
if !all { |
| 670 |
return err |
| 671 |
} |
| 672 |
errors = append(errors, err) |
| 673 |
} |
| 674 |
oneofFilterSpecifierPresent = true |
| 675 |
|
| 676 |
if all { |
| 677 |
switch v := interface{}(m.GetExtensionFilter()).(type) { |
| 678 |
case interface{ ValidateAll() error }: |
| 679 |
if err := v.ValidateAll(); err != nil { |
| 680 |
errors = append(errors, AccessLogFilterValidationError{ |
| 681 |
field: "ExtensionFilter", |
| 682 |
reason: "embedded message failed validation", |
| 683 |
cause: err, |
| 684 |
}) |
| 685 |
} |
| 686 |
case interface{ Validate() error }: |
| 687 |
if err := v.Validate(); err != nil { |
| 688 |
errors = append(errors, AccessLogFilterValidationError{ |
| 689 |
field: "ExtensionFilter", |
| 690 |
reason: "embedded message failed validation", |
| 691 |
cause: err, |
| 692 |
}) |
| 693 |
} |
| 694 |
} |
| 695 |
} else if v, ok := interface{}(m.GetExtensionFilter()).(interface{ Validate() error }); ok { |
| 696 |
if err := v.Validate(); err != nil { |
| 697 |
return AccessLogFilterValidationError{ |
| 698 |
field: "ExtensionFilter", |
| 699 |
reason: "embedded message failed validation", |
| 700 |
cause: err, |
| 701 |
} |
| 702 |
} |
| 703 |
} |
| 704 |
|
| 705 |
case *AccessLogFilter_MetadataFilter: |
| 706 |
if v == nil { |
| 707 |
err := AccessLogFilterValidationError{ |
| 708 |
field: "FilterSpecifier", |
| 709 |
reason: "oneof value cannot be a typed-nil", |
| 710 |
} |
| 711 |
if !all { |
| 712 |
return err |
| 713 |
} |
| 714 |
errors = append(errors, err) |
| 715 |
} |
| 716 |
oneofFilterSpecifierPresent = true |
| 717 |
|
| 718 |
if all { |
| 719 |
switch v := interface{}(m.GetMetadataFilter()).(type) { |
| 720 |
case interface{ ValidateAll() error }: |
| 721 |
if err := v.ValidateAll(); err != nil { |
| 722 |
errors = append(errors, AccessLogFilterValidationError{ |
| 723 |
field: "MetadataFilter", |
| 724 |
reason: "embedded message failed validation", |
| 725 |
cause: err, |
| 726 |
}) |
| 727 |
} |
| 728 |
case interface{ Validate() error }: |
| 729 |
if err := v.Validate(); err != nil { |
| 730 |
errors = append(errors, AccessLogFilterValidationError{ |
| 731 |
field: "MetadataFilter", |
| 732 |
reason: "embedded message failed validation", |
| 733 |
cause: err, |
| 734 |
}) |
| 735 |
} |
| 736 |
} |
| 737 |
} else if v, ok := interface{}(m.GetMetadataFilter()).(interface{ Validate() error }); ok { |
| 738 |
if err := v.Validate(); err != nil { |
| 739 |
return AccessLogFilterValidationError{ |
| 740 |
field: "MetadataFilter", |
| 741 |
reason: "embedded message failed validation", |
| 742 |
cause: err, |
| 743 |
} |
| 744 |
} |
| 745 |
} |
| 746 |
|
| 747 |
case *AccessLogFilter_LogTypeFilter: |
| 748 |
if v == nil { |
| 749 |
err := AccessLogFilterValidationError{ |
| 750 |
field: "FilterSpecifier", |
| 751 |
reason: "oneof value cannot be a typed-nil", |
| 752 |
} |
| 753 |
if !all { |
| 754 |
return err |
| 755 |
} |
| 756 |
errors = append(errors, err) |
| 757 |
} |
| 758 |
oneofFilterSpecifierPresent = true |
| 759 |
|
| 760 |
if all { |
| 761 |
switch v := interface{}(m.GetLogTypeFilter()).(type) { |
| 762 |
case interface{ ValidateAll() error }: |
| 763 |
if err := v.ValidateAll(); err != nil { |
| 764 |
errors = append(errors, AccessLogFilterValidationError{ |
| 765 |
field: "LogTypeFilter", |
| 766 |
reason: "embedded message failed validation", |
| 767 |
cause: err, |
| 768 |
}) |
| 769 |
} |
| 770 |
case interface{ Validate() error }: |
| 771 |
if err := v.Validate(); err != nil { |
| 772 |
errors = append(errors, AccessLogFilterValidationError{ |
| 773 |
field: "LogTypeFilter", |
| 774 |
reason: "embedded message failed validation", |
| 775 |
cause: err, |
| 776 |
}) |
| 777 |
} |
| 778 |
} |
| 779 |
} else if v, ok := interface{}(m.GetLogTypeFilter()).(interface{ Validate() error }); ok { |
| 780 |
if err := v.Validate(); err != nil { |
| 781 |
return AccessLogFilterValidationError{ |
| 782 |
field: "LogTypeFilter", |
| 783 |
reason: "embedded message failed validation", |
| 784 |
cause: err, |
| 785 |
} |
| 786 |
} |
| 787 |
} |
| 788 |
|
| 789 |
default: |
| 790 |
_ = v // ensures v is used |
| 791 |
} |
| 792 |
if !oneofFilterSpecifierPresent { |
| 793 |
err := AccessLogFilterValidationError{ |
| 794 |
field: "FilterSpecifier", |
| 795 |
reason: "value is required", |
| 796 |
} |
| 797 |
if !all { |
| 798 |
return err |
| 799 |
} |
| 800 |
errors = append(errors, err) |
| 801 |
} |
| 802 |
|
| 803 |
if len(errors) > 0 { |
| 804 |
return AccessLogFilterMultiError(errors) |
| 805 |
} |
| 806 |
|
| 807 |
return nil |
| 808 |
} |
| 809 |
|
| 810 |
// AccessLogFilterMultiError is an error wrapping multiple validation errors |
| 811 |
// returned by AccessLogFilter.ValidateAll() if the designated constraints |
| 812 |
// aren't met. |
| 813 |
type AccessLogFilterMultiError []error |
| 814 |
|
| 815 |
// Error returns a concatenation of all the error messages it wraps. |
| 816 |
func (m AccessLogFilterMultiError) Error() string { |
| 817 |
var msgs []string |
| 818 |
for _, err := range m { |
| 819 |
msgs = append(msgs, err.Error()) |
| 820 |
} |
| 821 |
return strings.Join(msgs, "; ") |
| 822 |
} |
| 823 |
|
| 824 |
// AllErrors returns a list of validation violation errors. |
| 825 |
func (m AccessLogFilterMultiError) AllErrors() []error { return m } |
| 826 |
|
| 827 |
// AccessLogFilterValidationError is the validation error returned by |
| 828 |
// AccessLogFilter.Validate if the designated constraints aren't met. |
| 829 |
type AccessLogFilterValidationError struct { |
| 830 |
field string |
| 831 |
reason string |
| 832 |
cause error |
| 833 |
key bool |
| 834 |
} |
| 835 |
|
| 836 |
// Field function returns field value. |
| 837 |
func (e AccessLogFilterValidationError) Field() string { return e.field } |
| 838 |
|
| 839 |
// Reason function returns reason value. |
| 840 |
func (e AccessLogFilterValidationError) Reason() string { return e.reason } |
| 841 |
|
| 842 |
// Cause function returns cause value. |
| 843 |
func (e AccessLogFilterValidationError) Cause() error { return e.cause } |
| 844 |
|
| 845 |
// Key function returns key value. |
| 846 |
func (e AccessLogFilterValidationError) Key() bool { return e.key } |
| 847 |
|
| 848 |
// ErrorName returns error name. |
| 849 |
func (e AccessLogFilterValidationError) ErrorName() string { return "AccessLogFilterValidationError" } |
| 850 |
|
| 851 |
// Error satisfies the builtin error interface |
| 852 |
func (e AccessLogFilterValidationError) Error() string { |
| 853 |
cause := "" |
| 854 |
if e.cause != nil { |
| 855 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 856 |
} |
| 857 |
|
| 858 |
key := "" |
| 859 |
if e.key { |
| 860 |
key = "key for " |
| 861 |
} |
| 862 |
|
| 863 |
return fmt.Sprintf( |
| 864 |
"invalid %sAccessLogFilter.%s: %s%s", |
| 865 |
key, |
| 866 |
e.field, |
| 867 |
e.reason, |
| 868 |
cause) |
| 869 |
} |
| 870 |
|
| 871 |
var _ error = AccessLogFilterValidationError{} |
| 872 |
|
| 873 |
var _ interface { |
| 874 |
Field() string |
| 875 |
Reason() string |
| 876 |
Key() bool |
| 877 |
Cause() error |
| 878 |
ErrorName() string |
| 879 |
} = AccessLogFilterValidationError{} |
| 880 |
|
| 881 |
// Validate checks the field values on ComparisonFilter with the rules defined |
| 882 |
// in the proto definition for this message. If any rules are violated, the |
| 883 |
// first error encountered is returned, or nil if there are no violations. |
| 884 |
func (m *ComparisonFilter) Validate() error { |
| 885 |
return m.validate(false) |
| 886 |
} |
| 887 |
|
| 888 |
// ValidateAll checks the field values on ComparisonFilter with the rules |
| 889 |
// defined in the proto definition for this message. If any rules are |
| 890 |
// violated, the result is a list of violation errors wrapped in |
| 891 |
// ComparisonFilterMultiError, or nil if none found. |
| 892 |
func (m *ComparisonFilter) ValidateAll() error { |
| 893 |
return m.validate(true) |
| 894 |
} |
| 895 |
|
| 896 |
func (m *ComparisonFilter) validate(all bool) error { |
| 897 |
if m == nil { |
| 898 |
return nil |
| 899 |
} |
| 900 |
|
| 901 |
var errors []error |
| 902 |
|
| 903 |
if _, ok := ComparisonFilter_Op_name[int32(m.GetOp())]; !ok { |
| 904 |
err := ComparisonFilterValidationError{ |
| 905 |
field: "Op", |
| 906 |
reason: "value must be one of the defined enum values", |
| 907 |
} |
| 908 |
if !all { |
| 909 |
return err |
| 910 |
} |
| 911 |
errors = append(errors, err) |
| 912 |
} |
| 913 |
|
| 914 |
if m.GetValue() == nil { |
| 915 |
err := ComparisonFilterValidationError{ |
| 916 |
field: "Value", |
| 917 |
reason: "value is required", |
| 918 |
} |
| 919 |
if !all { |
| 920 |
return err |
| 921 |
} |
| 922 |
errors = append(errors, err) |
| 923 |
} |
| 924 |
|
| 925 |
if all { |
| 926 |
switch v := interface{}(m.GetValue()).(type) { |
| 927 |
case interface{ ValidateAll() error }: |
| 928 |
if err := v.ValidateAll(); err != nil { |
| 929 |
errors = append(errors, ComparisonFilterValidationError{ |
| 930 |
field: "Value", |
| 931 |
reason: "embedded message failed validation", |
| 932 |
cause: err, |
| 933 |
}) |
| 934 |
} |
| 935 |
case interface{ Validate() error }: |
| 936 |
if err := v.Validate(); err != nil { |
| 937 |
errors = append(errors, ComparisonFilterValidationError{ |
| 938 |
field: "Value", |
| 939 |
reason: "embedded message failed validation", |
| 940 |
cause: err, |
| 941 |
}) |
| 942 |
} |
| 943 |
} |
| 944 |
} else if v, ok := interface{}(m.GetValue()).(interface{ Validate() error }); ok { |
| 945 |
if err := v.Validate(); err != nil { |
| 946 |
return ComparisonFilterValidationError{ |
| 947 |
field: "Value", |
| 948 |
reason: "embedded message failed validation", |
| 949 |
cause: err, |
| 950 |
} |
| 951 |
} |
| 952 |
} |
| 953 |
|
| 954 |
if len(errors) > 0 { |
| 955 |
return ComparisonFilterMultiError(errors) |
| 956 |
} |
| 957 |
|
| 958 |
return nil |
| 959 |
} |
| 960 |
|
| 961 |
// ComparisonFilterMultiError is an error wrapping multiple validation errors |
| 962 |
// returned by ComparisonFilter.ValidateAll() if the designated constraints |
| 963 |
// aren't met. |
| 964 |
type ComparisonFilterMultiError []error |
| 965 |
|
| 966 |
// Error returns a concatenation of all the error messages it wraps. |
| 967 |
func (m ComparisonFilterMultiError) Error() string { |
| 968 |
var msgs []string |
| 969 |
for _, err := range m { |
| 970 |
msgs = append(msgs, err.Error()) |
| 971 |
} |
| 972 |
return strings.Join(msgs, "; ") |
| 973 |
} |
| 974 |
|
| 975 |
// AllErrors returns a list of validation violation errors. |
| 976 |
func (m ComparisonFilterMultiError) AllErrors() []error { return m } |
| 977 |
|
| 978 |
// ComparisonFilterValidationError is the validation error returned by |
| 979 |
// ComparisonFilter.Validate if the designated constraints aren't met. |
| 980 |
type ComparisonFilterValidationError struct { |
| 981 |
field string |
| 982 |
reason string |
| 983 |
cause error |
| 984 |
key bool |
| 985 |
} |
| 986 |
|
| 987 |
// Field function returns field value. |
| 988 |
func (e ComparisonFilterValidationError) Field() string { return e.field } |
| 989 |
|
| 990 |
// Reason function returns reason value. |
| 991 |
func (e ComparisonFilterValidationError) Reason() string { return e.reason } |
| 992 |
|
| 993 |
// Cause function returns cause value. |
| 994 |
func (e ComparisonFilterValidationError) Cause() error { return e.cause } |
| 995 |
|
| 996 |
// Key function returns key value. |
| 997 |
func (e ComparisonFilterValidationError) Key() bool { return e.key } |
| 998 |
|
| 999 |
// ErrorName returns error name. |
| 1000 |
func (e ComparisonFilterValidationError) ErrorName() string { return "ComparisonFilterValidationError" } |
| 1001 |
|
| 1002 |
// Error satisfies the builtin error interface |
| 1003 |
func (e ComparisonFilterValidationError) Error() string { |
| 1004 |
cause := "" |
| 1005 |
if e.cause != nil { |
| 1006 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 1007 |
} |
| 1008 |
|
| 1009 |
key := "" |
| 1010 |
if e.key { |
| 1011 |
key = "key for " |
| 1012 |
} |
| 1013 |
|
| 1014 |
return fmt.Sprintf( |
| 1015 |
"invalid %sComparisonFilter.%s: %s%s", |
| 1016 |
key, |
| 1017 |
e.field, |
| 1018 |
e.reason, |
| 1019 |
cause) |
| 1020 |
} |
| 1021 |
|
| 1022 |
var _ error = ComparisonFilterValidationError{} |
| 1023 |
|
| 1024 |
var _ interface { |
| 1025 |
Field() string |
| 1026 |
Reason() string |
| 1027 |
Key() bool |
| 1028 |
Cause() error |
| 1029 |
ErrorName() string |
| 1030 |
} = ComparisonFilterValidationError{} |
| 1031 |
|
| 1032 |
// Validate checks the field values on StatusCodeFilter with the rules defined |
| 1033 |
// in the proto definition for this message. If any rules are violated, the |
| 1034 |
// first error encountered is returned, or nil if there are no violations. |
| 1035 |
func (m *StatusCodeFilter) Validate() error { |
| 1036 |
return m.validate(false) |
| 1037 |
} |
| 1038 |
|
| 1039 |
// ValidateAll checks the field values on StatusCodeFilter with the rules |
| 1040 |
// defined in the proto definition for this message. If any rules are |
| 1041 |
// violated, the result is a list of violation errors wrapped in |
| 1042 |
// StatusCodeFilterMultiError, or nil if none found. |
| 1043 |
func (m *StatusCodeFilter) ValidateAll() error { |
| 1044 |
return m.validate(true) |
| 1045 |
} |
| 1046 |
|
| 1047 |
func (m *StatusCodeFilter) validate(all bool) error { |
| 1048 |
if m == nil { |
| 1049 |
return nil |
| 1050 |
} |
| 1051 |
|
| 1052 |
var errors []error |
| 1053 |
|
| 1054 |
if m.GetComparison() == nil { |
| 1055 |
err := StatusCodeFilterValidationError{ |
| 1056 |
field: "Comparison", |
| 1057 |
reason: "value is required", |
| 1058 |
} |
| 1059 |
if !all { |
| 1060 |
return err |
| 1061 |
} |
| 1062 |
errors = append(errors, err) |
| 1063 |
} |
| 1064 |
|
| 1065 |
if all { |
| 1066 |
switch v := interface{}(m.GetComparison()).(type) { |
| 1067 |
case interface{ ValidateAll() error }: |
| 1068 |
if err := v.ValidateAll(); err != nil { |
| 1069 |
errors = append(errors, StatusCodeFilterValidationError{ |
| 1070 |
field: "Comparison", |
| 1071 |
reason: "embedded message failed validation", |
| 1072 |
cause: err, |
| 1073 |
}) |
| 1074 |
} |
| 1075 |
case interface{ Validate() error }: |
| 1076 |
if err := v.Validate(); err != nil { |
| 1077 |
errors = append(errors, StatusCodeFilterValidationError{ |
| 1078 |
field: "Comparison", |
| 1079 |
reason: "embedded message failed validation", |
| 1080 |
cause: err, |
| 1081 |
}) |
| 1082 |
} |
| 1083 |
} |
| 1084 |
} else if v, ok := interface{}(m.GetComparison()).(interface{ Validate() error }); ok { |
| 1085 |
if err := v.Validate(); err != nil { |
| 1086 |
return StatusCodeFilterValidationError{ |
| 1087 |
field: "Comparison", |
| 1088 |
reason: "embedded message failed validation", |
| 1089 |
cause: err, |
| 1090 |
} |
| 1091 |
} |
| 1092 |
} |
| 1093 |
|
| 1094 |
if len(errors) > 0 { |
| 1095 |
return StatusCodeFilterMultiError(errors) |
| 1096 |
} |
| 1097 |
|
| 1098 |
return nil |
| 1099 |
} |
| 1100 |
|
| 1101 |
// StatusCodeFilterMultiError is an error wrapping multiple validation errors |
| 1102 |
// returned by StatusCodeFilter.ValidateAll() if the designated constraints |
| 1103 |
// aren't met. |
| 1104 |
type StatusCodeFilterMultiError []error |
| 1105 |
|
| 1106 |
// Error returns a concatenation of all the error messages it wraps. |
| 1107 |
func (m StatusCodeFilterMultiError) Error() string { |
| 1108 |
var msgs []string |
| 1109 |
for _, err := range m { |
| 1110 |
msgs = append(msgs, err.Error()) |
| 1111 |
} |
| 1112 |
return strings.Join(msgs, "; ") |
| 1113 |
} |
| 1114 |
|
| 1115 |
// AllErrors returns a list of validation violation errors. |
| 1116 |
func (m StatusCodeFilterMultiError) AllErrors() []error { return m } |
| 1117 |
|
| 1118 |
// StatusCodeFilterValidationError is the validation error returned by |
| 1119 |
// StatusCodeFilter.Validate if the designated constraints aren't met. |
| 1120 |
type StatusCodeFilterValidationError struct { |
| 1121 |
field string |
| 1122 |
reason string |
| 1123 |
cause error |
| 1124 |
key bool |
| 1125 |
} |
| 1126 |
|
| 1127 |
// Field function returns field value. |
| 1128 |
func (e StatusCodeFilterValidationError) Field() string { return e.field } |
| 1129 |
|
| 1130 |
// Reason function returns reason value. |
| 1131 |
func (e StatusCodeFilterValidationError) Reason() string { return e.reason } |
| 1132 |
|
| 1133 |
// Cause function returns cause value. |
| 1134 |
func (e StatusCodeFilterValidationError) Cause() error { return e.cause } |
| 1135 |
|
| 1136 |
// Key function returns key value. |
| 1137 |
func (e StatusCodeFilterValidationError) Key() bool { return e.key } |
| 1138 |
|
| 1139 |
// ErrorName returns error name. |
| 1140 |
func (e StatusCodeFilterValidationError) ErrorName() string { return "StatusCodeFilterValidationError" } |
| 1141 |
|
| 1142 |
// Error satisfies the builtin error interface |
| 1143 |
func (e StatusCodeFilterValidationError) Error() string { |
| 1144 |
cause := "" |
| 1145 |
if e.cause != nil { |
| 1146 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 1147 |
} |
| 1148 |
|
| 1149 |
key := "" |
| 1150 |
if e.key { |
| 1151 |
key = "key for " |
| 1152 |
} |
| 1153 |
|
| 1154 |
return fmt.Sprintf( |
| 1155 |
"invalid %sStatusCodeFilter.%s: %s%s", |
| 1156 |
key, |
| 1157 |
e.field, |
| 1158 |
e.reason, |
| 1159 |
cause) |
| 1160 |
} |
| 1161 |
|
| 1162 |
var _ error = StatusCodeFilterValidationError{} |
| 1163 |
|
| 1164 |
var _ interface { |
| 1165 |
Field() string |
| 1166 |
Reason() string |
| 1167 |
Key() bool |
| 1168 |
Cause() error |
| 1169 |
ErrorName() string |
| 1170 |
} = StatusCodeFilterValidationError{} |
| 1171 |
|
| 1172 |
// Validate checks the field values on DurationFilter with the rules defined in |
| 1173 |
// the proto definition for this message. If any rules are violated, the first |
| 1174 |
// error encountered is returned, or nil if there are no violations. |
| 1175 |
func (m *DurationFilter) Validate() error { |
| 1176 |
return m.validate(false) |
| 1177 |
} |
| 1178 |
|
| 1179 |
// ValidateAll checks the field values on DurationFilter with the rules defined |
| 1180 |
// in the proto definition for this message. If any rules are violated, the |
| 1181 |
// result is a list of violation errors wrapped in DurationFilterMultiError, |
| 1182 |
// or nil if none found. |
| 1183 |
func (m *DurationFilter) ValidateAll() error { |
| 1184 |
return m.validate(true) |
| 1185 |
} |
| 1186 |
|
| 1187 |
func (m *DurationFilter) validate(all bool) error { |
| 1188 |
if m == nil { |
| 1189 |
return nil |
| 1190 |
} |
| 1191 |
|
| 1192 |
var errors []error |
| 1193 |
|
| 1194 |
if m.GetComparison() == nil { |
| 1195 |
err := DurationFilterValidationError{ |
| 1196 |
field: "Comparison", |
| 1197 |
reason: "value is required", |
| 1198 |
} |
| 1199 |
if !all { |
| 1200 |
return err |
| 1201 |
} |
| 1202 |
errors = append(errors, err) |
| 1203 |
} |
| 1204 |
|
| 1205 |
if all { |
| 1206 |
switch v := interface{}(m.GetComparison()).(type) { |
| 1207 |
case interface{ ValidateAll() error }: |
| 1208 |
if err := v.ValidateAll(); err != nil { |
| 1209 |
errors = append(errors, DurationFilterValidationError{ |
| 1210 |
field: "Comparison", |
| 1211 |
reason: "embedded message failed validation", |
| 1212 |
cause: err, |
| 1213 |
}) |
| 1214 |
} |
| 1215 |
case interface{ Validate() error }: |
| 1216 |
if err := v.Validate(); err != nil { |
| 1217 |
errors = append(errors, DurationFilterValidationError{ |
| 1218 |
field: "Comparison", |
| 1219 |
reason: "embedded message failed validation", |
| 1220 |
cause: err, |
| 1221 |
}) |
| 1222 |
} |
| 1223 |
} |
| 1224 |
} else if v, ok := interface{}(m.GetComparison()).(interface{ Validate() error }); ok { |
| 1225 |
if err := v.Validate(); err != nil { |
| 1226 |
return DurationFilterValidationError{ |
| 1227 |
field: "Comparison", |
| 1228 |
reason: "embedded message failed validation", |
| 1229 |
cause: err, |
| 1230 |
} |
| 1231 |
} |
| 1232 |
} |
| 1233 |
|
| 1234 |
if len(errors) > 0 { |
| 1235 |
return DurationFilterMultiError(errors) |
| 1236 |
} |
| 1237 |
|
| 1238 |
return nil |
| 1239 |
} |
| 1240 |
|
| 1241 |
// DurationFilterMultiError is an error wrapping multiple validation errors |
| 1242 |
// returned by DurationFilter.ValidateAll() if the designated constraints |
| 1243 |
// aren't met. |
| 1244 |
type DurationFilterMultiError []error |
| 1245 |
|
| 1246 |
// Error returns a concatenation of all the error messages it wraps. |
| 1247 |
func (m DurationFilterMultiError) Error() string { |
| 1248 |
var msgs []string |
| 1249 |
for _, err := range m { |
| 1250 |
msgs = append(msgs, err.Error()) |
| 1251 |
} |
| 1252 |
return strings.Join(msgs, "; ") |
| 1253 |
} |
| 1254 |
|
| 1255 |
// AllErrors returns a list of validation violation errors. |
| 1256 |
func (m DurationFilterMultiError) AllErrors() []error { return m } |
| 1257 |
|
| 1258 |
// DurationFilterValidationError is the validation error returned by |
| 1259 |
// DurationFilter.Validate if the designated constraints aren't met. |
| 1260 |
type DurationFilterValidationError struct { |
| 1261 |
field string |
| 1262 |
reason string |
| 1263 |
cause error |
| 1264 |
key bool |
| 1265 |
} |
| 1266 |
|
| 1267 |
// Field function returns field value. |
| 1268 |
func (e DurationFilterValidationError) Field() string { return e.field } |
| 1269 |
|
| 1270 |
// Reason function returns reason value. |
| 1271 |
func (e DurationFilterValidationError) Reason() string { return e.reason } |
| 1272 |
|
| 1273 |
// Cause function returns cause value. |
| 1274 |
func (e DurationFilterValidationError) Cause() error { return e.cause } |
| 1275 |
|
| 1276 |
// Key function returns key value. |
| 1277 |
func (e DurationFilterValidationError) Key() bool { return e.key } |
| 1278 |
|
| 1279 |
// ErrorName returns error name. |
| 1280 |
func (e DurationFilterValidationError) ErrorName() string { return "DurationFilterValidationError" } |
| 1281 |
|
| 1282 |
// Error satisfies the builtin error interface |
| 1283 |
func (e DurationFilterValidationError) Error() string { |
| 1284 |
cause := "" |
| 1285 |
if e.cause != nil { |
| 1286 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 1287 |
} |
| 1288 |
|
| 1289 |
key := "" |
| 1290 |
if e.key { |
| 1291 |
key = "key for " |
| 1292 |
} |
| 1293 |
|
| 1294 |
return fmt.Sprintf( |
| 1295 |
"invalid %sDurationFilter.%s: %s%s", |
| 1296 |
key, |
| 1297 |
e.field, |
| 1298 |
e.reason, |
| 1299 |
cause) |
| 1300 |
} |
| 1301 |
|
| 1302 |
var _ error = DurationFilterValidationError{} |
| 1303 |
|
| 1304 |
var _ interface { |
| 1305 |
Field() string |
| 1306 |
Reason() string |
| 1307 |
Key() bool |
| 1308 |
Cause() error |
| 1309 |
ErrorName() string |
| 1310 |
} = DurationFilterValidationError{} |
| 1311 |
|
| 1312 |
// Validate checks the field values on NotHealthCheckFilter with the rules |
| 1313 |
// defined in the proto definition for this message. If any rules are |
| 1314 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 1315 |
func (m *NotHealthCheckFilter) Validate() error { |
| 1316 |
return m.validate(false) |
| 1317 |
} |
| 1318 |
|
| 1319 |
// ValidateAll checks the field values on NotHealthCheckFilter with the rules |
| 1320 |
// defined in the proto definition for this message. If any rules are |
| 1321 |
// violated, the result is a list of violation errors wrapped in |
| 1322 |
// NotHealthCheckFilterMultiError, or nil if none found. |
| 1323 |
func (m *NotHealthCheckFilter) ValidateAll() error { |
| 1324 |
return m.validate(true) |
| 1325 |
} |
| 1326 |
|
| 1327 |
func (m *NotHealthCheckFilter) validate(all bool) error { |
| 1328 |
if m == nil { |
| 1329 |
return nil |
| 1330 |
} |
| 1331 |
|
| 1332 |
var errors []error |
| 1333 |
|
| 1334 |
if len(errors) > 0 { |
| 1335 |
return NotHealthCheckFilterMultiError(errors) |
| 1336 |
} |
| 1337 |
|
| 1338 |
return nil |
| 1339 |
} |
| 1340 |
|
| 1341 |
// NotHealthCheckFilterMultiError is an error wrapping multiple validation |
| 1342 |
// errors returned by NotHealthCheckFilter.ValidateAll() if the designated |
| 1343 |
// constraints aren't met. |
| 1344 |
type NotHealthCheckFilterMultiError []error |
| 1345 |
|
| 1346 |
// Error returns a concatenation of all the error messages it wraps. |
| 1347 |
func (m NotHealthCheckFilterMultiError) Error() string { |
| 1348 |
var msgs []string |
| 1349 |
for _, err := range m { |
| 1350 |
msgs = append(msgs, err.Error()) |
| 1351 |
} |
| 1352 |
return strings.Join(msgs, "; ") |
| 1353 |
} |
| 1354 |
|
| 1355 |
// AllErrors returns a list of validation violation errors. |
| 1356 |
func (m NotHealthCheckFilterMultiError) AllErrors() []error { return m } |
| 1357 |
|
| 1358 |
// NotHealthCheckFilterValidationError is the validation error returned by |
| 1359 |
// NotHealthCheckFilter.Validate if the designated constraints aren't met. |
| 1360 |
type NotHealthCheckFilterValidationError struct { |
| 1361 |
field string |
| 1362 |
reason string |
| 1363 |
cause error |
| 1364 |
key bool |
| 1365 |
} |
| 1366 |
|
| 1367 |
// Field function returns field value. |
| 1368 |
func (e NotHealthCheckFilterValidationError) Field() string { return e.field } |
| 1369 |
|
| 1370 |
// Reason function returns reason value. |
| 1371 |
func (e NotHealthCheckFilterValidationError) Reason() string { return e.reason } |
| 1372 |
|
| 1373 |
// Cause function returns cause value. |
| 1374 |
func (e NotHealthCheckFilterValidationError) Cause() error { return e.cause } |
| 1375 |
|
| 1376 |
// Key function returns key value. |
| 1377 |
func (e NotHealthCheckFilterValidationError) Key() bool { return e.key } |
| 1378 |
|
| 1379 |
// ErrorName returns error name. |
| 1380 |
func (e NotHealthCheckFilterValidationError) ErrorName() string { |
| 1381 |
return "NotHealthCheckFilterValidationError" |
| 1382 |
} |
| 1383 |
|
| 1384 |
// Error satisfies the builtin error interface |
| 1385 |
func (e NotHealthCheckFilterValidationError) Error() string { |
| 1386 |
cause := "" |
| 1387 |
if e.cause != nil { |
| 1388 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 1389 |
} |
| 1390 |
|
| 1391 |
key := "" |
| 1392 |
if e.key { |
| 1393 |
key = "key for " |
| 1394 |
} |
| 1395 |
|
| 1396 |
return fmt.Sprintf( |
| 1397 |
"invalid %sNotHealthCheckFilter.%s: %s%s", |
| 1398 |
key, |
| 1399 |
e.field, |
| 1400 |
e.reason, |
| 1401 |
cause) |
| 1402 |
} |
| 1403 |
|
| 1404 |
var _ error = NotHealthCheckFilterValidationError{} |
| 1405 |
|
| 1406 |
var _ interface { |
| 1407 |
Field() string |
| 1408 |
Reason() string |
| 1409 |
Key() bool |
| 1410 |
Cause() error |
| 1411 |
ErrorName() string |
| 1412 |
} = NotHealthCheckFilterValidationError{} |
| 1413 |
|
| 1414 |
// Validate checks the field values on TraceableFilter with the rules defined |
| 1415 |
// in the proto definition for this message. If any rules are violated, the |
| 1416 |
// first error encountered is returned, or nil if there are no violations. |
| 1417 |
func (m *TraceableFilter) Validate() error { |
| 1418 |
return m.validate(false) |
| 1419 |
} |
| 1420 |
|
| 1421 |
// ValidateAll checks the field values on TraceableFilter with the rules |
| 1422 |
// defined in the proto definition for this message. If any rules are |
| 1423 |
// violated, the result is a list of violation errors wrapped in |
| 1424 |
// TraceableFilterMultiError, or nil if none found. |
| 1425 |
func (m *TraceableFilter) ValidateAll() error { |
| 1426 |
return m.validate(true) |
| 1427 |
} |
| 1428 |
|
| 1429 |
func (m *TraceableFilter) validate(all bool) error { |
| 1430 |
if m == nil { |
| 1431 |
return nil |
| 1432 |
} |
| 1433 |
|
| 1434 |
var errors []error |
| 1435 |
|
| 1436 |
if len(errors) > 0 { |
| 1437 |
return TraceableFilterMultiError(errors) |
| 1438 |
} |
| 1439 |
|
| 1440 |
return nil |
| 1441 |
} |
| 1442 |
|
| 1443 |
// TraceableFilterMultiError is an error wrapping multiple validation errors |
| 1444 |
// returned by TraceableFilter.ValidateAll() if the designated constraints |
| 1445 |
// aren't met. |
| 1446 |
type TraceableFilterMultiError []error |
| 1447 |
|
| 1448 |
// Error returns a concatenation of all the error messages it wraps. |
| 1449 |
func (m TraceableFilterMultiError) Error() string { |
| 1450 |
var msgs []string |
| 1451 |
for _, err := range m { |
| 1452 |
msgs = append(msgs, err.Error()) |
| 1453 |
} |
| 1454 |
return strings.Join(msgs, "; ") |
| 1455 |
} |
| 1456 |
|
| 1457 |
// AllErrors returns a list of validation violation errors. |
| 1458 |
func (m TraceableFilterMultiError) AllErrors() []error { return m } |
| 1459 |
|
| 1460 |
// TraceableFilterValidationError is the validation error returned by |
| 1461 |
// TraceableFilter.Validate if the designated constraints aren't met. |
| 1462 |
type TraceableFilterValidationError struct { |
| 1463 |
field string |
| 1464 |
reason string |
| 1465 |
cause error |
| 1466 |
key bool |
| 1467 |
} |
| 1468 |
|
| 1469 |
// Field function returns field value. |
| 1470 |
func (e TraceableFilterValidationError) Field() string { return e.field } |
| 1471 |
|
| 1472 |
// Reason function returns reason value. |
| 1473 |
func (e TraceableFilterValidationError) Reason() string { return e.reason } |
| 1474 |
|
| 1475 |
// Cause function returns cause value. |
| 1476 |
func (e TraceableFilterValidationError) Cause() error { return e.cause } |
| 1477 |
|
| 1478 |
// Key function returns key value. |
| 1479 |
func (e TraceableFilterValidationError) Key() bool { return e.key } |
| 1480 |
|
| 1481 |
// ErrorName returns error name. |
| 1482 |
func (e TraceableFilterValidationError) ErrorName() string { return "TraceableFilterValidationError" } |
| 1483 |
|
| 1484 |
// Error satisfies the builtin error interface |
| 1485 |
func (e TraceableFilterValidationError) Error() string { |
| 1486 |
cause := "" |
| 1487 |
if e.cause != nil { |
| 1488 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 1489 |
} |
| 1490 |
|
| 1491 |
key := "" |
| 1492 |
if e.key { |
| 1493 |
key = "key for " |
| 1494 |
} |
| 1495 |
|
| 1496 |
return fmt.Sprintf( |
| 1497 |
"invalid %sTraceableFilter.%s: %s%s", |
| 1498 |
key, |
| 1499 |
e.field, |
| 1500 |
e.reason, |
| 1501 |
cause) |
| 1502 |
} |
| 1503 |
|
| 1504 |
var _ error = TraceableFilterValidationError{} |
| 1505 |
|
| 1506 |
var _ interface { |
| 1507 |
Field() string |
| 1508 |
Reason() string |
| 1509 |
Key() bool |
| 1510 |
Cause() error |
| 1511 |
ErrorName() string |
| 1512 |
} = TraceableFilterValidationError{} |
| 1513 |
|
| 1514 |
// Validate checks the field values on RuntimeFilter with the rules defined in |
| 1515 |
// the proto definition for this message. If any rules are violated, the first |
| 1516 |
// error encountered is returned, or nil if there are no violations. |
| 1517 |
func (m *RuntimeFilter) Validate() error { |
| 1518 |
return m.validate(false) |
| 1519 |
} |
| 1520 |
|
| 1521 |
// ValidateAll checks the field values on RuntimeFilter with the rules defined |
| 1522 |
// in the proto definition for this message. If any rules are violated, the |
| 1523 |
// result is a list of violation errors wrapped in RuntimeFilterMultiError, or |
| 1524 |
// nil if none found. |
| 1525 |
func (m *RuntimeFilter) ValidateAll() error { |
| 1526 |
return m.validate(true) |
| 1527 |
} |
| 1528 |
|
| 1529 |
func (m *RuntimeFilter) validate(all bool) error { |
| 1530 |
if m == nil { |
| 1531 |
return nil |
| 1532 |
} |
| 1533 |
|
| 1534 |
var errors []error |
| 1535 |
|
| 1536 |
if utf8.RuneCountInString(m.GetRuntimeKey()) < 1 { |
| 1537 |
err := RuntimeFilterValidationError{ |
| 1538 |
field: "RuntimeKey", |
| 1539 |
reason: "value length must be at least 1 runes", |
| 1540 |
} |
| 1541 |
if !all { |
| 1542 |
return err |
| 1543 |
} |
| 1544 |
errors = append(errors, err) |
| 1545 |
} |
| 1546 |
|
| 1547 |
if all { |
| 1548 |
switch v := interface{}(m.GetPercentSampled()).(type) { |
| 1549 |
case interface{ ValidateAll() error }: |
| 1550 |
if err := v.ValidateAll(); err != nil { |
| 1551 |
errors = append(errors, RuntimeFilterValidationError{ |
| 1552 |
field: "PercentSampled", |
| 1553 |
reason: "embedded message failed validation", |
| 1554 |
cause: err, |
| 1555 |
}) |
| 1556 |
} |
| 1557 |
case interface{ Validate() error }: |
| 1558 |
if err := v.Validate(); err != nil { |
| 1559 |
errors = append(errors, RuntimeFilterValidationError{ |
| 1560 |
field: "PercentSampled", |
| 1561 |
reason: "embedded message failed validation", |
| 1562 |
cause: err, |
| 1563 |
}) |
| 1564 |
} |
| 1565 |
} |
| 1566 |
} else if v, ok := interface{}(m.GetPercentSampled()).(interface{ Validate() error }); ok { |
| 1567 |
if err := v.Validate(); err != nil { |
| 1568 |
return RuntimeFilterValidationError{ |
| 1569 |
field: "PercentSampled", |
| 1570 |
reason: "embedded message failed validation", |
| 1571 |
cause: err, |
| 1572 |
} |
| 1573 |
} |
| 1574 |
} |
| 1575 |
|
| 1576 |
// no validation rules for UseIndependentRandomness |
| 1577 |
|
| 1578 |
if len(errors) > 0 { |
| 1579 |
return RuntimeFilterMultiError(errors) |
| 1580 |
} |
| 1581 |
|
| 1582 |
return nil |
| 1583 |
} |
| 1584 |
|
| 1585 |
// RuntimeFilterMultiError is an error wrapping multiple validation errors |
| 1586 |
// returned by RuntimeFilter.ValidateAll() if the designated constraints |
| 1587 |
// aren't met. |
| 1588 |
type RuntimeFilterMultiError []error |
| 1589 |
|
| 1590 |
// Error returns a concatenation of all the error messages it wraps. |
| 1591 |
func (m RuntimeFilterMultiError) Error() string { |
| 1592 |
var msgs []string |
| 1593 |
for _, err := range m { |
| 1594 |
msgs = append(msgs, err.Error()) |
| 1595 |
} |
| 1596 |
return strings.Join(msgs, "; ") |
| 1597 |
} |
| 1598 |
|
| 1599 |
// AllErrors returns a list of validation violation errors. |
| 1600 |
func (m RuntimeFilterMultiError) AllErrors() []error { return m } |
| 1601 |
|
| 1602 |
// RuntimeFilterValidationError is the validation error returned by |
| 1603 |
// RuntimeFilter.Validate if the designated constraints aren't met. |
| 1604 |
type RuntimeFilterValidationError struct { |
| 1605 |
field string |
| 1606 |
reason string |
| 1607 |
cause error |
| 1608 |
key bool |
| 1609 |
} |
| 1610 |
|
| 1611 |
// Field function returns field value. |
| 1612 |
func (e RuntimeFilterValidationError) Field() string { return e.field } |
| 1613 |
|
| 1614 |
// Reason function returns reason value. |
| 1615 |
func (e RuntimeFilterValidationError) Reason() string { return e.reason } |
| 1616 |
|
| 1617 |
// Cause function returns cause value. |
| 1618 |
func (e RuntimeFilterValidationError) Cause() error { return e.cause } |
| 1619 |
|
| 1620 |
// Key function returns key value. |
| 1621 |
func (e RuntimeFilterValidationError) Key() bool { return e.key } |
| 1622 |
|
| 1623 |
// ErrorName returns error name. |
| 1624 |
func (e RuntimeFilterValidationError) ErrorName() string { return "RuntimeFilterValidationError" } |
| 1625 |
|
| 1626 |
// Error satisfies the builtin error interface |
| 1627 |
func (e RuntimeFilterValidationError) Error() string { |
| 1628 |
cause := "" |
| 1629 |
if e.cause != nil { |
| 1630 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 1631 |
} |
| 1632 |
|
| 1633 |
key := "" |
| 1634 |
if e.key { |
| 1635 |
key = "key for " |
| 1636 |
} |
| 1637 |
|
| 1638 |
return fmt.Sprintf( |
| 1639 |
"invalid %sRuntimeFilter.%s: %s%s", |
| 1640 |
key, |
| 1641 |
e.field, |
| 1642 |
e.reason, |
| 1643 |
cause) |
| 1644 |
} |
| 1645 |
|
| 1646 |
var _ error = RuntimeFilterValidationError{} |
| 1647 |
|
| 1648 |
var _ interface { |
| 1649 |
Field() string |
| 1650 |
Reason() string |
| 1651 |
Key() bool |
| 1652 |
Cause() error |
| 1653 |
ErrorName() string |
| 1654 |
} = RuntimeFilterValidationError{} |
| 1655 |
|
| 1656 |
// Validate checks the field values on AndFilter with the rules defined in the |
| 1657 |
// proto definition for this message. If any rules are violated, the first |
| 1658 |
// error encountered is returned, or nil if there are no violations. |
| 1659 |
func (m *AndFilter) Validate() error { |
| 1660 |
return m.validate(false) |
| 1661 |
} |
| 1662 |
|
| 1663 |
// ValidateAll checks the field values on AndFilter with the rules defined in |
| 1664 |
// the proto definition for this message. If any rules are violated, the |
| 1665 |
// result is a list of violation errors wrapped in AndFilterMultiError, or nil |
| 1666 |
// if none found. |
| 1667 |
func (m *AndFilter) ValidateAll() error { |
| 1668 |
return m.validate(true) |
| 1669 |
} |
| 1670 |
|
| 1671 |
func (m *AndFilter) validate(all bool) error { |
| 1672 |
if m == nil { |
| 1673 |
return nil |
| 1674 |
} |
| 1675 |
|
| 1676 |
var errors []error |
| 1677 |
|
| 1678 |
if len(m.GetFilters()) < 2 { |
| 1679 |
err := AndFilterValidationError{ |
| 1680 |
field: "Filters", |
| 1681 |
reason: "value must contain at least 2 item(s)", |
| 1682 |
} |
| 1683 |
if !all { |
| 1684 |
return err |
| 1685 |
} |
| 1686 |
errors = append(errors, err) |
| 1687 |
} |
| 1688 |
|
| 1689 |
for idx, item := range m.GetFilters() { |
| 1690 |
_, _ = idx, item |
| 1691 |
|
| 1692 |
if all { |
| 1693 |
switch v := interface{}(item).(type) { |
| 1694 |
case interface{ ValidateAll() error }: |
| 1695 |
if err := v.ValidateAll(); err != nil { |
| 1696 |
errors = append(errors, AndFilterValidationError{ |
| 1697 |
field: fmt.Sprintf("Filters[%v]", idx), |
| 1698 |
reason: "embedded message failed validation", |
| 1699 |
cause: err, |
| 1700 |
}) |
| 1701 |
} |
| 1702 |
case interface{ Validate() error }: |
| 1703 |
if err := v.Validate(); err != nil { |
| 1704 |
errors = append(errors, AndFilterValidationError{ |
| 1705 |
field: fmt.Sprintf("Filters[%v]", idx), |
| 1706 |
reason: "embedded message failed validation", |
| 1707 |
cause: err, |
| 1708 |
}) |
| 1709 |
} |
| 1710 |
} |
| 1711 |
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok { |
| 1712 |
if err := v.Validate(); err != nil { |
| 1713 |
return AndFilterValidationError{ |
| 1714 |
field: fmt.Sprintf("Filters[%v]", idx), |
| 1715 |
reason: "embedded message failed validation", |
| 1716 |
cause: err, |
| 1717 |
} |
| 1718 |
} |
| 1719 |
} |
| 1720 |
|
| 1721 |
} |
| 1722 |
|
| 1723 |
if len(errors) > 0 { |
| 1724 |
return AndFilterMultiError(errors) |
| 1725 |
} |
| 1726 |
|
| 1727 |
return nil |
| 1728 |
} |
| 1729 |
|
| 1730 |
// AndFilterMultiError is an error wrapping multiple validation errors returned |
| 1731 |
// by AndFilter.ValidateAll() if the designated constraints aren't met. |
| 1732 |
type AndFilterMultiError []error |
| 1733 |
|
| 1734 |
// Error returns a concatenation of all the error messages it wraps. |
| 1735 |
func (m AndFilterMultiError) Error() string { |
| 1736 |
var msgs []string |
| 1737 |
for _, err := range m { |
| 1738 |
msgs = append(msgs, err.Error()) |
| 1739 |
} |
| 1740 |
return strings.Join(msgs, "; ") |
| 1741 |
} |
| 1742 |
|
| 1743 |
// AllErrors returns a list of validation violation errors. |
| 1744 |
func (m AndFilterMultiError) AllErrors() []error { return m } |
| 1745 |
|
| 1746 |
// AndFilterValidationError is the validation error returned by |
| 1747 |
// AndFilter.Validate if the designated constraints aren't met. |
| 1748 |
type AndFilterValidationError struct { |
| 1749 |
field string |
| 1750 |
reason string |
| 1751 |
cause error |
| 1752 |
key bool |
| 1753 |
} |
| 1754 |
|
| 1755 |
// Field function returns field value. |
| 1756 |
func (e AndFilterValidationError) Field() string { return e.field } |
| 1757 |
|
| 1758 |
// Reason function returns reason value. |
| 1759 |
func (e AndFilterValidationError) Reason() string { return e.reason } |
| 1760 |
|
| 1761 |
// Cause function returns cause value. |
| 1762 |
func (e AndFilterValidationError) Cause() error { return e.cause } |
| 1763 |
|
| 1764 |
// Key function returns key value. |
| 1765 |
func (e AndFilterValidationError) Key() bool { return e.key } |
| 1766 |
|
| 1767 |
// ErrorName returns error name. |
| 1768 |
func (e AndFilterValidationError) ErrorName() string { return "AndFilterValidationError" } |
| 1769 |
|
| 1770 |
// Error satisfies the builtin error interface |
| 1771 |
func (e AndFilterValidationError) Error() string { |
| 1772 |
cause := "" |
| 1773 |
if e.cause != nil { |
| 1774 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 1775 |
} |
| 1776 |
|
| 1777 |
key := "" |
| 1778 |
if e.key { |
| 1779 |
key = "key for " |
| 1780 |
} |
| 1781 |
|
| 1782 |
return fmt.Sprintf( |
| 1783 |
"invalid %sAndFilter.%s: %s%s", |
| 1784 |
key, |
| 1785 |
e.field, |
| 1786 |
e.reason, |
| 1787 |
cause) |
| 1788 |
} |
| 1789 |
|
| 1790 |
var _ error = AndFilterValidationError{} |
| 1791 |
|
| 1792 |
var _ interface { |
| 1793 |
Field() string |
| 1794 |
Reason() string |
| 1795 |
Key() bool |
| 1796 |
Cause() error |
| 1797 |
ErrorName() string |
| 1798 |
} = AndFilterValidationError{} |
| 1799 |
|
| 1800 |
// Validate checks the field values on OrFilter with the rules defined in the |
| 1801 |
// proto definition for this message. If any rules are violated, the first |
| 1802 |
// error encountered is returned, or nil if there are no violations. |
| 1803 |
func (m *OrFilter) Validate() error { |
| 1804 |
return m.validate(false) |
| 1805 |
} |
| 1806 |
|
| 1807 |
// ValidateAll checks the field values on OrFilter with the rules defined in |
| 1808 |
// the proto definition for this message. If any rules are violated, the |
| 1809 |
// result is a list of violation errors wrapped in OrFilterMultiError, or nil |
| 1810 |
// if none found. |
| 1811 |
func (m *OrFilter) ValidateAll() error { |
| 1812 |
return m.validate(true) |
| 1813 |
} |
| 1814 |
|
| 1815 |
func (m *OrFilter) validate(all bool) error { |
| 1816 |
if m == nil { |
| 1817 |
return nil |
| 1818 |
} |
| 1819 |
|
| 1820 |
var errors []error |
| 1821 |
|
| 1822 |
if len(m.GetFilters()) < 2 { |
| 1823 |
err := OrFilterValidationError{ |
| 1824 |
field: "Filters", |
| 1825 |
reason: "value must contain at least 2 item(s)", |
| 1826 |
} |
| 1827 |
if !all { |
| 1828 |
return err |
| 1829 |
} |
| 1830 |
errors = append(errors, err) |
| 1831 |
} |
| 1832 |
|
| 1833 |
for idx, item := range m.GetFilters() { |
| 1834 |
_, _ = idx, item |
| 1835 |
|
| 1836 |
if all { |
| 1837 |
switch v := interface{}(item).(type) { |
| 1838 |
case interface{ ValidateAll() error }: |
| 1839 |
if err := v.ValidateAll(); err != nil { |
| 1840 |
errors = append(errors, OrFilterValidationError{ |
| 1841 |
field: fmt.Sprintf("Filters[%v]", idx), |
| 1842 |
reason: "embedded message failed validation", |
| 1843 |
cause: err, |
| 1844 |
}) |
| 1845 |
} |
| 1846 |
case interface{ Validate() error }: |
| 1847 |
if err := v.Validate(); err != nil { |
| 1848 |
errors = append(errors, OrFilterValidationError{ |
| 1849 |
field: fmt.Sprintf("Filters[%v]", idx), |
| 1850 |
reason: "embedded message failed validation", |
| 1851 |
cause: err, |
| 1852 |
}) |
| 1853 |
} |
| 1854 |
} |
| 1855 |
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok { |
| 1856 |
if err := v.Validate(); err != nil { |
| 1857 |
return OrFilterValidationError{ |
| 1858 |
field: fmt.Sprintf("Filters[%v]", idx), |
| 1859 |
reason: "embedded message failed validation", |
| 1860 |
cause: err, |
| 1861 |
} |
| 1862 |
} |
| 1863 |
} |
| 1864 |
|
| 1865 |
} |
| 1866 |
|
| 1867 |
if len(errors) > 0 { |
| 1868 |
return OrFilterMultiError(errors) |
| 1869 |
} |
| 1870 |
|
| 1871 |
return nil |
| 1872 |
} |
| 1873 |
|
| 1874 |
// OrFilterMultiError is an error wrapping multiple validation errors returned |
| 1875 |
// by OrFilter.ValidateAll() if the designated constraints aren't met. |
| 1876 |
type OrFilterMultiError []error |
| 1877 |
|
| 1878 |
// Error returns a concatenation of all the error messages it wraps. |
| 1879 |
func (m OrFilterMultiError) Error() string { |
| 1880 |
var msgs []string |
| 1881 |
for _, err := range m { |
| 1882 |
msgs = append(msgs, err.Error()) |
| 1883 |
} |
| 1884 |
return strings.Join(msgs, "; ") |
| 1885 |
} |
| 1886 |
|
| 1887 |
// AllErrors returns a list of validation violation errors. |
| 1888 |
func (m OrFilterMultiError) AllErrors() []error { return m } |
| 1889 |
|
| 1890 |
// OrFilterValidationError is the validation error returned by |
| 1891 |
// OrFilter.Validate if the designated constraints aren't met. |
| 1892 |
type OrFilterValidationError struct { |
| 1893 |
field string |
| 1894 |
reason string |
| 1895 |
cause error |
| 1896 |
key bool |
| 1897 |
} |
| 1898 |
|
| 1899 |
// Field function returns field value. |
| 1900 |
func (e OrFilterValidationError) Field() string { return e.field } |
| 1901 |
|
| 1902 |
// Reason function returns reason value. |
| 1903 |
func (e OrFilterValidationError) Reason() string { return e.reason } |
| 1904 |
|
| 1905 |
// Cause function returns cause value. |
| 1906 |
func (e OrFilterValidationError) Cause() error { return e.cause } |
| 1907 |
|
| 1908 |
// Key function returns key value. |
| 1909 |
func (e OrFilterValidationError) Key() bool { return e.key } |
| 1910 |
|
| 1911 |
// ErrorName returns error name. |
| 1912 |
func (e OrFilterValidationError) ErrorName() string { return "OrFilterValidationError" } |
| 1913 |
|
| 1914 |
// Error satisfies the builtin error interface |
| 1915 |
func (e OrFilterValidationError) Error() string { |
| 1916 |
cause := "" |
| 1917 |
if e.cause != nil { |
| 1918 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 1919 |
} |
| 1920 |
|
| 1921 |
key := "" |
| 1922 |
if e.key { |
| 1923 |
key = "key for " |
| 1924 |
} |
| 1925 |
|
| 1926 |
return fmt.Sprintf( |
| 1927 |
"invalid %sOrFilter.%s: %s%s", |
| 1928 |
key, |
| 1929 |
e.field, |
| 1930 |
e.reason, |
| 1931 |
cause) |
| 1932 |
} |
| 1933 |
|
| 1934 |
var _ error = OrFilterValidationError{} |
| 1935 |
|
| 1936 |
var _ interface { |
| 1937 |
Field() string |
| 1938 |
Reason() string |
| 1939 |
Key() bool |
| 1940 |
Cause() error |
| 1941 |
ErrorName() string |
| 1942 |
} = OrFilterValidationError{} |
| 1943 |
|
| 1944 |
// Validate checks the field values on HeaderFilter with the rules defined in |
| 1945 |
// the proto definition for this message. If any rules are violated, the first |
| 1946 |
// error encountered is returned, or nil if there are no violations. |
| 1947 |
func (m *HeaderFilter) Validate() error { |
| 1948 |
return m.validate(false) |
| 1949 |
} |
| 1950 |
|
| 1951 |
// ValidateAll checks the field values on HeaderFilter with the rules defined |
| 1952 |
// in the proto definition for this message. If any rules are violated, the |
| 1953 |
// result is a list of violation errors wrapped in HeaderFilterMultiError, or |
| 1954 |
// nil if none found. |
| 1955 |
func (m *HeaderFilter) ValidateAll() error { |
| 1956 |
return m.validate(true) |
| 1957 |
} |
| 1958 |
|
| 1959 |
func (m *HeaderFilter) validate(all bool) error { |
| 1960 |
if m == nil { |
| 1961 |
return nil |
| 1962 |
} |
| 1963 |
|
| 1964 |
var errors []error |
| 1965 |
|
| 1966 |
if m.GetHeader() == nil { |
| 1967 |
err := HeaderFilterValidationError{ |
| 1968 |
field: "Header", |
| 1969 |
reason: "value is required", |
| 1970 |
} |
| 1971 |
if !all { |
| 1972 |
return err |
| 1973 |
} |
| 1974 |
errors = append(errors, err) |
| 1975 |
} |
| 1976 |
|
| 1977 |
if all { |
| 1978 |
switch v := interface{}(m.GetHeader()).(type) { |
| 1979 |
case interface{ ValidateAll() error }: |
| 1980 |
if err := v.ValidateAll(); err != nil { |
| 1981 |
errors = append(errors, HeaderFilterValidationError{ |
| 1982 |
field: "Header", |
| 1983 |
reason: "embedded message failed validation", |
| 1984 |
cause: err, |
| 1985 |
}) |
| 1986 |
} |
| 1987 |
case interface{ Validate() error }: |
| 1988 |
if err := v.Validate(); err != nil { |
| 1989 |
errors = append(errors, HeaderFilterValidationError{ |
| 1990 |
field: "Header", |
| 1991 |
reason: "embedded message failed validation", |
| 1992 |
cause: err, |
| 1993 |
}) |
| 1994 |
} |
| 1995 |
} |
| 1996 |
} else if v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok { |
| 1997 |
if err := v.Validate(); err != nil { |
| 1998 |
return HeaderFilterValidationError{ |
| 1999 |
field: "Header", |
| 2000 |
reason: "embedded message failed validation", |
| 2001 |
cause: err, |
| 2002 |
} |
| 2003 |
} |
| 2004 |
} |
| 2005 |
|
| 2006 |
if len(errors) > 0 { |
| 2007 |
return HeaderFilterMultiError(errors) |
| 2008 |
} |
| 2009 |
|
| 2010 |
return nil |
| 2011 |
} |
| 2012 |
|
| 2013 |
// HeaderFilterMultiError is an error wrapping multiple validation errors |
| 2014 |
// returned by HeaderFilter.ValidateAll() if the designated constraints aren't met. |
| 2015 |
type HeaderFilterMultiError []error |
| 2016 |
|
| 2017 |
// Error returns a concatenation of all the error messages it wraps. |
| 2018 |
func (m HeaderFilterMultiError) Error() string { |
| 2019 |
var msgs []string |
| 2020 |
for _, err := range m { |
| 2021 |
msgs = append(msgs, err.Error()) |
| 2022 |
} |
| 2023 |
return strings.Join(msgs, "; ") |
| 2024 |
} |
| 2025 |
|
| 2026 |
// AllErrors returns a list of validation violation errors. |
| 2027 |
func (m HeaderFilterMultiError) AllErrors() []error { return m } |
| 2028 |
|
| 2029 |
// HeaderFilterValidationError is the validation error returned by |
| 2030 |
// HeaderFilter.Validate if the designated constraints aren't met. |
| 2031 |
type HeaderFilterValidationError struct { |
| 2032 |
field string |
| 2033 |
reason string |
| 2034 |
cause error |
| 2035 |
key bool |
| 2036 |
} |
| 2037 |
|
| 2038 |
// Field function returns field value. |
| 2039 |
func (e HeaderFilterValidationError) Field() string { return e.field } |
| 2040 |
|
| 2041 |
// Reason function returns reason value. |
| 2042 |
func (e HeaderFilterValidationError) Reason() string { return e.reason } |
| 2043 |
|
| 2044 |
// Cause function returns cause value. |
| 2045 |
func (e HeaderFilterValidationError) Cause() error { return e.cause } |
| 2046 |
|
| 2047 |
// Key function returns key value. |
| 2048 |
func (e HeaderFilterValidationError) Key() bool { return e.key } |
| 2049 |
|
| 2050 |
// ErrorName returns error name. |
| 2051 |
func (e HeaderFilterValidationError) ErrorName() string { return "HeaderFilterValidationError" } |
| 2052 |
|
| 2053 |
// Error satisfies the builtin error interface |
| 2054 |
func (e HeaderFilterValidationError) Error() string { |
| 2055 |
cause := "" |
| 2056 |
if e.cause != nil { |
| 2057 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 2058 |
} |
| 2059 |
|
| 2060 |
key := "" |
| 2061 |
if e.key { |
| 2062 |
key = "key for " |
| 2063 |
} |
| 2064 |
|
| 2065 |
return fmt.Sprintf( |
| 2066 |
"invalid %sHeaderFilter.%s: %s%s", |
| 2067 |
key, |
| 2068 |
e.field, |
| 2069 |
e.reason, |
| 2070 |
cause) |
| 2071 |
} |
| 2072 |
|
| 2073 |
var _ error = HeaderFilterValidationError{} |
| 2074 |
|
| 2075 |
var _ interface { |
| 2076 |
Field() string |
| 2077 |
Reason() string |
| 2078 |
Key() bool |
| 2079 |
Cause() error |
| 2080 |
ErrorName() string |
| 2081 |
} = HeaderFilterValidationError{} |
| 2082 |
|
| 2083 |
// Validate checks the field values on ResponseFlagFilter with the rules |
| 2084 |
// defined in the proto definition for this message. If any rules are |
| 2085 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 2086 |
func (m *ResponseFlagFilter) Validate() error { |
| 2087 |
return m.validate(false) |
| 2088 |
} |
| 2089 |
|
| 2090 |
// ValidateAll checks the field values on ResponseFlagFilter with the rules |
| 2091 |
// defined in the proto definition for this message. If any rules are |
| 2092 |
// violated, the result is a list of violation errors wrapped in |
| 2093 |
// ResponseFlagFilterMultiError, or nil if none found. |
| 2094 |
func (m *ResponseFlagFilter) ValidateAll() error { |
| 2095 |
return m.validate(true) |
| 2096 |
} |
| 2097 |
|
| 2098 |
func (m *ResponseFlagFilter) validate(all bool) error { |
| 2099 |
if m == nil { |
| 2100 |
return nil |
| 2101 |
} |
| 2102 |
|
| 2103 |
var errors []error |
| 2104 |
|
| 2105 |
for idx, item := range m.GetFlags() { |
| 2106 |
_, _ = idx, item |
| 2107 |
|
| 2108 |
if _, ok := _ResponseFlagFilter_Flags_InLookup[item]; !ok { |
| 2109 |
err := ResponseFlagFilterValidationError{ |
| 2110 |
field: fmt.Sprintf("Flags[%v]", idx), |
| 2111 |
reason: "value must be in list [LH UH UT LR UR UF UC UO NR DI FI RL UAEX RLSE DC URX SI IH DPE UMSDR RFCF NFCF DT UPE NC OM DF DO DR]", |
| 2112 |
} |
| 2113 |
if !all { |
| 2114 |
return err |
| 2115 |
} |
| 2116 |
errors = append(errors, err) |
| 2117 |
} |
| 2118 |
|
| 2119 |
} |
| 2120 |
|
| 2121 |
if len(errors) > 0 { |
| 2122 |
return ResponseFlagFilterMultiError(errors) |
| 2123 |
} |
| 2124 |
|
| 2125 |
return nil |
| 2126 |
} |
| 2127 |
|
| 2128 |
// ResponseFlagFilterMultiError is an error wrapping multiple validation errors |
| 2129 |
// returned by ResponseFlagFilter.ValidateAll() if the designated constraints |
| 2130 |
// aren't met. |
| 2131 |
type ResponseFlagFilterMultiError []error |
| 2132 |
|
| 2133 |
// Error returns a concatenation of all the error messages it wraps. |
| 2134 |
func (m ResponseFlagFilterMultiError) Error() string { |
| 2135 |
var msgs []string |
| 2136 |
for _, err := range m { |
| 2137 |
msgs = append(msgs, err.Error()) |
| 2138 |
} |
| 2139 |
return strings.Join(msgs, "; ") |
| 2140 |
} |
| 2141 |
|
| 2142 |
// AllErrors returns a list of validation violation errors. |
| 2143 |
func (m ResponseFlagFilterMultiError) AllErrors() []error { return m } |
| 2144 |
|
| 2145 |
// ResponseFlagFilterValidationError is the validation error returned by |
| 2146 |
// ResponseFlagFilter.Validate if the designated constraints aren't met. |
| 2147 |
type ResponseFlagFilterValidationError struct { |
| 2148 |
field string |
| 2149 |
reason string |
| 2150 |
cause error |
| 2151 |
key bool |
| 2152 |
} |
| 2153 |
|
| 2154 |
// Field function returns field value. |
| 2155 |
func (e ResponseFlagFilterValidationError) Field() string { return e.field } |
| 2156 |
|
| 2157 |
// Reason function returns reason value. |
| 2158 |
func (e ResponseFlagFilterValidationError) Reason() string { return e.reason } |
| 2159 |
|
| 2160 |
// Cause function returns cause value. |
| 2161 |
func (e ResponseFlagFilterValidationError) Cause() error { return e.cause } |
| 2162 |
|
| 2163 |
// Key function returns key value. |
| 2164 |
func (e ResponseFlagFilterValidationError) Key() bool { return e.key } |
| 2165 |
|
| 2166 |
// ErrorName returns error name. |
| 2167 |
func (e ResponseFlagFilterValidationError) ErrorName() string { |
| 2168 |
return "ResponseFlagFilterValidationError" |
| 2169 |
} |
| 2170 |
|
| 2171 |
// Error satisfies the builtin error interface |
| 2172 |
func (e ResponseFlagFilterValidationError) Error() string { |
| 2173 |
cause := "" |
| 2174 |
if e.cause != nil { |
| 2175 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 2176 |
} |
| 2177 |
|
| 2178 |
key := "" |
| 2179 |
if e.key { |
| 2180 |
key = "key for " |
| 2181 |
} |
| 2182 |
|
| 2183 |
return fmt.Sprintf( |
| 2184 |
"invalid %sResponseFlagFilter.%s: %s%s", |
| 2185 |
key, |
| 2186 |
e.field, |
| 2187 |
e.reason, |
| 2188 |
cause) |
| 2189 |
} |
| 2190 |
|
| 2191 |
var _ error = ResponseFlagFilterValidationError{} |
| 2192 |
|
| 2193 |
var _ interface { |
| 2194 |
Field() string |
| 2195 |
Reason() string |
| 2196 |
Key() bool |
| 2197 |
Cause() error |
| 2198 |
ErrorName() string |
| 2199 |
} = ResponseFlagFilterValidationError{} |
| 2200 |
|
| 2201 |
var _ResponseFlagFilter_Flags_InLookup = map[string]struct{}{ |
| 2202 |
"LH": {}, |
| 2203 |
"UH": {}, |
| 2204 |
"UT": {}, |
| 2205 |
"LR": {}, |
| 2206 |
"UR": {}, |
| 2207 |
"UF": {}, |
| 2208 |
"UC": {}, |
| 2209 |
"UO": {}, |
| 2210 |
"NR": {}, |
| 2211 |
"DI": {}, |
| 2212 |
"FI": {}, |
| 2213 |
"RL": {}, |
| 2214 |
"UAEX": {}, |
| 2215 |
"RLSE": {}, |
| 2216 |
"DC": {}, |
| 2217 |
"URX": {}, |
| 2218 |
"SI": {}, |
| 2219 |
"IH": {}, |
| 2220 |
"DPE": {}, |
| 2221 |
"UMSDR": {}, |
| 2222 |
"RFCF": {}, |
| 2223 |
"NFCF": {}, |
| 2224 |
"DT": {}, |
| 2225 |
"UPE": {}, |
| 2226 |
"NC": {}, |
| 2227 |
"OM": {}, |
| 2228 |
"DF": {}, |
| 2229 |
"DO": {}, |
| 2230 |
"DR": {}, |
| 2231 |
} |
| 2232 |
|
| 2233 |
// Validate checks the field values on GrpcStatusFilter with the rules defined |
| 2234 |
// in the proto definition for this message. If any rules are violated, the |
| 2235 |
// first error encountered is returned, or nil if there are no violations. |
| 2236 |
func (m *GrpcStatusFilter) Validate() error { |
| 2237 |
return m.validate(false) |
| 2238 |
} |
| 2239 |
|
| 2240 |
// ValidateAll checks the field values on GrpcStatusFilter with the rules |
| 2241 |
// defined in the proto definition for this message. If any rules are |
| 2242 |
// violated, the result is a list of violation errors wrapped in |
| 2243 |
// GrpcStatusFilterMultiError, or nil if none found. |
| 2244 |
func (m *GrpcStatusFilter) ValidateAll() error { |
| 2245 |
return m.validate(true) |
| 2246 |
} |
| 2247 |
|
| 2248 |
func (m *GrpcStatusFilter) validate(all bool) error { |
| 2249 |
if m == nil { |
| 2250 |
return nil |
| 2251 |
} |
| 2252 |
|
| 2253 |
var errors []error |
| 2254 |
|
| 2255 |
for idx, item := range m.GetStatuses() { |
| 2256 |
_, _ = idx, item |
| 2257 |
|
| 2258 |
if _, ok := GrpcStatusFilter_Status_name[int32(item)]; !ok { |
| 2259 |
err := GrpcStatusFilterValidationError{ |
| 2260 |
field: fmt.Sprintf("Statuses[%v]", idx), |
| 2261 |
reason: "value must be one of the defined enum values", |
| 2262 |
} |
| 2263 |
if !all { |
| 2264 |
return err |
| 2265 |
} |
| 2266 |
errors = append(errors, err) |
| 2267 |
} |
| 2268 |
|
| 2269 |
} |
| 2270 |
|
| 2271 |
// no validation rules for Exclude |
| 2272 |
|
| 2273 |
if len(errors) > 0 { |
| 2274 |
return GrpcStatusFilterMultiError(errors) |
| 2275 |
} |
| 2276 |
|
| 2277 |
return nil |
| 2278 |
} |
| 2279 |
|
| 2280 |
// GrpcStatusFilterMultiError is an error wrapping multiple validation errors |
| 2281 |
// returned by GrpcStatusFilter.ValidateAll() if the designated constraints |
| 2282 |
// aren't met. |
| 2283 |
type GrpcStatusFilterMultiError []error |
| 2284 |
|
| 2285 |
// Error returns a concatenation of all the error messages it wraps. |
| 2286 |
func (m GrpcStatusFilterMultiError) Error() string { |
| 2287 |
var msgs []string |
| 2288 |
for _, err := range m { |
| 2289 |
msgs = append(msgs, err.Error()) |
| 2290 |
} |
| 2291 |
return strings.Join(msgs, "; ") |
| 2292 |
} |
| 2293 |
|
| 2294 |
// AllErrors returns a list of validation violation errors. |
| 2295 |
func (m GrpcStatusFilterMultiError) AllErrors() []error { return m } |
| 2296 |
|
| 2297 |
// GrpcStatusFilterValidationError is the validation error returned by |
| 2298 |
// GrpcStatusFilter.Validate if the designated constraints aren't met. |
| 2299 |
type GrpcStatusFilterValidationError struct { |
| 2300 |
field string |
| 2301 |
reason string |
| 2302 |
cause error |
| 2303 |
key bool |
| 2304 |
} |
| 2305 |
|
| 2306 |
// Field function returns field value. |
| 2307 |
func (e GrpcStatusFilterValidationError) Field() string { return e.field } |
| 2308 |
|
| 2309 |
// Reason function returns reason value. |
| 2310 |
func (e GrpcStatusFilterValidationError) Reason() string { return e.reason } |
| 2311 |
|
| 2312 |
// Cause function returns cause value. |
| 2313 |
func (e GrpcStatusFilterValidationError) Cause() error { return e.cause } |
| 2314 |
|
| 2315 |
// Key function returns key value. |
| 2316 |
func (e GrpcStatusFilterValidationError) Key() bool { return e.key } |
| 2317 |
|
| 2318 |
// ErrorName returns error name. |
| 2319 |
func (e GrpcStatusFilterValidationError) ErrorName() string { return "GrpcStatusFilterValidationError" } |
| 2320 |
|
| 2321 |
// Error satisfies the builtin error interface |
| 2322 |
func (e GrpcStatusFilterValidationError) Error() string { |
| 2323 |
cause := "" |
| 2324 |
if e.cause != nil { |
| 2325 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 2326 |
} |
| 2327 |
|
| 2328 |
key := "" |
| 2329 |
if e.key { |
| 2330 |
key = "key for " |
| 2331 |
} |
| 2332 |
|
| 2333 |
return fmt.Sprintf( |
| 2334 |
"invalid %sGrpcStatusFilter.%s: %s%s", |
| 2335 |
key, |
| 2336 |
e.field, |
| 2337 |
e.reason, |
| 2338 |
cause) |
| 2339 |
} |
| 2340 |
|
| 2341 |
var _ error = GrpcStatusFilterValidationError{} |
| 2342 |
|
| 2343 |
var _ interface { |
| 2344 |
Field() string |
| 2345 |
Reason() string |
| 2346 |
Key() bool |
| 2347 |
Cause() error |
| 2348 |
ErrorName() string |
| 2349 |
} = GrpcStatusFilterValidationError{} |
| 2350 |
|
| 2351 |
// Validate checks the field values on MetadataFilter with the rules defined in |
| 2352 |
// the proto definition for this message. If any rules are violated, the first |
| 2353 |
// error encountered is returned, or nil if there are no violations. |
| 2354 |
func (m *MetadataFilter) Validate() error { |
| 2355 |
return m.validate(false) |
| 2356 |
} |
| 2357 |
|
| 2358 |
// ValidateAll checks the field values on MetadataFilter with the rules defined |
| 2359 |
// in the proto definition for this message. If any rules are violated, the |
| 2360 |
// result is a list of violation errors wrapped in MetadataFilterMultiError, |
| 2361 |
// or nil if none found. |
| 2362 |
func (m *MetadataFilter) ValidateAll() error { |
| 2363 |
return m.validate(true) |
| 2364 |
} |
| 2365 |
|
| 2366 |
func (m *MetadataFilter) validate(all bool) error { |
| 2367 |
if m == nil { |
| 2368 |
return nil |
| 2369 |
} |
| 2370 |
|
| 2371 |
var errors []error |
| 2372 |
|
| 2373 |
if all { |
| 2374 |
switch v := interface{}(m.GetMatcher()).(type) { |
| 2375 |
case interface{ ValidateAll() error }: |
| 2376 |
if err := v.ValidateAll(); err != nil { |
| 2377 |
errors = append(errors, MetadataFilterValidationError{ |
| 2378 |
field: "Matcher", |
| 2379 |
reason: "embedded message failed validation", |
| 2380 |
cause: err, |
| 2381 |
}) |
| 2382 |
} |
| 2383 |
case interface{ Validate() error }: |
| 2384 |
if err := v.Validate(); err != nil { |
| 2385 |
errors = append(errors, MetadataFilterValidationError{ |
| 2386 |
field: "Matcher", |
| 2387 |
reason: "embedded message failed validation", |
| 2388 |
cause: err, |
| 2389 |
}) |
| 2390 |
} |
| 2391 |
} |
| 2392 |
} else if v, ok := interface{}(m.GetMatcher()).(interface{ Validate() error }); ok { |
| 2393 |
if err := v.Validate(); err != nil { |
| 2394 |
return MetadataFilterValidationError{ |
| 2395 |
field: "Matcher", |
| 2396 |
reason: "embedded message failed validation", |
| 2397 |
cause: err, |
| 2398 |
} |
| 2399 |
} |
| 2400 |
} |
| 2401 |
|
| 2402 |
if all { |
| 2403 |
switch v := interface{}(m.GetMatchIfKeyNotFound()).(type) { |
| 2404 |
case interface{ ValidateAll() error }: |
| 2405 |
if err := v.ValidateAll(); err != nil { |
| 2406 |
errors = append(errors, MetadataFilterValidationError{ |
| 2407 |
field: "MatchIfKeyNotFound", |
| 2408 |
reason: "embedded message failed validation", |
| 2409 |
cause: err, |
| 2410 |
}) |
| 2411 |
} |
| 2412 |
case interface{ Validate() error }: |
| 2413 |
if err := v.Validate(); err != nil { |
| 2414 |
errors = append(errors, MetadataFilterValidationError{ |
| 2415 |
field: "MatchIfKeyNotFound", |
| 2416 |
reason: "embedded message failed validation", |
| 2417 |
cause: err, |
| 2418 |
}) |
| 2419 |
} |
| 2420 |
} |
| 2421 |
} else if v, ok := interface{}(m.GetMatchIfKeyNotFound()).(interface{ Validate() error }); ok { |
| 2422 |
if err := v.Validate(); err != nil { |
| 2423 |
return MetadataFilterValidationError{ |
| 2424 |
field: "MatchIfKeyNotFound", |
| 2425 |
reason: "embedded message failed validation", |
| 2426 |
cause: err, |
| 2427 |
} |
| 2428 |
} |
| 2429 |
} |
| 2430 |
|
| 2431 |
if len(errors) > 0 { |
| 2432 |
return MetadataFilterMultiError(errors) |
| 2433 |
} |
| 2434 |
|
| 2435 |
return nil |
| 2436 |
} |
| 2437 |
|
| 2438 |
// MetadataFilterMultiError is an error wrapping multiple validation errors |
| 2439 |
// returned by MetadataFilter.ValidateAll() if the designated constraints |
| 2440 |
// aren't met. |
| 2441 |
type MetadataFilterMultiError []error |
| 2442 |
|
| 2443 |
// Error returns a concatenation of all the error messages it wraps. |
| 2444 |
func (m MetadataFilterMultiError) Error() string { |
| 2445 |
var msgs []string |
| 2446 |
for _, err := range m { |
| 2447 |
msgs = append(msgs, err.Error()) |
| 2448 |
} |
| 2449 |
return strings.Join(msgs, "; ") |
| 2450 |
} |
| 2451 |
|
| 2452 |
// AllErrors returns a list of validation violation errors. |
| 2453 |
func (m MetadataFilterMultiError) AllErrors() []error { return m } |
| 2454 |
|
| 2455 |
// MetadataFilterValidationError is the validation error returned by |
| 2456 |
// MetadataFilter.Validate if the designated constraints aren't met. |
| 2457 |
type MetadataFilterValidationError struct { |
| 2458 |
field string |
| 2459 |
reason string |
| 2460 |
cause error |
| 2461 |
key bool |
| 2462 |
} |
| 2463 |
|
| 2464 |
// Field function returns field value. |
| 2465 |
func (e MetadataFilterValidationError) Field() string { return e.field } |
| 2466 |
|
| 2467 |
// Reason function returns reason value. |
| 2468 |
func (e MetadataFilterValidationError) Reason() string { return e.reason } |
| 2469 |
|
| 2470 |
// Cause function returns cause value. |
| 2471 |
func (e MetadataFilterValidationError) Cause() error { return e.cause } |
| 2472 |
|
| 2473 |
// Key function returns key value. |
| 2474 |
func (e MetadataFilterValidationError) Key() bool { return e.key } |
| 2475 |
|
| 2476 |
// ErrorName returns error name. |
| 2477 |
func (e MetadataFilterValidationError) ErrorName() string { return "MetadataFilterValidationError" } |
| 2478 |
|
| 2479 |
// Error satisfies the builtin error interface |
| 2480 |
func (e MetadataFilterValidationError) Error() string { |
| 2481 |
cause := "" |
| 2482 |
if e.cause != nil { |
| 2483 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 2484 |
} |
| 2485 |
|
| 2486 |
key := "" |
| 2487 |
if e.key { |
| 2488 |
key = "key for " |
| 2489 |
} |
| 2490 |
|
| 2491 |
return fmt.Sprintf( |
| 2492 |
"invalid %sMetadataFilter.%s: %s%s", |
| 2493 |
key, |
| 2494 |
e.field, |
| 2495 |
e.reason, |
| 2496 |
cause) |
| 2497 |
} |
| 2498 |
|
| 2499 |
var _ error = MetadataFilterValidationError{} |
| 2500 |
|
| 2501 |
var _ interface { |
| 2502 |
Field() string |
| 2503 |
Reason() string |
| 2504 |
Key() bool |
| 2505 |
Cause() error |
| 2506 |
ErrorName() string |
| 2507 |
} = MetadataFilterValidationError{} |
| 2508 |
|
| 2509 |
// Validate checks the field values on LogTypeFilter with the rules defined in |
| 2510 |
// the proto definition for this message. If any rules are violated, the first |
| 2511 |
// error encountered is returned, or nil if there are no violations. |
| 2512 |
func (m *LogTypeFilter) Validate() error { |
| 2513 |
return m.validate(false) |
| 2514 |
} |
| 2515 |
|
| 2516 |
// ValidateAll checks the field values on LogTypeFilter with the rules defined |
| 2517 |
// in the proto definition for this message. If any rules are violated, the |
| 2518 |
// result is a list of violation errors wrapped in LogTypeFilterMultiError, or |
| 2519 |
// nil if none found. |
| 2520 |
func (m *LogTypeFilter) ValidateAll() error { |
| 2521 |
return m.validate(true) |
| 2522 |
} |
| 2523 |
|
| 2524 |
func (m *LogTypeFilter) validate(all bool) error { |
| 2525 |
if m == nil { |
| 2526 |
return nil |
| 2527 |
} |
| 2528 |
|
| 2529 |
var errors []error |
| 2530 |
|
| 2531 |
for idx, item := range m.GetTypes() { |
| 2532 |
_, _ = idx, item |
| 2533 |
|
| 2534 |
if _, ok := v3.AccessLogType_name[int32(item)]; !ok { |
| 2535 |
err := LogTypeFilterValidationError{ |
| 2536 |
field: fmt.Sprintf("Types[%v]", idx), |
| 2537 |
reason: "value must be one of the defined enum values", |
| 2538 |
} |
| 2539 |
if !all { |
| 2540 |
return err |
| 2541 |
} |
| 2542 |
errors = append(errors, err) |
| 2543 |
} |
| 2544 |
|
| 2545 |
} |
| 2546 |
|
| 2547 |
// no validation rules for Exclude |
| 2548 |
|
| 2549 |
if len(errors) > 0 { |
| 2550 |
return LogTypeFilterMultiError(errors) |
| 2551 |
} |
| 2552 |
|
| 2553 |
return nil |
| 2554 |
} |
| 2555 |
|
| 2556 |
// LogTypeFilterMultiError is an error wrapping multiple validation errors |
| 2557 |
// returned by LogTypeFilter.ValidateAll() if the designated constraints |
| 2558 |
// aren't met. |
| 2559 |
type LogTypeFilterMultiError []error |
| 2560 |
|
| 2561 |
// Error returns a concatenation of all the error messages it wraps. |
| 2562 |
func (m LogTypeFilterMultiError) Error() string { |
| 2563 |
var msgs []string |
| 2564 |
for _, err := range m { |
| 2565 |
msgs = append(msgs, err.Error()) |
| 2566 |
} |
| 2567 |
return strings.Join(msgs, "; ") |
| 2568 |
} |
| 2569 |
|
| 2570 |
// AllErrors returns a list of validation violation errors. |
| 2571 |
func (m LogTypeFilterMultiError) AllErrors() []error { return m } |
| 2572 |
|
| 2573 |
// LogTypeFilterValidationError is the validation error returned by |
| 2574 |
// LogTypeFilter.Validate if the designated constraints aren't met. |
| 2575 |
type LogTypeFilterValidationError struct { |
| 2576 |
field string |
| 2577 |
reason string |
| 2578 |
cause error |
| 2579 |
key bool |
| 2580 |
} |
| 2581 |
|
| 2582 |
// Field function returns field value. |
| 2583 |
func (e LogTypeFilterValidationError) Field() string { return e.field } |
| 2584 |
|
| 2585 |
// Reason function returns reason value. |
| 2586 |
func (e LogTypeFilterValidationError) Reason() string { return e.reason } |
| 2587 |
|
| 2588 |
// Cause function returns cause value. |
| 2589 |
func (e LogTypeFilterValidationError) Cause() error { return e.cause } |
| 2590 |
|
| 2591 |
// Key function returns key value. |
| 2592 |
func (e LogTypeFilterValidationError) Key() bool { return e.key } |
| 2593 |
|
| 2594 |
// ErrorName returns error name. |
| 2595 |
func (e LogTypeFilterValidationError) ErrorName() string { return "LogTypeFilterValidationError" } |
| 2596 |
|
| 2597 |
// Error satisfies the builtin error interface |
| 2598 |
func (e LogTypeFilterValidationError) Error() string { |
| 2599 |
cause := "" |
| 2600 |
if e.cause != nil { |
| 2601 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 2602 |
} |
| 2603 |
|
| 2604 |
key := "" |
| 2605 |
if e.key { |
| 2606 |
key = "key for " |
| 2607 |
} |
| 2608 |
|
| 2609 |
return fmt.Sprintf( |
| 2610 |
"invalid %sLogTypeFilter.%s: %s%s", |
| 2611 |
key, |
| 2612 |
e.field, |
| 2613 |
e.reason, |
| 2614 |
cause) |
| 2615 |
} |
| 2616 |
|
| 2617 |
var _ error = LogTypeFilterValidationError{} |
| 2618 |
|
| 2619 |
var _ interface { |
| 2620 |
Field() string |
| 2621 |
Reason() string |
| 2622 |
Key() bool |
| 2623 |
Cause() error |
| 2624 |
ErrorName() string |
| 2625 |
} = LogTypeFilterValidationError{} |
| 2626 |
|
| 2627 |
// Validate checks the field values on ExtensionFilter with the rules defined |
| 2628 |
// in the proto definition for this message. If any rules are violated, the |
| 2629 |
// first error encountered is returned, or nil if there are no violations. |
| 2630 |
func (m *ExtensionFilter) Validate() error { |
| 2631 |
return m.validate(false) |
| 2632 |
} |
| 2633 |
|
| 2634 |
// ValidateAll checks the field values on ExtensionFilter with the rules |
| 2635 |
// defined in the proto definition for this message. If any rules are |
| 2636 |
// violated, the result is a list of violation errors wrapped in |
| 2637 |
// ExtensionFilterMultiError, or nil if none found. |
| 2638 |
func (m *ExtensionFilter) ValidateAll() error { |
| 2639 |
return m.validate(true) |
| 2640 |
} |
| 2641 |
|
| 2642 |
func (m *ExtensionFilter) validate(all bool) error { |
| 2643 |
if m == nil { |
| 2644 |
return nil |
| 2645 |
} |
| 2646 |
|
| 2647 |
var errors []error |
| 2648 |
|
| 2649 |
// no validation rules for Name |
| 2650 |
|
| 2651 |
switch v := m.ConfigType.(type) { |
| 2652 |
case *ExtensionFilter_TypedConfig: |
| 2653 |
if v == nil { |
| 2654 |
err := ExtensionFilterValidationError{ |
| 2655 |
field: "ConfigType", |
| 2656 |
reason: "oneof value cannot be a typed-nil", |
| 2657 |
} |
| 2658 |
if !all { |
| 2659 |
return err |
| 2660 |
} |
| 2661 |
errors = append(errors, err) |
| 2662 |
} |
| 2663 |
|
| 2664 |
if all { |
| 2665 |
switch v := interface{}(m.GetTypedConfig()).(type) { |
| 2666 |
case interface{ ValidateAll() error }: |
| 2667 |
if err := v.ValidateAll(); err != nil { |
| 2668 |
errors = append(errors, ExtensionFilterValidationError{ |
| 2669 |
field: "TypedConfig", |
| 2670 |
reason: "embedded message failed validation", |
| 2671 |
cause: err, |
| 2672 |
}) |
| 2673 |
} |
| 2674 |
case interface{ Validate() error }: |
| 2675 |
if err := v.Validate(); err != nil { |
| 2676 |
errors = append(errors, ExtensionFilterValidationError{ |
| 2677 |
field: "TypedConfig", |
| 2678 |
reason: "embedded message failed validation", |
| 2679 |
cause: err, |
| 2680 |
}) |
| 2681 |
} |
| 2682 |
} |
| 2683 |
} else if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok { |
| 2684 |
if err := v.Validate(); err != nil { |
| 2685 |
return ExtensionFilterValidationError{ |
| 2686 |
field: "TypedConfig", |
| 2687 |
reason: "embedded message failed validation", |
| 2688 |
cause: err, |
| 2689 |
} |
| 2690 |
} |
| 2691 |
} |
| 2692 |
|
| 2693 |
default: |
| 2694 |
_ = v // ensures v is used |
| 2695 |
} |
| 2696 |
|
| 2697 |
if len(errors) > 0 { |
| 2698 |
return ExtensionFilterMultiError(errors) |
| 2699 |
} |
| 2700 |
|
| 2701 |
return nil |
| 2702 |
} |
| 2703 |
|
| 2704 |
// ExtensionFilterMultiError is an error wrapping multiple validation errors |
| 2705 |
// returned by ExtensionFilter.ValidateAll() if the designated constraints |
| 2706 |
// aren't met. |
| 2707 |
type ExtensionFilterMultiError []error |
| 2708 |
|
| 2709 |
// Error returns a concatenation of all the error messages it wraps. |
| 2710 |
func (m ExtensionFilterMultiError) Error() string { |
| 2711 |
var msgs []string |
| 2712 |
for _, err := range m { |
| 2713 |
msgs = append(msgs, err.Error()) |
| 2714 |
} |
| 2715 |
return strings.Join(msgs, "; ") |
| 2716 |
} |
| 2717 |
|
| 2718 |
// AllErrors returns a list of validation violation errors. |
| 2719 |
func (m ExtensionFilterMultiError) AllErrors() []error { return m } |
| 2720 |
|
| 2721 |
// ExtensionFilterValidationError is the validation error returned by |
| 2722 |
// ExtensionFilter.Validate if the designated constraints aren't met. |
| 2723 |
type ExtensionFilterValidationError struct { |
| 2724 |
field string |
| 2725 |
reason string |
| 2726 |
cause error |
| 2727 |
key bool |
| 2728 |
} |
| 2729 |
|
| 2730 |
// Field function returns field value. |
| 2731 |
func (e ExtensionFilterValidationError) Field() string { return e.field } |
| 2732 |
|
| 2733 |
// Reason function returns reason value. |
| 2734 |
func (e ExtensionFilterValidationError) Reason() string { return e.reason } |
| 2735 |
|
| 2736 |
// Cause function returns cause value. |
| 2737 |
func (e ExtensionFilterValidationError) Cause() error { return e.cause } |
| 2738 |
|
| 2739 |
// Key function returns key value. |
| 2740 |
func (e ExtensionFilterValidationError) Key() bool { return e.key } |
| 2741 |
|
| 2742 |
// ErrorName returns error name. |
| 2743 |
func (e ExtensionFilterValidationError) ErrorName() string { return "ExtensionFilterValidationError" } |
| 2744 |
|
| 2745 |
// Error satisfies the builtin error interface |
| 2746 |
func (e ExtensionFilterValidationError) Error() string { |
| 2747 |
cause := "" |
| 2748 |
if e.cause != nil { |
| 2749 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 2750 |
} |
| 2751 |
|
| 2752 |
key := "" |
| 2753 |
if e.key { |
| 2754 |
key = "key for " |
| 2755 |
} |
| 2756 |
|
| 2757 |
return fmt.Sprintf( |
| 2758 |
"invalid %sExtensionFilter.%s: %s%s", |
| 2759 |
key, |
| 2760 |
e.field, |
| 2761 |
e.reason, |
| 2762 |
cause) |
| 2763 |
} |
| 2764 |
|
| 2765 |
var _ error = ExtensionFilterValidationError{} |
| 2766 |
|
| 2767 |
var _ interface { |
| 2768 |
Field() string |
| 2769 |
Reason() string |
| 2770 |
Key() bool |
| 2771 |
Cause() error |
| 2772 |
ErrorName() string |
| 2773 |
} = ExtensionFilterValidationError{} |