| 1 |
//go:build !disable_pgv |
| 2 |
// Code generated by protoc-gen-validate. DO NOT EDIT. |
| 3 |
// source: envoy/config/trace/v3/dynamic_ot.proto |
| 4 |
|
| 5 |
package tracev3 |
| 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 DynamicOtConfig 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 *DynamicOtConfig) Validate() error { |
| 43 |
return m.validate(false) |
| 44 |
} |
| 45 |
|
| 46 |
// ValidateAll checks the field values on DynamicOtConfig 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 |
// DynamicOtConfigMultiError, or nil if none found. |
| 50 |
func (m *DynamicOtConfig) ValidateAll() error { |
| 51 |
return m.validate(true) |
| 52 |
} |
| 53 |
|
| 54 |
func (m *DynamicOtConfig) validate(all bool) error { |
| 55 |
if m == nil { |
| 56 |
return nil |
| 57 |
} |
| 58 |
|
| 59 |
var errors []error |
| 60 |
|
| 61 |
if utf8.RuneCountInString(m.GetLibrary()) < 1 { |
| 62 |
err := DynamicOtConfigValidationError{ |
| 63 |
field: "Library", |
| 64 |
reason: "value length must be at least 1 runes", |
| 65 |
} |
| 66 |
if !all { |
| 67 |
return err |
| 68 |
} |
| 69 |
errors = append(errors, err) |
| 70 |
} |
| 71 |
|
| 72 |
if all { |
| 73 |
switch v := interface{}(m.GetConfig()).(type) { |
| 74 |
case interface{ ValidateAll() error }: |
| 75 |
if err := v.ValidateAll(); err != nil { |
| 76 |
errors = append(errors, DynamicOtConfigValidationError{ |
| 77 |
field: "Config", |
| 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, DynamicOtConfigValidationError{ |
| 85 |
field: "Config", |
| 86 |
reason: "embedded message failed validation", |
| 87 |
cause: err, |
| 88 |
}) |
| 89 |
} |
| 90 |
} |
| 91 |
} else if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok { |
| 92 |
if err := v.Validate(); err != nil { |
| 93 |
return DynamicOtConfigValidationError{ |
| 94 |
field: "Config", |
| 95 |
reason: "embedded message failed validation", |
| 96 |
cause: err, |
| 97 |
} |
| 98 |
} |
| 99 |
} |
| 100 |
|
| 101 |
if len(errors) > 0 { |
| 102 |
return DynamicOtConfigMultiError(errors) |
| 103 |
} |
| 104 |
|
| 105 |
return nil |
| 106 |
} |
| 107 |
|
| 108 |
// DynamicOtConfigMultiError is an error wrapping multiple validation errors |
| 109 |
// returned by DynamicOtConfig.ValidateAll() if the designated constraints |
| 110 |
// aren't met. |
| 111 |
type DynamicOtConfigMultiError []error |
| 112 |
|
| 113 |
// Error returns a concatenation of all the error messages it wraps. |
| 114 |
func (m DynamicOtConfigMultiError) 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 DynamicOtConfigMultiError) AllErrors() []error { return m } |
| 124 |
|
| 125 |
// DynamicOtConfigValidationError is the validation error returned by |
| 126 |
// DynamicOtConfig.Validate if the designated constraints aren't met. |
| 127 |
type DynamicOtConfigValidationError struct { |
| 128 |
field string |
| 129 |
reason string |
| 130 |
cause error |
| 131 |
key bool |
| 132 |
} |
| 133 |
|
| 134 |
// Field function returns field value. |
| 135 |
func (e DynamicOtConfigValidationError) Field() string { return e.field } |
| 136 |
|
| 137 |
// Reason function returns reason value. |
| 138 |
func (e DynamicOtConfigValidationError) Reason() string { return e.reason } |
| 139 |
|
| 140 |
// Cause function returns cause value. |
| 141 |
func (e DynamicOtConfigValidationError) Cause() error { return e.cause } |
| 142 |
|
| 143 |
// Key function returns key value. |
| 144 |
func (e DynamicOtConfigValidationError) Key() bool { return e.key } |
| 145 |
|
| 146 |
// ErrorName returns error name. |
| 147 |
func (e DynamicOtConfigValidationError) ErrorName() string { return "DynamicOtConfigValidationError" } |
| 148 |
|
| 149 |
// Error satisfies the builtin error interface |
| 150 |
func (e DynamicOtConfigValidationError) Error() string { |
| 151 |
cause := "" |
| 152 |
if e.cause != nil { |
| 153 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 154 |
} |
| 155 |
|
| 156 |
key := "" |
| 157 |
if e.key { |
| 158 |
key = "key for " |
| 159 |
} |
| 160 |
|
| 161 |
return fmt.Sprintf( |
| 162 |
"invalid %sDynamicOtConfig.%s: %s%s", |
| 163 |
key, |
| 164 |
e.field, |
| 165 |
e.reason, |
| 166 |
cause) |
| 167 |
} |
| 168 |
|
| 169 |
var _ error = DynamicOtConfigValidationError{} |
| 170 |
|
| 171 |
var _ interface { |
| 172 |
Field() string |
| 173 |
Reason() string |
| 174 |
Key() bool |
| 175 |
Cause() error |
| 176 |
ErrorName() string |
| 177 |
} = DynamicOtConfigValidationError{} |