Debian Codegraph @

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

raw symbols SCIP
1 // Code generated by protoc-gen-validate. DO NOT EDIT.
2 // source: xds/annotations/v3/security.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 FieldSecurityAnnotation 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 *FieldSecurityAnnotation) Validate() error {
42 return m.validate(false)
43 }
44
45 // ValidateAll checks the field values on FieldSecurityAnnotation with the
46 // rules 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 // FieldSecurityAnnotationMultiError, or nil if none found.
49 func (m *FieldSecurityAnnotation) ValidateAll() error {
50 return m.validate(true)
51 }
52
53 func (m *FieldSecurityAnnotation) validate(all bool) error {
54 if m == nil {
55 return nil
56 }
57
58 var errors []error
59
60 // no validation rules for ConfigureForUntrustedDownstream
61
62 // no validation rules for ConfigureForUntrustedUpstream
63
64 if len(errors) > 0 {
65 return FieldSecurityAnnotationMultiError(errors)
66 }
67
68 return nil
69 }
70
71 // FieldSecurityAnnotationMultiError is an error wrapping multiple validation
72 // errors returned by FieldSecurityAnnotation.ValidateAll() if the designated
73 // constraints aren't met.
74 type FieldSecurityAnnotationMultiError []error
75
76 // Error returns a concatenation of all the error messages it wraps.
77 func (m FieldSecurityAnnotationMultiError) Error() string {
78 msgs := make([]string, 0, len(m))
79 for _, err := range m {
80 msgs = append(msgs, err.Error())
81 }
82 return strings.Join(msgs, "; ")
83 }
84
85 // AllErrors returns a list of validation violation errors.
86 func (m FieldSecurityAnnotationMultiError) AllErrors() []error { return m }
87
88 // FieldSecurityAnnotationValidationError is the validation error returned by
89 // FieldSecurityAnnotation.Validate if the designated constraints aren't met.
90 type FieldSecurityAnnotationValidationError struct {
91 field string
92 reason string
93 cause error
94 key bool
95 }
96
97 // Field function returns field value.
98 func (e FieldSecurityAnnotationValidationError) Field() string { return e.field }
99
100 // Reason function returns reason value.
101 func (e FieldSecurityAnnotationValidationError) Reason() string { return e.reason }
102
103 // Cause function returns cause value.
104 func (e FieldSecurityAnnotationValidationError) Cause() error { return e.cause }
105
106 // Key function returns key value.
107 func (e FieldSecurityAnnotationValidationError) Key() bool { return e.key }
108
109 // ErrorName returns error name.
110 func (e FieldSecurityAnnotationValidationError) ErrorName() string {
111 return "FieldSecurityAnnotationValidationError"
112 }
113
114 // Error satisfies the builtin error interface
115 func (e FieldSecurityAnnotationValidationError) Error() string {
116 cause := ""
117 if e.cause != nil {
118 cause = fmt.Sprintf(" | caused by: %v", e.cause)
119 }
120
121 key := ""
122 if e.key {
123 key = "key for "
124 }
125
126 return fmt.Sprintf(
127 "invalid %sFieldSecurityAnnotation.%s: %s%s",
128 key,
129 e.field,
130 e.reason,
131 cause)
132 }
133
134 var _ error = FieldSecurityAnnotationValidationError{}
135
136 var _ interface {
137 Field() string
138 Reason() string
139 Key() bool
140 Cause() error
141 ErrorName() string
142 } = FieldSecurityAnnotationValidationError{}