1// Code generated by protoc-gen-validate. DO NOT EDIT.
2// source: envoy/api/v2/core/event_service_config.proto
3
4package envoy_api_v2_core
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 EventServiceConfig with the rules
37// defined in the proto definition for this message. If any rules are
38// violated, an error is returned.
39func (m *EventServiceConfig) Validate() error {
40	if m == nil {
41		return nil
42	}
43
44	switch m.ConfigSourceSpecifier.(type) {
45
46	case *EventServiceConfig_GrpcService:
47
48		if v, ok := interface{}(m.GetGrpcService()).(interface{ Validate() error }); ok {
49			if err := v.Validate(); err != nil {
50				return EventServiceConfigValidationError{
51					field:  "GrpcService",
52					reason: "embedded message failed validation",
53					cause:  err,
54				}
55			}
56		}
57
58	default:
59		return EventServiceConfigValidationError{
60			field:  "ConfigSourceSpecifier",
61			reason: "value is required",
62		}
63
64	}
65
66	return nil
67}
68
69// EventServiceConfigValidationError is the validation error returned by
70// EventServiceConfig.Validate if the designated constraints aren't met.
71type EventServiceConfigValidationError struct {
72	field  string
73	reason string
74	cause  error
75	key    bool
76}
77
78// Field function returns field value.
79func (e EventServiceConfigValidationError) Field() string { return e.field }
80
81// Reason function returns reason value.
82func (e EventServiceConfigValidationError) Reason() string { return e.reason }
83
84// Cause function returns cause value.
85func (e EventServiceConfigValidationError) Cause() error { return e.cause }
86
87// Key function returns key value.
88func (e EventServiceConfigValidationError) Key() bool { return e.key }
89
90// ErrorName returns error name.
91func (e EventServiceConfigValidationError) ErrorName() string {
92	return "EventServiceConfigValidationError"
93}
94
95// Error satisfies the builtin error interface
96func (e EventServiceConfigValidationError) Error() string {
97	cause := ""
98	if e.cause != nil {
99		cause = fmt.Sprintf(" | caused by: %v", e.cause)
100	}
101
102	key := ""
103	if e.key {
104		key = "key for "
105	}
106
107	return fmt.Sprintf(
108		"invalid %sEventServiceConfig.%s: %s%s",
109		key,
110		e.field,
111		e.reason,
112		cause)
113}
114
115var _ error = EventServiceConfigValidationError{}
116
117var _ interface {
118	Field() string
119	Reason() string
120	Key() bool
121	Cause() error
122	ErrorName() string
123} = EventServiceConfigValidationError{}
124