/pkg/api/envoy/admin/v3/listeners.pb.validate.go

https://github.com/datawire/ambassador · Go · 193 lines · 131 code · 36 blank · 26 comment · 17 complexity · d4c4e7b3539724eb79245b54c8729676 MD5 · raw file

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