Debian Codegraph @

envoy/extensions/upstreams/http/generic/v3/generic_connection_pool.pb.validate.go

raw
1 //go:build !disable_pgv
2 // Code generated by protoc-gen-validate. DO NOT EDIT.
3 // source: envoy/extensions/upstreams/http/generic/v3/generic_connection_pool.proto
4
5 package genericv3
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 GenericConnectionPoolProto 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 *GenericConnectionPoolProto) Validate() error {
43 return m.validate(false)
44 }
45
46 // ValidateAll checks the field values on GenericConnectionPoolProto with the
47 // rules 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 // GenericConnectionPoolProtoMultiError, or nil if none found.
50 func (m *GenericConnectionPoolProto) ValidateAll() error {
51 return m.validate(true)
52 }
53
54 func (m *GenericConnectionPoolProto) 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 GenericConnectionPoolProtoMultiError(errors)
63 }
64
65 return nil
66 }
67
68 // GenericConnectionPoolProtoMultiError is an error wrapping multiple
69 // validation errors returned by GenericConnectionPoolProto.ValidateAll() if
70 // the designated constraints aren't met.
71 type GenericConnectionPoolProtoMultiError []error
72
73 // Error returns a concatenation of all the error messages it wraps.
74 func (m GenericConnectionPoolProtoMultiError) 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 GenericConnectionPoolProtoMultiError) AllErrors() []error { return m }
84
85 // GenericConnectionPoolProtoValidationError is the validation error returned
86 // by GenericConnectionPoolProto.Validate if the designated constraints aren't met.
87 type GenericConnectionPoolProtoValidationError struct {
88 field string
89 reason string
90 cause error
91 key bool
92 }
93
94 // Field function returns field value.
95 func (e GenericConnectionPoolProtoValidationError) Field() string { return e.field }
96
97 // Reason function returns reason value.
98 func (e GenericConnectionPoolProtoValidationError) Reason() string { return e.reason }
99
100 // Cause function returns cause value.
101 func (e GenericConnectionPoolProtoValidationError) Cause() error { return e.cause }
102
103 // Key function returns key value.
104 func (e GenericConnectionPoolProtoValidationError) Key() bool { return e.key }
105
106 // ErrorName returns error name.
107 func (e GenericConnectionPoolProtoValidationError) ErrorName() string {
108 return "GenericConnectionPoolProtoValidationError"
109 }
110
111 // Error satisfies the builtin error interface
112 func (e GenericConnectionPoolProtoValidationError) Error() string {
113 cause := ""
114 if e.cause != nil {
115 cause = fmt.Sprintf(" | caused by: %v", e.cause)
116 }
117
118 key := ""
119 if e.key {
120 key = "key for "
121 }
122
123 return fmt.Sprintf(
124 "invalid %sGenericConnectionPoolProto.%s: %s%s",
125 key,
126 e.field,
127 e.reason,
128 cause)
129 }
130
131 var _ error = GenericConnectionPoolProtoValidationError{}
132
133 var _ interface {
134 Field() string
135 Reason() string
136 Key() bool
137 Cause() error
138 ErrorName() string
139 } = GenericConnectionPoolProtoValidationError{}