github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/service/load_stats/v2/lrs.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: envoy/service/load_stats/v2/lrs.proto 3 4 package envoy_service_load_stats_v2 5 6 import ( 7 "bytes" 8 "errors" 9 "fmt" 10 "net" 11 "net/mail" 12 "net/url" 13 "regexp" 14 "strings" 15 "time" 16 "unicode/utf8" 17 18 "google.golang.org/protobuf/types/known/anypb" 19 ) 20 21 // ensure the imports are used 22 var ( 23 _ = bytes.MinRead 24 _ = errors.New("") 25 _ = fmt.Print 26 _ = utf8.UTFMax 27 _ = (*regexp.Regexp)(nil) 28 _ = (*strings.Reader)(nil) 29 _ = net.IPv4len 30 _ = time.Duration(0) 31 _ = (*url.URL)(nil) 32 _ = (*mail.Address)(nil) 33 _ = anypb.Any{} 34 ) 35 36 // Validate checks the field values on LoadStatsRequest with the rules defined 37 // in the proto definition for this message. If any rules are violated, an 38 // error is returned. 39 func (m *LoadStatsRequest) Validate() error { 40 if m == nil { 41 return nil 42 } 43 44 if v, ok := interface{}(m.GetNode()).(interface{ Validate() error }); ok { 45 if err := v.Validate(); err != nil { 46 return LoadStatsRequestValidationError{ 47 field: "Node", 48 reason: "embedded message failed validation", 49 cause: err, 50 } 51 } 52 } 53 54 for idx, item := range m.GetClusterStats() { 55 _, _ = idx, item 56 57 if v, ok := interface{}(item).(interface{ Validate() error }); ok { 58 if err := v.Validate(); err != nil { 59 return LoadStatsRequestValidationError{ 60 field: fmt.Sprintf("ClusterStats[%v]", idx), 61 reason: "embedded message failed validation", 62 cause: err, 63 } 64 } 65 } 66 67 } 68 69 return nil 70 } 71 72 // LoadStatsRequestValidationError is the validation error returned by 73 // LoadStatsRequest.Validate if the designated constraints aren't met. 74 type LoadStatsRequestValidationError struct { 75 field string 76 reason string 77 cause error 78 key bool 79 } 80 81 // Field function returns field value. 82 func (e LoadStatsRequestValidationError) Field() string { return e.field } 83 84 // Reason function returns reason value. 85 func (e LoadStatsRequestValidationError) Reason() string { return e.reason } 86 87 // Cause function returns cause value. 88 func (e LoadStatsRequestValidationError) Cause() error { return e.cause } 89 90 // Key function returns key value. 91 func (e LoadStatsRequestValidationError) Key() bool { return e.key } 92 93 // ErrorName returns error name. 94 func (e LoadStatsRequestValidationError) ErrorName() string { return "LoadStatsRequestValidationError" } 95 96 // Error satisfies the builtin error interface 97 func (e LoadStatsRequestValidationError) Error() string { 98 cause := "" 99 if e.cause != nil { 100 cause = fmt.Sprintf(" | caused by: %v", e.cause) 101 } 102 103 key := "" 104 if e.key { 105 key = "key for " 106 } 107 108 return fmt.Sprintf( 109 "invalid %sLoadStatsRequest.%s: %s%s", 110 key, 111 e.field, 112 e.reason, 113 cause) 114 } 115 116 var _ error = LoadStatsRequestValidationError{} 117 118 var _ interface { 119 Field() string 120 Reason() string 121 Key() bool 122 Cause() error 123 ErrorName() string 124 } = LoadStatsRequestValidationError{} 125 126 // Validate checks the field values on LoadStatsResponse with the rules defined 127 // in the proto definition for this message. If any rules are violated, an 128 // error is returned. 129 func (m *LoadStatsResponse) Validate() error { 130 if m == nil { 131 return nil 132 } 133 134 // no validation rules for SendAllClusters 135 136 if v, ok := interface{}(m.GetLoadReportingInterval()).(interface{ Validate() error }); ok { 137 if err := v.Validate(); err != nil { 138 return LoadStatsResponseValidationError{ 139 field: "LoadReportingInterval", 140 reason: "embedded message failed validation", 141 cause: err, 142 } 143 } 144 } 145 146 // no validation rules for ReportEndpointGranularity 147 148 return nil 149 } 150 151 // LoadStatsResponseValidationError is the validation error returned by 152 // LoadStatsResponse.Validate if the designated constraints aren't met. 153 type LoadStatsResponseValidationError struct { 154 field string 155 reason string 156 cause error 157 key bool 158 } 159 160 // Field function returns field value. 161 func (e LoadStatsResponseValidationError) Field() string { return e.field } 162 163 // Reason function returns reason value. 164 func (e LoadStatsResponseValidationError) Reason() string { return e.reason } 165 166 // Cause function returns cause value. 167 func (e LoadStatsResponseValidationError) Cause() error { return e.cause } 168 169 // Key function returns key value. 170 func (e LoadStatsResponseValidationError) Key() bool { return e.key } 171 172 // ErrorName returns error name. 173 func (e LoadStatsResponseValidationError) ErrorName() string { 174 return "LoadStatsResponseValidationError" 175 } 176 177 // Error satisfies the builtin error interface 178 func (e LoadStatsResponseValidationError) Error() string { 179 cause := "" 180 if e.cause != nil { 181 cause = fmt.Sprintf(" | caused by: %v", e.cause) 182 } 183 184 key := "" 185 if e.key { 186 key = "key for " 187 } 188 189 return fmt.Sprintf( 190 "invalid %sLoadStatsResponse.%s: %s%s", 191 key, 192 e.field, 193 e.reason, 194 cause) 195 } 196 197 var _ error = LoadStatsResponseValidationError{} 198 199 var _ interface { 200 Field() string 201 Reason() string 202 Key() bool 203 Cause() error 204 ErrorName() string 205 } = LoadStatsResponseValidationError{}