Debian Codegraph @

envoy/service/discovery/v3/ads.pb.validate.go

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