Debian Codegraph @

go/xds/annotations/v3/versioning.pb.validate.go

raw symbols SCIP
1 // Code generated by protoc-gen-validate. DO NOT EDIT.
2 // source: xds/annotations/v3/versioning.proto
3
4 package v3
5
6 import (
7 "bytes"
8 "errors"
9 "fmt"
10 "net"
11 "net/mail"
12 "net/url"
13 "regexp"
14 "sort"
15 "strings"
16 "time"
17 "unicode/utf8"
18
19 "google.golang.org/protobuf/types/known/anypb"
20 )
21
22 // ensure the imports are used
23 var (
24 _ = bytes.MinRead
25 _ = errors.New("")
26 _ = fmt.Print
27 _ = utf8.UTFMax
28 _ = (*regexp.Regexp)(nil)
29 _ = (*strings.Reader)(nil)
30 _ = net.IPv4len
31 _ = time.Duration(0)
32 _ = (*url.URL)(nil)
33 _ = (*mail.Address)(nil)
34 _ = anypb.Any{}
35 _ = sort.Sort
36 )
37
38 // Validate checks the field values on VersioningAnnotation with the rules
39 // defined in the proto definition for this message. If any rules are
40 // violated, the first error encountered is returned, or nil if there are no violations.
41 func (m *VersioningAnnotation) Validate() error {
42 return m.validate(false)
43 }
44
45 // ValidateAll checks the field values on VersioningAnnotation with the rules
46 // defined in the proto definition for this message. If any rules are
47 // violated, the result is a list of violation errors wrapped in
48 // VersioningAnnotationMultiError, or nil if none found.
49 func (m *VersioningAnnotation) ValidateAll() error {
50 return m.validate(true)
51 }
52
53 func (m *VersioningAnnotation) validate(all bool) error {
54 if m == nil {
55 return nil
56 }
57
58 var errors []error
59
60 // no validation rules for PreviousMessageType
61
62 if len(errors) > 0 {
63 return VersioningAnnotationMultiError(errors)
64 }
65
66 return nil
67 }
68
69 // VersioningAnnotationMultiError is an error wrapping multiple validation
70 // errors returned by VersioningAnnotation.ValidateAll() if the designated
71 // constraints aren't met.
72 type VersioningAnnotationMultiError []error
73
74 // Error returns a concatenation of all the error messages it wraps.
75 func (m VersioningAnnotationMultiError) Error() string {
76 msgs := make([]string, 0, len(m))
77 for _, err := range m {
78 msgs = append(msgs, err.Error())
79 }
80 return strings.Join(msgs, "; ")
81 }
82
83 // AllErrors returns a list of validation violation errors.
84 func (m VersioningAnnotationMultiError) AllErrors() []error { return m }
85
86 // VersioningAnnotationValidationError is the validation error returned by
87 // VersioningAnnotation.Validate if the designated constraints aren't met.
88 type VersioningAnnotationValidationError struct {
89 field string
90 reason string
91 cause error
92 key bool
93 }
94
95 // Field function returns field value.
96 func (e VersioningAnnotationValidationError) Field() string { return e.field }
97
98 // Reason function returns reason value.
99 func (e VersioningAnnotationValidationError) Reason() string { return e.reason }
100
101 // Cause function returns cause value.
102 func (e VersioningAnnotationValidationError) Cause() error { return e.cause }
103
104 // Key function returns key value.
105 func (e VersioningAnnotationValidationError) Key() bool { return e.key }
106
107 // ErrorName returns error name.
108 func (e VersioningAnnotationValidationError) ErrorName() string {
109 return "VersioningAnnotationValidationError"
110 }
111
112 // Error satisfies the builtin error interface
113 func (e VersioningAnnotationValidationError) 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 %sVersioningAnnotation.%s: %s%s",
126 key,
127 e.field,
128 e.reason,
129 cause)
130 }
131
132 var _ error = VersioningAnnotationValidationError{}
133
134 var _ interface {
135 Field() string
136 Reason() string
137 Key() bool
138 Cause() error
139 ErrorName() string
140 } = VersioningAnnotationValidationError{}