/envoy/extensions/filters/network/rocketmq_proxy/v4alpha/route.pb.validate.go

https://github.com/envoyproxy/go-control-plane · Go · 397 lines · 278 code · 72 blank · 47 comment · 47 complexity · cba943d799fbc83f921846097fb8573c MD5 · raw file

  1. // Code generated by protoc-gen-validate. DO NOT EDIT.
  2. // source: envoy/extensions/filters/network/rocketmq_proxy/v4alpha/route.proto
  3. package envoy_extensions_filters_network_rocketmq_proxy_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 _route_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 RouteConfiguration with the rules
  34. // defined in the proto definition for this message. If any rules are
  35. // violated, an error is returned.
  36. func (m *RouteConfiguration) Validate() error {
  37. if m == nil {
  38. return nil
  39. }
  40. // no validation rules for Name
  41. for idx, item := range m.GetRoutes() {
  42. _, _ = idx, item
  43. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  44. if err := v.Validate(); err != nil {
  45. return RouteConfigurationValidationError{
  46. field: fmt.Sprintf("Routes[%v]", idx),
  47. reason: "embedded message failed validation",
  48. cause: err,
  49. }
  50. }
  51. }
  52. }
  53. return nil
  54. }
  55. // RouteConfigurationValidationError is the validation error returned by
  56. // RouteConfiguration.Validate if the designated constraints aren't met.
  57. type RouteConfigurationValidationError struct {
  58. field string
  59. reason string
  60. cause error
  61. key bool
  62. }
  63. // Field function returns field value.
  64. func (e RouteConfigurationValidationError) Field() string { return e.field }
  65. // Reason function returns reason value.
  66. func (e RouteConfigurationValidationError) Reason() string { return e.reason }
  67. // Cause function returns cause value.
  68. func (e RouteConfigurationValidationError) Cause() error { return e.cause }
  69. // Key function returns key value.
  70. func (e RouteConfigurationValidationError) Key() bool { return e.key }
  71. // ErrorName returns error name.
  72. func (e RouteConfigurationValidationError) ErrorName() string {
  73. return "RouteConfigurationValidationError"
  74. }
  75. // Error satisfies the builtin error interface
  76. func (e RouteConfigurationValidationError) 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 %sRouteConfiguration.%s: %s%s",
  87. key,
  88. e.field,
  89. e.reason,
  90. cause)
  91. }
  92. var _ error = RouteConfigurationValidationError{}
  93. var _ interface {
  94. Field() string
  95. Reason() string
  96. Key() bool
  97. Cause() error
  98. ErrorName() string
  99. } = RouteConfigurationValidationError{}
  100. // Validate checks the field values on Route with the rules defined in the
  101. // proto definition for this message. If any rules are violated, an error is returned.
  102. func (m *Route) Validate() error {
  103. if m == nil {
  104. return nil
  105. }
  106. if m.GetMatch() == nil {
  107. return RouteValidationError{
  108. field: "Match",
  109. reason: "value is required",
  110. }
  111. }
  112. if v, ok := interface{}(m.GetMatch()).(interface{ Validate() error }); ok {
  113. if err := v.Validate(); err != nil {
  114. return RouteValidationError{
  115. field: "Match",
  116. reason: "embedded message failed validation",
  117. cause: err,
  118. }
  119. }
  120. }
  121. if m.GetRoute() == nil {
  122. return RouteValidationError{
  123. field: "Route",
  124. reason: "value is required",
  125. }
  126. }
  127. if v, ok := interface{}(m.GetRoute()).(interface{ Validate() error }); ok {
  128. if err := v.Validate(); err != nil {
  129. return RouteValidationError{
  130. field: "Route",
  131. reason: "embedded message failed validation",
  132. cause: err,
  133. }
  134. }
  135. }
  136. return nil
  137. }
  138. // RouteValidationError is the validation error returned by Route.Validate if
  139. // the designated constraints aren't met.
  140. type RouteValidationError struct {
  141. field string
  142. reason string
  143. cause error
  144. key bool
  145. }
  146. // Field function returns field value.
  147. func (e RouteValidationError) Field() string { return e.field }
  148. // Reason function returns reason value.
  149. func (e RouteValidationError) Reason() string { return e.reason }
  150. // Cause function returns cause value.
  151. func (e RouteValidationError) Cause() error { return e.cause }
  152. // Key function returns key value.
  153. func (e RouteValidationError) Key() bool { return e.key }
  154. // ErrorName returns error name.
  155. func (e RouteValidationError) ErrorName() string { return "RouteValidationError" }
  156. // Error satisfies the builtin error interface
  157. func (e RouteValidationError) Error() string {
  158. cause := ""
  159. if e.cause != nil {
  160. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  161. }
  162. key := ""
  163. if e.key {
  164. key = "key for "
  165. }
  166. return fmt.Sprintf(
  167. "invalid %sRoute.%s: %s%s",
  168. key,
  169. e.field,
  170. e.reason,
  171. cause)
  172. }
  173. var _ error = RouteValidationError{}
  174. var _ interface {
  175. Field() string
  176. Reason() string
  177. Key() bool
  178. Cause() error
  179. ErrorName() string
  180. } = RouteValidationError{}
  181. // Validate checks the field values on RouteMatch with the rules defined in the
  182. // proto definition for this message. If any rules are violated, an error is returned.
  183. func (m *RouteMatch) Validate() error {
  184. if m == nil {
  185. return nil
  186. }
  187. if m.GetTopic() == nil {
  188. return RouteMatchValidationError{
  189. field: "Topic",
  190. reason: "value is required",
  191. }
  192. }
  193. if v, ok := interface{}(m.GetTopic()).(interface{ Validate() error }); ok {
  194. if err := v.Validate(); err != nil {
  195. return RouteMatchValidationError{
  196. field: "Topic",
  197. reason: "embedded message failed validation",
  198. cause: err,
  199. }
  200. }
  201. }
  202. for idx, item := range m.GetHeaders() {
  203. _, _ = idx, item
  204. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  205. if err := v.Validate(); err != nil {
  206. return RouteMatchValidationError{
  207. field: fmt.Sprintf("Headers[%v]", idx),
  208. reason: "embedded message failed validation",
  209. cause: err,
  210. }
  211. }
  212. }
  213. }
  214. return nil
  215. }
  216. // RouteMatchValidationError is the validation error returned by
  217. // RouteMatch.Validate if the designated constraints aren't met.
  218. type RouteMatchValidationError struct {
  219. field string
  220. reason string
  221. cause error
  222. key bool
  223. }
  224. // Field function returns field value.
  225. func (e RouteMatchValidationError) Field() string { return e.field }
  226. // Reason function returns reason value.
  227. func (e RouteMatchValidationError) Reason() string { return e.reason }
  228. // Cause function returns cause value.
  229. func (e RouteMatchValidationError) Cause() error { return e.cause }
  230. // Key function returns key value.
  231. func (e RouteMatchValidationError) Key() bool { return e.key }
  232. // ErrorName returns error name.
  233. func (e RouteMatchValidationError) ErrorName() string { return "RouteMatchValidationError" }
  234. // Error satisfies the builtin error interface
  235. func (e RouteMatchValidationError) Error() string {
  236. cause := ""
  237. if e.cause != nil {
  238. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  239. }
  240. key := ""
  241. if e.key {
  242. key = "key for "
  243. }
  244. return fmt.Sprintf(
  245. "invalid %sRouteMatch.%s: %s%s",
  246. key,
  247. e.field,
  248. e.reason,
  249. cause)
  250. }
  251. var _ error = RouteMatchValidationError{}
  252. var _ interface {
  253. Field() string
  254. Reason() string
  255. Key() bool
  256. Cause() error
  257. ErrorName() string
  258. } = RouteMatchValidationError{}
  259. // Validate checks the field values on RouteAction with the rules defined in
  260. // the proto definition for this message. If any rules are violated, an error
  261. // is returned.
  262. func (m *RouteAction) Validate() error {
  263. if m == nil {
  264. return nil
  265. }
  266. if utf8.RuneCountInString(m.GetCluster()) < 1 {
  267. return RouteActionValidationError{
  268. field: "Cluster",
  269. reason: "value length must be at least 1 runes",
  270. }
  271. }
  272. if v, ok := interface{}(m.GetMetadataMatch()).(interface{ Validate() error }); ok {
  273. if err := v.Validate(); err != nil {
  274. return RouteActionValidationError{
  275. field: "MetadataMatch",
  276. reason: "embedded message failed validation",
  277. cause: err,
  278. }
  279. }
  280. }
  281. return nil
  282. }
  283. // RouteActionValidationError is the validation error returned by
  284. // RouteAction.Validate if the designated constraints aren't met.
  285. type RouteActionValidationError struct {
  286. field string
  287. reason string
  288. cause error
  289. key bool
  290. }
  291. // Field function returns field value.
  292. func (e RouteActionValidationError) Field() string { return e.field }
  293. // Reason function returns reason value.
  294. func (e RouteActionValidationError) Reason() string { return e.reason }
  295. // Cause function returns cause value.
  296. func (e RouteActionValidationError) Cause() error { return e.cause }
  297. // Key function returns key value.
  298. func (e RouteActionValidationError) Key() bool { return e.key }
  299. // ErrorName returns error name.
  300. func (e RouteActionValidationError) ErrorName() string { return "RouteActionValidationError" }
  301. // Error satisfies the builtin error interface
  302. func (e RouteActionValidationError) Error() string {
  303. cause := ""
  304. if e.cause != nil {
  305. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  306. }
  307. key := ""
  308. if e.key {
  309. key = "key for "
  310. }
  311. return fmt.Sprintf(
  312. "invalid %sRouteAction.%s: %s%s",
  313. key,
  314. e.field,
  315. e.reason,
  316. cause)
  317. }
  318. var _ error = RouteActionValidationError{}
  319. var _ interface {
  320. Field() string
  321. Reason() string
  322. Key() bool
  323. Cause() error
  324. ErrorName() string
  325. } = RouteActionValidationError{}