| 1 |
//go:build !disable_pgv |
| 2 |
// Code generated by protoc-gen-validate. DO NOT EDIT. |
| 3 |
// source: envoy/extensions/wasm/v3/wasm.proto |
| 4 |
|
| 5 |
package wasmv3 |
| 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 ReloadConfig with the rules defined in |
| 40 |
// the proto definition for this message. If any rules are violated, the first |
| 41 |
// error encountered is returned, or nil if there are no violations. |
| 42 |
func (m *ReloadConfig) Validate() error { |
| 43 |
return m.validate(false) |
| 44 |
} |
| 45 |
|
| 46 |
// ValidateAll checks the field values on ReloadConfig with the rules defined |
| 47 |
// in the proto definition for this message. If any rules are violated, the |
| 48 |
// result is a list of violation errors wrapped in ReloadConfigMultiError, or |
| 49 |
// nil if none found. |
| 50 |
func (m *ReloadConfig) ValidateAll() error { |
| 51 |
return m.validate(true) |
| 52 |
} |
| 53 |
|
| 54 |
func (m *ReloadConfig) validate(all bool) error { |
| 55 |
if m == nil { |
| 56 |
return nil |
| 57 |
} |
| 58 |
|
| 59 |
var errors []error |
| 60 |
|
| 61 |
if all { |
| 62 |
switch v := interface{}(m.GetBackoff()).(type) { |
| 63 |
case interface{ ValidateAll() error }: |
| 64 |
if err := v.ValidateAll(); err != nil { |
| 65 |
errors = append(errors, ReloadConfigValidationError{ |
| 66 |
field: "Backoff", |
| 67 |
reason: "embedded message failed validation", |
| 68 |
cause: err, |
| 69 |
}) |
| 70 |
} |
| 71 |
case interface{ Validate() error }: |
| 72 |
if err := v.Validate(); err != nil { |
| 73 |
errors = append(errors, ReloadConfigValidationError{ |
| 74 |
field: "Backoff", |
| 75 |
reason: "embedded message failed validation", |
| 76 |
cause: err, |
| 77 |
}) |
| 78 |
} |
| 79 |
} |
| 80 |
} else if v, ok := interface{}(m.GetBackoff()).(interface{ Validate() error }); ok { |
| 81 |
if err := v.Validate(); err != nil { |
| 82 |
return ReloadConfigValidationError{ |
| 83 |
field: "Backoff", |
| 84 |
reason: "embedded message failed validation", |
| 85 |
cause: err, |
| 86 |
} |
| 87 |
} |
| 88 |
} |
| 89 |
|
| 90 |
if len(errors) > 0 { |
| 91 |
return ReloadConfigMultiError(errors) |
| 92 |
} |
| 93 |
|
| 94 |
return nil |
| 95 |
} |
| 96 |
|
| 97 |
// ReloadConfigMultiError is an error wrapping multiple validation errors |
| 98 |
// returned by ReloadConfig.ValidateAll() if the designated constraints aren't met. |
| 99 |
type ReloadConfigMultiError []error |
| 100 |
|
| 101 |
// Error returns a concatenation of all the error messages it wraps. |
| 102 |
func (m ReloadConfigMultiError) Error() string { |
| 103 |
var msgs []string |
| 104 |
for _, err := range m { |
| 105 |
msgs = append(msgs, err.Error()) |
| 106 |
} |
| 107 |
return strings.Join(msgs, "; ") |
| 108 |
} |
| 109 |
|
| 110 |
// AllErrors returns a list of validation violation errors. |
| 111 |
func (m ReloadConfigMultiError) AllErrors() []error { return m } |
| 112 |
|
| 113 |
// ReloadConfigValidationError is the validation error returned by |
| 114 |
// ReloadConfig.Validate if the designated constraints aren't met. |
| 115 |
type ReloadConfigValidationError struct { |
| 116 |
field string |
| 117 |
reason string |
| 118 |
cause error |
| 119 |
key bool |
| 120 |
} |
| 121 |
|
| 122 |
// Field function returns field value. |
| 123 |
func (e ReloadConfigValidationError) Field() string { return e.field } |
| 124 |
|
| 125 |
// Reason function returns reason value. |
| 126 |
func (e ReloadConfigValidationError) Reason() string { return e.reason } |
| 127 |
|
| 128 |
// Cause function returns cause value. |
| 129 |
func (e ReloadConfigValidationError) Cause() error { return e.cause } |
| 130 |
|
| 131 |
// Key function returns key value. |
| 132 |
func (e ReloadConfigValidationError) Key() bool { return e.key } |
| 133 |
|
| 134 |
// ErrorName returns error name. |
| 135 |
func (e ReloadConfigValidationError) ErrorName() string { return "ReloadConfigValidationError" } |
| 136 |
|
| 137 |
// Error satisfies the builtin error interface |
| 138 |
func (e ReloadConfigValidationError) Error() string { |
| 139 |
cause := "" |
| 140 |
if e.cause != nil { |
| 141 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 142 |
} |
| 143 |
|
| 144 |
key := "" |
| 145 |
if e.key { |
| 146 |
key = "key for " |
| 147 |
} |
| 148 |
|
| 149 |
return fmt.Sprintf( |
| 150 |
"invalid %sReloadConfig.%s: %s%s", |
| 151 |
key, |
| 152 |
e.field, |
| 153 |
e.reason, |
| 154 |
cause) |
| 155 |
} |
| 156 |
|
| 157 |
var _ error = ReloadConfigValidationError{} |
| 158 |
|
| 159 |
var _ interface { |
| 160 |
Field() string |
| 161 |
Reason() string |
| 162 |
Key() bool |
| 163 |
Cause() error |
| 164 |
ErrorName() string |
| 165 |
} = ReloadConfigValidationError{} |
| 166 |
|
| 167 |
// Validate checks the field values on CapabilityRestrictionConfig with the |
| 168 |
// rules defined in the proto definition for this message. If any rules are |
| 169 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 170 |
func (m *CapabilityRestrictionConfig) Validate() error { |
| 171 |
return m.validate(false) |
| 172 |
} |
| 173 |
|
| 174 |
// ValidateAll checks the field values on CapabilityRestrictionConfig with the |
| 175 |
// rules defined in the proto definition for this message. If any rules are |
| 176 |
// violated, the result is a list of violation errors wrapped in |
| 177 |
// CapabilityRestrictionConfigMultiError, or nil if none found. |
| 178 |
func (m *CapabilityRestrictionConfig) ValidateAll() error { |
| 179 |
return m.validate(true) |
| 180 |
} |
| 181 |
|
| 182 |
func (m *CapabilityRestrictionConfig) validate(all bool) error { |
| 183 |
if m == nil { |
| 184 |
return nil |
| 185 |
} |
| 186 |
|
| 187 |
var errors []error |
| 188 |
|
| 189 |
{ |
| 190 |
sorted_keys := make([]string, len(m.GetAllowedCapabilities())) |
| 191 |
i := 0 |
| 192 |
for key := range m.GetAllowedCapabilities() { |
| 193 |
sorted_keys[i] = key |
| 194 |
i++ |
| 195 |
} |
| 196 |
sort.Slice(sorted_keys, func(i, j int) bool { return sorted_keys[i] < sorted_keys[j] }) |
| 197 |
for _, key := range sorted_keys { |
| 198 |
val := m.GetAllowedCapabilities()[key] |
| 199 |
_ = val |
| 200 |
|
| 201 |
// no validation rules for AllowedCapabilities[key] |
| 202 |
|
| 203 |
if all { |
| 204 |
switch v := interface{}(val).(type) { |
| 205 |
case interface{ ValidateAll() error }: |
| 206 |
if err := v.ValidateAll(); err != nil { |
| 207 |
errors = append(errors, CapabilityRestrictionConfigValidationError{ |
| 208 |
field: fmt.Sprintf("AllowedCapabilities[%v]", key), |
| 209 |
reason: "embedded message failed validation", |
| 210 |
cause: err, |
| 211 |
}) |
| 212 |
} |
| 213 |
case interface{ Validate() error }: |
| 214 |
if err := v.Validate(); err != nil { |
| 215 |
errors = append(errors, CapabilityRestrictionConfigValidationError{ |
| 216 |
field: fmt.Sprintf("AllowedCapabilities[%v]", key), |
| 217 |
reason: "embedded message failed validation", |
| 218 |
cause: err, |
| 219 |
}) |
| 220 |
} |
| 221 |
} |
| 222 |
} else if v, ok := interface{}(val).(interface{ Validate() error }); ok { |
| 223 |
if err := v.Validate(); err != nil { |
| 224 |
return CapabilityRestrictionConfigValidationError{ |
| 225 |
field: fmt.Sprintf("AllowedCapabilities[%v]", key), |
| 226 |
reason: "embedded message failed validation", |
| 227 |
cause: err, |
| 228 |
} |
| 229 |
} |
| 230 |
} |
| 231 |
|
| 232 |
} |
| 233 |
} |
| 234 |
|
| 235 |
if len(errors) > 0 { |
| 236 |
return CapabilityRestrictionConfigMultiError(errors) |
| 237 |
} |
| 238 |
|
| 239 |
return nil |
| 240 |
} |
| 241 |
|
| 242 |
// CapabilityRestrictionConfigMultiError is an error wrapping multiple |
| 243 |
// validation errors returned by CapabilityRestrictionConfig.ValidateAll() if |
| 244 |
// the designated constraints aren't met. |
| 245 |
type CapabilityRestrictionConfigMultiError []error |
| 246 |
|
| 247 |
// Error returns a concatenation of all the error messages it wraps. |
| 248 |
func (m CapabilityRestrictionConfigMultiError) Error() string { |
| 249 |
var msgs []string |
| 250 |
for _, err := range m { |
| 251 |
msgs = append(msgs, err.Error()) |
| 252 |
} |
| 253 |
return strings.Join(msgs, "; ") |
| 254 |
} |
| 255 |
|
| 256 |
// AllErrors returns a list of validation violation errors. |
| 257 |
func (m CapabilityRestrictionConfigMultiError) AllErrors() []error { return m } |
| 258 |
|
| 259 |
// CapabilityRestrictionConfigValidationError is the validation error returned |
| 260 |
// by CapabilityRestrictionConfig.Validate if the designated constraints |
| 261 |
// aren't met. |
| 262 |
type CapabilityRestrictionConfigValidationError struct { |
| 263 |
field string |
| 264 |
reason string |
| 265 |
cause error |
| 266 |
key bool |
| 267 |
} |
| 268 |
|
| 269 |
// Field function returns field value. |
| 270 |
func (e CapabilityRestrictionConfigValidationError) Field() string { return e.field } |
| 271 |
|
| 272 |
// Reason function returns reason value. |
| 273 |
func (e CapabilityRestrictionConfigValidationError) Reason() string { return e.reason } |
| 274 |
|
| 275 |
// Cause function returns cause value. |
| 276 |
func (e CapabilityRestrictionConfigValidationError) Cause() error { return e.cause } |
| 277 |
|
| 278 |
// Key function returns key value. |
| 279 |
func (e CapabilityRestrictionConfigValidationError) Key() bool { return e.key } |
| 280 |
|
| 281 |
// ErrorName returns error name. |
| 282 |
func (e CapabilityRestrictionConfigValidationError) ErrorName() string { |
| 283 |
return "CapabilityRestrictionConfigValidationError" |
| 284 |
} |
| 285 |
|
| 286 |
// Error satisfies the builtin error interface |
| 287 |
func (e CapabilityRestrictionConfigValidationError) Error() string { |
| 288 |
cause := "" |
| 289 |
if e.cause != nil { |
| 290 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 291 |
} |
| 292 |
|
| 293 |
key := "" |
| 294 |
if e.key { |
| 295 |
key = "key for " |
| 296 |
} |
| 297 |
|
| 298 |
return fmt.Sprintf( |
| 299 |
"invalid %sCapabilityRestrictionConfig.%s: %s%s", |
| 300 |
key, |
| 301 |
e.field, |
| 302 |
e.reason, |
| 303 |
cause) |
| 304 |
} |
| 305 |
|
| 306 |
var _ error = CapabilityRestrictionConfigValidationError{} |
| 307 |
|
| 308 |
var _ interface { |
| 309 |
Field() string |
| 310 |
Reason() string |
| 311 |
Key() bool |
| 312 |
Cause() error |
| 313 |
ErrorName() string |
| 314 |
} = CapabilityRestrictionConfigValidationError{} |
| 315 |
|
| 316 |
// Validate checks the field values on SanitizationConfig with the rules |
| 317 |
// defined in the proto definition for this message. If any rules are |
| 318 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 319 |
func (m *SanitizationConfig) Validate() error { |
| 320 |
return m.validate(false) |
| 321 |
} |
| 322 |
|
| 323 |
// ValidateAll checks the field values on SanitizationConfig with the rules |
| 324 |
// defined in the proto definition for this message. If any rules are |
| 325 |
// violated, the result is a list of violation errors wrapped in |
| 326 |
// SanitizationConfigMultiError, or nil if none found. |
| 327 |
func (m *SanitizationConfig) ValidateAll() error { |
| 328 |
return m.validate(true) |
| 329 |
} |
| 330 |
|
| 331 |
func (m *SanitizationConfig) validate(all bool) error { |
| 332 |
if m == nil { |
| 333 |
return nil |
| 334 |
} |
| 335 |
|
| 336 |
var errors []error |
| 337 |
|
| 338 |
if len(errors) > 0 { |
| 339 |
return SanitizationConfigMultiError(errors) |
| 340 |
} |
| 341 |
|
| 342 |
return nil |
| 343 |
} |
| 344 |
|
| 345 |
// SanitizationConfigMultiError is an error wrapping multiple validation errors |
| 346 |
// returned by SanitizationConfig.ValidateAll() if the designated constraints |
| 347 |
// aren't met. |
| 348 |
type SanitizationConfigMultiError []error |
| 349 |
|
| 350 |
// Error returns a concatenation of all the error messages it wraps. |
| 351 |
func (m SanitizationConfigMultiError) Error() string { |
| 352 |
var msgs []string |
| 353 |
for _, err := range m { |
| 354 |
msgs = append(msgs, err.Error()) |
| 355 |
} |
| 356 |
return strings.Join(msgs, "; ") |
| 357 |
} |
| 358 |
|
| 359 |
// AllErrors returns a list of validation violation errors. |
| 360 |
func (m SanitizationConfigMultiError) AllErrors() []error { return m } |
| 361 |
|
| 362 |
// SanitizationConfigValidationError is the validation error returned by |
| 363 |
// SanitizationConfig.Validate if the designated constraints aren't met. |
| 364 |
type SanitizationConfigValidationError struct { |
| 365 |
field string |
| 366 |
reason string |
| 367 |
cause error |
| 368 |
key bool |
| 369 |
} |
| 370 |
|
| 371 |
// Field function returns field value. |
| 372 |
func (e SanitizationConfigValidationError) Field() string { return e.field } |
| 373 |
|
| 374 |
// Reason function returns reason value. |
| 375 |
func (e SanitizationConfigValidationError) Reason() string { return e.reason } |
| 376 |
|
| 377 |
// Cause function returns cause value. |
| 378 |
func (e SanitizationConfigValidationError) Cause() error { return e.cause } |
| 379 |
|
| 380 |
// Key function returns key value. |
| 381 |
func (e SanitizationConfigValidationError) Key() bool { return e.key } |
| 382 |
|
| 383 |
// ErrorName returns error name. |
| 384 |
func (e SanitizationConfigValidationError) ErrorName() string { |
| 385 |
return "SanitizationConfigValidationError" |
| 386 |
} |
| 387 |
|
| 388 |
// Error satisfies the builtin error interface |
| 389 |
func (e SanitizationConfigValidationError) Error() string { |
| 390 |
cause := "" |
| 391 |
if e.cause != nil { |
| 392 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 393 |
} |
| 394 |
|
| 395 |
key := "" |
| 396 |
if e.key { |
| 397 |
key = "key for " |
| 398 |
} |
| 399 |
|
| 400 |
return fmt.Sprintf( |
| 401 |
"invalid %sSanitizationConfig.%s: %s%s", |
| 402 |
key, |
| 403 |
e.field, |
| 404 |
e.reason, |
| 405 |
cause) |
| 406 |
} |
| 407 |
|
| 408 |
var _ error = SanitizationConfigValidationError{} |
| 409 |
|
| 410 |
var _ interface { |
| 411 |
Field() string |
| 412 |
Reason() string |
| 413 |
Key() bool |
| 414 |
Cause() error |
| 415 |
ErrorName() string |
| 416 |
} = SanitizationConfigValidationError{} |
| 417 |
|
| 418 |
// Validate checks the field values on VmConfig with the rules defined in the |
| 419 |
// proto definition for this message. If any rules are violated, the first |
| 420 |
// error encountered is returned, or nil if there are no violations. |
| 421 |
func (m *VmConfig) Validate() error { |
| 422 |
return m.validate(false) |
| 423 |
} |
| 424 |
|
| 425 |
// ValidateAll checks the field values on VmConfig with the rules defined in |
| 426 |
// the proto definition for this message. If any rules are violated, the |
| 427 |
// result is a list of violation errors wrapped in VmConfigMultiError, or nil |
| 428 |
// if none found. |
| 429 |
func (m *VmConfig) ValidateAll() error { |
| 430 |
return m.validate(true) |
| 431 |
} |
| 432 |
|
| 433 |
func (m *VmConfig) validate(all bool) error { |
| 434 |
if m == nil { |
| 435 |
return nil |
| 436 |
} |
| 437 |
|
| 438 |
var errors []error |
| 439 |
|
| 440 |
// no validation rules for VmId |
| 441 |
|
| 442 |
// no validation rules for Runtime |
| 443 |
|
| 444 |
if all { |
| 445 |
switch v := interface{}(m.GetCode()).(type) { |
| 446 |
case interface{ ValidateAll() error }: |
| 447 |
if err := v.ValidateAll(); err != nil { |
| 448 |
errors = append(errors, VmConfigValidationError{ |
| 449 |
field: "Code", |
| 450 |
reason: "embedded message failed validation", |
| 451 |
cause: err, |
| 452 |
}) |
| 453 |
} |
| 454 |
case interface{ Validate() error }: |
| 455 |
if err := v.Validate(); err != nil { |
| 456 |
errors = append(errors, VmConfigValidationError{ |
| 457 |
field: "Code", |
| 458 |
reason: "embedded message failed validation", |
| 459 |
cause: err, |
| 460 |
}) |
| 461 |
} |
| 462 |
} |
| 463 |
} else if v, ok := interface{}(m.GetCode()).(interface{ Validate() error }); ok { |
| 464 |
if err := v.Validate(); err != nil { |
| 465 |
return VmConfigValidationError{ |
| 466 |
field: "Code", |
| 467 |
reason: "embedded message failed validation", |
| 468 |
cause: err, |
| 469 |
} |
| 470 |
} |
| 471 |
} |
| 472 |
|
| 473 |
if all { |
| 474 |
switch v := interface{}(m.GetConfiguration()).(type) { |
| 475 |
case interface{ ValidateAll() error }: |
| 476 |
if err := v.ValidateAll(); err != nil { |
| 477 |
errors = append(errors, VmConfigValidationError{ |
| 478 |
field: "Configuration", |
| 479 |
reason: "embedded message failed validation", |
| 480 |
cause: err, |
| 481 |
}) |
| 482 |
} |
| 483 |
case interface{ Validate() error }: |
| 484 |
if err := v.Validate(); err != nil { |
| 485 |
errors = append(errors, VmConfigValidationError{ |
| 486 |
field: "Configuration", |
| 487 |
reason: "embedded message failed validation", |
| 488 |
cause: err, |
| 489 |
}) |
| 490 |
} |
| 491 |
} |
| 492 |
} else if v, ok := interface{}(m.GetConfiguration()).(interface{ Validate() error }); ok { |
| 493 |
if err := v.Validate(); err != nil { |
| 494 |
return VmConfigValidationError{ |
| 495 |
field: "Configuration", |
| 496 |
reason: "embedded message failed validation", |
| 497 |
cause: err, |
| 498 |
} |
| 499 |
} |
| 500 |
} |
| 501 |
|
| 502 |
// no validation rules for AllowPrecompiled |
| 503 |
|
| 504 |
// no validation rules for NackOnCodeCacheMiss |
| 505 |
|
| 506 |
if all { |
| 507 |
switch v := interface{}(m.GetEnvironmentVariables()).(type) { |
| 508 |
case interface{ ValidateAll() error }: |
| 509 |
if err := v.ValidateAll(); err != nil { |
| 510 |
errors = append(errors, VmConfigValidationError{ |
| 511 |
field: "EnvironmentVariables", |
| 512 |
reason: "embedded message failed validation", |
| 513 |
cause: err, |
| 514 |
}) |
| 515 |
} |
| 516 |
case interface{ Validate() error }: |
| 517 |
if err := v.Validate(); err != nil { |
| 518 |
errors = append(errors, VmConfigValidationError{ |
| 519 |
field: "EnvironmentVariables", |
| 520 |
reason: "embedded message failed validation", |
| 521 |
cause: err, |
| 522 |
}) |
| 523 |
} |
| 524 |
} |
| 525 |
} else if v, ok := interface{}(m.GetEnvironmentVariables()).(interface{ Validate() error }); ok { |
| 526 |
if err := v.Validate(); err != nil { |
| 527 |
return VmConfigValidationError{ |
| 528 |
field: "EnvironmentVariables", |
| 529 |
reason: "embedded message failed validation", |
| 530 |
cause: err, |
| 531 |
} |
| 532 |
} |
| 533 |
} |
| 534 |
|
| 535 |
if len(errors) > 0 { |
| 536 |
return VmConfigMultiError(errors) |
| 537 |
} |
| 538 |
|
| 539 |
return nil |
| 540 |
} |
| 541 |
|
| 542 |
// VmConfigMultiError is an error wrapping multiple validation errors returned |
| 543 |
// by VmConfig.ValidateAll() if the designated constraints aren't met. |
| 544 |
type VmConfigMultiError []error |
| 545 |
|
| 546 |
// Error returns a concatenation of all the error messages it wraps. |
| 547 |
func (m VmConfigMultiError) Error() string { |
| 548 |
var msgs []string |
| 549 |
for _, err := range m { |
| 550 |
msgs = append(msgs, err.Error()) |
| 551 |
} |
| 552 |
return strings.Join(msgs, "; ") |
| 553 |
} |
| 554 |
|
| 555 |
// AllErrors returns a list of validation violation errors. |
| 556 |
func (m VmConfigMultiError) AllErrors() []error { return m } |
| 557 |
|
| 558 |
// VmConfigValidationError is the validation error returned by |
| 559 |
// VmConfig.Validate if the designated constraints aren't met. |
| 560 |
type VmConfigValidationError struct { |
| 561 |
field string |
| 562 |
reason string |
| 563 |
cause error |
| 564 |
key bool |
| 565 |
} |
| 566 |
|
| 567 |
// Field function returns field value. |
| 568 |
func (e VmConfigValidationError) Field() string { return e.field } |
| 569 |
|
| 570 |
// Reason function returns reason value. |
| 571 |
func (e VmConfigValidationError) Reason() string { return e.reason } |
| 572 |
|
| 573 |
// Cause function returns cause value. |
| 574 |
func (e VmConfigValidationError) Cause() error { return e.cause } |
| 575 |
|
| 576 |
// Key function returns key value. |
| 577 |
func (e VmConfigValidationError) Key() bool { return e.key } |
| 578 |
|
| 579 |
// ErrorName returns error name. |
| 580 |
func (e VmConfigValidationError) ErrorName() string { return "VmConfigValidationError" } |
| 581 |
|
| 582 |
// Error satisfies the builtin error interface |
| 583 |
func (e VmConfigValidationError) Error() string { |
| 584 |
cause := "" |
| 585 |
if e.cause != nil { |
| 586 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 587 |
} |
| 588 |
|
| 589 |
key := "" |
| 590 |
if e.key { |
| 591 |
key = "key for " |
| 592 |
} |
| 593 |
|
| 594 |
return fmt.Sprintf( |
| 595 |
"invalid %sVmConfig.%s: %s%s", |
| 596 |
key, |
| 597 |
e.field, |
| 598 |
e.reason, |
| 599 |
cause) |
| 600 |
} |
| 601 |
|
| 602 |
var _ error = VmConfigValidationError{} |
| 603 |
|
| 604 |
var _ interface { |
| 605 |
Field() string |
| 606 |
Reason() string |
| 607 |
Key() bool |
| 608 |
Cause() error |
| 609 |
ErrorName() string |
| 610 |
} = VmConfigValidationError{} |
| 611 |
|
| 612 |
// Validate checks the field values on EnvironmentVariables with the rules |
| 613 |
// defined in the proto definition for this message. If any rules are |
| 614 |
// violated, the first error encountered is returned, or nil if there are no violations. |
| 615 |
func (m *EnvironmentVariables) Validate() error { |
| 616 |
return m.validate(false) |
| 617 |
} |
| 618 |
|
| 619 |
// ValidateAll checks the field values on EnvironmentVariables with the rules |
| 620 |
// defined in the proto definition for this message. If any rules are |
| 621 |
// violated, the result is a list of violation errors wrapped in |
| 622 |
// EnvironmentVariablesMultiError, or nil if none found. |
| 623 |
func (m *EnvironmentVariables) ValidateAll() error { |
| 624 |
return m.validate(true) |
| 625 |
} |
| 626 |
|
| 627 |
func (m *EnvironmentVariables) validate(all bool) error { |
| 628 |
if m == nil { |
| 629 |
return nil |
| 630 |
} |
| 631 |
|
| 632 |
var errors []error |
| 633 |
|
| 634 |
// no validation rules for KeyValues |
| 635 |
|
| 636 |
if len(errors) > 0 { |
| 637 |
return EnvironmentVariablesMultiError(errors) |
| 638 |
} |
| 639 |
|
| 640 |
return nil |
| 641 |
} |
| 642 |
|
| 643 |
// EnvironmentVariablesMultiError is an error wrapping multiple validation |
| 644 |
// errors returned by EnvironmentVariables.ValidateAll() if the designated |
| 645 |
// constraints aren't met. |
| 646 |
type EnvironmentVariablesMultiError []error |
| 647 |
|
| 648 |
// Error returns a concatenation of all the error messages it wraps. |
| 649 |
func (m EnvironmentVariablesMultiError) Error() string { |
| 650 |
var msgs []string |
| 651 |
for _, err := range m { |
| 652 |
msgs = append(msgs, err.Error()) |
| 653 |
} |
| 654 |
return strings.Join(msgs, "; ") |
| 655 |
} |
| 656 |
|
| 657 |
// AllErrors returns a list of validation violation errors. |
| 658 |
func (m EnvironmentVariablesMultiError) AllErrors() []error { return m } |
| 659 |
|
| 660 |
// EnvironmentVariablesValidationError is the validation error returned by |
| 661 |
// EnvironmentVariables.Validate if the designated constraints aren't met. |
| 662 |
type EnvironmentVariablesValidationError struct { |
| 663 |
field string |
| 664 |
reason string |
| 665 |
cause error |
| 666 |
key bool |
| 667 |
} |
| 668 |
|
| 669 |
// Field function returns field value. |
| 670 |
func (e EnvironmentVariablesValidationError) Field() string { return e.field } |
| 671 |
|
| 672 |
// Reason function returns reason value. |
| 673 |
func (e EnvironmentVariablesValidationError) Reason() string { return e.reason } |
| 674 |
|
| 675 |
// Cause function returns cause value. |
| 676 |
func (e EnvironmentVariablesValidationError) Cause() error { return e.cause } |
| 677 |
|
| 678 |
// Key function returns key value. |
| 679 |
func (e EnvironmentVariablesValidationError) Key() bool { return e.key } |
| 680 |
|
| 681 |
// ErrorName returns error name. |
| 682 |
func (e EnvironmentVariablesValidationError) ErrorName() string { |
| 683 |
return "EnvironmentVariablesValidationError" |
| 684 |
} |
| 685 |
|
| 686 |
// Error satisfies the builtin error interface |
| 687 |
func (e EnvironmentVariablesValidationError) Error() string { |
| 688 |
cause := "" |
| 689 |
if e.cause != nil { |
| 690 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 691 |
} |
| 692 |
|
| 693 |
key := "" |
| 694 |
if e.key { |
| 695 |
key = "key for " |
| 696 |
} |
| 697 |
|
| 698 |
return fmt.Sprintf( |
| 699 |
"invalid %sEnvironmentVariables.%s: %s%s", |
| 700 |
key, |
| 701 |
e.field, |
| 702 |
e.reason, |
| 703 |
cause) |
| 704 |
} |
| 705 |
|
| 706 |
var _ error = EnvironmentVariablesValidationError{} |
| 707 |
|
| 708 |
var _ interface { |
| 709 |
Field() string |
| 710 |
Reason() string |
| 711 |
Key() bool |
| 712 |
Cause() error |
| 713 |
ErrorName() string |
| 714 |
} = EnvironmentVariablesValidationError{} |
| 715 |
|
| 716 |
// Validate checks the field values on PluginConfig with the rules defined in |
| 717 |
// the proto definition for this message. If any rules are violated, the first |
| 718 |
// error encountered is returned, or nil if there are no violations. |
| 719 |
func (m *PluginConfig) Validate() error { |
| 720 |
return m.validate(false) |
| 721 |
} |
| 722 |
|
| 723 |
// ValidateAll checks the field values on PluginConfig with the rules defined |
| 724 |
// in the proto definition for this message. If any rules are violated, the |
| 725 |
// result is a list of violation errors wrapped in PluginConfigMultiError, or |
| 726 |
// nil if none found. |
| 727 |
func (m *PluginConfig) ValidateAll() error { |
| 728 |
return m.validate(true) |
| 729 |
} |
| 730 |
|
| 731 |
func (m *PluginConfig) validate(all bool) error { |
| 732 |
if m == nil { |
| 733 |
return nil |
| 734 |
} |
| 735 |
|
| 736 |
var errors []error |
| 737 |
|
| 738 |
// no validation rules for Name |
| 739 |
|
| 740 |
// no validation rules for RootId |
| 741 |
|
| 742 |
if all { |
| 743 |
switch v := interface{}(m.GetConfiguration()).(type) { |
| 744 |
case interface{ ValidateAll() error }: |
| 745 |
if err := v.ValidateAll(); err != nil { |
| 746 |
errors = append(errors, PluginConfigValidationError{ |
| 747 |
field: "Configuration", |
| 748 |
reason: "embedded message failed validation", |
| 749 |
cause: err, |
| 750 |
}) |
| 751 |
} |
| 752 |
case interface{ Validate() error }: |
| 753 |
if err := v.Validate(); err != nil { |
| 754 |
errors = append(errors, PluginConfigValidationError{ |
| 755 |
field: "Configuration", |
| 756 |
reason: "embedded message failed validation", |
| 757 |
cause: err, |
| 758 |
}) |
| 759 |
} |
| 760 |
} |
| 761 |
} else if v, ok := interface{}(m.GetConfiguration()).(interface{ Validate() error }); ok { |
| 762 |
if err := v.Validate(); err != nil { |
| 763 |
return PluginConfigValidationError{ |
| 764 |
field: "Configuration", |
| 765 |
reason: "embedded message failed validation", |
| 766 |
cause: err, |
| 767 |
} |
| 768 |
} |
| 769 |
} |
| 770 |
|
| 771 |
// no validation rules for FailOpen |
| 772 |
|
| 773 |
// no validation rules for FailurePolicy |
| 774 |
|
| 775 |
if all { |
| 776 |
switch v := interface{}(m.GetReloadConfig()).(type) { |
| 777 |
case interface{ ValidateAll() error }: |
| 778 |
if err := v.ValidateAll(); err != nil { |
| 779 |
errors = append(errors, PluginConfigValidationError{ |
| 780 |
field: "ReloadConfig", |
| 781 |
reason: "embedded message failed validation", |
| 782 |
cause: err, |
| 783 |
}) |
| 784 |
} |
| 785 |
case interface{ Validate() error }: |
| 786 |
if err := v.Validate(); err != nil { |
| 787 |
errors = append(errors, PluginConfigValidationError{ |
| 788 |
field: "ReloadConfig", |
| 789 |
reason: "embedded message failed validation", |
| 790 |
cause: err, |
| 791 |
}) |
| 792 |
} |
| 793 |
} |
| 794 |
} else if v, ok := interface{}(m.GetReloadConfig()).(interface{ Validate() error }); ok { |
| 795 |
if err := v.Validate(); err != nil { |
| 796 |
return PluginConfigValidationError{ |
| 797 |
field: "ReloadConfig", |
| 798 |
reason: "embedded message failed validation", |
| 799 |
cause: err, |
| 800 |
} |
| 801 |
} |
| 802 |
} |
| 803 |
|
| 804 |
if all { |
| 805 |
switch v := interface{}(m.GetCapabilityRestrictionConfig()).(type) { |
| 806 |
case interface{ ValidateAll() error }: |
| 807 |
if err := v.ValidateAll(); err != nil { |
| 808 |
errors = append(errors, PluginConfigValidationError{ |
| 809 |
field: "CapabilityRestrictionConfig", |
| 810 |
reason: "embedded message failed validation", |
| 811 |
cause: err, |
| 812 |
}) |
| 813 |
} |
| 814 |
case interface{ Validate() error }: |
| 815 |
if err := v.Validate(); err != nil { |
| 816 |
errors = append(errors, PluginConfigValidationError{ |
| 817 |
field: "CapabilityRestrictionConfig", |
| 818 |
reason: "embedded message failed validation", |
| 819 |
cause: err, |
| 820 |
}) |
| 821 |
} |
| 822 |
} |
| 823 |
} else if v, ok := interface{}(m.GetCapabilityRestrictionConfig()).(interface{ Validate() error }); ok { |
| 824 |
if err := v.Validate(); err != nil { |
| 825 |
return PluginConfigValidationError{ |
| 826 |
field: "CapabilityRestrictionConfig", |
| 827 |
reason: "embedded message failed validation", |
| 828 |
cause: err, |
| 829 |
} |
| 830 |
} |
| 831 |
} |
| 832 |
|
| 833 |
switch v := m.Vm.(type) { |
| 834 |
case *PluginConfig_VmConfig: |
| 835 |
if v == nil { |
| 836 |
err := PluginConfigValidationError{ |
| 837 |
field: "Vm", |
| 838 |
reason: "oneof value cannot be a typed-nil", |
| 839 |
} |
| 840 |
if !all { |
| 841 |
return err |
| 842 |
} |
| 843 |
errors = append(errors, err) |
| 844 |
} |
| 845 |
|
| 846 |
if all { |
| 847 |
switch v := interface{}(m.GetVmConfig()).(type) { |
| 848 |
case interface{ ValidateAll() error }: |
| 849 |
if err := v.ValidateAll(); err != nil { |
| 850 |
errors = append(errors, PluginConfigValidationError{ |
| 851 |
field: "VmConfig", |
| 852 |
reason: "embedded message failed validation", |
| 853 |
cause: err, |
| 854 |
}) |
| 855 |
} |
| 856 |
case interface{ Validate() error }: |
| 857 |
if err := v.Validate(); err != nil { |
| 858 |
errors = append(errors, PluginConfigValidationError{ |
| 859 |
field: "VmConfig", |
| 860 |
reason: "embedded message failed validation", |
| 861 |
cause: err, |
| 862 |
}) |
| 863 |
} |
| 864 |
} |
| 865 |
} else if v, ok := interface{}(m.GetVmConfig()).(interface{ Validate() error }); ok { |
| 866 |
if err := v.Validate(); err != nil { |
| 867 |
return PluginConfigValidationError{ |
| 868 |
field: "VmConfig", |
| 869 |
reason: "embedded message failed validation", |
| 870 |
cause: err, |
| 871 |
} |
| 872 |
} |
| 873 |
} |
| 874 |
|
| 875 |
default: |
| 876 |
_ = v // ensures v is used |
| 877 |
} |
| 878 |
|
| 879 |
if len(errors) > 0 { |
| 880 |
return PluginConfigMultiError(errors) |
| 881 |
} |
| 882 |
|
| 883 |
return nil |
| 884 |
} |
| 885 |
|
| 886 |
// PluginConfigMultiError is an error wrapping multiple validation errors |
| 887 |
// returned by PluginConfig.ValidateAll() if the designated constraints aren't met. |
| 888 |
type PluginConfigMultiError []error |
| 889 |
|
| 890 |
// Error returns a concatenation of all the error messages it wraps. |
| 891 |
func (m PluginConfigMultiError) Error() string { |
| 892 |
var msgs []string |
| 893 |
for _, err := range m { |
| 894 |
msgs = append(msgs, err.Error()) |
| 895 |
} |
| 896 |
return strings.Join(msgs, "; ") |
| 897 |
} |
| 898 |
|
| 899 |
// AllErrors returns a list of validation violation errors. |
| 900 |
func (m PluginConfigMultiError) AllErrors() []error { return m } |
| 901 |
|
| 902 |
// PluginConfigValidationError is the validation error returned by |
| 903 |
// PluginConfig.Validate if the designated constraints aren't met. |
| 904 |
type PluginConfigValidationError struct { |
| 905 |
field string |
| 906 |
reason string |
| 907 |
cause error |
| 908 |
key bool |
| 909 |
} |
| 910 |
|
| 911 |
// Field function returns field value. |
| 912 |
func (e PluginConfigValidationError) Field() string { return e.field } |
| 913 |
|
| 914 |
// Reason function returns reason value. |
| 915 |
func (e PluginConfigValidationError) Reason() string { return e.reason } |
| 916 |
|
| 917 |
// Cause function returns cause value. |
| 918 |
func (e PluginConfigValidationError) Cause() error { return e.cause } |
| 919 |
|
| 920 |
// Key function returns key value. |
| 921 |
func (e PluginConfigValidationError) Key() bool { return e.key } |
| 922 |
|
| 923 |
// ErrorName returns error name. |
| 924 |
func (e PluginConfigValidationError) ErrorName() string { return "PluginConfigValidationError" } |
| 925 |
|
| 926 |
// Error satisfies the builtin error interface |
| 927 |
func (e PluginConfigValidationError) Error() string { |
| 928 |
cause := "" |
| 929 |
if e.cause != nil { |
| 930 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 931 |
} |
| 932 |
|
| 933 |
key := "" |
| 934 |
if e.key { |
| 935 |
key = "key for " |
| 936 |
} |
| 937 |
|
| 938 |
return fmt.Sprintf( |
| 939 |
"invalid %sPluginConfig.%s: %s%s", |
| 940 |
key, |
| 941 |
e.field, |
| 942 |
e.reason, |
| 943 |
cause) |
| 944 |
} |
| 945 |
|
| 946 |
var _ error = PluginConfigValidationError{} |
| 947 |
|
| 948 |
var _ interface { |
| 949 |
Field() string |
| 950 |
Reason() string |
| 951 |
Key() bool |
| 952 |
Cause() error |
| 953 |
ErrorName() string |
| 954 |
} = PluginConfigValidationError{} |
| 955 |
|
| 956 |
// Validate checks the field values on WasmService with the rules defined in |
| 957 |
// the proto definition for this message. If any rules are violated, the first |
| 958 |
// error encountered is returned, or nil if there are no violations. |
| 959 |
func (m *WasmService) Validate() error { |
| 960 |
return m.validate(false) |
| 961 |
} |
| 962 |
|
| 963 |
// ValidateAll checks the field values on WasmService with the rules defined in |
| 964 |
// the proto definition for this message. If any rules are violated, the |
| 965 |
// result is a list of violation errors wrapped in WasmServiceMultiError, or |
| 966 |
// nil if none found. |
| 967 |
func (m *WasmService) ValidateAll() error { |
| 968 |
return m.validate(true) |
| 969 |
} |
| 970 |
|
| 971 |
func (m *WasmService) validate(all bool) error { |
| 972 |
if m == nil { |
| 973 |
return nil |
| 974 |
} |
| 975 |
|
| 976 |
var errors []error |
| 977 |
|
| 978 |
if all { |
| 979 |
switch v := interface{}(m.GetConfig()).(type) { |
| 980 |
case interface{ ValidateAll() error }: |
| 981 |
if err := v.ValidateAll(); err != nil { |
| 982 |
errors = append(errors, WasmServiceValidationError{ |
| 983 |
field: "Config", |
| 984 |
reason: "embedded message failed validation", |
| 985 |
cause: err, |
| 986 |
}) |
| 987 |
} |
| 988 |
case interface{ Validate() error }: |
| 989 |
if err := v.Validate(); err != nil { |
| 990 |
errors = append(errors, WasmServiceValidationError{ |
| 991 |
field: "Config", |
| 992 |
reason: "embedded message failed validation", |
| 993 |
cause: err, |
| 994 |
}) |
| 995 |
} |
| 996 |
} |
| 997 |
} else if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok { |
| 998 |
if err := v.Validate(); err != nil { |
| 999 |
return WasmServiceValidationError{ |
| 1000 |
field: "Config", |
| 1001 |
reason: "embedded message failed validation", |
| 1002 |
cause: err, |
| 1003 |
} |
| 1004 |
} |
| 1005 |
} |
| 1006 |
|
| 1007 |
// no validation rules for Singleton |
| 1008 |
|
| 1009 |
if len(errors) > 0 { |
| 1010 |
return WasmServiceMultiError(errors) |
| 1011 |
} |
| 1012 |
|
| 1013 |
return nil |
| 1014 |
} |
| 1015 |
|
| 1016 |
// WasmServiceMultiError is an error wrapping multiple validation errors |
| 1017 |
// returned by WasmService.ValidateAll() if the designated constraints aren't met. |
| 1018 |
type WasmServiceMultiError []error |
| 1019 |
|
| 1020 |
// Error returns a concatenation of all the error messages it wraps. |
| 1021 |
func (m WasmServiceMultiError) Error() string { |
| 1022 |
var msgs []string |
| 1023 |
for _, err := range m { |
| 1024 |
msgs = append(msgs, err.Error()) |
| 1025 |
} |
| 1026 |
return strings.Join(msgs, "; ") |
| 1027 |
} |
| 1028 |
|
| 1029 |
// AllErrors returns a list of validation violation errors. |
| 1030 |
func (m WasmServiceMultiError) AllErrors() []error { return m } |
| 1031 |
|
| 1032 |
// WasmServiceValidationError is the validation error returned by |
| 1033 |
// WasmService.Validate if the designated constraints aren't met. |
| 1034 |
type WasmServiceValidationError struct { |
| 1035 |
field string |
| 1036 |
reason string |
| 1037 |
cause error |
| 1038 |
key bool |
| 1039 |
} |
| 1040 |
|
| 1041 |
// Field function returns field value. |
| 1042 |
func (e WasmServiceValidationError) Field() string { return e.field } |
| 1043 |
|
| 1044 |
// Reason function returns reason value. |
| 1045 |
func (e WasmServiceValidationError) Reason() string { return e.reason } |
| 1046 |
|
| 1047 |
// Cause function returns cause value. |
| 1048 |
func (e WasmServiceValidationError) Cause() error { return e.cause } |
| 1049 |
|
| 1050 |
// Key function returns key value. |
| 1051 |
func (e WasmServiceValidationError) Key() bool { return e.key } |
| 1052 |
|
| 1053 |
// ErrorName returns error name. |
| 1054 |
func (e WasmServiceValidationError) ErrorName() string { return "WasmServiceValidationError" } |
| 1055 |
|
| 1056 |
// Error satisfies the builtin error interface |
| 1057 |
func (e WasmServiceValidationError) Error() string { |
| 1058 |
cause := "" |
| 1059 |
if e.cause != nil { |
| 1060 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 1061 |
} |
| 1062 |
|
| 1063 |
key := "" |
| 1064 |
if e.key { |
| 1065 |
key = "key for " |
| 1066 |
} |
| 1067 |
|
| 1068 |
return fmt.Sprintf( |
| 1069 |
"invalid %sWasmService.%s: %s%s", |
| 1070 |
key, |
| 1071 |
e.field, |
| 1072 |
e.reason, |
| 1073 |
cause) |
| 1074 |
} |
| 1075 |
|
| 1076 |
var _ error = WasmServiceValidationError{} |
| 1077 |
|
| 1078 |
var _ interface { |
| 1079 |
Field() string |
| 1080 |
Reason() string |
| 1081 |
Key() bool |
| 1082 |
Cause() error |
| 1083 |
ErrorName() string |
| 1084 |
} = WasmServiceValidationError{} |