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