1// Code generated by protoc-gen-validate. DO NOT EDIT. 2// source: envoy/type/matcher/v3/value.proto 3 4package envoy_type_matcher_v3 5 6import ( 7 "bytes" 8 "errors" 9 "fmt" 10 "net" 11 "net/mail" 12 "net/url" 13 "regexp" 14 "strings" 15 "time" 16 "unicode/utf8" 17 18 "github.com/golang/protobuf/ptypes" 19) 20 21// ensure the imports are used 22var ( 23 _ = bytes.MinRead 24 _ = errors.New("") 25 _ = fmt.Print 26 _ = utf8.UTFMax 27 _ = (*regexp.Regexp)(nil) 28 _ = (*strings.Reader)(nil) 29 _ = net.IPv4len 30 _ = time.Duration(0) 31 _ = (*url.URL)(nil) 32 _ = (*mail.Address)(nil) 33 _ = ptypes.DynamicAny{} 34) 35 36// Validate checks the field values on ValueMatcher with the rules defined in 37// the proto definition for this message. If any rules are violated, an error 38// is returned. 39func (m *ValueMatcher) Validate() error { 40 if m == nil { 41 return nil 42 } 43 44 switch m.MatchPattern.(type) { 45 46 case *ValueMatcher_NullMatch_: 47 48 if v, ok := interface{}(m.GetNullMatch()).(interface{ Validate() error }); ok { 49 if err := v.Validate(); err != nil { 50 return ValueMatcherValidationError{ 51 field: "NullMatch", 52 reason: "embedded message failed validation", 53 cause: err, 54 } 55 } 56 } 57 58 case *ValueMatcher_DoubleMatch: 59 60 if v, ok := interface{}(m.GetDoubleMatch()).(interface{ Validate() error }); ok { 61 if err := v.Validate(); err != nil { 62 return ValueMatcherValidationError{ 63 field: "DoubleMatch", 64 reason: "embedded message failed validation", 65 cause: err, 66 } 67 } 68 } 69 70 case *ValueMatcher_StringMatch: 71 72 if v, ok := interface{}(m.GetStringMatch()).(interface{ Validate() error }); ok { 73 if err := v.Validate(); err != nil { 74 return ValueMatcherValidationError{ 75 field: "StringMatch", 76 reason: "embedded message failed validation", 77 cause: err, 78 } 79 } 80 } 81 82 case *ValueMatcher_BoolMatch: 83 // no validation rules for BoolMatch 84 85 case *ValueMatcher_PresentMatch: 86 // no validation rules for PresentMatch 87 88 case *ValueMatcher_ListMatch: 89 90 if v, ok := interface{}(m.GetListMatch()).(interface{ Validate() error }); ok { 91 if err := v.Validate(); err != nil { 92 return ValueMatcherValidationError{ 93 field: "ListMatch", 94 reason: "embedded message failed validation", 95 cause: err, 96 } 97 } 98 } 99 100 default: 101 return ValueMatcherValidationError{ 102 field: "MatchPattern", 103 reason: "value is required", 104 } 105 106 } 107 108 return nil 109} 110 111// ValueMatcherValidationError is the validation error returned by 112// ValueMatcher.Validate if the designated constraints aren't met. 113type ValueMatcherValidationError struct { 114 field string 115 reason string 116 cause error 117 key bool 118} 119 120// Field function returns field value. 121func (e ValueMatcherValidationError) Field() string { return e.field } 122 123// Reason function returns reason value. 124func (e ValueMatcherValidationError) Reason() string { return e.reason } 125 126// Cause function returns cause value. 127func (e ValueMatcherValidationError) Cause() error { return e.cause } 128 129// Key function returns key value. 130func (e ValueMatcherValidationError) Key() bool { return e.key } 131 132// ErrorName returns error name. 133func (e ValueMatcherValidationError) ErrorName() string { return "ValueMatcherValidationError" } 134 135// Error satisfies the builtin error interface 136func (e ValueMatcherValidationError) Error() string { 137 cause := "" 138 if e.cause != nil { 139 cause = fmt.Sprintf(" | caused by: %v", e.cause) 140 } 141 142 key := "" 143 if e.key { 144 key = "key for " 145 } 146 147 return fmt.Sprintf( 148 "invalid %sValueMatcher.%s: %s%s", 149 key, 150 e.field, 151 e.reason, 152 cause) 153} 154 155var _ error = ValueMatcherValidationError{} 156 157var _ interface { 158 Field() string 159 Reason() string 160 Key() bool 161 Cause() error 162 ErrorName() string 163} = ValueMatcherValidationError{} 164 165// Validate checks the field values on ListMatcher with the rules defined in 166// the proto definition for this message. If any rules are violated, an error 167// is returned. 168func (m *ListMatcher) Validate() error { 169 if m == nil { 170 return nil 171 } 172 173 switch m.MatchPattern.(type) { 174 175 case *ListMatcher_OneOf: 176 177 if v, ok := interface{}(m.GetOneOf()).(interface{ Validate() error }); ok { 178 if err := v.Validate(); err != nil { 179 return ListMatcherValidationError{ 180 field: "OneOf", 181 reason: "embedded message failed validation", 182 cause: err, 183 } 184 } 185 } 186 187 default: 188 return ListMatcherValidationError{ 189 field: "MatchPattern", 190 reason: "value is required", 191 } 192 193 } 194 195 return nil 196} 197 198// ListMatcherValidationError is the validation error returned by 199// ListMatcher.Validate if the designated constraints aren't met. 200type ListMatcherValidationError struct { 201 field string 202 reason string 203 cause error 204 key bool 205} 206 207// Field function returns field value. 208func (e ListMatcherValidationError) Field() string { return e.field } 209 210// Reason function returns reason value. 211func (e ListMatcherValidationError) Reason() string { return e.reason } 212 213// Cause function returns cause value. 214func (e ListMatcherValidationError) Cause() error { return e.cause } 215 216// Key function returns key value. 217func (e ListMatcherValidationError) Key() bool { return e.key } 218 219// ErrorName returns error name. 220func (e ListMatcherValidationError) ErrorName() string { return "ListMatcherValidationError" } 221 222// Error satisfies the builtin error interface 223func (e ListMatcherValidationError) Error() string { 224 cause := "" 225 if e.cause != nil { 226 cause = fmt.Sprintf(" | caused by: %v", e.cause) 227 } 228 229 key := "" 230 if e.key { 231 key = "key for " 232 } 233 234 return fmt.Sprintf( 235 "invalid %sListMatcher.%s: %s%s", 236 key, 237 e.field, 238 e.reason, 239 cause) 240} 241 242var _ error = ListMatcherValidationError{} 243 244var _ interface { 245 Field() string 246 Reason() string 247 Key() bool 248 Cause() error 249 ErrorName() string 250} = ListMatcherValidationError{} 251 252// Validate checks the field values on ValueMatcher_NullMatch with the rules 253// defined in the proto definition for this message. If any rules are 254// violated, an error is returned. 255func (m *ValueMatcher_NullMatch) Validate() error { 256 if m == nil { 257 return nil 258 } 259 260 return nil 261} 262 263// ValueMatcher_NullMatchValidationError is the validation error returned by 264// ValueMatcher_NullMatch.Validate if the designated constraints aren't met. 265type ValueMatcher_NullMatchValidationError struct { 266 field string 267 reason string 268 cause error 269 key bool 270} 271 272// Field function returns field value. 273func (e ValueMatcher_NullMatchValidationError) Field() string { return e.field } 274 275// Reason function returns reason value. 276func (e ValueMatcher_NullMatchValidationError) Reason() string { return e.reason } 277 278// Cause function returns cause value. 279func (e ValueMatcher_NullMatchValidationError) Cause() error { return e.cause } 280 281// Key function returns key value. 282func (e ValueMatcher_NullMatchValidationError) Key() bool { return e.key } 283 284// ErrorName returns error name. 285func (e ValueMatcher_NullMatchValidationError) ErrorName() string { 286 return "ValueMatcher_NullMatchValidationError" 287} 288 289// Error satisfies the builtin error interface 290func (e ValueMatcher_NullMatchValidationError) Error() string { 291 cause := "" 292 if e.cause != nil { 293 cause = fmt.Sprintf(" | caused by: %v", e.cause) 294 } 295 296 key := "" 297 if e.key { 298 key = "key for " 299 } 300 301 return fmt.Sprintf( 302 "invalid %sValueMatcher_NullMatch.%s: %s%s", 303 key, 304 e.field, 305 e.reason, 306 cause) 307} 308 309var _ error = ValueMatcher_NullMatchValidationError{} 310 311var _ interface { 312 Field() string 313 Reason() string 314 Key() bool 315 Cause() error 316 ErrorName() string 317} = ValueMatcher_NullMatchValidationError{} 318