/vendor/github.com/envoyproxy/go-control-plane/envoy/config/route/v3/scoped_route.pb.validate.go

https://github.com/knative/pkg · Go · 305 lines · 209 code · 56 blank · 40 comment · 28 complexity · bca578ffd75b676aa617ac5d69f93d8d MD5 · raw file

  1. // Code generated by protoc-gen-validate. DO NOT EDIT.
  2. // source: envoy/config/route/v3/scoped_route.proto
  3. package envoy_config_route_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. "google.golang.org/protobuf/types/known/anypb"
  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. _ = anypb.Any{}
  30. )
  31. // Validate checks the field values on ScopedRouteConfiguration with the rules
  32. // defined in the proto definition for this message. If any rules are
  33. // violated, an error is returned.
  34. func (m *ScopedRouteConfiguration) Validate() error {
  35. if m == nil {
  36. return nil
  37. }
  38. // no validation rules for OnDemand
  39. if utf8.RuneCountInString(m.GetName()) < 1 {
  40. return ScopedRouteConfigurationValidationError{
  41. field: "Name",
  42. reason: "value length must be at least 1 runes",
  43. }
  44. }
  45. if utf8.RuneCountInString(m.GetRouteConfigurationName()) < 1 {
  46. return ScopedRouteConfigurationValidationError{
  47. field: "RouteConfigurationName",
  48. reason: "value length must be at least 1 runes",
  49. }
  50. }
  51. if m.GetKey() == nil {
  52. return ScopedRouteConfigurationValidationError{
  53. field: "Key",
  54. reason: "value is required",
  55. }
  56. }
  57. if v, ok := interface{}(m.GetKey()).(interface{ Validate() error }); ok {
  58. if err := v.Validate(); err != nil {
  59. return ScopedRouteConfigurationValidationError{
  60. field: "Key",
  61. reason: "embedded message failed validation",
  62. cause: err,
  63. }
  64. }
  65. }
  66. return nil
  67. }
  68. // ScopedRouteConfigurationValidationError is the validation error returned by
  69. // ScopedRouteConfiguration.Validate if the designated constraints aren't met.
  70. type ScopedRouteConfigurationValidationError struct {
  71. field string
  72. reason string
  73. cause error
  74. key bool
  75. }
  76. // Field function returns field value.
  77. func (e ScopedRouteConfigurationValidationError) Field() string { return e.field }
  78. // Reason function returns reason value.
  79. func (e ScopedRouteConfigurationValidationError) Reason() string { return e.reason }
  80. // Cause function returns cause value.
  81. func (e ScopedRouteConfigurationValidationError) Cause() error { return e.cause }
  82. // Key function returns key value.
  83. func (e ScopedRouteConfigurationValidationError) Key() bool { return e.key }
  84. // ErrorName returns error name.
  85. func (e ScopedRouteConfigurationValidationError) ErrorName() string {
  86. return "ScopedRouteConfigurationValidationError"
  87. }
  88. // Error satisfies the builtin error interface
  89. func (e ScopedRouteConfigurationValidationError) Error() string {
  90. cause := ""
  91. if e.cause != nil {
  92. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  93. }
  94. key := ""
  95. if e.key {
  96. key = "key for "
  97. }
  98. return fmt.Sprintf(
  99. "invalid %sScopedRouteConfiguration.%s: %s%s",
  100. key,
  101. e.field,
  102. e.reason,
  103. cause)
  104. }
  105. var _ error = ScopedRouteConfigurationValidationError{}
  106. var _ interface {
  107. Field() string
  108. Reason() string
  109. Key() bool
  110. Cause() error
  111. ErrorName() string
  112. } = ScopedRouteConfigurationValidationError{}
  113. // Validate checks the field values on ScopedRouteConfiguration_Key with the
  114. // rules defined in the proto definition for this message. If any rules are
  115. // violated, an error is returned.
  116. func (m *ScopedRouteConfiguration_Key) Validate() error {
  117. if m == nil {
  118. return nil
  119. }
  120. if len(m.GetFragments()) < 1 {
  121. return ScopedRouteConfiguration_KeyValidationError{
  122. field: "Fragments",
  123. reason: "value must contain at least 1 item(s)",
  124. }
  125. }
  126. for idx, item := range m.GetFragments() {
  127. _, _ = idx, item
  128. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  129. if err := v.Validate(); err != nil {
  130. return ScopedRouteConfiguration_KeyValidationError{
  131. field: fmt.Sprintf("Fragments[%v]", idx),
  132. reason: "embedded message failed validation",
  133. cause: err,
  134. }
  135. }
  136. }
  137. }
  138. return nil
  139. }
  140. // ScopedRouteConfiguration_KeyValidationError is the validation error returned
  141. // by ScopedRouteConfiguration_Key.Validate if the designated constraints
  142. // aren't met.
  143. type ScopedRouteConfiguration_KeyValidationError struct {
  144. field string
  145. reason string
  146. cause error
  147. key bool
  148. }
  149. // Field function returns field value.
  150. func (e ScopedRouteConfiguration_KeyValidationError) Field() string { return e.field }
  151. // Reason function returns reason value.
  152. func (e ScopedRouteConfiguration_KeyValidationError) Reason() string { return e.reason }
  153. // Cause function returns cause value.
  154. func (e ScopedRouteConfiguration_KeyValidationError) Cause() error { return e.cause }
  155. // Key function returns key value.
  156. func (e ScopedRouteConfiguration_KeyValidationError) Key() bool { return e.key }
  157. // ErrorName returns error name.
  158. func (e ScopedRouteConfiguration_KeyValidationError) ErrorName() string {
  159. return "ScopedRouteConfiguration_KeyValidationError"
  160. }
  161. // Error satisfies the builtin error interface
  162. func (e ScopedRouteConfiguration_KeyValidationError) Error() string {
  163. cause := ""
  164. if e.cause != nil {
  165. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  166. }
  167. key := ""
  168. if e.key {
  169. key = "key for "
  170. }
  171. return fmt.Sprintf(
  172. "invalid %sScopedRouteConfiguration_Key.%s: %s%s",
  173. key,
  174. e.field,
  175. e.reason,
  176. cause)
  177. }
  178. var _ error = ScopedRouteConfiguration_KeyValidationError{}
  179. var _ interface {
  180. Field() string
  181. Reason() string
  182. Key() bool
  183. Cause() error
  184. ErrorName() string
  185. } = ScopedRouteConfiguration_KeyValidationError{}
  186. // Validate checks the field values on ScopedRouteConfiguration_Key_Fragment
  187. // with the rules defined in the proto definition for this message. If any
  188. // rules are violated, an error is returned.
  189. func (m *ScopedRouteConfiguration_Key_Fragment) Validate() error {
  190. if m == nil {
  191. return nil
  192. }
  193. switch m.Type.(type) {
  194. case *ScopedRouteConfiguration_Key_Fragment_StringKey:
  195. // no validation rules for StringKey
  196. default:
  197. return ScopedRouteConfiguration_Key_FragmentValidationError{
  198. field: "Type",
  199. reason: "value is required",
  200. }
  201. }
  202. return nil
  203. }
  204. // ScopedRouteConfiguration_Key_FragmentValidationError is the validation error
  205. // returned by ScopedRouteConfiguration_Key_Fragment.Validate if the
  206. // designated constraints aren't met.
  207. type ScopedRouteConfiguration_Key_FragmentValidationError struct {
  208. field string
  209. reason string
  210. cause error
  211. key bool
  212. }
  213. // Field function returns field value.
  214. func (e ScopedRouteConfiguration_Key_FragmentValidationError) Field() string { return e.field }
  215. // Reason function returns reason value.
  216. func (e ScopedRouteConfiguration_Key_FragmentValidationError) Reason() string { return e.reason }
  217. // Cause function returns cause value.
  218. func (e ScopedRouteConfiguration_Key_FragmentValidationError) Cause() error { return e.cause }
  219. // Key function returns key value.
  220. func (e ScopedRouteConfiguration_Key_FragmentValidationError) Key() bool { return e.key }
  221. // ErrorName returns error name.
  222. func (e ScopedRouteConfiguration_Key_FragmentValidationError) ErrorName() string {
  223. return "ScopedRouteConfiguration_Key_FragmentValidationError"
  224. }
  225. // Error satisfies the builtin error interface
  226. func (e ScopedRouteConfiguration_Key_FragmentValidationError) Error() string {
  227. cause := ""
  228. if e.cause != nil {
  229. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  230. }
  231. key := ""
  232. if e.key {
  233. key = "key for "
  234. }
  235. return fmt.Sprintf(
  236. "invalid %sScopedRouteConfiguration_Key_Fragment.%s: %s%s",
  237. key,
  238. e.field,
  239. e.reason,
  240. cause)
  241. }
  242. var _ error = ScopedRouteConfiguration_Key_FragmentValidationError{}
  243. var _ interface {
  244. Field() string
  245. Reason() string
  246. Key() bool
  247. Cause() error
  248. ErrorName() string
  249. } = ScopedRouteConfiguration_Key_FragmentValidationError{}