github.com/hxx258456/ccgo@v0.0.5-0.20230213014102-48b35f46f66f/go-control-plane/envoy/extensions/access_loggers/open_telemetry/v3alpha/logs_service.pb.validate.go (about) 1 // Code generated by protoc-gen-validate. DO NOT EDIT. 2 // source: envoy/extensions/access_loggers/open_telemetry/v3alpha/logs_service.proto 3 4 package envoy_extensions_access_loggers_open_telemetry_v3alpha 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 OpenTelemetryAccessLogConfig with the 37 // rules defined in the proto definition for this message. If any rules are 38 // violated, an error is returned. 39 func (m *OpenTelemetryAccessLogConfig) Validate() error { 40 if m == nil { 41 return nil 42 } 43 44 if m.GetCommonConfig() == nil { 45 return OpenTelemetryAccessLogConfigValidationError{ 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 OpenTelemetryAccessLogConfigValidationError{ 54 field: "CommonConfig", 55 reason: "embedded message failed validation", 56 cause: err, 57 } 58 } 59 } 60 61 if v, ok := interface{}(m.GetBody()).(interface{ Validate() error }); ok { 62 if err := v.Validate(); err != nil { 63 return OpenTelemetryAccessLogConfigValidationError{ 64 field: "Body", 65 reason: "embedded message failed validation", 66 cause: err, 67 } 68 } 69 } 70 71 if v, ok := interface{}(m.GetAttributes()).(interface{ Validate() error }); ok { 72 if err := v.Validate(); err != nil { 73 return OpenTelemetryAccessLogConfigValidationError{ 74 field: "Attributes", 75 reason: "embedded message failed validation", 76 cause: err, 77 } 78 } 79 } 80 81 return nil 82 } 83 84 // OpenTelemetryAccessLogConfigValidationError is the validation error returned 85 // by OpenTelemetryAccessLogConfig.Validate if the designated constraints 86 // aren't met. 87 type OpenTelemetryAccessLogConfigValidationError struct { 88 field string 89 reason string 90 cause error 91 key bool 92 } 93 94 // Field function returns field value. 95 func (e OpenTelemetryAccessLogConfigValidationError) Field() string { return e.field } 96 97 // Reason function returns reason value. 98 func (e OpenTelemetryAccessLogConfigValidationError) Reason() string { return e.reason } 99 100 // Cause function returns cause value. 101 func (e OpenTelemetryAccessLogConfigValidationError) Cause() error { return e.cause } 102 103 // Key function returns key value. 104 func (e OpenTelemetryAccessLogConfigValidationError) Key() bool { return e.key } 105 106 // ErrorName returns error name. 107 func (e OpenTelemetryAccessLogConfigValidationError) ErrorName() string { 108 return "OpenTelemetryAccessLogConfigValidationError" 109 } 110 111 // Error satisfies the builtin error interface 112 func (e OpenTelemetryAccessLogConfigValidationError) 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 %sOpenTelemetryAccessLogConfig.%s: %s%s", 125 key, 126 e.field, 127 e.reason, 128 cause) 129 } 130 131 var _ error = OpenTelemetryAccessLogConfigValidationError{} 132 133 var _ interface { 134 Field() string 135 Reason() string 136 Key() bool 137 Cause() error 138 ErrorName() string 139 } = OpenTelemetryAccessLogConfigValidationError{}