Debian Codegraph @

envoy/extensions/tracers/opentelemetry/resource_detectors/v3/environment_resource_detector.pb.validate.go

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