1// Code generated by protoc-gen-validate. DO NOT EDIT. 2// source: envoy/api/v2/endpoint/endpoint_components.proto 3 4package envoy_api_v2_endpoint 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 core "github.com/envoyproxy/go-control-plane/envoy/api/v2/core" 21) 22 23// ensure the imports are used 24var ( 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 _ = ptypes.DynamicAny{} 36 37 _ = core.HealthStatus(0) 38) 39 40// Validate checks the field values on Endpoint with the rules defined in the 41// proto definition for this message. If any rules are violated, an error is returned. 42func (m *Endpoint) Validate() error { 43 if m == nil { 44 return nil 45 } 46 47 if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok { 48 if err := v.Validate(); err != nil { 49 return EndpointValidationError{ 50 field: "Address", 51 reason: "embedded message failed validation", 52 cause: err, 53 } 54 } 55 } 56 57 if v, ok := interface{}(m.GetHealthCheckConfig()).(interface{ Validate() error }); ok { 58 if err := v.Validate(); err != nil { 59 return EndpointValidationError{ 60 field: "HealthCheckConfig", 61 reason: "embedded message failed validation", 62 cause: err, 63 } 64 } 65 } 66 67 // no validation rules for Hostname 68 69 return nil 70} 71 72// EndpointValidationError is the validation error returned by 73// Endpoint.Validate if the designated constraints aren't met. 74type EndpointValidationError struct { 75 field string 76 reason string 77 cause error 78 key bool 79} 80 81// Field function returns field value. 82func (e EndpointValidationError) Field() string { return e.field } 83 84// Reason function returns reason value. 85func (e EndpointValidationError) Reason() string { return e.reason } 86 87// Cause function returns cause value. 88func (e EndpointValidationError) Cause() error { return e.cause } 89 90// Key function returns key value. 91func (e EndpointValidationError) Key() bool { return e.key } 92 93// ErrorName returns error name. 94func (e EndpointValidationError) ErrorName() string { return "EndpointValidationError" } 95 96// Error satisfies the builtin error interface 97func (e EndpointValidationError) Error() string { 98 cause := "" 99 if e.cause != nil { 100 cause = fmt.Sprintf(" | caused by: %v", e.cause) 101 } 102 103 key := "" 104 if e.key { 105 key = "key for " 106 } 107 108 return fmt.Sprintf( 109 "invalid %sEndpoint.%s: %s%s", 110 key, 111 e.field, 112 e.reason, 113 cause) 114} 115 116var _ error = EndpointValidationError{} 117 118var _ interface { 119 Field() string 120 Reason() string 121 Key() bool 122 Cause() error 123 ErrorName() string 124} = EndpointValidationError{} 125 126// Validate checks the field values on LbEndpoint with the rules defined in the 127// proto definition for this message. If any rules are violated, an error is returned. 128func (m *LbEndpoint) Validate() error { 129 if m == nil { 130 return nil 131 } 132 133 // no validation rules for HealthStatus 134 135 if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok { 136 if err := v.Validate(); err != nil { 137 return LbEndpointValidationError{ 138 field: "Metadata", 139 reason: "embedded message failed validation", 140 cause: err, 141 } 142 } 143 } 144 145 if wrapper := m.GetLoadBalancingWeight(); wrapper != nil { 146 147 if wrapper.GetValue() < 1 { 148 return LbEndpointValidationError{ 149 field: "LoadBalancingWeight", 150 reason: "value must be greater than or equal to 1", 151 } 152 } 153 154 } 155 156 switch m.HostIdentifier.(type) { 157 158 case *LbEndpoint_Endpoint: 159 160 if v, ok := interface{}(m.GetEndpoint()).(interface{ Validate() error }); ok { 161 if err := v.Validate(); err != nil { 162 return LbEndpointValidationError{ 163 field: "Endpoint", 164 reason: "embedded message failed validation", 165 cause: err, 166 } 167 } 168 } 169 170 case *LbEndpoint_EndpointName: 171 // no validation rules for EndpointName 172 173 } 174 175 return nil 176} 177 178// LbEndpointValidationError is the validation error returned by 179// LbEndpoint.Validate if the designated constraints aren't met. 180type LbEndpointValidationError struct { 181 field string 182 reason string 183 cause error 184 key bool 185} 186 187// Field function returns field value. 188func (e LbEndpointValidationError) Field() string { return e.field } 189 190// Reason function returns reason value. 191func (e LbEndpointValidationError) Reason() string { return e.reason } 192 193// Cause function returns cause value. 194func (e LbEndpointValidationError) Cause() error { return e.cause } 195 196// Key function returns key value. 197func (e LbEndpointValidationError) Key() bool { return e.key } 198 199// ErrorName returns error name. 200func (e LbEndpointValidationError) ErrorName() string { return "LbEndpointValidationError" } 201 202// Error satisfies the builtin error interface 203func (e LbEndpointValidationError) Error() string { 204 cause := "" 205 if e.cause != nil { 206 cause = fmt.Sprintf(" | caused by: %v", e.cause) 207 } 208 209 key := "" 210 if e.key { 211 key = "key for " 212 } 213 214 return fmt.Sprintf( 215 "invalid %sLbEndpoint.%s: %s%s", 216 key, 217 e.field, 218 e.reason, 219 cause) 220} 221 222var _ error = LbEndpointValidationError{} 223 224var _ interface { 225 Field() string 226 Reason() string 227 Key() bool 228 Cause() error 229 ErrorName() string 230} = LbEndpointValidationError{} 231 232// Validate checks the field values on LocalityLbEndpoints with the rules 233// defined in the proto definition for this message. If any rules are 234// violated, an error is returned. 235func (m *LocalityLbEndpoints) Validate() error { 236 if m == nil { 237 return nil 238 } 239 240 if v, ok := interface{}(m.GetLocality()).(interface{ Validate() error }); ok { 241 if err := v.Validate(); err != nil { 242 return LocalityLbEndpointsValidationError{ 243 field: "Locality", 244 reason: "embedded message failed validation", 245 cause: err, 246 } 247 } 248 } 249 250 for idx, item := range m.GetLbEndpoints() { 251 _, _ = idx, item 252 253 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 254 if err := v.Validate(); err != nil { 255 return LocalityLbEndpointsValidationError{ 256 field: fmt.Sprintf("LbEndpoints[%v]", idx), 257 reason: "embedded message failed validation", 258 cause: err, 259 } 260 } 261 } 262 263 } 264 265 if wrapper := m.GetLoadBalancingWeight(); wrapper != nil { 266 267 if wrapper.GetValue() < 1 { 268 return LocalityLbEndpointsValidationError{ 269 field: "LoadBalancingWeight", 270 reason: "value must be greater than or equal to 1", 271 } 272 } 273 274 } 275 276 if m.GetPriority() > 128 { 277 return LocalityLbEndpointsValidationError{ 278 field: "Priority", 279 reason: "value must be less than or equal to 128", 280 } 281 } 282 283 if v, ok := interface{}(m.GetProximity()).(interface{ Validate() error }); ok { 284 if err := v.Validate(); err != nil { 285 return LocalityLbEndpointsValidationError{ 286 field: "Proximity", 287 reason: "embedded message failed validation", 288 cause: err, 289 } 290 } 291 } 292 293 return nil 294} 295 296// LocalityLbEndpointsValidationError is the validation error returned by 297// LocalityLbEndpoints.Validate if the designated constraints aren't met. 298type LocalityLbEndpointsValidationError struct { 299 field string 300 reason string 301 cause error 302 key bool 303} 304 305// Field function returns field value. 306func (e LocalityLbEndpointsValidationError) Field() string { return e.field } 307 308// Reason function returns reason value. 309func (e LocalityLbEndpointsValidationError) Reason() string { return e.reason } 310 311// Cause function returns cause value. 312func (e LocalityLbEndpointsValidationError) Cause() error { return e.cause } 313 314// Key function returns key value. 315func (e LocalityLbEndpointsValidationError) Key() bool { return e.key } 316 317// ErrorName returns error name. 318func (e LocalityLbEndpointsValidationError) ErrorName() string { 319 return "LocalityLbEndpointsValidationError" 320} 321 322// Error satisfies the builtin error interface 323func (e LocalityLbEndpointsValidationError) Error() string { 324 cause := "" 325 if e.cause != nil { 326 cause = fmt.Sprintf(" | caused by: %v", e.cause) 327 } 328 329 key := "" 330 if e.key { 331 key = "key for " 332 } 333 334 return fmt.Sprintf( 335 "invalid %sLocalityLbEndpoints.%s: %s%s", 336 key, 337 e.field, 338 e.reason, 339 cause) 340} 341 342var _ error = LocalityLbEndpointsValidationError{} 343 344var _ interface { 345 Field() string 346 Reason() string 347 Key() bool 348 Cause() error 349 ErrorName() string 350} = LocalityLbEndpointsValidationError{} 351 352// Validate checks the field values on Endpoint_HealthCheckConfig with the 353// rules defined in the proto definition for this message. If any rules are 354// violated, an error is returned. 355func (m *Endpoint_HealthCheckConfig) Validate() error { 356 if m == nil { 357 return nil 358 } 359 360 if m.GetPortValue() > 65535 { 361 return Endpoint_HealthCheckConfigValidationError{ 362 field: "PortValue", 363 reason: "value must be less than or equal to 65535", 364 } 365 } 366 367 // no validation rules for Hostname 368 369 return nil 370} 371 372// Endpoint_HealthCheckConfigValidationError is the validation error returned 373// by Endpoint_HealthCheckConfig.Validate if the designated constraints aren't met. 374type Endpoint_HealthCheckConfigValidationError struct { 375 field string 376 reason string 377 cause error 378 key bool 379} 380 381// Field function returns field value. 382func (e Endpoint_HealthCheckConfigValidationError) Field() string { return e.field } 383 384// Reason function returns reason value. 385func (e Endpoint_HealthCheckConfigValidationError) Reason() string { return e.reason } 386 387// Cause function returns cause value. 388func (e Endpoint_HealthCheckConfigValidationError) Cause() error { return e.cause } 389 390// Key function returns key value. 391func (e Endpoint_HealthCheckConfigValidationError) Key() bool { return e.key } 392 393// ErrorName returns error name. 394func (e Endpoint_HealthCheckConfigValidationError) ErrorName() string { 395 return "Endpoint_HealthCheckConfigValidationError" 396} 397 398// Error satisfies the builtin error interface 399func (e Endpoint_HealthCheckConfigValidationError) Error() string { 400 cause := "" 401 if e.cause != nil { 402 cause = fmt.Sprintf(" | caused by: %v", e.cause) 403 } 404 405 key := "" 406 if e.key { 407 key = "key for " 408 } 409 410 return fmt.Sprintf( 411 "invalid %sEndpoint_HealthCheckConfig.%s: %s%s", 412 key, 413 e.field, 414 e.reason, 415 cause) 416} 417 418var _ error = Endpoint_HealthCheckConfigValidationError{} 419 420var _ interface { 421 Field() string 422 Reason() string 423 Key() bool 424 Cause() error 425 ErrorName() string 426} = Endpoint_HealthCheckConfigValidationError{} 427