Debian Codegraph @

envoy/extensions/config/validators/minimum_clusters/v3/minimum_clusters.pb.validate.go

raw
1 //go:build !disable_pgv
2 // Code generated by protoc-gen-validate. DO NOT EDIT.
3 // source: envoy/extensions/config/validators/minimum_clusters/v3/minimum_clusters.proto
4
5 package minimum_clustersv3
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 MinimumClustersValidator with the rules
40 // defined in the proto definition for this message. If any rules are
41 // violated, the first error encountered is returned, or nil if there are no violations.
42 func (m *MinimumClustersValidator) Validate() error {
43 return m.validate(false)
44 }
45
46 // ValidateAll checks the field values on MinimumClustersValidator with the
47 // rules 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 // MinimumClustersValidatorMultiError, or nil if none found.
50 func (m *MinimumClustersValidator) ValidateAll() error {
51 return m.validate(true)
52 }
53
54 func (m *MinimumClustersValidator) validate(all bool) error {
55 if m == nil {
56 return nil
57 }
58
59 var errors []error
60
61 // no validation rules for MinClustersNum
62
63 if len(errors) > 0 {
64 return MinimumClustersValidatorMultiError(errors)
65 }
66
67 return nil
68 }
69
70 // MinimumClustersValidatorMultiError is an error wrapping multiple validation
71 // errors returned by MinimumClustersValidator.ValidateAll() if the designated
72 // constraints aren't met.
73 type MinimumClustersValidatorMultiError []error
74
75 // Error returns a concatenation of all the error messages it wraps.
76 func (m MinimumClustersValidatorMultiError) Error() string {
77 var msgs []string
78 for _, err := range m {
79 msgs = append(msgs, err.Error())
80 }
81 return strings.Join(msgs, "; ")
82 }
83
84 // AllErrors returns a list of validation violation errors.
85 func (m MinimumClustersValidatorMultiError) AllErrors() []error { return m }
86
87 // MinimumClustersValidatorValidationError is the validation error returned by
88 // MinimumClustersValidator.Validate if the designated constraints aren't met.
89 type MinimumClustersValidatorValidationError struct {
90 field string
91 reason string
92 cause error
93 key bool
94 }
95
96 // Field function returns field value.
97 func (e MinimumClustersValidatorValidationError) Field() string { return e.field }
98
99 // Reason function returns reason value.
100 func (e MinimumClustersValidatorValidationError) Reason() string { return e.reason }
101
102 // Cause function returns cause value.
103 func (e MinimumClustersValidatorValidationError) Cause() error { return e.cause }
104
105 // Key function returns key value.
106 func (e MinimumClustersValidatorValidationError) Key() bool { return e.key }
107
108 // ErrorName returns error name.
109 func (e MinimumClustersValidatorValidationError) ErrorName() string {
110 return "MinimumClustersValidatorValidationError"
111 }
112
113 // Error satisfies the builtin error interface
114 func (e MinimumClustersValidatorValidationError) Error() string {
115 cause := ""
116 if e.cause != nil {
117 cause = fmt.Sprintf(" | caused by: %v", e.cause)
118 }
119
120 key := ""
121 if e.key {
122 key = "key for "
123 }
124
125 return fmt.Sprintf(
126 "invalid %sMinimumClustersValidator.%s: %s%s",
127 key,
128 e.field,
129 e.reason,
130 cause)
131 }
132
133 var _ error = MinimumClustersValidatorValidationError{}
134
135 var _ interface {
136 Field() string
137 Reason() string
138 Key() bool
139 Cause() error
140 ErrorName() string
141 } = MinimumClustersValidatorValidationError{}