| 1 |
//go:build !disable_pgv |
| 2 |
// Code generated by protoc-gen-validate. DO NOT EDIT. |
| 3 |
// source: envoy/extensions/request_id/uuid/v3/uuid.proto |
| 4 |
|
| 5 |
package uuidv3 |
| 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 UuidRequestIdConfig 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 *UuidRequestIdConfig) Validate() error { |
| 43 |
return m.validate(false) |
| 44 |
} |
| 45 |
|
| 46 |
// ValidateAll checks the field values on UuidRequestIdConfig 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 |
// UuidRequestIdConfigMultiError, or nil if none found. |
| 50 |
func (m *UuidRequestIdConfig) ValidateAll() error { |
| 51 |
return m.validate(true) |
| 52 |
} |
| 53 |
|
| 54 |
func (m *UuidRequestIdConfig) 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.GetPackTraceReason()).(type) { |
| 63 |
case interface{ ValidateAll() error }: |
| 64 |
if err := v.ValidateAll(); err != nil { |
| 65 |
errors = append(errors, UuidRequestIdConfigValidationError{ |
| 66 |
field: "PackTraceReason", |
| 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, UuidRequestIdConfigValidationError{ |
| 74 |
field: "PackTraceReason", |
| 75 |
reason: "embedded message failed validation", |
| 76 |
cause: err, |
| 77 |
}) |
| 78 |
} |
| 79 |
} |
| 80 |
} else if v, ok := interface{}(m.GetPackTraceReason()).(interface{ Validate() error }); ok { |
| 81 |
if err := v.Validate(); err != nil { |
| 82 |
return UuidRequestIdConfigValidationError{ |
| 83 |
field: "PackTraceReason", |
| 84 |
reason: "embedded message failed validation", |
| 85 |
cause: err, |
| 86 |
} |
| 87 |
} |
| 88 |
} |
| 89 |
|
| 90 |
if all { |
| 91 |
switch v := interface{}(m.GetUseRequestIdForTraceSampling()).(type) { |
| 92 |
case interface{ ValidateAll() error }: |
| 93 |
if err := v.ValidateAll(); err != nil { |
| 94 |
errors = append(errors, UuidRequestIdConfigValidationError{ |
| 95 |
field: "UseRequestIdForTraceSampling", |
| 96 |
reason: "embedded message failed validation", |
| 97 |
cause: err, |
| 98 |
}) |
| 99 |
} |
| 100 |
case interface{ Validate() error }: |
| 101 |
if err := v.Validate(); err != nil { |
| 102 |
errors = append(errors, UuidRequestIdConfigValidationError{ |
| 103 |
field: "UseRequestIdForTraceSampling", |
| 104 |
reason: "embedded message failed validation", |
| 105 |
cause: err, |
| 106 |
}) |
| 107 |
} |
| 108 |
} |
| 109 |
} else if v, ok := interface{}(m.GetUseRequestIdForTraceSampling()).(interface{ Validate() error }); ok { |
| 110 |
if err := v.Validate(); err != nil { |
| 111 |
return UuidRequestIdConfigValidationError{ |
| 112 |
field: "UseRequestIdForTraceSampling", |
| 113 |
reason: "embedded message failed validation", |
| 114 |
cause: err, |
| 115 |
} |
| 116 |
} |
| 117 |
} |
| 118 |
|
| 119 |
if len(errors) > 0 { |
| 120 |
return UuidRequestIdConfigMultiError(errors) |
| 121 |
} |
| 122 |
|
| 123 |
return nil |
| 124 |
} |
| 125 |
|
| 126 |
// UuidRequestIdConfigMultiError is an error wrapping multiple validation |
| 127 |
// errors returned by UuidRequestIdConfig.ValidateAll() if the designated |
| 128 |
// constraints aren't met. |
| 129 |
type UuidRequestIdConfigMultiError []error |
| 130 |
|
| 131 |
// Error returns a concatenation of all the error messages it wraps. |
| 132 |
func (m UuidRequestIdConfigMultiError) Error() string { |
| 133 |
var msgs []string |
| 134 |
for _, err := range m { |
| 135 |
msgs = append(msgs, err.Error()) |
| 136 |
} |
| 137 |
return strings.Join(msgs, "; ") |
| 138 |
} |
| 139 |
|
| 140 |
// AllErrors returns a list of validation violation errors. |
| 141 |
func (m UuidRequestIdConfigMultiError) AllErrors() []error { return m } |
| 142 |
|
| 143 |
// UuidRequestIdConfigValidationError is the validation error returned by |
| 144 |
// UuidRequestIdConfig.Validate if the designated constraints aren't met. |
| 145 |
type UuidRequestIdConfigValidationError struct { |
| 146 |
field string |
| 147 |
reason string |
| 148 |
cause error |
| 149 |
key bool |
| 150 |
} |
| 151 |
|
| 152 |
// Field function returns field value. |
| 153 |
func (e UuidRequestIdConfigValidationError) Field() string { return e.field } |
| 154 |
|
| 155 |
// Reason function returns reason value. |
| 156 |
func (e UuidRequestIdConfigValidationError) Reason() string { return e.reason } |
| 157 |
|
| 158 |
// Cause function returns cause value. |
| 159 |
func (e UuidRequestIdConfigValidationError) Cause() error { return e.cause } |
| 160 |
|
| 161 |
// Key function returns key value. |
| 162 |
func (e UuidRequestIdConfigValidationError) Key() bool { return e.key } |
| 163 |
|
| 164 |
// ErrorName returns error name. |
| 165 |
func (e UuidRequestIdConfigValidationError) ErrorName() string { |
| 166 |
return "UuidRequestIdConfigValidationError" |
| 167 |
} |
| 168 |
|
| 169 |
// Error satisfies the builtin error interface |
| 170 |
func (e UuidRequestIdConfigValidationError) Error() string { |
| 171 |
cause := "" |
| 172 |
if e.cause != nil { |
| 173 |
cause = fmt.Sprintf(" | caused by: %v", e.cause) |
| 174 |
} |
| 175 |
|
| 176 |
key := "" |
| 177 |
if e.key { |
| 178 |
key = "key for " |
| 179 |
} |
| 180 |
|
| 181 |
return fmt.Sprintf( |
| 182 |
"invalid %sUuidRequestIdConfig.%s: %s%s", |
| 183 |
key, |
| 184 |
e.field, |
| 185 |
e.reason, |
| 186 |
cause) |
| 187 |
} |
| 188 |
|
| 189 |
var _ error = UuidRequestIdConfigValidationError{} |
| 190 |
|
| 191 |
var _ interface { |
| 192 |
Field() string |
| 193 |
Reason() string |
| 194 |
Key() bool |
| 195 |
Cause() error |
| 196 |
ErrorName() string |
| 197 |
} = UuidRequestIdConfigValidationError{} |