| 1 |
//go:build !disable_pgv |
| 2 |
// Code generated by protoc-gen-validate. DO NOT EDIT. |
| 3 |
// source: envoy/service/load_stats/v2/lrs.proto |
| 4 |
|
| 5 |
package load_statsv2 |
| 6 |
|
| 7 |
import ( |
| 8 |
"bytes" |
| 9 |
"errors" |
| 10 |
"fmt" |
| 11 |
"net" |
| 12 |
"net/mail" |
| 13 |
"net/url" |
| 14 |
"regexp" |
| 15 |
"sort" |
| 16 |
"strings" |
| 17 |
"time" |
| 18 |
"unicode/utf8" |
| 19 |
|
| 20 |
"google.golang.org/protobuf/types/known/anypb" |
| 21 |
) |
| 22 |
|
| 23 |
// ensure the imports are used |
| 24 |
var ( |
| 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 |
_ = anypb.Any{} |
| 36 |
_ = sort.Sort |
| 37 |
) |
| 38 |
|
| 39 |
// Validate checks the field values on LoadStatsRequest with the rules defined |
| 40 |
// in the proto definition for this message. If any rules are violated, the |
| 41 |
// first error encountered is returned, or nil if there are no violations. |
| 42 |
func (m *LoadStatsRequest) Validate() error { |
| 43 |
return m.validate(false) |
| 44 |
} |
| 45 |
|
| 46 |
// ValidateAll checks the field values on LoadStatsRequest with the rules |
| 47 |
// defined in the proto definition for this message. If any rules are |
| 48 |
// violated, the result is a list of violation errors wrapped in |
| 49 |
// LoadStatsRequestMultiError, or nil if none found. |
| 50 |
func (m *LoadStatsRequest) ValidateAll() error { |
| 51 |
return m.validate(true) |
| 52 |
} |
| 53 |
|
| 54 |
func (m *LoadStatsRequest) validate(all bool) error { |
| 55 |
if m == nil { |
| 56 |
return nil |
| 57 |
} |
| 58 |
|
| 59 |
var errors []error |
| 60 |
|
| 61 |
if all { |
| 62 |
switch v := interface{}(m.GetNode()).(type) { |
| 63 |
case interface{ ValidateAll() error }: |
| 64 |
if err := v.ValidateAll(); err != nil { |
| 65 |
errors = append(errors, LoadStatsRequestValidationError{ |
| 66 |
field: "Node", |
| 67 |
reason: "embedded message failed validation", |
| 68 |
cause: err, |
| 69 |
}) |
| 70 |
} |
| 71 |
case interface{ Validate() error }: |
| 72 |
if err := v.Validate(); err != nil { |
| 73 |
errors = append(errors, LoadStatsRequestValidationError{ |
| 74 |
field: "Node", |
| 75 |
reason: "embedded message failed validation", |
| 76 |
cause: err, |
| 77 |
}) |
| 78 |
} |
| 79 |
} |
| 80 |
} else if v, ok := interface{}(m.GetNode()).(interface{ Validate() error }); ok { |
| 81 |
if err := v.Validate(); err != nil { |
| 82 |
return LoadStatsRequestValidationError{ |
| 83 |
field: "Node", |
| 84 |
reason: "embedded message failed validation", |
| 85 |
cause: err, |
| 86 |
} |
| 87 |
} |
| 88 |
} |
| 89 |
|
| 90 |
for idx, item := range m.GetClusterStats() { |
| 91 |
_, _ = idx, item |
| 92 |
|
| 93 |
if all { |
| 94 |
switch v := interface{}(item).(type) { |
| 95 |
case interface{ ValidateAll() error }: |
| 96 |
if err := v.ValidateAll(); err != nil { |
| 97 |
errors = append(errors, LoadStatsRequestValidationError{ |
| 98 |
field: fmt.Sprintf("ClusterStats[%v]", idx), |
| 99 |
reason: "embedded message failed validation", |
| 100 |
cause: err, |
| 101 |
}) |
| 102 |
} |
| 103 |
case interface{ Validate() error }: |
| 104 |
if err := v.Validate(); err != nil { |
| 105 |
errors = append(errors, LoadStatsRequestValidationError{ |
| 106 |
field: fmt.Sprintf("ClusterStats[%v]", idx), |
| 107 |
reason: "embedded message failed validation", |
| 108 |
cause: err, |
| 109 |
}) |
| 110 |
} |
| 111 |
} |
| 112 |
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok { |
| 113 |
if err := v.Validate(); err != nil { |
| 114 |
return LoadStatsRequestValidationError{ |
| 115 |
field: fmt.Sprintf("ClusterStats[%v]", idx), |
| 116 |
reason: "embedded message failed validation", |
| 117 |
cause: err, |
| 118 |
} |
| 119 |
} |
| 120 |
} |
| 121 |
|
| 122 |
} |
| 123 |
|
| 124 |
if len(errors) > 0 { |
| 125 |
return LoadStatsRequestMultiError(errors) |
| 126 |
} |
| 127 |
|
| 128 |
return nil |
| 129 |
} |
| 130 |
|
| 131 |
// LoadStatsRequestMultiError is an error wrapping multiple validation errors |
| 132 |
// returned by LoadStatsRequest.ValidateAll() if the designated constraints |
| 133 |
// aren't met. |
| 134 |
type LoadStatsRequestMultiError []error |
| 135 |
|
| 136 |
// Error returns a concatenation of all the error messages it wraps. |
| 137 |
func (m LoadStatsRequestMultiError) Error() string { |
| 138 |
var msgs []string |
| 139 |
for _, err := range m { |
| 140 |
msgs = append(msgs, err.Error()) |
| 141 |
} |
| 142 |
return strings.Join(msgs, "; ") |
| 143 |
} |
| 144 |
|
| 145 |
// AllErrors returns a list of validation violation errors. |
| 146 |
func (m LoadStatsRequestMultiError) AllErrors() []error { return m } |
| 147 |
|
| 148 |
// LoadStatsRequestValidationError is the validation error returned by |
| 149 |
// LoadStatsRequest.Validate if the designated constraints aren't met. |
| 150 |
type LoadStatsRequestValidationError struct { |
| 151 |
field string |
| 152 |
reason string |
| 153 |
cause error |
| 154 |
key bool |
| 155 |
} |
| 156 |
|
| 157 |
// Field function returns field value. |
| 158 |
func (e LoadStatsRequestValidationError) Field() string { return e.field } |
| 159 |
|
| 160 |
// Reason function returns reason value. |
| 161 |
func (e LoadStatsRequestValidationError) Reason() string { return e.reason } |
| 162 |
|
| 163 |
// Cause function returns cause value. |
| 164 |
func (e LoadStatsRequestValidationError) Cause() error { return e.cause } |
| 165 |
|
| 166 |
// Key function returns key value. |
| 167 |
func (e LoadStatsRequestValidationError) Key() bool { return e.key } |
| 168 |
|
| 169 |
// ErrorName returns error name. |
| 170 |
func (e LoadStatsRequestValidationError) ErrorName() string { return "LoadStatsRequestValidationError" } |
| 171 |
|
| 172 |
// Error satisfies the builtin error interface |
| 173 |
func (e LoadStatsRequestValidationError) Error() string { |
| 174 |
cause := "" |
| 175 |
if e.cause != nil { |
| 176 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 177 |
} |
| 178 |
|
| 179 |
key := "" |
| 180 |
if e.key { |
| 181 |
key = "key for " |
| 182 |
} |
| 183 |
|
| 184 |
return fmt.Sprintf( |
| 185 |
"invalid %sLoadStatsRequest.%s: %s%s", |
| 186 |
key, |
| 187 |
e.field, |
| 188 |
e.reason, |
| 189 |
cause) |
| 190 |
} |
| 191 |
|
| 192 |
var _ error = LoadStatsRequestValidationError{} |
| 193 |
|
| 194 |
var _ interface { |
| 195 |
Field() string |
| 196 |
Reason() string |
| 197 |
Key() bool |
| 198 |
Cause() error |
| 199 |
ErrorName() string |
| 200 |
} = LoadStatsRequestValidationError{} |
| 201 |
|
| 202 |
// Validate checks the field values on LoadStatsResponse with the rules defined |
| 203 |
// in the proto definition for this message. If any rules are violated, the |
| 204 |
// first error encountered is returned, or nil if there are no violations. |
| 205 |
func (m *LoadStatsResponse) Validate() error { |
| 206 |
return m.validate(false) |
| 207 |
} |
| 208 |
|
| 209 |
// ValidateAll checks the field values on LoadStatsResponse with the rules |
| 210 |
// defined in the proto definition for this message. If any rules are |
| 211 |
// violated, the result is a list of violation errors wrapped in |
| 212 |
// LoadStatsResponseMultiError, or nil if none found. |
| 213 |
func (m *LoadStatsResponse) ValidateAll() error { |
| 214 |
return m.validate(true) |
| 215 |
} |
| 216 |
|
| 217 |
func (m *LoadStatsResponse) validate(all bool) error { |
| 218 |
if m == nil { |
| 219 |
return nil |
| 220 |
} |
| 221 |
|
| 222 |
var errors []error |
| 223 |
|
| 224 |
// no validation rules for SendAllClusters |
| 225 |
|
| 226 |
if all { |
| 227 |
switch v := interface{}(m.GetLoadReportingInterval()).(type) { |
| 228 |
case interface{ ValidateAll() error }: |
| 229 |
if err := v.ValidateAll(); err != nil { |
| 230 |
errors = append(errors, LoadStatsResponseValidationError{ |
| 231 |
field: "LoadReportingInterval", |
| 232 |
reason: "embedded message failed validation", |
| 233 |
cause: err, |
| 234 |
}) |
| 235 |
} |
| 236 |
case interface{ Validate() error }: |
| 237 |
if err := v.Validate(); err != nil { |
| 238 |
errors = append(errors, LoadStatsResponseValidationError{ |
| 239 |
field: "LoadReportingInterval", |
| 240 |
reason: "embedded message failed validation", |
| 241 |
cause: err, |
| 242 |
}) |
| 243 |
} |
| 244 |
} |
| 245 |
} else if v, ok := interface{}(m.GetLoadReportingInterval()).(interface{ Validate() error }); ok { |
| 246 |
if err := v.Validate(); err != nil { |
| 247 |
return LoadStatsResponseValidationError{ |
| 248 |
field: "LoadReportingInterval", |
| 249 |
reason: "embedded message failed validation", |
| 250 |
cause: err, |
| 251 |
} |
| 252 |
} |
| 253 |
} |
| 254 |
|
| 255 |
// no validation rules for ReportEndpointGranularity |
| 256 |
|
| 257 |
if len(errors) > 0 { |
| 258 |
return LoadStatsResponseMultiError(errors) |
| 259 |
} |
| 260 |
|
| 261 |
return nil |
| 262 |
} |
| 263 |
|
| 264 |
// LoadStatsResponseMultiError is an error wrapping multiple validation errors |
| 265 |
// returned by LoadStatsResponse.ValidateAll() if the designated constraints |
| 266 |
// aren't met. |
| 267 |
type LoadStatsResponseMultiError []error |
| 268 |
|
| 269 |
// Error returns a concatenation of all the error messages it wraps. |
| 270 |
func (m LoadStatsResponseMultiError) Error() string { |
| 271 |
var msgs []string |
| 272 |
for _, err := range m { |
| 273 |
msgs = append(msgs, err.Error()) |
| 274 |
} |
| 275 |
return strings.Join(msgs, "; ") |
| 276 |
} |
| 277 |
|
| 278 |
// AllErrors returns a list of validation violation errors. |
| 279 |
func (m LoadStatsResponseMultiError) AllErrors() []error { return m } |
| 280 |
|
| 281 |
// LoadStatsResponseValidationError is the validation error returned by |
| 282 |
// LoadStatsResponse.Validate if the designated constraints aren't met. |
| 283 |
type LoadStatsResponseValidationError struct { |
| 284 |
field string |
| 285 |
reason string |
| 286 |
cause error |
| 287 |
key bool |
| 288 |
} |
| 289 |
|
| 290 |
// Field function returns field value. |
| 291 |
func (e LoadStatsResponseValidationError) Field() string { return e.field } |
| 292 |
|
| 293 |
// Reason function returns reason value. |
| 294 |
func (e LoadStatsResponseValidationError) Reason() string { return e.reason } |
| 295 |
|
| 296 |
// Cause function returns cause value. |
| 297 |
func (e LoadStatsResponseValidationError) Cause() error { return e.cause } |
| 298 |
|
| 299 |
// Key function returns key value. |
| 300 |
func (e LoadStatsResponseValidationError) Key() bool { return e.key } |
| 301 |
|
| 302 |
// ErrorName returns error name. |
| 303 |
func (e LoadStatsResponseValidationError) ErrorName() string { |
| 304 |
return "LoadStatsResponseValidationError" |
| 305 |
} |
| 306 |
|
| 307 |
// Error satisfies the builtin error interface |
| 308 |
func (e LoadStatsResponseValidationError) Error() string { |
| 309 |
cause := "" |
| 310 |
if e.cause != nil { |
| 311 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 312 |
} |
| 313 |
|
| 314 |
key := "" |
| 315 |
if e.key { |
| 316 |
key = "key for " |
| 317 |
} |
| 318 |
|
| 319 |
return fmt.Sprintf( |
| 320 |
"invalid %sLoadStatsResponse.%s: %s%s", |
| 321 |
key, |
| 322 |
e.field, |
| 323 |
e.reason, |
| 324 |
cause) |
| 325 |
} |
| 326 |
|
| 327 |
var _ error = LoadStatsResponseValidationError{} |
| 328 |
|
| 329 |
var _ interface { |
| 330 |
Field() string |
| 331 |
Reason() string |
| 332 |
Key() bool |
| 333 |
Cause() error |
| 334 |
ErrorName() string |
| 335 |
} = LoadStatsResponseValidationError{} |