Debian Codegraph @

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