/pkg/api/envoy/config/trace/v4alpha/http_tracer.pb.validate.go

https://github.com/datawire/ambassador · Go · 199 lines · 137 code · 37 blank · 25 comment · 18 complexity · d799d02f8eabb2c095e6e4066043633f MD5 · raw file

  1. // Code generated by protoc-gen-validate. DO NOT EDIT.
  2. // source: envoy/config/trace/v4alpha/http_tracer.proto
  3. package envoy_config_trace_v4alpha
  4. import (
  5. "bytes"
  6. "errors"
  7. "fmt"
  8. "net"
  9. "net/mail"
  10. "net/url"
  11. "regexp"
  12. "strings"
  13. "time"
  14. "unicode/utf8"
  15. "github.com/golang/protobuf/ptypes"
  16. )
  17. // ensure the imports are used
  18. var (
  19. _ = bytes.MinRead
  20. _ = errors.New("")
  21. _ = fmt.Print
  22. _ = utf8.UTFMax
  23. _ = (*regexp.Regexp)(nil)
  24. _ = (*strings.Reader)(nil)
  25. _ = net.IPv4len
  26. _ = time.Duration(0)
  27. _ = (*url.URL)(nil)
  28. _ = (*mail.Address)(nil)
  29. _ = ptypes.DynamicAny{}
  30. )
  31. // define the regex for a UUID once up-front
  32. var _http_tracer_uuidPattern = regexp.MustCompile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$")
  33. // Validate checks the field values on Tracing with the rules defined in the
  34. // proto definition for this message. If any rules are violated, an error is returned.
  35. func (m *Tracing) Validate() error {
  36. if m == nil {
  37. return nil
  38. }
  39. if v, ok := interface{}(m.GetHttp()).(interface{ Validate() error }); ok {
  40. if err := v.Validate(); err != nil {
  41. return TracingValidationError{
  42. field: "Http",
  43. reason: "embedded message failed validation",
  44. cause: err,
  45. }
  46. }
  47. }
  48. return nil
  49. }
  50. // TracingValidationError is the validation error returned by Tracing.Validate
  51. // if the designated constraints aren't met.
  52. type TracingValidationError struct {
  53. field string
  54. reason string
  55. cause error
  56. key bool
  57. }
  58. // Field function returns field value.
  59. func (e TracingValidationError) Field() string { return e.field }
  60. // Reason function returns reason value.
  61. func (e TracingValidationError) Reason() string { return e.reason }
  62. // Cause function returns cause value.
  63. func (e TracingValidationError) Cause() error { return e.cause }
  64. // Key function returns key value.
  65. func (e TracingValidationError) Key() bool { return e.key }
  66. // ErrorName returns error name.
  67. func (e TracingValidationError) ErrorName() string { return "TracingValidationError" }
  68. // Error satisfies the builtin error interface
  69. func (e TracingValidationError) Error() string {
  70. cause := ""
  71. if e.cause != nil {
  72. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  73. }
  74. key := ""
  75. if e.key {
  76. key = "key for "
  77. }
  78. return fmt.Sprintf(
  79. "invalid %sTracing.%s: %s%s",
  80. key,
  81. e.field,
  82. e.reason,
  83. cause)
  84. }
  85. var _ error = TracingValidationError{}
  86. var _ interface {
  87. Field() string
  88. Reason() string
  89. Key() bool
  90. Cause() error
  91. ErrorName() string
  92. } = TracingValidationError{}
  93. // Validate checks the field values on Tracing_Http with the rules defined in
  94. // the proto definition for this message. If any rules are violated, an error
  95. // is returned.
  96. func (m *Tracing_Http) Validate() error {
  97. if m == nil {
  98. return nil
  99. }
  100. if len(m.GetName()) < 1 {
  101. return Tracing_HttpValidationError{
  102. field: "Name",
  103. reason: "value length must be at least 1 bytes",
  104. }
  105. }
  106. switch m.ConfigType.(type) {
  107. case *Tracing_Http_TypedConfig:
  108. if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok {
  109. if err := v.Validate(); err != nil {
  110. return Tracing_HttpValidationError{
  111. field: "TypedConfig",
  112. reason: "embedded message failed validation",
  113. cause: err,
  114. }
  115. }
  116. }
  117. }
  118. return nil
  119. }
  120. // Tracing_HttpValidationError is the validation error returned by
  121. // Tracing_Http.Validate if the designated constraints aren't met.
  122. type Tracing_HttpValidationError struct {
  123. field string
  124. reason string
  125. cause error
  126. key bool
  127. }
  128. // Field function returns field value.
  129. func (e Tracing_HttpValidationError) Field() string { return e.field }
  130. // Reason function returns reason value.
  131. func (e Tracing_HttpValidationError) Reason() string { return e.reason }
  132. // Cause function returns cause value.
  133. func (e Tracing_HttpValidationError) Cause() error { return e.cause }
  134. // Key function returns key value.
  135. func (e Tracing_HttpValidationError) Key() bool { return e.key }
  136. // ErrorName returns error name.
  137. func (e Tracing_HttpValidationError) ErrorName() string { return "Tracing_HttpValidationError" }
  138. // Error satisfies the builtin error interface
  139. func (e Tracing_HttpValidationError) Error() string {
  140. cause := ""
  141. if e.cause != nil {
  142. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  143. }
  144. key := ""
  145. if e.key {
  146. key = "key for "
  147. }
  148. return fmt.Sprintf(
  149. "invalid %sTracing_Http.%s: %s%s",
  150. key,
  151. e.field,
  152. e.reason,
  153. cause)
  154. }
  155. var _ error = Tracing_HttpValidationError{}
  156. var _ interface {
  157. Field() string
  158. Reason() string
  159. Key() bool
  160. Cause() error
  161. ErrorName() string
  162. } = Tracing_HttpValidationError{}