| 1 |
//go:build !disable_pgv |
| 2 |
// Code generated by protoc-gen-validate. DO NOT EDIT. |
| 3 |
// source: envoy/config/accesslog/v2/als.proto |
| 4 |
|
| 5 |
package accesslogv2 |
| 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 HttpGrpcAccessLogConfig 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 *HttpGrpcAccessLogConfig) Validate() error { |
| 43 |
return m.validate(false) |
| 44 |
} |
| 45 |
|
| 46 |
// ValidateAll checks the field values on HttpGrpcAccessLogConfig 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 |
// HttpGrpcAccessLogConfigMultiError, or nil if none found. |
| 50 |
func (m *HttpGrpcAccessLogConfig) ValidateAll() error { |
| 51 |
return m.validate(true) |
| 52 |
} |
| 53 |
|
| 54 |
func (m *HttpGrpcAccessLogConfig) validate(all bool) error { |
| 55 |
if m == nil { |
| 56 |
return nil |
| 57 |
} |
| 58 |
|
| 59 |
var errors []error |
| 60 |
|
| 61 |
if m.GetCommonConfig() == nil { |
| 62 |
err := HttpGrpcAccessLogConfigValidationError{ |
| 63 |
field: "CommonConfig", |
| 64 |
reason: "value is required", |
| 65 |
} |
| 66 |
if !all { |
| 67 |
return err |
| 68 |
} |
| 69 |
errors = append(errors, err) |
| 70 |
} |
| 71 |
|
| 72 |
if all { |
| 73 |
switch v := interface{}(m.GetCommonConfig()).(type) { |
| 74 |
case interface{ ValidateAll() error }: |
| 75 |
if err := v.ValidateAll(); err != nil { |
| 76 |
errors = append(errors, HttpGrpcAccessLogConfigValidationError{ |
| 77 |
field: "CommonConfig", |
| 78 |
reason: "embedded message failed validation", |
| 79 |
cause: err, |
| 80 |
}) |
| 81 |
} |
| 82 |
case interface{ Validate() error }: |
| 83 |
if err := v.Validate(); err != nil { |
| 84 |
errors = append(errors, HttpGrpcAccessLogConfigValidationError{ |
| 85 |
field: "CommonConfig", |
| 86 |
reason: "embedded message failed validation", |
| 87 |
cause: err, |
| 88 |
}) |
| 89 |
} |
| 90 |
} |
| 91 |
} else if v, ok := interface{}(m.GetCommonConfig()).(interface{ Validate() error }); ok { |
| 92 |
if err := v.Validate(); err != nil { |
| 93 |
return HttpGrpcAccessLogConfigValidationError{ |
| 94 |
field: "CommonConfig", |
| 95 |
reason: "embedded message failed validation", |
| 96 |
cause: err, |
| 97 |
} |
| 98 |
} |
| 99 |
} |
| 100 |
|
| 101 |
if len(errors) > 0 { |
| 102 |
return HttpGrpcAccessLogConfigMultiError(errors) |
| 103 |
} |
| 104 |
|
| 105 |
return nil |
| 106 |
} |
| 107 |
|
| 108 |
// HttpGrpcAccessLogConfigMultiError is an error wrapping multiple validation |
| 109 |
// errors returned by HttpGrpcAccessLogConfig.ValidateAll() if the designated |
| 110 |
// constraints aren't met. |
| 111 |
type HttpGrpcAccessLogConfigMultiError []error |
| 112 |
|
| 113 |
// Error returns a concatenation of all the error messages it wraps. |
| 114 |
func (m HttpGrpcAccessLogConfigMultiError) Error() string { |
| 115 |
var msgs []string |
| 116 |
for _, err := range m { |
| 117 |
msgs = append(msgs, err.Error()) |
| 118 |
} |
| 119 |
return strings.Join(msgs, "; ") |
| 120 |
} |
| 121 |
|
| 122 |
// AllErrors returns a list of validation violation errors. |
| 123 |
func (m HttpGrpcAccessLogConfigMultiError) AllErrors() []error { return m } |
| 124 |
|
| 125 |
// HttpGrpcAccessLogConfigValidationError is the validation error returned by |
| 126 |
// HttpGrpcAccessLogConfig.Validate if the designated constraints aren't met. |
| 127 |
type HttpGrpcAccessLogConfigValidationError struct { |
| 128 |
field string |
| 129 |
reason string |
| 130 |
cause error |
| 131 |
key bool |
| 132 |
} |
| 133 |
|
| 134 |
// Field function returns field value. |
| 135 |
func (e HttpGrpcAccessLogConfigValidationError) Field() string { return e.field } |
| 136 |
|
| 137 |
// Reason function returns reason value. |
| 138 |
func (e HttpGrpcAccessLogConfigValidationError) Reason() string { return e.reason } |
| 139 |
|
| 140 |
// Cause function returns cause value. |
| 141 |
func (e HttpGrpcAccessLogConfigValidationError) Cause() error { return e.cause } |
| 142 |
|
| 143 |
// Key function returns key value. |
| 144 |
func (e HttpGrpcAccessLogConfigValidationError) Key() bool { return e.key } |
| 145 |
|
| 146 |
// ErrorName returns error name. |
| 147 |
func (e HttpGrpcAccessLogConfigValidationError) ErrorName() string { |
| 148 |
return "HttpGrpcAccessLogConfigValidationError" |
| 149 |
} |
| 150 |
|
| 151 |
// Error satisfies the builtin error interface |
| 152 |
func (e HttpGrpcAccessLogConfigValidationError) Error() string { |
| 153 |
cause := "" |
| 154 |
if e.cause != nil { |
| 155 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 156 |
} |
| 157 |
|
| 158 |
key := "" |
| 159 |
if e.key { |
| 160 |
key = "key for " |
| 161 |
} |
| 162 |
|
| 163 |
return fmt.Sprintf( |
| 164 |
"invalid %sHttpGrpcAccessLogConfig.%s: %s%s", |
| 165 |
key, |
| 166 |
e.field, |
| 167 |
e.reason, |
| 168 |
cause) |
| 169 |
} |
| 170 |
|
| 171 |
var _ error = HttpGrpcAccessLogConfigValidationError{} |
| 172 |
|
| 173 |
var _ interface { |
| 174 |
Field() string |
| 175 |
Reason() string |
| 176 |
Key() bool |
| 177 |
Cause() error |
| 178 |
ErrorName() string |
| 179 |
} = HttpGrpcAccessLogConfigValidationError{} |
| 180 |
|
| 181 |
// Validate checks the field values on TcpGrpcAccessLogConfig with the rules |
| 182 |
// defined in the proto definition for this message. If any rules are |
| 183 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 184 |
func (m *TcpGrpcAccessLogConfig) Validate() error { |
| 185 |
return m.validate(false) |
| 186 |
} |
| 187 |
|
| 188 |
// ValidateAll checks the field values on TcpGrpcAccessLogConfig with the rules |
| 189 |
// defined in the proto definition for this message. If any rules are |
| 190 |
// violated, the result is a list of violation errors wrapped in |
| 191 |
// TcpGrpcAccessLogConfigMultiError, or nil if none found. |
| 192 |
func (m *TcpGrpcAccessLogConfig) ValidateAll() error { |
| 193 |
return m.validate(true) |
| 194 |
} |
| 195 |
|
| 196 |
func (m *TcpGrpcAccessLogConfig) validate(all bool) error { |
| 197 |
if m == nil { |
| 198 |
return nil |
| 199 |
} |
| 200 |
|
| 201 |
var errors []error |
| 202 |
|
| 203 |
if m.GetCommonConfig() == nil { |
| 204 |
err := TcpGrpcAccessLogConfigValidationError{ |
| 205 |
field: "CommonConfig", |
| 206 |
reason: "value is required", |
| 207 |
} |
| 208 |
if !all { |
| 209 |
return err |
| 210 |
} |
| 211 |
errors = append(errors, err) |
| 212 |
} |
| 213 |
|
| 214 |
if all { |
| 215 |
switch v := interface{}(m.GetCommonConfig()).(type) { |
| 216 |
case interface{ ValidateAll() error }: |
| 217 |
if err := v.ValidateAll(); err != nil { |
| 218 |
errors = append(errors, TcpGrpcAccessLogConfigValidationError{ |
| 219 |
field: "CommonConfig", |
| 220 |
reason: "embedded message failed validation", |
| 221 |
cause: err, |
| 222 |
}) |
| 223 |
} |
| 224 |
case interface{ Validate() error }: |
| 225 |
if err := v.Validate(); err != nil { |
| 226 |
errors = append(errors, TcpGrpcAccessLogConfigValidationError{ |
| 227 |
field: "CommonConfig", |
| 228 |
reason: "embedded message failed validation", |
| 229 |
cause: err, |
| 230 |
}) |
| 231 |
} |
| 232 |
} |
| 233 |
} else if v, ok := interface{}(m.GetCommonConfig()).(interface{ Validate() error }); ok { |
| 234 |
if err := v.Validate(); err != nil { |
| 235 |
return TcpGrpcAccessLogConfigValidationError{ |
| 236 |
field: "CommonConfig", |
| 237 |
reason: "embedded message failed validation", |
| 238 |
cause: err, |
| 239 |
} |
| 240 |
} |
| 241 |
} |
| 242 |
|
| 243 |
if len(errors) > 0 { |
| 244 |
return TcpGrpcAccessLogConfigMultiError(errors) |
| 245 |
} |
| 246 |
|
| 247 |
return nil |
| 248 |
} |
| 249 |
|
| 250 |
// TcpGrpcAccessLogConfigMultiError is an error wrapping multiple validation |
| 251 |
// errors returned by TcpGrpcAccessLogConfig.ValidateAll() if the designated |
| 252 |
// constraints aren't met. |
| 253 |
type TcpGrpcAccessLogConfigMultiError []error |
| 254 |
|
| 255 |
// Error returns a concatenation of all the error messages it wraps. |
| 256 |
func (m TcpGrpcAccessLogConfigMultiError) Error() string { |
| 257 |
var msgs []string |
| 258 |
for _, err := range m { |
| 259 |
msgs = append(msgs, err.Error()) |
| 260 |
} |
| 261 |
return strings.Join(msgs, "; ") |
| 262 |
} |
| 263 |
|
| 264 |
// AllErrors returns a list of validation violation errors. |
| 265 |
func (m TcpGrpcAccessLogConfigMultiError) AllErrors() []error { return m } |
| 266 |
|
| 267 |
// TcpGrpcAccessLogConfigValidationError is the validation error returned by |
| 268 |
// TcpGrpcAccessLogConfig.Validate if the designated constraints aren't met. |
| 269 |
type TcpGrpcAccessLogConfigValidationError struct { |
| 270 |
field string |
| 271 |
reason string |
| 272 |
cause error |
| 273 |
key bool |
| 274 |
} |
| 275 |
|
| 276 |
// Field function returns field value. |
| 277 |
func (e TcpGrpcAccessLogConfigValidationError) Field() string { return e.field } |
| 278 |
|
| 279 |
// Reason function returns reason value. |
| 280 |
func (e TcpGrpcAccessLogConfigValidationError) Reason() string { return e.reason } |
| 281 |
|
| 282 |
// Cause function returns cause value. |
| 283 |
func (e TcpGrpcAccessLogConfigValidationError) Cause() error { return e.cause } |
| 284 |
|
| 285 |
// Key function returns key value. |
| 286 |
func (e TcpGrpcAccessLogConfigValidationError) Key() bool { return e.key } |
| 287 |
|
| 288 |
// ErrorName returns error name. |
| 289 |
func (e TcpGrpcAccessLogConfigValidationError) ErrorName() string { |
| 290 |
return "TcpGrpcAccessLogConfigValidationError" |
| 291 |
} |
| 292 |
|
| 293 |
// Error satisfies the builtin error interface |
| 294 |
func (e TcpGrpcAccessLogConfigValidationError) Error() string { |
| 295 |
cause := "" |
| 296 |
if e.cause != nil { |
| 297 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 298 |
} |
| 299 |
|
| 300 |
key := "" |
| 301 |
if e.key { |
| 302 |
key = "key for " |
| 303 |
} |
| 304 |
|
| 305 |
return fmt.Sprintf( |
| 306 |
"invalid %sTcpGrpcAccessLogConfig.%s: %s%s", |
| 307 |
key, |
| 308 |
e.field, |
| 309 |
e.reason, |
| 310 |
cause) |
| 311 |
} |
| 312 |
|
| 313 |
var _ error = TcpGrpcAccessLogConfigValidationError{} |
| 314 |
|
| 315 |
var _ interface { |
| 316 |
Field() string |
| 317 |
Reason() string |
| 318 |
Key() bool |
| 319 |
Cause() error |
| 320 |
ErrorName() string |
| 321 |
} = TcpGrpcAccessLogConfigValidationError{} |
| 322 |
|
| 323 |
// Validate checks the field values on CommonGrpcAccessLogConfig with the rules |
| 324 |
// defined in the proto definition for this message. If any rules are |
| 325 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 326 |
func (m *CommonGrpcAccessLogConfig) Validate() error { |
| 327 |
return m.validate(false) |
| 328 |
} |
| 329 |
|
| 330 |
// ValidateAll checks the field values on CommonGrpcAccessLogConfig with the |
| 331 |
// rules defined in the proto definition for this message. If any rules are |
| 332 |
// violated, the result is a list of violation errors wrapped in |
| 333 |
// CommonGrpcAccessLogConfigMultiError, or nil if none found. |
| 334 |
func (m *CommonGrpcAccessLogConfig) ValidateAll() error { |
| 335 |
return m.validate(true) |
| 336 |
} |
| 337 |
|
| 338 |
func (m *CommonGrpcAccessLogConfig) validate(all bool) error { |
| 339 |
if m == nil { |
| 340 |
return nil |
| 341 |
} |
| 342 |
|
| 343 |
var errors []error |
| 344 |
|
| 345 |
if len(m.GetLogName()) < 1 { |
| 346 |
err := CommonGrpcAccessLogConfigValidationError{ |
| 347 |
field: "LogName", |
| 348 |
reason: "value length must be at least 1 bytes", |
| 349 |
} |
| 350 |
if !all { |
| 351 |
return err |
| 352 |
} |
| 353 |
errors = append(errors, err) |
| 354 |
} |
| 355 |
|
| 356 |
if m.GetGrpcService() == nil { |
| 357 |
err := CommonGrpcAccessLogConfigValidationError{ |
| 358 |
field: "GrpcService", |
| 359 |
reason: "value is required", |
| 360 |
} |
| 361 |
if !all { |
| 362 |
return err |
| 363 |
} |
| 364 |
errors = append(errors, err) |
| 365 |
} |
| 366 |
|
| 367 |
if all { |
| 368 |
switch v := interface{}(m.GetGrpcService()).(type) { |
| 369 |
case interface{ ValidateAll() error }: |
| 370 |
if err := v.ValidateAll(); err != nil { |
| 371 |
errors = append(errors, CommonGrpcAccessLogConfigValidationError{ |
| 372 |
field: "GrpcService", |
| 373 |
reason: "embedded message failed validation", |
| 374 |
cause: err, |
| 375 |
}) |
| 376 |
} |
| 377 |
case interface{ Validate() error }: |
| 378 |
if err := v.Validate(); err != nil { |
| 379 |
errors = append(errors, CommonGrpcAccessLogConfigValidationError{ |
| 380 |
field: "GrpcService", |
| 381 |
reason: "embedded message failed validation", |
| 382 |
cause: err, |
| 383 |
}) |
| 384 |
} |
| 385 |
} |
| 386 |
} else if v, ok := interface{}(m.GetGrpcService()).(interface{ Validate() error }); ok { |
| 387 |
if err := v.Validate(); err != nil { |
| 388 |
return CommonGrpcAccessLogConfigValidationError{ |
| 389 |
field: "GrpcService", |
| 390 |
reason: "embedded message failed validation", |
| 391 |
cause: err, |
| 392 |
} |
| 393 |
} |
| 394 |
} |
| 395 |
|
| 396 |
if d := m.GetBufferFlushInterval(); d != nil { |
| 397 |
dur, err := d.AsDuration(), d.CheckValid() |
| 398 |
if err != nil { |
| 399 |
err = CommonGrpcAccessLogConfigValidationError{ |
| 400 |
field: "BufferFlushInterval", |
| 401 |
reason: "value is not a valid duration", |
| 402 |
cause: err, |
| 403 |
} |
| 404 |
if !all { |
| 405 |
return err |
| 406 |
} |
| 407 |
errors = append(errors, err) |
| 408 |
} else { |
| 409 |
|
| 410 |
gt := time.Duration(0*time.Second + 0*time.Nanosecond) |
| 411 |
|
| 412 |
if dur <= gt { |
| 413 |
err := CommonGrpcAccessLogConfigValidationError{ |
| 414 |
field: "BufferFlushInterval", |
| 415 |
reason: "value must be greater than 0s", |
| 416 |
} |
| 417 |
if !all { |
| 418 |
return err |
| 419 |
} |
| 420 |
errors = append(errors, err) |
| 421 |
} |
| 422 |
|
| 423 |
} |
| 424 |
} |
| 425 |
|
| 426 |
if all { |
| 427 |
switch v := interface{}(m.GetBufferSizeBytes()).(type) { |
| 428 |
case interface{ ValidateAll() error }: |
| 429 |
if err := v.ValidateAll(); err != nil { |
| 430 |
errors = append(errors, CommonGrpcAccessLogConfigValidationError{ |
| 431 |
field: "BufferSizeBytes", |
| 432 |
reason: "embedded message failed validation", |
| 433 |
cause: err, |
| 434 |
}) |
| 435 |
} |
| 436 |
case interface{ Validate() error }: |
| 437 |
if err := v.Validate(); err != nil { |
| 438 |
errors = append(errors, CommonGrpcAccessLogConfigValidationError{ |
| 439 |
field: "BufferSizeBytes", |
| 440 |
reason: "embedded message failed validation", |
| 441 |
cause: err, |
| 442 |
}) |
| 443 |
} |
| 444 |
} |
| 445 |
} else if v, ok := interface{}(m.GetBufferSizeBytes()).(interface{ Validate() error }); ok { |
| 446 |
if err := v.Validate(); err != nil { |
| 447 |
return CommonGrpcAccessLogConfigValidationError{ |
| 448 |
field: "BufferSizeBytes", |
| 449 |
reason: "embedded message failed validation", |
| 450 |
cause: err, |
| 451 |
} |
| 452 |
} |
| 453 |
} |
| 454 |
|
| 455 |
if len(errors) > 0 { |
| 456 |
return CommonGrpcAccessLogConfigMultiError(errors) |
| 457 |
} |
| 458 |
|
| 459 |
return nil |
| 460 |
} |
| 461 |
|
| 462 |
// CommonGrpcAccessLogConfigMultiError is an error wrapping multiple validation |
| 463 |
// errors returned by CommonGrpcAccessLogConfig.ValidateAll() if the |
| 464 |
// designated constraints aren't met. |
| 465 |
type CommonGrpcAccessLogConfigMultiError []error |
| 466 |
|
| 467 |
// Error returns a concatenation of all the error messages it wraps. |
| 468 |
func (m CommonGrpcAccessLogConfigMultiError) Error() string { |
| 469 |
var msgs []string |
| 470 |
for _, err := range m { |
| 471 |
msgs = append(msgs, err.Error()) |
| 472 |
} |
| 473 |
return strings.Join(msgs, "; ") |
| 474 |
} |
| 475 |
|
| 476 |
// AllErrors returns a list of validation violation errors. |
| 477 |
func (m CommonGrpcAccessLogConfigMultiError) AllErrors() []error { return m } |
| 478 |
|
| 479 |
// CommonGrpcAccessLogConfigValidationError is the validation error returned by |
| 480 |
// CommonGrpcAccessLogConfig.Validate if the designated constraints aren't met. |
| 481 |
type CommonGrpcAccessLogConfigValidationError struct { |
| 482 |
field string |
| 483 |
reason string |
| 484 |
cause error |
| 485 |
key bool |
| 486 |
} |
| 487 |
|
| 488 |
// Field function returns field value. |
| 489 |
func (e CommonGrpcAccessLogConfigValidationError) Field() string { return e.field } |
| 490 |
|
| 491 |
// Reason function returns reason value. |
| 492 |
func (e CommonGrpcAccessLogConfigValidationError) Reason() string { return e.reason } |
| 493 |
|
| 494 |
// Cause function returns cause value. |
| 495 |
func (e CommonGrpcAccessLogConfigValidationError) Cause() error { return e.cause } |
| 496 |
|
| 497 |
// Key function returns key value. |
| 498 |
func (e CommonGrpcAccessLogConfigValidationError) Key() bool { return e.key } |
| 499 |
|
| 500 |
// ErrorName returns error name. |
| 501 |
func (e CommonGrpcAccessLogConfigValidationError) ErrorName() string { |
| 502 |
return "CommonGrpcAccessLogConfigValidationError" |
| 503 |
} |
| 504 |
|
| 505 |
// Error satisfies the builtin error interface |
| 506 |
func (e CommonGrpcAccessLogConfigValidationError) Error() string { |
| 507 |
cause := "" |
| 508 |
if e.cause != nil { |
| 509 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 510 |
} |
| 511 |
|
| 512 |
key := "" |
| 513 |
if e.key { |
| 514 |
key = "key for " |
| 515 |
} |
| 516 |
|
| 517 |
return fmt.Sprintf( |
| 518 |
"invalid %sCommonGrpcAccessLogConfig.%s: %s%s", |
| 519 |
key, |
| 520 |
e.field, |
| 521 |
e.reason, |
| 522 |
cause) |
| 523 |
} |
| 524 |
|
| 525 |
var _ error = CommonGrpcAccessLogConfigValidationError{} |
| 526 |
|
| 527 |
var _ interface { |
| 528 |
Field() string |
| 529 |
Reason() string |
| 530 |
Key() bool |
| 531 |
Cause() error |
| 532 |
ErrorName() string |
| 533 |
} = CommonGrpcAccessLogConfigValidationError{} |