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