Debian Codegraph @

go/udpa/service/orca/v1/orca.pb.validate.go

raw symbols SCIP
1 // Code generated by protoc-gen-validate. DO NOT EDIT.
2 // source: udpa/service/orca/v1/orca.proto
3
4 package v1
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 OrcaLoadReportRequest 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 *OrcaLoadReportRequest) Validate() error {
42 return m.validate(false)
43 }
44
45 // ValidateAll checks the field values on OrcaLoadReportRequest 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 // OrcaLoadReportRequestMultiError, or nil if none found.
49 func (m *OrcaLoadReportRequest) ValidateAll() error {
50 return m.validate(true)
51 }
52
53 func (m *OrcaLoadReportRequest) validate(all bool) error {
54 if m == nil {
55 return nil
56 }
57
58 var errors []error
59
60 if all {
61 switch v := interface{}(m.GetReportInterval()).(type) {
62 case interface{ ValidateAll() error }:
63 if err := v.ValidateAll(); err != nil {
64 errors = append(errors, OrcaLoadReportRequestValidationError{
65 field: "ReportInterval",
66 reason: "embedded message failed validation",
67 cause: err,
68 })
69 }
70 case interface{ Validate() error }:
71 if err := v.Validate(); err != nil {
72 errors = append(errors, OrcaLoadReportRequestValidationError{
73 field: "ReportInterval",
74 reason: "embedded message failed validation",
75 cause: err,
76 })
77 }
78 }
79 } else if v, ok := interface{}(m.GetReportInterval()).(interface{ Validate() error }); ok {
80 if err := v.Validate(); err != nil {
81 return OrcaLoadReportRequestValidationError{
82 field: "ReportInterval",
83 reason: "embedded message failed validation",
84 cause: err,
85 }
86 }
87 }
88
89 if len(errors) > 0 {
90 return OrcaLoadReportRequestMultiError(errors)
91 }
92
93 return nil
94 }
95
96 // OrcaLoadReportRequestMultiError is an error wrapping multiple validation
97 // errors returned by OrcaLoadReportRequest.ValidateAll() if the designated
98 // constraints aren't met.
99 type OrcaLoadReportRequestMultiError []error
100
101 // Error returns a concatenation of all the error messages it wraps.
102 func (m OrcaLoadReportRequestMultiError) Error() string {
103 msgs := make([]string, 0, len(m))
104 for _, err := range m {
105 msgs = append(msgs, err.Error())
106 }
107 return strings.Join(msgs, "; ")
108 }
109
110 // AllErrors returns a list of validation violation errors.
111 func (m OrcaLoadReportRequestMultiError) AllErrors() []error { return m }
112
113 // OrcaLoadReportRequestValidationError is the validation error returned by
114 // OrcaLoadReportRequest.Validate if the designated constraints aren't met.
115 type OrcaLoadReportRequestValidationError struct {
116 field string
117 reason string
118 cause error
119 key bool
120 }
121
122 // Field function returns field value.
123 func (e OrcaLoadReportRequestValidationError) Field() string { return e.field }
124
125 // Reason function returns reason value.
126 func (e OrcaLoadReportRequestValidationError) Reason() string { return e.reason }
127
128 // Cause function returns cause value.
129 func (e OrcaLoadReportRequestValidationError) Cause() error { return e.cause }
130
131 // Key function returns key value.
132 func (e OrcaLoadReportRequestValidationError) Key() bool { return e.key }
133
134 // ErrorName returns error name.
135 func (e OrcaLoadReportRequestValidationError) ErrorName() string {
136 return "OrcaLoadReportRequestValidationError"
137 }
138
139 // Error satisfies the builtin error interface
140 func (e OrcaLoadReportRequestValidationError) Error() string {
141 cause := ""
142 if e.cause != nil {
143 cause = fmt.Sprintf(" | caused by: %v", e.cause)
144 }
145
146 key := ""
147 if e.key {
148 key = "key for "
149 }
150
151 return fmt.Sprintf(
152 "invalid %sOrcaLoadReportRequest.%s: %s%s",
153 key,
154 e.field,
155 e.reason,
156 cause)
157 }
158
159 var _ error = OrcaLoadReportRequestValidationError{}
160
161 var _ interface {
162 Field() string
163 Reason() string
164 Key() bool
165 Cause() error
166 ErrorName() string
167 } = OrcaLoadReportRequestValidationError{}