Debian Codegraph @

envoy/config/core/v3/extension.pb.validate.go

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