1// Code generated by protoc-gen-validate. DO NOT EDIT.
2// source: envoy/extensions/filters/http/cache/v3alpha/cache.proto
3
4package envoy_extensions_filters_http_cache_v3alpha
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 _cache_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 CacheConfig with the rules defined in
40// the proto definition for this message. If any rules are violated, an error
41// is returned.
42func (m *CacheConfig) Validate() error {
43	if m == nil {
44		return nil
45	}
46
47	if m.GetTypedConfig() == nil {
48		return CacheConfigValidationError{
49			field:  "TypedConfig",
50			reason: "value is required",
51		}
52	}
53
54	if a := m.GetTypedConfig(); a != nil {
55
56	}
57
58	for idx, item := range m.GetAllowedVaryHeaders() {
59		_, _ = idx, item
60
61		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
62			if err := v.Validate(); err != nil {
63				return CacheConfigValidationError{
64					field:  fmt.Sprintf("AllowedVaryHeaders[%v]", idx),
65					reason: "embedded message failed validation",
66					cause:  err,
67				}
68			}
69		}
70
71	}
72
73	if v, ok := interface{}(m.GetKeyCreatorParams()).(interface{ Validate() error }); ok {
74		if err := v.Validate(); err != nil {
75			return CacheConfigValidationError{
76				field:  "KeyCreatorParams",
77				reason: "embedded message failed validation",
78				cause:  err,
79			}
80		}
81	}
82
83	// no validation rules for MaxBodyBytes
84
85	return nil
86}
87
88// CacheConfigValidationError is the validation error returned by
89// CacheConfig.Validate if the designated constraints aren't met.
90type CacheConfigValidationError struct {
91	field  string
92	reason string
93	cause  error
94	key    bool
95}
96
97// Field function returns field value.
98func (e CacheConfigValidationError) Field() string { return e.field }
99
100// Reason function returns reason value.
101func (e CacheConfigValidationError) Reason() string { return e.reason }
102
103// Cause function returns cause value.
104func (e CacheConfigValidationError) Cause() error { return e.cause }
105
106// Key function returns key value.
107func (e CacheConfigValidationError) Key() bool { return e.key }
108
109// ErrorName returns error name.
110func (e CacheConfigValidationError) ErrorName() string { return "CacheConfigValidationError" }
111
112// Error satisfies the builtin error interface
113func (e CacheConfigValidationError) Error() string {
114	cause := ""
115	if e.cause != nil {
116		cause = fmt.Sprintf(" | caused by: %v", e.cause)
117	}
118
119	key := ""
120	if e.key {
121		key = "key for "
122	}
123
124	return fmt.Sprintf(
125		"invalid %sCacheConfig.%s: %s%s",
126		key,
127		e.field,
128		e.reason,
129		cause)
130}
131
132var _ error = CacheConfigValidationError{}
133
134var _ interface {
135	Field() string
136	Reason() string
137	Key() bool
138	Cause() error
139	ErrorName() string
140} = CacheConfigValidationError{}
141
142// Validate checks the field values on CacheConfig_KeyCreatorParams with the
143// rules defined in the proto definition for this message. If any rules are
144// violated, an error is returned.
145func (m *CacheConfig_KeyCreatorParams) Validate() error {
146	if m == nil {
147		return nil
148	}
149
150	// no validation rules for ExcludeScheme
151
152	// no validation rules for ExcludeHost
153
154	for idx, item := range m.GetQueryParametersIncluded() {
155		_, _ = idx, item
156
157		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
158			if err := v.Validate(); err != nil {
159				return CacheConfig_KeyCreatorParamsValidationError{
160					field:  fmt.Sprintf("QueryParametersIncluded[%v]", idx),
161					reason: "embedded message failed validation",
162					cause:  err,
163				}
164			}
165		}
166
167	}
168
169	for idx, item := range m.GetQueryParametersExcluded() {
170		_, _ = idx, item
171
172		if v, ok := interface{}(item).(interface{ Validate() error }); ok {
173			if err := v.Validate(); err != nil {
174				return CacheConfig_KeyCreatorParamsValidationError{
175					field:  fmt.Sprintf("QueryParametersExcluded[%v]", idx),
176					reason: "embedded message failed validation",
177					cause:  err,
178				}
179			}
180		}
181
182	}
183
184	return nil
185}
186
187// CacheConfig_KeyCreatorParamsValidationError is the validation error returned
188// by CacheConfig_KeyCreatorParams.Validate if the designated constraints
189// aren't met.
190type CacheConfig_KeyCreatorParamsValidationError struct {
191	field  string
192	reason string
193	cause  error
194	key    bool
195}
196
197// Field function returns field value.
198func (e CacheConfig_KeyCreatorParamsValidationError) Field() string { return e.field }
199
200// Reason function returns reason value.
201func (e CacheConfig_KeyCreatorParamsValidationError) Reason() string { return e.reason }
202
203// Cause function returns cause value.
204func (e CacheConfig_KeyCreatorParamsValidationError) Cause() error { return e.cause }
205
206// Key function returns key value.
207func (e CacheConfig_KeyCreatorParamsValidationError) Key() bool { return e.key }
208
209// ErrorName returns error name.
210func (e CacheConfig_KeyCreatorParamsValidationError) ErrorName() string {
211	return "CacheConfig_KeyCreatorParamsValidationError"
212}
213
214// Error satisfies the builtin error interface
215func (e CacheConfig_KeyCreatorParamsValidationError) Error() string {
216	cause := ""
217	if e.cause != nil {
218		cause = fmt.Sprintf(" | caused by: %v", e.cause)
219	}
220
221	key := ""
222	if e.key {
223		key = "key for "
224	}
225
226	return fmt.Sprintf(
227		"invalid %sCacheConfig_KeyCreatorParams.%s: %s%s",
228		key,
229		e.field,
230		e.reason,
231		cause)
232}
233
234var _ error = CacheConfig_KeyCreatorParamsValidationError{}
235
236var _ interface {
237	Field() string
238	Reason() string
239	Key() bool
240	Cause() error
241	ErrorName() string
242} = CacheConfig_KeyCreatorParamsValidationError{}
243