github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/config/accesslog/v2/als.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: envoy/config/accesslog/v2/als.proto 3 4 package envoy_config_accesslog_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 HttpGrpcAccessLogConfig with the rules 37 // defined in the proto definition for this message. If any rules are 38 // violated, an error is returned. 39 func (m *HttpGrpcAccessLogConfig) Validate() error { 40 if m == nil { 41 return nil 42 } 43 44 if m.GetCommonConfig() == nil { 45 return HttpGrpcAccessLogConfigValidationError{ 46 field: "CommonConfig", 47 reason: "value is required", 48 } 49 } 50 51 if v, ok := interface{}(m.GetCommonConfig()).(interface{ Validate() error }); ok { 52 if err := v.Validate(); err != nil { 53 return HttpGrpcAccessLogConfigValidationError{ 54 field: "CommonConfig", 55 reason: "embedded message failed validation", 56 cause: err, 57 } 58 } 59 } 60 61 return nil 62 } 63 64 // HttpGrpcAccessLogConfigValidationError is the validation error returned by 65 // HttpGrpcAccessLogConfig.Validate if the designated constraints aren't met. 66 type HttpGrpcAccessLogConfigValidationError struct { 67 field string 68 reason string 69 cause error 70 key bool 71 } 72 73 // Field function returns field value. 74 func (e HttpGrpcAccessLogConfigValidationError) Field() string { return e.field } 75 76 // Reason function returns reason value. 77 func (e HttpGrpcAccessLogConfigValidationError) Reason() string { return e.reason } 78 79 // Cause function returns cause value. 80 func (e HttpGrpcAccessLogConfigValidationError) Cause() error { return e.cause } 81 82 // Key function returns key value. 83 func (e HttpGrpcAccessLogConfigValidationError) Key() bool { return e.key } 84 85 // ErrorName returns error name. 86 func (e HttpGrpcAccessLogConfigValidationError) ErrorName() string { 87 return "HttpGrpcAccessLogConfigValidationError" 88 } 89 90 // Error satisfies the builtin error interface 91 func (e HttpGrpcAccessLogConfigValidationError) Error() string { 92 cause := "" 93 if e.cause != nil { 94 cause = fmt.Sprintf(" | caused by: %v", e.cause) 95 } 96 97 key := "" 98 if e.key { 99 key = "key for " 100 } 101 102 return fmt.Sprintf( 103 "invalid %sHttpGrpcAccessLogConfig.%s: %s%s", 104 key, 105 e.field, 106 e.reason, 107 cause) 108 } 109 110 var _ error = HttpGrpcAccessLogConfigValidationError{} 111 112 var _ interface { 113 Field() string 114 Reason() string 115 Key() bool 116 Cause() error 117 ErrorName() string 118 } = HttpGrpcAccessLogConfigValidationError{} 119 120 // Validate checks the field values on TcpGrpcAccessLogConfig with the rules 121 // defined in the proto definition for this message. If any rules are 122 // violated, an error is returned. 123 func (m *TcpGrpcAccessLogConfig) Validate() error { 124 if m == nil { 125 return nil 126 } 127 128 if m.GetCommonConfig() == nil { 129 return TcpGrpcAccessLogConfigValidationError{ 130 field: "CommonConfig", 131 reason: "value is required", 132 } 133 } 134 135 if v, ok := interface{}(m.GetCommonConfig()).(interface{ Validate() error }); ok { 136 if err := v.Validate(); err != nil { 137 return TcpGrpcAccessLogConfigValidationError{ 138 field: "CommonConfig", 139 reason: "embedded message failed validation", 140 cause: err, 141 } 142 } 143 } 144 145 return nil 146 } 147 148 // TcpGrpcAccessLogConfigValidationError is the validation error returned by 149 // TcpGrpcAccessLogConfig.Validate if the designated constraints aren't met. 150 type TcpGrpcAccessLogConfigValidationError struct { 151 field string 152 reason string 153 cause error 154 key bool 155 } 156 157 // Field function returns field value. 158 func (e TcpGrpcAccessLogConfigValidationError) Field() string { return e.field } 159 160 // Reason function returns reason value. 161 func (e TcpGrpcAccessLogConfigValidationError) Reason() string { return e.reason } 162 163 // Cause function returns cause value. 164 func (e TcpGrpcAccessLogConfigValidationError) Cause() error { return e.cause } 165 166 // Key function returns key value. 167 func (e TcpGrpcAccessLogConfigValidationError) Key() bool { return e.key } 168 169 // ErrorName returns error name. 170 func (e TcpGrpcAccessLogConfigValidationError) ErrorName() string { 171 return "TcpGrpcAccessLogConfigValidationError" 172 } 173 174 // Error satisfies the builtin error interface 175 func (e TcpGrpcAccessLogConfigValidationError) Error() string { 176 cause := "" 177 if e.cause != nil { 178 cause = fmt.Sprintf(" | caused by: %v", e.cause) 179 } 180 181 key := "" 182 if e.key { 183 key = "key for " 184 } 185 186 return fmt.Sprintf( 187 "invalid %sTcpGrpcAccessLogConfig.%s: %s%s", 188 key, 189 e.field, 190 e.reason, 191 cause) 192 } 193 194 var _ error = TcpGrpcAccessLogConfigValidationError{} 195 196 var _ interface { 197 Field() string 198 Reason() string 199 Key() bool 200 Cause() error 201 ErrorName() string 202 } = TcpGrpcAccessLogConfigValidationError{} 203 204 // Validate checks the field values on CommonGrpcAccessLogConfig with the rules 205 // defined in the proto definition for this message. If any rules are 206 // violated, an error is returned. 207 func (m *CommonGrpcAccessLogConfig) Validate() error { 208 if m == nil { 209 return nil 210 } 211 212 if len(m.GetLogName()) < 1 { 213 return CommonGrpcAccessLogConfigValidationError{ 214 field: "LogName", 215 reason: "value length must be at least 1 bytes", 216 } 217 } 218 219 if m.GetGrpcService() == nil { 220 return CommonGrpcAccessLogConfigValidationError{ 221 field: "GrpcService", 222 reason: "value is required", 223 } 224 } 225 226 if v, ok := interface{}(m.GetGrpcService()).(interface{ Validate() error }); ok { 227 if err := v.Validate(); err != nil { 228 return CommonGrpcAccessLogConfigValidationError{ 229 field: "GrpcService", 230 reason: "embedded message failed validation", 231 cause: err, 232 } 233 } 234 } 235 236 if d := m.GetBufferFlushInterval(); d != nil { 237 dur, err := d.AsDuration(), d.CheckValid() 238 if err != nil { 239 return CommonGrpcAccessLogConfigValidationError{ 240 field: "BufferFlushInterval", 241 reason: "value is not a valid duration", 242 cause: err, 243 } 244 } 245 246 gt := time.Duration(0*time.Second + 0*time.Nanosecond) 247 248 if dur <= gt { 249 return CommonGrpcAccessLogConfigValidationError{ 250 field: "BufferFlushInterval", 251 reason: "value must be greater than 0s", 252 } 253 } 254 255 } 256 257 if v, ok := interface{}(m.GetBufferSizeBytes()).(interface{ Validate() error }); ok { 258 if err := v.Validate(); err != nil { 259 return CommonGrpcAccessLogConfigValidationError{ 260 field: "BufferSizeBytes", 261 reason: "embedded message failed validation", 262 cause: err, 263 } 264 } 265 } 266 267 return nil 268 } 269 270 // CommonGrpcAccessLogConfigValidationError is the validation error returned by 271 // CommonGrpcAccessLogConfig.Validate if the designated constraints aren't met. 272 type CommonGrpcAccessLogConfigValidationError struct { 273 field string 274 reason string 275 cause error 276 key bool 277 } 278 279 // Field function returns field value. 280 func (e CommonGrpcAccessLogConfigValidationError) Field() string { return e.field } 281 282 // Reason function returns reason value. 283 func (e CommonGrpcAccessLogConfigValidationError) Reason() string { return e.reason } 284 285 // Cause function returns cause value. 286 func (e CommonGrpcAccessLogConfigValidationError) Cause() error { return e.cause } 287 288 // Key function returns key value. 289 func (e CommonGrpcAccessLogConfigValidationError) Key() bool { return e.key } 290 291 // ErrorName returns error name. 292 func (e CommonGrpcAccessLogConfigValidationError) ErrorName() string { 293 return "CommonGrpcAccessLogConfigValidationError" 294 } 295 296 // Error satisfies the builtin error interface 297 func (e CommonGrpcAccessLogConfigValidationError) Error() string { 298 cause := "" 299 if e.cause != nil { 300 cause = fmt.Sprintf(" | caused by: %v", e.cause) 301 } 302 303 key := "" 304 if e.key { 305 key = "key for " 306 } 307 308 return fmt.Sprintf( 309 "invalid %sCommonGrpcAccessLogConfig.%s: %s%s", 310 key, 311 e.field, 312 e.reason, 313 cause) 314 } 315 316 var _ error = CommonGrpcAccessLogConfigValidationError{} 317 318 var _ interface { 319 Field() string 320 Reason() string 321 Key() bool 322 Cause() error 323 ErrorName() string 324 } = CommonGrpcAccessLogConfigValidationError{}