| 1 |
//go:build !disable_pgv |
| 2 |
// Code generated by protoc-gen-validate. DO NOT EDIT. |
| 3 |
// source: envoy/watchdog/v3/abort_action.proto |
| 4 |
|
| 5 |
package watchdogv3 |
| 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 AbortActionConfig with the rules defined |
| 40 |
// in the proto definition for this message. If any rules are violated, the |
| 41 |
// first error encountered is returned, or nil if there are no violations. |
| 42 |
func (m *AbortActionConfig) Validate() error { |
| 43 |
return m.validate(false) |
| 44 |
} |
| 45 |
|
| 46 |
// ValidateAll checks the field values on AbortActionConfig with the rules |
| 47 |
// 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 |
// AbortActionConfigMultiError, or nil if none found. |
| 50 |
func (m *AbortActionConfig) ValidateAll() error { |
| 51 |
return m.validate(true) |
| 52 |
} |
| 53 |
|
| 54 |
func (m *AbortActionConfig) 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.GetWaitDuration()).(type) { |
| 63 |
case interface{ ValidateAll() error }: |
| 64 |
if err := v.ValidateAll(); err != nil { |
| 65 |
errors = append(errors, AbortActionConfigValidationError{ |
| 66 |
field: "WaitDuration", |
| 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, AbortActionConfigValidationError{ |
| 74 |
field: "WaitDuration", |
| 75 |
reason: "embedded message failed validation", |
| 76 |
cause: err, |
| 77 |
}) |
| 78 |
} |
| 79 |
} |
| 80 |
} else if v, ok := interface{}(m.GetWaitDuration()).(interface{ Validate() error }); ok { |
| 81 |
if err := v.Validate(); err != nil { |
| 82 |
return AbortActionConfigValidationError{ |
| 83 |
field: "WaitDuration", |
| 84 |
reason: "embedded message failed validation", |
| 85 |
cause: err, |
| 86 |
} |
| 87 |
} |
| 88 |
} |
| 89 |
|
| 90 |
if len(errors) > 0 { |
| 91 |
return AbortActionConfigMultiError(errors) |
| 92 |
} |
| 93 |
|
| 94 |
return nil |
| 95 |
} |
| 96 |
|
| 97 |
// AbortActionConfigMultiError is an error wrapping multiple validation errors |
| 98 |
// returned by AbortActionConfig.ValidateAll() if the designated constraints |
| 99 |
// aren't met. |
| 100 |
type AbortActionConfigMultiError []error |
| 101 |
|
| 102 |
// Error returns a concatenation of all the error messages it wraps. |
| 103 |
func (m AbortActionConfigMultiError) Error() string { |
| 104 |
var msgs []string |
| 105 |
for _, err := range m { |
| 106 |
msgs = append(msgs, err.Error()) |
| 107 |
} |
| 108 |
return strings.Join(msgs, "; ") |
| 109 |
} |
| 110 |
|
| 111 |
// AllErrors returns a list of validation violation errors. |
| 112 |
func (m AbortActionConfigMultiError) AllErrors() []error { return m } |
| 113 |
|
| 114 |
// AbortActionConfigValidationError is the validation error returned by |
| 115 |
// AbortActionConfig.Validate if the designated constraints aren't met. |
| 116 |
type AbortActionConfigValidationError struct { |
| 117 |
field string |
| 118 |
reason string |
| 119 |
cause error |
| 120 |
key bool |
| 121 |
} |
| 122 |
|
| 123 |
// Field function returns field value. |
| 124 |
func (e AbortActionConfigValidationError) Field() string { return e.field } |
| 125 |
|
| 126 |
// Reason function returns reason value. |
| 127 |
func (e AbortActionConfigValidationError) Reason() string { return e.reason } |
| 128 |
|
| 129 |
// Cause function returns cause value. |
| 130 |
func (e AbortActionConfigValidationError) Cause() error { return e.cause } |
| 131 |
|
| 132 |
// Key function returns key value. |
| 133 |
func (e AbortActionConfigValidationError) Key() bool { return e.key } |
| 134 |
|
| 135 |
// ErrorName returns error name. |
| 136 |
func (e AbortActionConfigValidationError) ErrorName() string { |
| 137 |
return "AbortActionConfigValidationError" |
| 138 |
} |
| 139 |
|
| 140 |
// Error satisfies the builtin error interface |
| 141 |
func (e AbortActionConfigValidationError) Error() string { |
| 142 |
cause := "" |
| 143 |
if e.cause != nil { |
| 144 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 145 |
} |
| 146 |
|
| 147 |
key := "" |
| 148 |
if e.key { |
| 149 |
key = "key for " |
| 150 |
} |
| 151 |
|
| 152 |
return fmt.Sprintf( |
| 153 |
"invalid %sAbortActionConfig.%s: %s%s", |
| 154 |
key, |
| 155 |
e.field, |
| 156 |
e.reason, |
| 157 |
cause) |
| 158 |
} |
| 159 |
|
| 160 |
var _ error = AbortActionConfigValidationError{} |
| 161 |
|
| 162 |
var _ interface { |
| 163 |
Field() string |
| 164 |
Reason() string |
| 165 |
Key() bool |
| 166 |
Cause() error |
| 167 |
ErrorName() string |
| 168 |
} = AbortActionConfigValidationError{} |