| 1 |
//go:build !disable_pgv |
| 2 |
// Code generated by protoc-gen-validate. DO NOT EDIT. |
| 3 |
// source: envoy/config/route/v3/scoped_route.proto |
| 4 |
|
| 5 |
package routev3 |
| 6 |
|
| 7 |
import ( |
| 8 |
"bytes" |
| 9 |
"errors" |
| 10 |
"fmt" |
| 11 |
"net" |
| 12 |
"net/mail" |
| 13 |
"net/url" |
| 14 |
"regexp" |
| 15 |
"sort" |
| 16 |
"strings" |
| 17 |
"time" |
| 18 |
"unicode/utf8" |
| 19 |
|
| 20 |
"google.golang.org/protobuf/types/known/anypb" |
| 21 |
) |
| 22 |
|
| 23 |
// ensure the imports are used |
| 24 |
var ( |
| 25 |
_ = bytes.MinRead |
| 26 |
_ = errors.New("") |
| 27 |
_ = fmt.Print |
| 28 |
_ = utf8.UTFMax |
| 29 |
_ = (*regexp.Regexp)(nil) |
| 30 |
_ = (*strings.Reader)(nil) |
| 31 |
_ = net.IPv4len |
| 32 |
_ = time.Duration(0) |
| 33 |
_ = (*url.URL)(nil) |
| 34 |
_ = (*mail.Address)(nil) |
| 35 |
_ = anypb.Any{} |
| 36 |
_ = sort.Sort |
| 37 |
) |
| 38 |
|
| 39 |
// Validate checks the field values on ScopedRouteConfiguration with the rules |
| 40 |
// defined in the proto definition for this message. If any rules are |
| 41 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 42 |
func (m *ScopedRouteConfiguration) Validate() error { |
| 43 |
return m.validate(false) |
| 44 |
} |
| 45 |
|
| 46 |
// ValidateAll checks the field values on ScopedRouteConfiguration with the |
| 47 |
// rules defined in the proto definition for this message. If any rules are |
| 48 |
// violated, the result is a list of violation errors wrapped in |
| 49 |
// ScopedRouteConfigurationMultiError, or nil if none found. |
| 50 |
func (m *ScopedRouteConfiguration) ValidateAll() error { |
| 51 |
return m.validate(true) |
| 52 |
} |
| 53 |
|
| 54 |
func (m *ScopedRouteConfiguration) validate(all bool) error { |
| 55 |
if m == nil { |
| 56 |
return nil |
| 57 |
} |
| 58 |
|
| 59 |
var errors []error |
| 60 |
|
| 61 |
// no validation rules for OnDemand |
| 62 |
|
| 63 |
if utf8.RuneCountInString(m.GetName()) < 1 { |
| 64 |
err := ScopedRouteConfigurationValidationError{ |
| 65 |
field: "Name", |
| 66 |
reason: "value length must be at least 1 runes", |
| 67 |
} |
| 68 |
if !all { |
| 69 |
return err |
| 70 |
} |
| 71 |
errors = append(errors, err) |
| 72 |
} |
| 73 |
|
| 74 |
// no validation rules for RouteConfigurationName |
| 75 |
|
| 76 |
if all { |
| 77 |
switch v := interface{}(m.GetRouteConfiguration()).(type) { |
| 78 |
case interface{ ValidateAll() error }: |
| 79 |
if err := v.ValidateAll(); err != nil { |
| 80 |
errors = append(errors, ScopedRouteConfigurationValidationError{ |
| 81 |
field: "RouteConfiguration", |
| 82 |
reason: "embedded message failed validation", |
| 83 |
cause: err, |
| 84 |
}) |
| 85 |
} |
| 86 |
case interface{ Validate() error }: |
| 87 |
if err := v.Validate(); err != nil { |
| 88 |
errors = append(errors, ScopedRouteConfigurationValidationError{ |
| 89 |
field: "RouteConfiguration", |
| 90 |
reason: "embedded message failed validation", |
| 91 |
cause: err, |
| 92 |
}) |
| 93 |
} |
| 94 |
} |
| 95 |
} else if v, ok := interface{}(m.GetRouteConfiguration()).(interface{ Validate() error }); ok { |
| 96 |
if err := v.Validate(); err != nil { |
| 97 |
return ScopedRouteConfigurationValidationError{ |
| 98 |
field: "RouteConfiguration", |
| 99 |
reason: "embedded message failed validation", |
| 100 |
cause: err, |
| 101 |
} |
| 102 |
} |
| 103 |
} |
| 104 |
|
| 105 |
if m.GetKey() == nil { |
| 106 |
err := ScopedRouteConfigurationValidationError{ |
| 107 |
field: "Key", |
| 108 |
reason: "value is required", |
| 109 |
} |
| 110 |
if !all { |
| 111 |
return err |
| 112 |
} |
| 113 |
errors = append(errors, err) |
| 114 |
} |
| 115 |
|
| 116 |
if all { |
| 117 |
switch v := interface{}(m.GetKey()).(type) { |
| 118 |
case interface{ ValidateAll() error }: |
| 119 |
if err := v.ValidateAll(); err != nil { |
| 120 |
errors = append(errors, ScopedRouteConfigurationValidationError{ |
| 121 |
field: "Key", |
| 122 |
reason: "embedded message failed validation", |
| 123 |
cause: err, |
| 124 |
}) |
| 125 |
} |
| 126 |
case interface{ Validate() error }: |
| 127 |
if err := v.Validate(); err != nil { |
| 128 |
errors = append(errors, ScopedRouteConfigurationValidationError{ |
| 129 |
field: "Key", |
| 130 |
reason: "embedded message failed validation", |
| 131 |
cause: err, |
| 132 |
}) |
| 133 |
} |
| 134 |
} |
| 135 |
} else if v, ok := interface{}(m.GetKey()).(interface{ Validate() error }); ok { |
| 136 |
if err := v.Validate(); err != nil { |
| 137 |
return ScopedRouteConfigurationValidationError{ |
| 138 |
field: "Key", |
| 139 |
reason: "embedded message failed validation", |
| 140 |
cause: err, |
| 141 |
} |
| 142 |
} |
| 143 |
} |
| 144 |
|
| 145 |
if len(errors) > 0 { |
| 146 |
return ScopedRouteConfigurationMultiError(errors) |
| 147 |
} |
| 148 |
|
| 149 |
return nil |
| 150 |
} |
| 151 |
|
| 152 |
// ScopedRouteConfigurationMultiError is an error wrapping multiple validation |
| 153 |
// errors returned by ScopedRouteConfiguration.ValidateAll() if the designated |
| 154 |
// constraints aren't met. |
| 155 |
type ScopedRouteConfigurationMultiError []error |
| 156 |
|
| 157 |
// Error returns a concatenation of all the error messages it wraps. |
| 158 |
func (m ScopedRouteConfigurationMultiError) Error() string { |
| 159 |
var msgs []string |
| 160 |
for _, err := range m { |
| 161 |
msgs = append(msgs, err.Error()) |
| 162 |
} |
| 163 |
return strings.Join(msgs, "; ") |
| 164 |
} |
| 165 |
|
| 166 |
// AllErrors returns a list of validation violation errors. |
| 167 |
func (m ScopedRouteConfigurationMultiError) AllErrors() []error { return m } |
| 168 |
|
| 169 |
// ScopedRouteConfigurationValidationError is the validation error returned by |
| 170 |
// ScopedRouteConfiguration.Validate if the designated constraints aren't met. |
| 171 |
type ScopedRouteConfigurationValidationError struct { |
| 172 |
field string |
| 173 |
reason string |
| 174 |
cause error |
| 175 |
key bool |
| 176 |
} |
| 177 |
|
| 178 |
// Field function returns field value. |
| 179 |
func (e ScopedRouteConfigurationValidationError) Field() string { return e.field } |
| 180 |
|
| 181 |
// Reason function returns reason value. |
| 182 |
func (e ScopedRouteConfigurationValidationError) Reason() string { return e.reason } |
| 183 |
|
| 184 |
// Cause function returns cause value. |
| 185 |
func (e ScopedRouteConfigurationValidationError) Cause() error { return e.cause } |
| 186 |
|
| 187 |
// Key function returns key value. |
| 188 |
func (e ScopedRouteConfigurationValidationError) Key() bool { return e.key } |
| 189 |
|
| 190 |
// ErrorName returns error name. |
| 191 |
func (e ScopedRouteConfigurationValidationError) ErrorName() string { |
| 192 |
return "ScopedRouteConfigurationValidationError" |
| 193 |
} |
| 194 |
|
| 195 |
// Error satisfies the builtin error interface |
| 196 |
func (e ScopedRouteConfigurationValidationError) Error() string { |
| 197 |
cause := "" |
| 198 |
if e.cause != nil { |
| 199 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 200 |
} |
| 201 |
|
| 202 |
key := "" |
| 203 |
if e.key { |
| 204 |
key = "key for " |
| 205 |
} |
| 206 |
|
| 207 |
return fmt.Sprintf( |
| 208 |
"invalid %sScopedRouteConfiguration.%s: %s%s", |
| 209 |
key, |
| 210 |
e.field, |
| 211 |
e.reason, |
| 212 |
cause) |
| 213 |
} |
| 214 |
|
| 215 |
var _ error = ScopedRouteConfigurationValidationError{} |
| 216 |
|
| 217 |
var _ interface { |
| 218 |
Field() string |
| 219 |
Reason() string |
| 220 |
Key() bool |
| 221 |
Cause() error |
| 222 |
ErrorName() string |
| 223 |
} = ScopedRouteConfigurationValidationError{} |
| 224 |
|
| 225 |
// Validate checks the field values on ScopedRouteConfiguration_Key with the |
| 226 |
// rules defined in the proto definition for this message. If any rules are |
| 227 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 228 |
func (m *ScopedRouteConfiguration_Key) Validate() error { |
| 229 |
return m.validate(false) |
| 230 |
} |
| 231 |
|
| 232 |
// ValidateAll checks the field values on ScopedRouteConfiguration_Key with the |
| 233 |
// rules defined in the proto definition for this message. If any rules are |
| 234 |
// violated, the result is a list of violation errors wrapped in |
| 235 |
// ScopedRouteConfiguration_KeyMultiError, or nil if none found. |
| 236 |
func (m *ScopedRouteConfiguration_Key) ValidateAll() error { |
| 237 |
return m.validate(true) |
| 238 |
} |
| 239 |
|
| 240 |
func (m *ScopedRouteConfiguration_Key) validate(all bool) error { |
| 241 |
if m == nil { |
| 242 |
return nil |
| 243 |
} |
| 244 |
|
| 245 |
var errors []error |
| 246 |
|
| 247 |
if len(m.GetFragments()) < 1 { |
| 248 |
err := ScopedRouteConfiguration_KeyValidationError{ |
| 249 |
field: "Fragments", |
| 250 |
reason: "value must contain at least 1 item(s)", |
| 251 |
} |
| 252 |
if !all { |
| 253 |
return err |
| 254 |
} |
| 255 |
errors = append(errors, err) |
| 256 |
} |
| 257 |
|
| 258 |
for idx, item := range m.GetFragments() { |
| 259 |
_, _ = idx, item |
| 260 |
|
| 261 |
if all { |
| 262 |
switch v := interface{}(item).(type) { |
| 263 |
case interface{ ValidateAll() error }: |
| 264 |
if err := v.ValidateAll(); err != nil { |
| 265 |
errors = append(errors, ScopedRouteConfiguration_KeyValidationError{ |
| 266 |
field: fmt.Sprintf("Fragments[%v]", idx), |
| 267 |
reason: "embedded message failed validation", |
| 268 |
cause: err, |
| 269 |
}) |
| 270 |
} |
| 271 |
case interface{ Validate() error }: |
| 272 |
if err := v.Validate(); err != nil { |
| 273 |
errors = append(errors, ScopedRouteConfiguration_KeyValidationError{ |
| 274 |
field: fmt.Sprintf("Fragments[%v]", idx), |
| 275 |
reason: "embedded message failed validation", |
| 276 |
cause: err, |
| 277 |
}) |
| 278 |
} |
| 279 |
} |
| 280 |
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok { |
| 281 |
if err := v.Validate(); err != nil { |
| 282 |
return ScopedRouteConfiguration_KeyValidationError{ |
| 283 |
field: fmt.Sprintf("Fragments[%v]", idx), |
| 284 |
reason: "embedded message failed validation", |
| 285 |
cause: err, |
| 286 |
} |
| 287 |
} |
| 288 |
} |
| 289 |
|
| 290 |
} |
| 291 |
|
| 292 |
if len(errors) > 0 { |
| 293 |
return ScopedRouteConfiguration_KeyMultiError(errors) |
| 294 |
} |
| 295 |
|
| 296 |
return nil |
| 297 |
} |
| 298 |
|
| 299 |
// ScopedRouteConfiguration_KeyMultiError is an error wrapping multiple |
| 300 |
// validation errors returned by ScopedRouteConfiguration_Key.ValidateAll() if |
| 301 |
// the designated constraints aren't met. |
| 302 |
type ScopedRouteConfiguration_KeyMultiError []error |
| 303 |
|
| 304 |
// Error returns a concatenation of all the error messages it wraps. |
| 305 |
func (m ScopedRouteConfiguration_KeyMultiError) Error() string { |
| 306 |
var msgs []string |
| 307 |
for _, err := range m { |
| 308 |
msgs = append(msgs, err.Error()) |
| 309 |
} |
| 310 |
return strings.Join(msgs, "; ") |
| 311 |
} |
| 312 |
|
| 313 |
// AllErrors returns a list of validation violation errors. |
| 314 |
func (m ScopedRouteConfiguration_KeyMultiError) AllErrors() []error { return m } |
| 315 |
|
| 316 |
// ScopedRouteConfiguration_KeyValidationError is the validation error returned |
| 317 |
// by ScopedRouteConfiguration_Key.Validate if the designated constraints |
| 318 |
// aren't met. |
| 319 |
type ScopedRouteConfiguration_KeyValidationError struct { |
| 320 |
field string |
| 321 |
reason string |
| 322 |
cause error |
| 323 |
key bool |
| 324 |
} |
| 325 |
|
| 326 |
// Field function returns field value. |
| 327 |
func (e ScopedRouteConfiguration_KeyValidationError) Field() string { return e.field } |
| 328 |
|
| 329 |
// Reason function returns reason value. |
| 330 |
func (e ScopedRouteConfiguration_KeyValidationError) Reason() string { return e.reason } |
| 331 |
|
| 332 |
// Cause function returns cause value. |
| 333 |
func (e ScopedRouteConfiguration_KeyValidationError) Cause() error { return e.cause } |
| 334 |
|
| 335 |
// Key function returns key value. |
| 336 |
func (e ScopedRouteConfiguration_KeyValidationError) Key() bool { return e.key } |
| 337 |
|
| 338 |
// ErrorName returns error name. |
| 339 |
func (e ScopedRouteConfiguration_KeyValidationError) ErrorName() string { |
| 340 |
return "ScopedRouteConfiguration_KeyValidationError" |
| 341 |
} |
| 342 |
|
| 343 |
// Error satisfies the builtin error interface |
| 344 |
func (e ScopedRouteConfiguration_KeyValidationError) Error() string { |
| 345 |
cause := "" |
| 346 |
if e.cause != nil { |
| 347 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 348 |
} |
| 349 |
|
| 350 |
key := "" |
| 351 |
if e.key { |
| 352 |
key = "key for " |
| 353 |
} |
| 354 |
|
| 355 |
return fmt.Sprintf( |
| 356 |
"invalid %sScopedRouteConfiguration_Key.%s: %s%s", |
| 357 |
key, |
| 358 |
e.field, |
| 359 |
e.reason, |
| 360 |
cause) |
| 361 |
} |
| 362 |
|
| 363 |
var _ error = ScopedRouteConfiguration_KeyValidationError{} |
| 364 |
|
| 365 |
var _ interface { |
| 366 |
Field() string |
| 367 |
Reason() string |
| 368 |
Key() bool |
| 369 |
Cause() error |
| 370 |
ErrorName() string |
| 371 |
} = ScopedRouteConfiguration_KeyValidationError{} |
| 372 |
|
| 373 |
// Validate checks the field values on ScopedRouteConfiguration_Key_Fragment |
| 374 |
// with the rules defined in the proto definition for this message. If any |
| 375 |
// rules are violated, the first error encountered is returned, or nil if |
| 376 |
// there are no violations. |
| 377 |
func (m *ScopedRouteConfiguration_Key_Fragment) Validate() error { |
| 378 |
return m.validate(false) |
| 379 |
} |
| 380 |
|
| 381 |
// ValidateAll checks the field values on ScopedRouteConfiguration_Key_Fragment |
| 382 |
// with the rules defined in the proto definition for this message. If any |
| 383 |
// rules are violated, the result is a list of violation errors wrapped in |
| 384 |
// ScopedRouteConfiguration_Key_FragmentMultiError, or nil if none found. |
| 385 |
func (m *ScopedRouteConfiguration_Key_Fragment) ValidateAll() error { |
| 386 |
return m.validate(true) |
| 387 |
} |
| 388 |
|
| 389 |
func (m *ScopedRouteConfiguration_Key_Fragment) validate(all bool) error { |
| 390 |
if m == nil { |
| 391 |
return nil |
| 392 |
} |
| 393 |
|
| 394 |
var errors []error |
| 395 |
|
| 396 |
oneofTypePresent := false |
| 397 |
switch v := m.Type.(type) { |
| 398 |
case *ScopedRouteConfiguration_Key_Fragment_StringKey: |
| 399 |
if v == nil { |
| 400 |
err := ScopedRouteConfiguration_Key_FragmentValidationError{ |
| 401 |
field: "Type", |
| 402 |
reason: "oneof value cannot be a typed-nil", |
| 403 |
} |
| 404 |
if !all { |
| 405 |
return err |
| 406 |
} |
| 407 |
errors = append(errors, err) |
| 408 |
} |
| 409 |
oneofTypePresent = true |
| 410 |
// no validation rules for StringKey |
| 411 |
default: |
| 412 |
_ = v // ensures v is used |
| 413 |
} |
| 414 |
if !oneofTypePresent { |
| 415 |
err := ScopedRouteConfiguration_Key_FragmentValidationError{ |
| 416 |
field: "Type", |
| 417 |
reason: "value is required", |
| 418 |
} |
| 419 |
if !all { |
| 420 |
return err |
| 421 |
} |
| 422 |
errors = append(errors, err) |
| 423 |
} |
| 424 |
|
| 425 |
if len(errors) > 0 { |
| 426 |
return ScopedRouteConfiguration_Key_FragmentMultiError(errors) |
| 427 |
} |
| 428 |
|
| 429 |
return nil |
| 430 |
} |
| 431 |
|
| 432 |
// ScopedRouteConfiguration_Key_FragmentMultiError is an error wrapping |
| 433 |
// multiple validation errors returned by |
| 434 |
// ScopedRouteConfiguration_Key_Fragment.ValidateAll() if the designated |
| 435 |
// constraints aren't met. |
| 436 |
type ScopedRouteConfiguration_Key_FragmentMultiError []error |
| 437 |
|
| 438 |
// Error returns a concatenation of all the error messages it wraps. |
| 439 |
func (m ScopedRouteConfiguration_Key_FragmentMultiError) Error() string { |
| 440 |
var msgs []string |
| 441 |
for _, err := range m { |
| 442 |
msgs = append(msgs, err.Error()) |
| 443 |
} |
| 444 |
return strings.Join(msgs, "; ") |
| 445 |
} |
| 446 |
|
| 447 |
// AllErrors returns a list of validation violation errors. |
| 448 |
func (m ScopedRouteConfiguration_Key_FragmentMultiError) AllErrors() []error { return m } |
| 449 |
|
| 450 |
// ScopedRouteConfiguration_Key_FragmentValidationError is the validation error |
| 451 |
// returned by ScopedRouteConfiguration_Key_Fragment.Validate if the |
| 452 |
// designated constraints aren't met. |
| 453 |
type ScopedRouteConfiguration_Key_FragmentValidationError struct { |
| 454 |
field string |
| 455 |
reason string |
| 456 |
cause error |
| 457 |
key bool |
| 458 |
} |
| 459 |
|
| 460 |
// Field function returns field value. |
| 461 |
func (e ScopedRouteConfiguration_Key_FragmentValidationError) Field() string { return e.field } |
| 462 |
|
| 463 |
// Reason function returns reason value. |
| 464 |
func (e ScopedRouteConfiguration_Key_FragmentValidationError) Reason() string { return e.reason } |
| 465 |
|
| 466 |
// Cause function returns cause value. |
| 467 |
func (e ScopedRouteConfiguration_Key_FragmentValidationError) Cause() error { return e.cause } |
| 468 |
|
| 469 |
// Key function returns key value. |
| 470 |
func (e ScopedRouteConfiguration_Key_FragmentValidationError) Key() bool { return e.key } |
| 471 |
|
| 472 |
// ErrorName returns error name. |
| 473 |
func (e ScopedRouteConfiguration_Key_FragmentValidationError) ErrorName() string { |
| 474 |
return "ScopedRouteConfiguration_Key_FragmentValidationError" |
| 475 |
} |
| 476 |
|
| 477 |
// Error satisfies the builtin error interface |
| 478 |
func (e ScopedRouteConfiguration_Key_FragmentValidationError) Error() string { |
| 479 |
cause := "" |
| 480 |
if e.cause != nil { |
| 481 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 482 |
} |
| 483 |
|
| 484 |
key := "" |
| 485 |
if e.key { |
| 486 |
key = "key for " |
| 487 |
} |
| 488 |
|
| 489 |
return fmt.Sprintf( |
| 490 |
"invalid %sScopedRouteConfiguration_Key_Fragment.%s: %s%s", |
| 491 |
key, |
| 492 |
e.field, |
| 493 |
e.reason, |
| 494 |
cause) |
| 495 |
} |
| 496 |
|
| 497 |
var _ error = ScopedRouteConfiguration_Key_FragmentValidationError{} |
| 498 |
|
| 499 |
var _ interface { |
| 500 |
Field() string |
| 501 |
Reason() string |
| 502 |
Key() bool |
| 503 |
Cause() error |
| 504 |
ErrorName() string |
| 505 |
} = ScopedRouteConfiguration_Key_FragmentValidationError{} |