Debian Codegraph @

envoy/extensions/resource_monitors/cpu_utilization/v3/cpu_utilization.pb.validate.go

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