/pkg/api/envoy/config/listener/v4alpha/udp_listener_config.pb.validate.go

https://github.com/datawire/ambassador · Go · 189 lines · 126 code · 36 blank · 27 comment · 14 complexity · bc16f3202affbb76d08846cdfcb01fa1 MD5 · raw file

  1. // Code generated by protoc-gen-validate. DO NOT EDIT.
  2. // source: envoy/config/listener/v4alpha/udp_listener_config.proto
  3. package envoy_config_listener_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 _udp_listener_config_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 UdpListenerConfig with the rules defined
  34. // in the proto definition for this message. If any rules are violated, an
  35. // error is returned.
  36. func (m *UdpListenerConfig) Validate() error {
  37. if m == nil {
  38. return nil
  39. }
  40. // no validation rules for UdpListenerName
  41. switch m.ConfigType.(type) {
  42. case *UdpListenerConfig_TypedConfig:
  43. if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok {
  44. if err := v.Validate(); err != nil {
  45. return UdpListenerConfigValidationError{
  46. field: "TypedConfig",
  47. reason: "embedded message failed validation",
  48. cause: err,
  49. }
  50. }
  51. }
  52. }
  53. return nil
  54. }
  55. // UdpListenerConfigValidationError is the validation error returned by
  56. // UdpListenerConfig.Validate if the designated constraints aren't met.
  57. type UdpListenerConfigValidationError struct {
  58. field string
  59. reason string
  60. cause error
  61. key bool
  62. }
  63. // Field function returns field value.
  64. func (e UdpListenerConfigValidationError) Field() string { return e.field }
  65. // Reason function returns reason value.
  66. func (e UdpListenerConfigValidationError) Reason() string { return e.reason }
  67. // Cause function returns cause value.
  68. func (e UdpListenerConfigValidationError) Cause() error { return e.cause }
  69. // Key function returns key value.
  70. func (e UdpListenerConfigValidationError) Key() bool { return e.key }
  71. // ErrorName returns error name.
  72. func (e UdpListenerConfigValidationError) ErrorName() string {
  73. return "UdpListenerConfigValidationError"
  74. }
  75. // Error satisfies the builtin error interface
  76. func (e UdpListenerConfigValidationError) Error() string {
  77. cause := ""
  78. if e.cause != nil {
  79. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  80. }
  81. key := ""
  82. if e.key {
  83. key = "key for "
  84. }
  85. return fmt.Sprintf(
  86. "invalid %sUdpListenerConfig.%s: %s%s",
  87. key,
  88. e.field,
  89. e.reason,
  90. cause)
  91. }
  92. var _ error = UdpListenerConfigValidationError{}
  93. var _ interface {
  94. Field() string
  95. Reason() string
  96. Key() bool
  97. Cause() error
  98. ErrorName() string
  99. } = UdpListenerConfigValidationError{}
  100. // Validate checks the field values on ActiveRawUdpListenerConfig with the
  101. // rules defined in the proto definition for this message. If any rules are
  102. // violated, an error is returned.
  103. func (m *ActiveRawUdpListenerConfig) Validate() error {
  104. if m == nil {
  105. return nil
  106. }
  107. return nil
  108. }
  109. // ActiveRawUdpListenerConfigValidationError is the validation error returned
  110. // by ActiveRawUdpListenerConfig.Validate if the designated constraints aren't met.
  111. type ActiveRawUdpListenerConfigValidationError struct {
  112. field string
  113. reason string
  114. cause error
  115. key bool
  116. }
  117. // Field function returns field value.
  118. func (e ActiveRawUdpListenerConfigValidationError) Field() string { return e.field }
  119. // Reason function returns reason value.
  120. func (e ActiveRawUdpListenerConfigValidationError) Reason() string { return e.reason }
  121. // Cause function returns cause value.
  122. func (e ActiveRawUdpListenerConfigValidationError) Cause() error { return e.cause }
  123. // Key function returns key value.
  124. func (e ActiveRawUdpListenerConfigValidationError) Key() bool { return e.key }
  125. // ErrorName returns error name.
  126. func (e ActiveRawUdpListenerConfigValidationError) ErrorName() string {
  127. return "ActiveRawUdpListenerConfigValidationError"
  128. }
  129. // Error satisfies the builtin error interface
  130. func (e ActiveRawUdpListenerConfigValidationError) Error() string {
  131. cause := ""
  132. if e.cause != nil {
  133. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  134. }
  135. key := ""
  136. if e.key {
  137. key = "key for "
  138. }
  139. return fmt.Sprintf(
  140. "invalid %sActiveRawUdpListenerConfig.%s: %s%s",
  141. key,
  142. e.field,
  143. e.reason,
  144. cause)
  145. }
  146. var _ error = ActiveRawUdpListenerConfigValidationError{}
  147. var _ interface {
  148. Field() string
  149. Reason() string
  150. Key() bool
  151. Cause() error
  152. ErrorName() string
  153. } = ActiveRawUdpListenerConfigValidationError{}