Debian Codegraph @

envoy/config/grpc_credential/v2alpha/aws_iam.pb.validate.go

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