Debian Codegraph @

envoy/config/retry/previous_priorities/previous_priorities_config.pb.validate.go

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