| 1 |
//go:build !disable_pgv |
| 2 |
// Code generated by protoc-gen-validate. DO NOT EDIT. |
| 3 |
// source: envoy/config/endpoint/v3/endpoint_components.proto |
| 4 |
|
| 5 |
package endpointv3 |
| 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/config/core/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.HealthStatus(0) |
| 41 |
) |
| 42 |
|
| 43 |
// Validate checks the field values on Endpoint 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 *Endpoint) Validate() error { |
| 47 |
return m.validate(false) |
| 48 |
} |
| 49 |
|
| 50 |
// ValidateAll checks the field values on Endpoint 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 EndpointMultiError, or nil |
| 53 |
// if none found. |
| 54 |
func (m *Endpoint) ValidateAll() error { |
| 55 |
return m.validate(true) |
| 56 |
} |
| 57 |
|
| 58 |
func (m *Endpoint) validate(all bool) error { |
| 59 |
if m == nil { |
| 60 |
return nil |
| 61 |
} |
| 62 |
|
| 63 |
var errors []error |
| 64 |
|
| 65 |
if all { |
| 66 |
switch v := interface{}(m.GetAddress()).(type) { |
| 67 |
case interface{ ValidateAll() error }: |
| 68 |
if err := v.ValidateAll(); err != nil { |
| 69 |
errors = append(errors, EndpointValidationError{ |
| 70 |
field: "Address", |
| 71 |
reason: "embedded message failed validation", |
| 72 |
cause: err, |
| 73 |
}) |
| 74 |
} |
| 75 |
case interface{ Validate() error }: |
| 76 |
if err := v.Validate(); err != nil { |
| 77 |
errors = append(errors, EndpointValidationError{ |
| 78 |
field: "Address", |
| 79 |
reason: "embedded message failed validation", |
| 80 |
cause: err, |
| 81 |
}) |
| 82 |
} |
| 83 |
} |
| 84 |
} else if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok { |
| 85 |
if err := v.Validate(); err != nil { |
| 86 |
return EndpointValidationError{ |
| 87 |
field: "Address", |
| 88 |
reason: "embedded message failed validation", |
| 89 |
cause: err, |
| 90 |
} |
| 91 |
} |
| 92 |
} |
| 93 |
|
| 94 |
if all { |
| 95 |
switch v := interface{}(m.GetHealthCheckConfig()).(type) { |
| 96 |
case interface{ ValidateAll() error }: |
| 97 |
if err := v.ValidateAll(); err != nil { |
| 98 |
errors = append(errors, EndpointValidationError{ |
| 99 |
field: "HealthCheckConfig", |
| 100 |
reason: "embedded message failed validation", |
| 101 |
cause: err, |
| 102 |
}) |
| 103 |
} |
| 104 |
case interface{ Validate() error }: |
| 105 |
if err := v.Validate(); err != nil { |
| 106 |
errors = append(errors, EndpointValidationError{ |
| 107 |
field: "HealthCheckConfig", |
| 108 |
reason: "embedded message failed validation", |
| 109 |
cause: err, |
| 110 |
}) |
| 111 |
} |
| 112 |
} |
| 113 |
} else if v, ok := interface{}(m.GetHealthCheckConfig()).(interface{ Validate() error }); ok { |
| 114 |
if err := v.Validate(); err != nil { |
| 115 |
return EndpointValidationError{ |
| 116 |
field: "HealthCheckConfig", |
| 117 |
reason: "embedded message failed validation", |
| 118 |
cause: err, |
| 119 |
} |
| 120 |
} |
| 121 |
} |
| 122 |
|
| 123 |
// no validation rules for Hostname |
| 124 |
|
| 125 |
for idx, item := range m.GetAdditionalAddresses() { |
| 126 |
_, _ = idx, item |
| 127 |
|
| 128 |
if all { |
| 129 |
switch v := interface{}(item).(type) { |
| 130 |
case interface{ ValidateAll() error }: |
| 131 |
if err := v.ValidateAll(); err != nil { |
| 132 |
errors = append(errors, EndpointValidationError{ |
| 133 |
field: fmt.Sprintf("AdditionalAddresses[%v]", idx), |
| 134 |
reason: "embedded message failed validation", |
| 135 |
cause: err, |
| 136 |
}) |
| 137 |
} |
| 138 |
case interface{ Validate() error }: |
| 139 |
if err := v.Validate(); err != nil { |
| 140 |
errors = append(errors, EndpointValidationError{ |
| 141 |
field: fmt.Sprintf("AdditionalAddresses[%v]", idx), |
| 142 |
reason: "embedded message failed validation", |
| 143 |
cause: err, |
| 144 |
}) |
| 145 |
} |
| 146 |
} |
| 147 |
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok { |
| 148 |
if err := v.Validate(); err != nil { |
| 149 |
return EndpointValidationError{ |
| 150 |
field: fmt.Sprintf("AdditionalAddresses[%v]", idx), |
| 151 |
reason: "embedded message failed validation", |
| 152 |
cause: err, |
| 153 |
} |
| 154 |
} |
| 155 |
} |
| 156 |
|
| 157 |
} |
| 158 |
|
| 159 |
if len(errors) > 0 { |
| 160 |
return EndpointMultiError(errors) |
| 161 |
} |
| 162 |
|
| 163 |
return nil |
| 164 |
} |
| 165 |
|
| 166 |
// EndpointMultiError is an error wrapping multiple validation errors returned |
| 167 |
// by Endpoint.ValidateAll() if the designated constraints aren't met. |
| 168 |
type EndpointMultiError []error |
| 169 |
|
| 170 |
// Error returns a concatenation of all the error messages it wraps. |
| 171 |
func (m EndpointMultiError) Error() string { |
| 172 |
var msgs []string |
| 173 |
for _, err := range m { |
| 174 |
msgs = append(msgs, err.Error()) |
| 175 |
} |
| 176 |
return strings.Join(msgs, "; ") |
| 177 |
} |
| 178 |
|
| 179 |
// AllErrors returns a list of validation violation errors. |
| 180 |
func (m EndpointMultiError) AllErrors() []error { return m } |
| 181 |
|
| 182 |
// EndpointValidationError is the validation error returned by |
| 183 |
// Endpoint.Validate if the designated constraints aren't met. |
| 184 |
type EndpointValidationError struct { |
| 185 |
field string |
| 186 |
reason string |
| 187 |
cause error |
| 188 |
key bool |
| 189 |
} |
| 190 |
|
| 191 |
// Field function returns field value. |
| 192 |
func (e EndpointValidationError) Field() string { return e.field } |
| 193 |
|
| 194 |
// Reason function returns reason value. |
| 195 |
func (e EndpointValidationError) Reason() string { return e.reason } |
| 196 |
|
| 197 |
// Cause function returns cause value. |
| 198 |
func (e EndpointValidationError) Cause() error { return e.cause } |
| 199 |
|
| 200 |
// Key function returns key value. |
| 201 |
func (e EndpointValidationError) Key() bool { return e.key } |
| 202 |
|
| 203 |
// ErrorName returns error name. |
| 204 |
func (e EndpointValidationError) ErrorName() string { return "EndpointValidationError" } |
| 205 |
|
| 206 |
// Error satisfies the builtin error interface |
| 207 |
func (e EndpointValidationError) Error() string { |
| 208 |
cause := "" |
| 209 |
if e.cause != nil { |
| 210 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 211 |
} |
| 212 |
|
| 213 |
key := "" |
| 214 |
if e.key { |
| 215 |
key = "key for " |
| 216 |
} |
| 217 |
|
| 218 |
return fmt.Sprintf( |
| 219 |
"invalid %sEndpoint.%s: %s%s", |
| 220 |
key, |
| 221 |
e.field, |
| 222 |
e.reason, |
| 223 |
cause) |
| 224 |
} |
| 225 |
|
| 226 |
var _ error = EndpointValidationError{} |
| 227 |
|
| 228 |
var _ interface { |
| 229 |
Field() string |
| 230 |
Reason() string |
| 231 |
Key() bool |
| 232 |
Cause() error |
| 233 |
ErrorName() string |
| 234 |
} = EndpointValidationError{} |
| 235 |
|
| 236 |
// Validate checks the field values on LbEndpoint with the rules defined in the |
| 237 |
// proto definition for this message. If any rules are violated, the first |
| 238 |
// error encountered is returned, or nil if there are no violations. |
| 239 |
func (m *LbEndpoint) Validate() error { |
| 240 |
return m.validate(false) |
| 241 |
} |
| 242 |
|
| 243 |
// ValidateAll checks the field values on LbEndpoint with the rules defined in |
| 244 |
// the proto definition for this message. If any rules are violated, the |
| 245 |
// result is a list of violation errors wrapped in LbEndpointMultiError, or |
| 246 |
// nil if none found. |
| 247 |
func (m *LbEndpoint) ValidateAll() error { |
| 248 |
return m.validate(true) |
| 249 |
} |
| 250 |
|
| 251 |
func (m *LbEndpoint) validate(all bool) error { |
| 252 |
if m == nil { |
| 253 |
return nil |
| 254 |
} |
| 255 |
|
| 256 |
var errors []error |
| 257 |
|
| 258 |
// no validation rules for HealthStatus |
| 259 |
|
| 260 |
if all { |
| 261 |
switch v := interface{}(m.GetMetadata()).(type) { |
| 262 |
case interface{ ValidateAll() error }: |
| 263 |
if err := v.ValidateAll(); err != nil { |
| 264 |
errors = append(errors, LbEndpointValidationError{ |
| 265 |
field: "Metadata", |
| 266 |
reason: "embedded message failed validation", |
| 267 |
cause: err, |
| 268 |
}) |
| 269 |
} |
| 270 |
case interface{ Validate() error }: |
| 271 |
if err := v.Validate(); err != nil { |
| 272 |
errors = append(errors, LbEndpointValidationError{ |
| 273 |
field: "Metadata", |
| 274 |
reason: "embedded message failed validation", |
| 275 |
cause: err, |
| 276 |
}) |
| 277 |
} |
| 278 |
} |
| 279 |
} else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { |
| 280 |
if err := v.Validate(); err != nil { |
| 281 |
return LbEndpointValidationError{ |
| 282 |
field: "Metadata", |
| 283 |
reason: "embedded message failed validation", |
| 284 |
cause: err, |
| 285 |
} |
| 286 |
} |
| 287 |
} |
| 288 |
|
| 289 |
if wrapper := m.GetLoadBalancingWeight(); wrapper != nil { |
| 290 |
|
| 291 |
if wrapper.GetValue() < 1 { |
| 292 |
err := LbEndpointValidationError{ |
| 293 |
field: "LoadBalancingWeight", |
| 294 |
reason: "value must be greater than or equal to 1", |
| 295 |
} |
| 296 |
if !all { |
| 297 |
return err |
| 298 |
} |
| 299 |
errors = append(errors, err) |
| 300 |
} |
| 301 |
|
| 302 |
} |
| 303 |
|
| 304 |
switch v := m.HostIdentifier.(type) { |
| 305 |
case *LbEndpoint_Endpoint: |
| 306 |
if v == nil { |
| 307 |
err := LbEndpointValidationError{ |
| 308 |
field: "HostIdentifier", |
| 309 |
reason: "oneof value cannot be a typed-nil", |
| 310 |
} |
| 311 |
if !all { |
| 312 |
return err |
| 313 |
} |
| 314 |
errors = append(errors, err) |
| 315 |
} |
| 316 |
|
| 317 |
if all { |
| 318 |
switch v := interface{}(m.GetEndpoint()).(type) { |
| 319 |
case interface{ ValidateAll() error }: |
| 320 |
if err := v.ValidateAll(); err != nil { |
| 321 |
errors = append(errors, LbEndpointValidationError{ |
| 322 |
field: "Endpoint", |
| 323 |
reason: "embedded message failed validation", |
| 324 |
cause: err, |
| 325 |
}) |
| 326 |
} |
| 327 |
case interface{ Validate() error }: |
| 328 |
if err := v.Validate(); err != nil { |
| 329 |
errors = append(errors, LbEndpointValidationError{ |
| 330 |
field: "Endpoint", |
| 331 |
reason: "embedded message failed validation", |
| 332 |
cause: err, |
| 333 |
}) |
| 334 |
} |
| 335 |
} |
| 336 |
} else if v, ok := interface{}(m.GetEndpoint()).(interface{ Validate() error }); ok { |
| 337 |
if err := v.Validate(); err != nil { |
| 338 |
return LbEndpointValidationError{ |
| 339 |
field: "Endpoint", |
| 340 |
reason: "embedded message failed validation", |
| 341 |
cause: err, |
| 342 |
} |
| 343 |
} |
| 344 |
} |
| 345 |
|
| 346 |
case *LbEndpoint_EndpointName: |
| 347 |
if v == nil { |
| 348 |
err := LbEndpointValidationError{ |
| 349 |
field: "HostIdentifier", |
| 350 |
reason: "oneof value cannot be a typed-nil", |
| 351 |
} |
| 352 |
if !all { |
| 353 |
return err |
| 354 |
} |
| 355 |
errors = append(errors, err) |
| 356 |
} |
| 357 |
// no validation rules for EndpointName |
| 358 |
default: |
| 359 |
_ = v // ensures v is used |
| 360 |
} |
| 361 |
|
| 362 |
if len(errors) > 0 { |
| 363 |
return LbEndpointMultiError(errors) |
| 364 |
} |
| 365 |
|
| 366 |
return nil |
| 367 |
} |
| 368 |
|
| 369 |
// LbEndpointMultiError is an error wrapping multiple validation errors |
| 370 |
// returned by LbEndpoint.ValidateAll() if the designated constraints aren't met. |
| 371 |
type LbEndpointMultiError []error |
| 372 |
|
| 373 |
// Error returns a concatenation of all the error messages it wraps. |
| 374 |
func (m LbEndpointMultiError) Error() string { |
| 375 |
var msgs []string |
| 376 |
for _, err := range m { |
| 377 |
msgs = append(msgs, err.Error()) |
| 378 |
} |
| 379 |
return strings.Join(msgs, "; ") |
| 380 |
} |
| 381 |
|
| 382 |
// AllErrors returns a list of validation violation errors. |
| 383 |
func (m LbEndpointMultiError) AllErrors() []error { return m } |
| 384 |
|
| 385 |
// LbEndpointValidationError is the validation error returned by |
| 386 |
// LbEndpoint.Validate if the designated constraints aren't met. |
| 387 |
type LbEndpointValidationError struct { |
| 388 |
field string |
| 389 |
reason string |
| 390 |
cause error |
| 391 |
key bool |
| 392 |
} |
| 393 |
|
| 394 |
// Field function returns field value. |
| 395 |
func (e LbEndpointValidationError) Field() string { return e.field } |
| 396 |
|
| 397 |
// Reason function returns reason value. |
| 398 |
func (e LbEndpointValidationError) Reason() string { return e.reason } |
| 399 |
|
| 400 |
// Cause function returns cause value. |
| 401 |
func (e LbEndpointValidationError) Cause() error { return e.cause } |
| 402 |
|
| 403 |
// Key function returns key value. |
| 404 |
func (e LbEndpointValidationError) Key() bool { return e.key } |
| 405 |
|
| 406 |
// ErrorName returns error name. |
| 407 |
func (e LbEndpointValidationError) ErrorName() string { return "LbEndpointValidationError" } |
| 408 |
|
| 409 |
// Error satisfies the builtin error interface |
| 410 |
func (e LbEndpointValidationError) Error() string { |
| 411 |
cause := "" |
| 412 |
if e.cause != nil { |
| 413 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 414 |
} |
| 415 |
|
| 416 |
key := "" |
| 417 |
if e.key { |
| 418 |
key = "key for " |
| 419 |
} |
| 420 |
|
| 421 |
return fmt.Sprintf( |
| 422 |
"invalid %sLbEndpoint.%s: %s%s", |
| 423 |
key, |
| 424 |
e.field, |
| 425 |
e.reason, |
| 426 |
cause) |
| 427 |
} |
| 428 |
|
| 429 |
var _ error = LbEndpointValidationError{} |
| 430 |
|
| 431 |
var _ interface { |
| 432 |
Field() string |
| 433 |
Reason() string |
| 434 |
Key() bool |
| 435 |
Cause() error |
| 436 |
ErrorName() string |
| 437 |
} = LbEndpointValidationError{} |
| 438 |
|
| 439 |
// Validate checks the field values on LedsClusterLocalityConfig with the rules |
| 440 |
// defined in the proto definition for this message. If any rules are |
| 441 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 442 |
func (m *LedsClusterLocalityConfig) Validate() error { |
| 443 |
return m.validate(false) |
| 444 |
} |
| 445 |
|
| 446 |
// ValidateAll checks the field values on LedsClusterLocalityConfig with the |
| 447 |
// rules defined in the proto definition for this message. If any rules are |
| 448 |
// violated, the result is a list of violation errors wrapped in |
| 449 |
// LedsClusterLocalityConfigMultiError, or nil if none found. |
| 450 |
func (m *LedsClusterLocalityConfig) ValidateAll() error { |
| 451 |
return m.validate(true) |
| 452 |
} |
| 453 |
|
| 454 |
func (m *LedsClusterLocalityConfig) validate(all bool) error { |
| 455 |
if m == nil { |
| 456 |
return nil |
| 457 |
} |
| 458 |
|
| 459 |
var errors []error |
| 460 |
|
| 461 |
if all { |
| 462 |
switch v := interface{}(m.GetLedsConfig()).(type) { |
| 463 |
case interface{ ValidateAll() error }: |
| 464 |
if err := v.ValidateAll(); err != nil { |
| 465 |
errors = append(errors, LedsClusterLocalityConfigValidationError{ |
| 466 |
field: "LedsConfig", |
| 467 |
reason: "embedded message failed validation", |
| 468 |
cause: err, |
| 469 |
}) |
| 470 |
} |
| 471 |
case interface{ Validate() error }: |
| 472 |
if err := v.Validate(); err != nil { |
| 473 |
errors = append(errors, LedsClusterLocalityConfigValidationError{ |
| 474 |
field: "LedsConfig", |
| 475 |
reason: "embedded message failed validation", |
| 476 |
cause: err, |
| 477 |
}) |
| 478 |
} |
| 479 |
} |
| 480 |
} else if v, ok := interface{}(m.GetLedsConfig()).(interface{ Validate() error }); ok { |
| 481 |
if err := v.Validate(); err != nil { |
| 482 |
return LedsClusterLocalityConfigValidationError{ |
| 483 |
field: "LedsConfig", |
| 484 |
reason: "embedded message failed validation", |
| 485 |
cause: err, |
| 486 |
} |
| 487 |
} |
| 488 |
} |
| 489 |
|
| 490 |
// no validation rules for LedsCollectionName |
| 491 |
|
| 492 |
if len(errors) > 0 { |
| 493 |
return LedsClusterLocalityConfigMultiError(errors) |
| 494 |
} |
| 495 |
|
| 496 |
return nil |
| 497 |
} |
| 498 |
|
| 499 |
// LedsClusterLocalityConfigMultiError is an error wrapping multiple validation |
| 500 |
// errors returned by LedsClusterLocalityConfig.ValidateAll() if the |
| 501 |
// designated constraints aren't met. |
| 502 |
type LedsClusterLocalityConfigMultiError []error |
| 503 |
|
| 504 |
// Error returns a concatenation of all the error messages it wraps. |
| 505 |
func (m LedsClusterLocalityConfigMultiError) Error() string { |
| 506 |
var msgs []string |
| 507 |
for _, err := range m { |
| 508 |
msgs = append(msgs, err.Error()) |
| 509 |
} |
| 510 |
return strings.Join(msgs, "; ") |
| 511 |
} |
| 512 |
|
| 513 |
// AllErrors returns a list of validation violation errors. |
| 514 |
func (m LedsClusterLocalityConfigMultiError) AllErrors() []error { return m } |
| 515 |
|
| 516 |
// LedsClusterLocalityConfigValidationError is the validation error returned by |
| 517 |
// LedsClusterLocalityConfig.Validate if the designated constraints aren't met. |
| 518 |
type LedsClusterLocalityConfigValidationError struct { |
| 519 |
field string |
| 520 |
reason string |
| 521 |
cause error |
| 522 |
key bool |
| 523 |
} |
| 524 |
|
| 525 |
// Field function returns field value. |
| 526 |
func (e LedsClusterLocalityConfigValidationError) Field() string { return e.field } |
| 527 |
|
| 528 |
// Reason function returns reason value. |
| 529 |
func (e LedsClusterLocalityConfigValidationError) Reason() string { return e.reason } |
| 530 |
|
| 531 |
// Cause function returns cause value. |
| 532 |
func (e LedsClusterLocalityConfigValidationError) Cause() error { return e.cause } |
| 533 |
|
| 534 |
// Key function returns key value. |
| 535 |
func (e LedsClusterLocalityConfigValidationError) Key() bool { return e.key } |
| 536 |
|
| 537 |
// ErrorName returns error name. |
| 538 |
func (e LedsClusterLocalityConfigValidationError) ErrorName() string { |
| 539 |
return "LedsClusterLocalityConfigValidationError" |
| 540 |
} |
| 541 |
|
| 542 |
// Error satisfies the builtin error interface |
| 543 |
func (e LedsClusterLocalityConfigValidationError) Error() string { |
| 544 |
cause := "" |
| 545 |
if e.cause != nil { |
| 546 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 547 |
} |
| 548 |
|
| 549 |
key := "" |
| 550 |
if e.key { |
| 551 |
key = "key for " |
| 552 |
} |
| 553 |
|
| 554 |
return fmt.Sprintf( |
| 555 |
"invalid %sLedsClusterLocalityConfig.%s: %s%s", |
| 556 |
key, |
| 557 |
e.field, |
| 558 |
e.reason, |
| 559 |
cause) |
| 560 |
} |
| 561 |
|
| 562 |
var _ error = LedsClusterLocalityConfigValidationError{} |
| 563 |
|
| 564 |
var _ interface { |
| 565 |
Field() string |
| 566 |
Reason() string |
| 567 |
Key() bool |
| 568 |
Cause() error |
| 569 |
ErrorName() string |
| 570 |
} = LedsClusterLocalityConfigValidationError{} |
| 571 |
|
| 572 |
// Validate checks the field values on LocalityLbEndpoints with the rules |
| 573 |
// defined in the proto definition for this message. If any rules are |
| 574 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 575 |
func (m *LocalityLbEndpoints) Validate() error { |
| 576 |
return m.validate(false) |
| 577 |
} |
| 578 |
|
| 579 |
// ValidateAll checks the field values on LocalityLbEndpoints with the rules |
| 580 |
// defined in the proto definition for this message. If any rules are |
| 581 |
// violated, the result is a list of violation errors wrapped in |
| 582 |
// LocalityLbEndpointsMultiError, or nil if none found. |
| 583 |
func (m *LocalityLbEndpoints) ValidateAll() error { |
| 584 |
return m.validate(true) |
| 585 |
} |
| 586 |
|
| 587 |
func (m *LocalityLbEndpoints) validate(all bool) error { |
| 588 |
if m == nil { |
| 589 |
return nil |
| 590 |
} |
| 591 |
|
| 592 |
var errors []error |
| 593 |
|
| 594 |
if all { |
| 595 |
switch v := interface{}(m.GetLocality()).(type) { |
| 596 |
case interface{ ValidateAll() error }: |
| 597 |
if err := v.ValidateAll(); err != nil { |
| 598 |
errors = append(errors, LocalityLbEndpointsValidationError{ |
| 599 |
field: "Locality", |
| 600 |
reason: "embedded message failed validation", |
| 601 |
cause: err, |
| 602 |
}) |
| 603 |
} |
| 604 |
case interface{ Validate() error }: |
| 605 |
if err := v.Validate(); err != nil { |
| 606 |
errors = append(errors, LocalityLbEndpointsValidationError{ |
| 607 |
field: "Locality", |
| 608 |
reason: "embedded message failed validation", |
| 609 |
cause: err, |
| 610 |
}) |
| 611 |
} |
| 612 |
} |
| 613 |
} else if v, ok := interface{}(m.GetLocality()).(interface{ Validate() error }); ok { |
| 614 |
if err := v.Validate(); err != nil { |
| 615 |
return LocalityLbEndpointsValidationError{ |
| 616 |
field: "Locality", |
| 617 |
reason: "embedded message failed validation", |
| 618 |
cause: err, |
| 619 |
} |
| 620 |
} |
| 621 |
} |
| 622 |
|
| 623 |
if all { |
| 624 |
switch v := interface{}(m.GetMetadata()).(type) { |
| 625 |
case interface{ ValidateAll() error }: |
| 626 |
if err := v.ValidateAll(); err != nil { |
| 627 |
errors = append(errors, LocalityLbEndpointsValidationError{ |
| 628 |
field: "Metadata", |
| 629 |
reason: "embedded message failed validation", |
| 630 |
cause: err, |
| 631 |
}) |
| 632 |
} |
| 633 |
case interface{ Validate() error }: |
| 634 |
if err := v.Validate(); err != nil { |
| 635 |
errors = append(errors, LocalityLbEndpointsValidationError{ |
| 636 |
field: "Metadata", |
| 637 |
reason: "embedded message failed validation", |
| 638 |
cause: err, |
| 639 |
}) |
| 640 |
} |
| 641 |
} |
| 642 |
} else if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { |
| 643 |
if err := v.Validate(); err != nil { |
| 644 |
return LocalityLbEndpointsValidationError{ |
| 645 |
field: "Metadata", |
| 646 |
reason: "embedded message failed validation", |
| 647 |
cause: err, |
| 648 |
} |
| 649 |
} |
| 650 |
} |
| 651 |
|
| 652 |
for idx, item := range m.GetLbEndpoints() { |
| 653 |
_, _ = idx, item |
| 654 |
|
| 655 |
if all { |
| 656 |
switch v := interface{}(item).(type) { |
| 657 |
case interface{ ValidateAll() error }: |
| 658 |
if err := v.ValidateAll(); err != nil { |
| 659 |
errors = append(errors, LocalityLbEndpointsValidationError{ |
| 660 |
field: fmt.Sprintf("LbEndpoints[%v]", idx), |
| 661 |
reason: "embedded message failed validation", |
| 662 |
cause: err, |
| 663 |
}) |
| 664 |
} |
| 665 |
case interface{ Validate() error }: |
| 666 |
if err := v.Validate(); err != nil { |
| 667 |
errors = append(errors, LocalityLbEndpointsValidationError{ |
| 668 |
field: fmt.Sprintf("LbEndpoints[%v]", idx), |
| 669 |
reason: "embedded message failed validation", |
| 670 |
cause: err, |
| 671 |
}) |
| 672 |
} |
| 673 |
} |
| 674 |
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok { |
| 675 |
if err := v.Validate(); err != nil { |
| 676 |
return LocalityLbEndpointsValidationError{ |
| 677 |
field: fmt.Sprintf("LbEndpoints[%v]", idx), |
| 678 |
reason: "embedded message failed validation", |
| 679 |
cause: err, |
| 680 |
} |
| 681 |
} |
| 682 |
} |
| 683 |
|
| 684 |
} |
| 685 |
|
| 686 |
if wrapper := m.GetLoadBalancingWeight(); wrapper != nil { |
| 687 |
|
| 688 |
if wrapper.GetValue() < 1 { |
| 689 |
err := LocalityLbEndpointsValidationError{ |
| 690 |
field: "LoadBalancingWeight", |
| 691 |
reason: "value must be greater than or equal to 1", |
| 692 |
} |
| 693 |
if !all { |
| 694 |
return err |
| 695 |
} |
| 696 |
errors = append(errors, err) |
| 697 |
} |
| 698 |
|
| 699 |
} |
| 700 |
|
| 701 |
if m.GetPriority() > 128 { |
| 702 |
err := LocalityLbEndpointsValidationError{ |
| 703 |
field: "Priority", |
| 704 |
reason: "value must be less than or equal to 128", |
| 705 |
} |
| 706 |
if !all { |
| 707 |
return err |
| 708 |
} |
| 709 |
errors = append(errors, err) |
| 710 |
} |
| 711 |
|
| 712 |
if all { |
| 713 |
switch v := interface{}(m.GetProximity()).(type) { |
| 714 |
case interface{ ValidateAll() error }: |
| 715 |
if err := v.ValidateAll(); err != nil { |
| 716 |
errors = append(errors, LocalityLbEndpointsValidationError{ |
| 717 |
field: "Proximity", |
| 718 |
reason: "embedded message failed validation", |
| 719 |
cause: err, |
| 720 |
}) |
| 721 |
} |
| 722 |
case interface{ Validate() error }: |
| 723 |
if err := v.Validate(); err != nil { |
| 724 |
errors = append(errors, LocalityLbEndpointsValidationError{ |
| 725 |
field: "Proximity", |
| 726 |
reason: "embedded message failed validation", |
| 727 |
cause: err, |
| 728 |
}) |
| 729 |
} |
| 730 |
} |
| 731 |
} else if v, ok := interface{}(m.GetProximity()).(interface{ Validate() error }); ok { |
| 732 |
if err := v.Validate(); err != nil { |
| 733 |
return LocalityLbEndpointsValidationError{ |
| 734 |
field: "Proximity", |
| 735 |
reason: "embedded message failed validation", |
| 736 |
cause: err, |
| 737 |
} |
| 738 |
} |
| 739 |
} |
| 740 |
|
| 741 |
switch v := m.LbConfig.(type) { |
| 742 |
case *LocalityLbEndpoints_LoadBalancerEndpoints: |
| 743 |
if v == nil { |
| 744 |
err := LocalityLbEndpointsValidationError{ |
| 745 |
field: "LbConfig", |
| 746 |
reason: "oneof value cannot be a typed-nil", |
| 747 |
} |
| 748 |
if !all { |
| 749 |
return err |
| 750 |
} |
| 751 |
errors = append(errors, err) |
| 752 |
} |
| 753 |
|
| 754 |
if all { |
| 755 |
switch v := interface{}(m.GetLoadBalancerEndpoints()).(type) { |
| 756 |
case interface{ ValidateAll() error }: |
| 757 |
if err := v.ValidateAll(); err != nil { |
| 758 |
errors = append(errors, LocalityLbEndpointsValidationError{ |
| 759 |
field: "LoadBalancerEndpoints", |
| 760 |
reason: "embedded message failed validation", |
| 761 |
cause: err, |
| 762 |
}) |
| 763 |
} |
| 764 |
case interface{ Validate() error }: |
| 765 |
if err := v.Validate(); err != nil { |
| 766 |
errors = append(errors, LocalityLbEndpointsValidationError{ |
| 767 |
field: "LoadBalancerEndpoints", |
| 768 |
reason: "embedded message failed validation", |
| 769 |
cause: err, |
| 770 |
}) |
| 771 |
} |
| 772 |
} |
| 773 |
} else if v, ok := interface{}(m.GetLoadBalancerEndpoints()).(interface{ Validate() error }); ok { |
| 774 |
if err := v.Validate(); err != nil { |
| 775 |
return LocalityLbEndpointsValidationError{ |
| 776 |
field: "LoadBalancerEndpoints", |
| 777 |
reason: "embedded message failed validation", |
| 778 |
cause: err, |
| 779 |
} |
| 780 |
} |
| 781 |
} |
| 782 |
|
| 783 |
case *LocalityLbEndpoints_LedsClusterLocalityConfig: |
| 784 |
if v == nil { |
| 785 |
err := LocalityLbEndpointsValidationError{ |
| 786 |
field: "LbConfig", |
| 787 |
reason: "oneof value cannot be a typed-nil", |
| 788 |
} |
| 789 |
if !all { |
| 790 |
return err |
| 791 |
} |
| 792 |
errors = append(errors, err) |
| 793 |
} |
| 794 |
|
| 795 |
if all { |
| 796 |
switch v := interface{}(m.GetLedsClusterLocalityConfig()).(type) { |
| 797 |
case interface{ ValidateAll() error }: |
| 798 |
if err := v.ValidateAll(); err != nil { |
| 799 |
errors = append(errors, LocalityLbEndpointsValidationError{ |
| 800 |
field: "LedsClusterLocalityConfig", |
| 801 |
reason: "embedded message failed validation", |
| 802 |
cause: err, |
| 803 |
}) |
| 804 |
} |
| 805 |
case interface{ Validate() error }: |
| 806 |
if err := v.Validate(); err != nil { |
| 807 |
errors = append(errors, LocalityLbEndpointsValidationError{ |
| 808 |
field: "LedsClusterLocalityConfig", |
| 809 |
reason: "embedded message failed validation", |
| 810 |
cause: err, |
| 811 |
}) |
| 812 |
} |
| 813 |
} |
| 814 |
} else if v, ok := interface{}(m.GetLedsClusterLocalityConfig()).(interface{ Validate() error }); ok { |
| 815 |
if err := v.Validate(); err != nil { |
| 816 |
return LocalityLbEndpointsValidationError{ |
| 817 |
field: "LedsClusterLocalityConfig", |
| 818 |
reason: "embedded message failed validation", |
| 819 |
cause: err, |
| 820 |
} |
| 821 |
} |
| 822 |
} |
| 823 |
|
| 824 |
default: |
| 825 |
_ = v // ensures v is used |
| 826 |
} |
| 827 |
|
| 828 |
if len(errors) > 0 { |
| 829 |
return LocalityLbEndpointsMultiError(errors) |
| 830 |
} |
| 831 |
|
| 832 |
return nil |
| 833 |
} |
| 834 |
|
| 835 |
// LocalityLbEndpointsMultiError is an error wrapping multiple validation |
| 836 |
// errors returned by LocalityLbEndpoints.ValidateAll() if the designated |
| 837 |
// constraints aren't met. |
| 838 |
type LocalityLbEndpointsMultiError []error |
| 839 |
|
| 840 |
// Error returns a concatenation of all the error messages it wraps. |
| 841 |
func (m LocalityLbEndpointsMultiError) Error() string { |
| 842 |
var msgs []string |
| 843 |
for _, err := range m { |
| 844 |
msgs = append(msgs, err.Error()) |
| 845 |
} |
| 846 |
return strings.Join(msgs, "; ") |
| 847 |
} |
| 848 |
|
| 849 |
// AllErrors returns a list of validation violation errors. |
| 850 |
func (m LocalityLbEndpointsMultiError) AllErrors() []error { return m } |
| 851 |
|
| 852 |
// LocalityLbEndpointsValidationError is the validation error returned by |
| 853 |
// LocalityLbEndpoints.Validate if the designated constraints aren't met. |
| 854 |
type LocalityLbEndpointsValidationError struct { |
| 855 |
field string |
| 856 |
reason string |
| 857 |
cause error |
| 858 |
key bool |
| 859 |
} |
| 860 |
|
| 861 |
// Field function returns field value. |
| 862 |
func (e LocalityLbEndpointsValidationError) Field() string { return e.field } |
| 863 |
|
| 864 |
// Reason function returns reason value. |
| 865 |
func (e LocalityLbEndpointsValidationError) Reason() string { return e.reason } |
| 866 |
|
| 867 |
// Cause function returns cause value. |
| 868 |
func (e LocalityLbEndpointsValidationError) Cause() error { return e.cause } |
| 869 |
|
| 870 |
// Key function returns key value. |
| 871 |
func (e LocalityLbEndpointsValidationError) Key() bool { return e.key } |
| 872 |
|
| 873 |
// ErrorName returns error name. |
| 874 |
func (e LocalityLbEndpointsValidationError) ErrorName() string { |
| 875 |
return "LocalityLbEndpointsValidationError" |
| 876 |
} |
| 877 |
|
| 878 |
// Error satisfies the builtin error interface |
| 879 |
func (e LocalityLbEndpointsValidationError) Error() string { |
| 880 |
cause := "" |
| 881 |
if e.cause != nil { |
| 882 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 883 |
} |
| 884 |
|
| 885 |
key := "" |
| 886 |
if e.key { |
| 887 |
key = "key for " |
| 888 |
} |
| 889 |
|
| 890 |
return fmt.Sprintf( |
| 891 |
"invalid %sLocalityLbEndpoints.%s: %s%s", |
| 892 |
key, |
| 893 |
e.field, |
| 894 |
e.reason, |
| 895 |
cause) |
| 896 |
} |
| 897 |
|
| 898 |
var _ error = LocalityLbEndpointsValidationError{} |
| 899 |
|
| 900 |
var _ interface { |
| 901 |
Field() string |
| 902 |
Reason() string |
| 903 |
Key() bool |
| 904 |
Cause() error |
| 905 |
ErrorName() string |
| 906 |
} = LocalityLbEndpointsValidationError{} |
| 907 |
|
| 908 |
// Validate checks the field values on Endpoint_HealthCheckConfig with the |
| 909 |
// rules defined in the proto definition for this message. If any rules are |
| 910 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 911 |
func (m *Endpoint_HealthCheckConfig) Validate() error { |
| 912 |
return m.validate(false) |
| 913 |
} |
| 914 |
|
| 915 |
// ValidateAll checks the field values on Endpoint_HealthCheckConfig with the |
| 916 |
// rules defined in the proto definition for this message. If any rules are |
| 917 |
// violated, the result is a list of violation errors wrapped in |
| 918 |
// Endpoint_HealthCheckConfigMultiError, or nil if none found. |
| 919 |
func (m *Endpoint_HealthCheckConfig) ValidateAll() error { |
| 920 |
return m.validate(true) |
| 921 |
} |
| 922 |
|
| 923 |
func (m *Endpoint_HealthCheckConfig) validate(all bool) error { |
| 924 |
if m == nil { |
| 925 |
return nil |
| 926 |
} |
| 927 |
|
| 928 |
var errors []error |
| 929 |
|
| 930 |
if m.GetPortValue() > 65535 { |
| 931 |
err := Endpoint_HealthCheckConfigValidationError{ |
| 932 |
field: "PortValue", |
| 933 |
reason: "value must be less than or equal to 65535", |
| 934 |
} |
| 935 |
if !all { |
| 936 |
return err |
| 937 |
} |
| 938 |
errors = append(errors, err) |
| 939 |
} |
| 940 |
|
| 941 |
// no validation rules for Hostname |
| 942 |
|
| 943 |
if all { |
| 944 |
switch v := interface{}(m.GetAddress()).(type) { |
| 945 |
case interface{ ValidateAll() error }: |
| 946 |
if err := v.ValidateAll(); err != nil { |
| 947 |
errors = append(errors, Endpoint_HealthCheckConfigValidationError{ |
| 948 |
field: "Address", |
| 949 |
reason: "embedded message failed validation", |
| 950 |
cause: err, |
| 951 |
}) |
| 952 |
} |
| 953 |
case interface{ Validate() error }: |
| 954 |
if err := v.Validate(); err != nil { |
| 955 |
errors = append(errors, Endpoint_HealthCheckConfigValidationError{ |
| 956 |
field: "Address", |
| 957 |
reason: "embedded message failed validation", |
| 958 |
cause: err, |
| 959 |
}) |
| 960 |
} |
| 961 |
} |
| 962 |
} else if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok { |
| 963 |
if err := v.Validate(); err != nil { |
| 964 |
return Endpoint_HealthCheckConfigValidationError{ |
| 965 |
field: "Address", |
| 966 |
reason: "embedded message failed validation", |
| 967 |
cause: err, |
| 968 |
} |
| 969 |
} |
| 970 |
} |
| 971 |
|
| 972 |
// no validation rules for DisableActiveHealthCheck |
| 973 |
|
| 974 |
if len(errors) > 0 { |
| 975 |
return Endpoint_HealthCheckConfigMultiError(errors) |
| 976 |
} |
| 977 |
|
| 978 |
return nil |
| 979 |
} |
| 980 |
|
| 981 |
// Endpoint_HealthCheckConfigMultiError is an error wrapping multiple |
| 982 |
// validation errors returned by Endpoint_HealthCheckConfig.ValidateAll() if |
| 983 |
// the designated constraints aren't met. |
| 984 |
type Endpoint_HealthCheckConfigMultiError []error |
| 985 |
|
| 986 |
// Error returns a concatenation of all the error messages it wraps. |
| 987 |
func (m Endpoint_HealthCheckConfigMultiError) Error() string { |
| 988 |
var msgs []string |
| 989 |
for _, err := range m { |
| 990 |
msgs = append(msgs, err.Error()) |
| 991 |
} |
| 992 |
return strings.Join(msgs, "; ") |
| 993 |
} |
| 994 |
|
| 995 |
// AllErrors returns a list of validation violation errors. |
| 996 |
func (m Endpoint_HealthCheckConfigMultiError) AllErrors() []error { return m } |
| 997 |
|
| 998 |
// Endpoint_HealthCheckConfigValidationError is the validation error returned |
| 999 |
// by Endpoint_HealthCheckConfig.Validate if the designated constraints aren't met. |
| 1000 |
type Endpoint_HealthCheckConfigValidationError struct { |
| 1001 |
field string |
| 1002 |
reason string |
| 1003 |
cause error |
| 1004 |
key bool |
| 1005 |
} |
| 1006 |
|
| 1007 |
// Field function returns field value. |
| 1008 |
func (e Endpoint_HealthCheckConfigValidationError) Field() string { return e.field } |
| 1009 |
|
| 1010 |
// Reason function returns reason value. |
| 1011 |
func (e Endpoint_HealthCheckConfigValidationError) Reason() string { return e.reason } |
| 1012 |
|
| 1013 |
// Cause function returns cause value. |
| 1014 |
func (e Endpoint_HealthCheckConfigValidationError) Cause() error { return e.cause } |
| 1015 |
|
| 1016 |
// Key function returns key value. |
| 1017 |
func (e Endpoint_HealthCheckConfigValidationError) Key() bool { return e.key } |
| 1018 |
|
| 1019 |
// ErrorName returns error name. |
| 1020 |
func (e Endpoint_HealthCheckConfigValidationError) ErrorName() string { |
| 1021 |
return "Endpoint_HealthCheckConfigValidationError" |
| 1022 |
} |
| 1023 |
|
| 1024 |
// Error satisfies the builtin error interface |
| 1025 |
func (e Endpoint_HealthCheckConfigValidationError) Error() string { |
| 1026 |
cause := "" |
| 1027 |
if e.cause != nil { |
| 1028 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 1029 |
} |
| 1030 |
|
| 1031 |
key := "" |
| 1032 |
if e.key { |
| 1033 |
key = "key for " |
| 1034 |
} |
| 1035 |
|
| 1036 |
return fmt.Sprintf( |
| 1037 |
"invalid %sEndpoint_HealthCheckConfig.%s: %s%s", |
| 1038 |
key, |
| 1039 |
e.field, |
| 1040 |
e.reason, |
| 1041 |
cause) |
| 1042 |
} |
| 1043 |
|
| 1044 |
var _ error = Endpoint_HealthCheckConfigValidationError{} |
| 1045 |
|
| 1046 |
var _ interface { |
| 1047 |
Field() string |
| 1048 |
Reason() string |
| 1049 |
Key() bool |
| 1050 |
Cause() error |
| 1051 |
ErrorName() string |
| 1052 |
} = Endpoint_HealthCheckConfigValidationError{} |
| 1053 |
|
| 1054 |
// Validate checks the field values on Endpoint_AdditionalAddress with the |
| 1055 |
// rules defined in the proto definition for this message. If any rules are |
| 1056 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 1057 |
func (m *Endpoint_AdditionalAddress) Validate() error { |
| 1058 |
return m.validate(false) |
| 1059 |
} |
| 1060 |
|
| 1061 |
// ValidateAll checks the field values on Endpoint_AdditionalAddress with the |
| 1062 |
// rules defined in the proto definition for this message. If any rules are |
| 1063 |
// violated, the result is a list of violation errors wrapped in |
| 1064 |
// Endpoint_AdditionalAddressMultiError, or nil if none found. |
| 1065 |
func (m *Endpoint_AdditionalAddress) ValidateAll() error { |
| 1066 |
return m.validate(true) |
| 1067 |
} |
| 1068 |
|
| 1069 |
func (m *Endpoint_AdditionalAddress) validate(all bool) error { |
| 1070 |
if m == nil { |
| 1071 |
return nil |
| 1072 |
} |
| 1073 |
|
| 1074 |
var errors []error |
| 1075 |
|
| 1076 |
if all { |
| 1077 |
switch v := interface{}(m.GetAddress()).(type) { |
| 1078 |
case interface{ ValidateAll() error }: |
| 1079 |
if err := v.ValidateAll(); err != nil { |
| 1080 |
errors = append(errors, Endpoint_AdditionalAddressValidationError{ |
| 1081 |
field: "Address", |
| 1082 |
reason: "embedded message failed validation", |
| 1083 |
cause: err, |
| 1084 |
}) |
| 1085 |
} |
| 1086 |
case interface{ Validate() error }: |
| 1087 |
if err := v.Validate(); err != nil { |
| 1088 |
errors = append(errors, Endpoint_AdditionalAddressValidationError{ |
| 1089 |
field: "Address", |
| 1090 |
reason: "embedded message failed validation", |
| 1091 |
cause: err, |
| 1092 |
}) |
| 1093 |
} |
| 1094 |
} |
| 1095 |
} else if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok { |
| 1096 |
if err := v.Validate(); err != nil { |
| 1097 |
return Endpoint_AdditionalAddressValidationError{ |
| 1098 |
field: "Address", |
| 1099 |
reason: "embedded message failed validation", |
| 1100 |
cause: err, |
| 1101 |
} |
| 1102 |
} |
| 1103 |
} |
| 1104 |
|
| 1105 |
if len(errors) > 0 { |
| 1106 |
return Endpoint_AdditionalAddressMultiError(errors) |
| 1107 |
} |
| 1108 |
|
| 1109 |
return nil |
| 1110 |
} |
| 1111 |
|
| 1112 |
// Endpoint_AdditionalAddressMultiError is an error wrapping multiple |
| 1113 |
// validation errors returned by Endpoint_AdditionalAddress.ValidateAll() if |
| 1114 |
// the designated constraints aren't met. |
| 1115 |
type Endpoint_AdditionalAddressMultiError []error |
| 1116 |
|
| 1117 |
// Error returns a concatenation of all the error messages it wraps. |
| 1118 |
func (m Endpoint_AdditionalAddressMultiError) Error() string { |
| 1119 |
var msgs []string |
| 1120 |
for _, err := range m { |
| 1121 |
msgs = append(msgs, err.Error()) |
| 1122 |
} |
| 1123 |
return strings.Join(msgs, "; ") |
| 1124 |
} |
| 1125 |
|
| 1126 |
// AllErrors returns a list of validation violation errors. |
| 1127 |
func (m Endpoint_AdditionalAddressMultiError) AllErrors() []error { return m } |
| 1128 |
|
| 1129 |
// Endpoint_AdditionalAddressValidationError is the validation error returned |
| 1130 |
// by Endpoint_AdditionalAddress.Validate if the designated constraints aren't met. |
| 1131 |
type Endpoint_AdditionalAddressValidationError struct { |
| 1132 |
field string |
| 1133 |
reason string |
| 1134 |
cause error |
| 1135 |
key bool |
| 1136 |
} |
| 1137 |
|
| 1138 |
// Field function returns field value. |
| 1139 |
func (e Endpoint_AdditionalAddressValidationError) Field() string { return e.field } |
| 1140 |
|
| 1141 |
// Reason function returns reason value. |
| 1142 |
func (e Endpoint_AdditionalAddressValidationError) Reason() string { return e.reason } |
| 1143 |
|
| 1144 |
// Cause function returns cause value. |
| 1145 |
func (e Endpoint_AdditionalAddressValidationError) Cause() error { return e.cause } |
| 1146 |
|
| 1147 |
// Key function returns key value. |
| 1148 |
func (e Endpoint_AdditionalAddressValidationError) Key() bool { return e.key } |
| 1149 |
|
| 1150 |
// ErrorName returns error name. |
| 1151 |
func (e Endpoint_AdditionalAddressValidationError) ErrorName() string { |
| 1152 |
return "Endpoint_AdditionalAddressValidationError" |
| 1153 |
} |
| 1154 |
|
| 1155 |
// Error satisfies the builtin error interface |
| 1156 |
func (e Endpoint_AdditionalAddressValidationError) Error() string { |
| 1157 |
cause := "" |
| 1158 |
if e.cause != nil { |
| 1159 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 1160 |
} |
| 1161 |
|
| 1162 |
key := "" |
| 1163 |
if e.key { |
| 1164 |
key = "key for " |
| 1165 |
} |
| 1166 |
|
| 1167 |
return fmt.Sprintf( |
| 1168 |
"invalid %sEndpoint_AdditionalAddress.%s: %s%s", |
| 1169 |
key, |
| 1170 |
e.field, |
| 1171 |
e.reason, |
| 1172 |
cause) |
| 1173 |
} |
| 1174 |
|
| 1175 |
var _ error = Endpoint_AdditionalAddressValidationError{} |
| 1176 |
|
| 1177 |
var _ interface { |
| 1178 |
Field() string |
| 1179 |
Reason() string |
| 1180 |
Key() bool |
| 1181 |
Cause() error |
| 1182 |
ErrorName() string |
| 1183 |
} = Endpoint_AdditionalAddressValidationError{} |
| 1184 |
|
| 1185 |
// Validate checks the field values on LocalityLbEndpoints_LbEndpointList with |
| 1186 |
// the rules defined in the proto definition for this message. If any rules |
| 1187 |
// are violated, the first error encountered is returned, or nil if there are |
| 1188 |
// no violations. |
| 1189 |
func (m *LocalityLbEndpoints_LbEndpointList) Validate() error { |
| 1190 |
return m.validate(false) |
| 1191 |
} |
| 1192 |
|
| 1193 |
// ValidateAll checks the field values on LocalityLbEndpoints_LbEndpointList |
| 1194 |
// with the rules defined in the proto definition for this message. If any |
| 1195 |
// rules are violated, the result is a list of violation errors wrapped in |
| 1196 |
// LocalityLbEndpoints_LbEndpointListMultiError, or nil if none found. |
| 1197 |
func (m *LocalityLbEndpoints_LbEndpointList) ValidateAll() error { |
| 1198 |
return m.validate(true) |
| 1199 |
} |
| 1200 |
|
| 1201 |
func (m *LocalityLbEndpoints_LbEndpointList) validate(all bool) error { |
| 1202 |
if m == nil { |
| 1203 |
return nil |
| 1204 |
} |
| 1205 |
|
| 1206 |
var errors []error |
| 1207 |
|
| 1208 |
for idx, item := range m.GetLbEndpoints() { |
| 1209 |
_, _ = idx, item |
| 1210 |
|
| 1211 |
if all { |
| 1212 |
switch v := interface{}(item).(type) { |
| 1213 |
case interface{ ValidateAll() error }: |
| 1214 |
if err := v.ValidateAll(); err != nil { |
| 1215 |
errors = append(errors, LocalityLbEndpoints_LbEndpointListValidationError{ |
| 1216 |
field: fmt.Sprintf("LbEndpoints[%v]", idx), |
| 1217 |
reason: "embedded message failed validation", |
| 1218 |
cause: err, |
| 1219 |
}) |
| 1220 |
} |
| 1221 |
case interface{ Validate() error }: |
| 1222 |
if err := v.Validate(); err != nil { |
| 1223 |
errors = append(errors, LocalityLbEndpoints_LbEndpointListValidationError{ |
| 1224 |
field: fmt.Sprintf("LbEndpoints[%v]", idx), |
| 1225 |
reason: "embedded message failed validation", |
| 1226 |
cause: err, |
| 1227 |
}) |
| 1228 |
} |
| 1229 |
} |
| 1230 |
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok { |
| 1231 |
if err := v.Validate(); err != nil { |
| 1232 |
return LocalityLbEndpoints_LbEndpointListValidationError{ |
| 1233 |
field: fmt.Sprintf("LbEndpoints[%v]", idx), |
| 1234 |
reason: "embedded message failed validation", |
| 1235 |
cause: err, |
| 1236 |
} |
| 1237 |
} |
| 1238 |
} |
| 1239 |
|
| 1240 |
} |
| 1241 |
|
| 1242 |
if len(errors) > 0 { |
| 1243 |
return LocalityLbEndpoints_LbEndpointListMultiError(errors) |
| 1244 |
} |
| 1245 |
|
| 1246 |
return nil |
| 1247 |
} |
| 1248 |
|
| 1249 |
// LocalityLbEndpoints_LbEndpointListMultiError is an error wrapping multiple |
| 1250 |
// validation errors returned by |
| 1251 |
// LocalityLbEndpoints_LbEndpointList.ValidateAll() if the designated |
| 1252 |
// constraints aren't met. |
| 1253 |
type LocalityLbEndpoints_LbEndpointListMultiError []error |
| 1254 |
|
| 1255 |
// Error returns a concatenation of all the error messages it wraps. |
| 1256 |
func (m LocalityLbEndpoints_LbEndpointListMultiError) Error() string { |
| 1257 |
var msgs []string |
| 1258 |
for _, err := range m { |
| 1259 |
msgs = append(msgs, err.Error()) |
| 1260 |
} |
| 1261 |
return strings.Join(msgs, "; ") |
| 1262 |
} |
| 1263 |
|
| 1264 |
// AllErrors returns a list of validation violation errors. |
| 1265 |
func (m LocalityLbEndpoints_LbEndpointListMultiError) AllErrors() []error { return m } |
| 1266 |
|
| 1267 |
// LocalityLbEndpoints_LbEndpointListValidationError is the validation error |
| 1268 |
// returned by LocalityLbEndpoints_LbEndpointList.Validate if the designated |
| 1269 |
// constraints aren't met. |
| 1270 |
type LocalityLbEndpoints_LbEndpointListValidationError struct { |
| 1271 |
field string |
| 1272 |
reason string |
| 1273 |
cause error |
| 1274 |
key bool |
| 1275 |
} |
| 1276 |
|
| 1277 |
// Field function returns field value. |
| 1278 |
func (e LocalityLbEndpoints_LbEndpointListValidationError) Field() string { return e.field } |
| 1279 |
|
| 1280 |
// Reason function returns reason value. |
| 1281 |
func (e LocalityLbEndpoints_LbEndpointListValidationError) Reason() string { return e.reason } |
| 1282 |
|
| 1283 |
// Cause function returns cause value. |
| 1284 |
func (e LocalityLbEndpoints_LbEndpointListValidationError) Cause() error { return e.cause } |
| 1285 |
|
| 1286 |
// Key function returns key value. |
| 1287 |
func (e LocalityLbEndpoints_LbEndpointListValidationError) Key() bool { return e.key } |
| 1288 |
|
| 1289 |
// ErrorName returns error name. |
| 1290 |
func (e LocalityLbEndpoints_LbEndpointListValidationError) ErrorName() string { |
| 1291 |
return "LocalityLbEndpoints_LbEndpointListValidationError" |
| 1292 |
} |
| 1293 |
|
| 1294 |
// Error satisfies the builtin error interface |
| 1295 |
func (e LocalityLbEndpoints_LbEndpointListValidationError) Error() string { |
| 1296 |
cause := "" |
| 1297 |
if e.cause != nil { |
| 1298 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 1299 |
} |
| 1300 |
|
| 1301 |
key := "" |
| 1302 |
if e.key { |
| 1303 |
key = "key for " |
| 1304 |
} |
| 1305 |
|
| 1306 |
return fmt.Sprintf( |
| 1307 |
"invalid %sLocalityLbEndpoints_LbEndpointList.%s: %s%s", |
| 1308 |
key, |
| 1309 |
e.field, |
| 1310 |
e.reason, |
| 1311 |
cause) |
| 1312 |
} |
| 1313 |
|
| 1314 |
var _ error = LocalityLbEndpoints_LbEndpointListValidationError{} |
| 1315 |
|
| 1316 |
var _ interface { |
| 1317 |
Field() string |
| 1318 |
Reason() string |
| 1319 |
Key() bool |
| 1320 |
Cause() error |
| 1321 |
ErrorName() string |
| 1322 |
} = LocalityLbEndpoints_LbEndpointListValidationError{} |