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