/pkg/api/envoy/extensions/filters/network/dubbo_proxy/v4alpha/route.pb.validate.go

https://github.com/datawire/ambassador · Go · 583 lines · 393 code · 114 blank · 76 comment · 66 complexity · b476192d86f2529f59ee9d411de4d623 MD5 · raw file

  1. // Code generated by protoc-gen-validate. DO NOT EDIT.
  2. // source: envoy/extensions/filters/network/dubbo_proxy/v4alpha/route.proto
  3. package envoy_extensions_filters_network_dubbo_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. // no validation rules for Interface
  42. // no validation rules for Group
  43. // no validation rules for Version
  44. for idx, item := range m.GetRoutes() {
  45. _, _ = idx, item
  46. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  47. if err := v.Validate(); err != nil {
  48. return RouteConfigurationValidationError{
  49. field: fmt.Sprintf("Routes[%v]", idx),
  50. reason: "embedded message failed validation",
  51. cause: err,
  52. }
  53. }
  54. }
  55. }
  56. return nil
  57. }
  58. // RouteConfigurationValidationError is the validation error returned by
  59. // RouteConfiguration.Validate if the designated constraints aren't met.
  60. type RouteConfigurationValidationError struct {
  61. field string
  62. reason string
  63. cause error
  64. key bool
  65. }
  66. // Field function returns field value.
  67. func (e RouteConfigurationValidationError) Field() string { return e.field }
  68. // Reason function returns reason value.
  69. func (e RouteConfigurationValidationError) Reason() string { return e.reason }
  70. // Cause function returns cause value.
  71. func (e RouteConfigurationValidationError) Cause() error { return e.cause }
  72. // Key function returns key value.
  73. func (e RouteConfigurationValidationError) Key() bool { return e.key }
  74. // ErrorName returns error name.
  75. func (e RouteConfigurationValidationError) ErrorName() string {
  76. return "RouteConfigurationValidationError"
  77. }
  78. // Error satisfies the builtin error interface
  79. func (e RouteConfigurationValidationError) Error() string {
  80. cause := ""
  81. if e.cause != nil {
  82. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  83. }
  84. key := ""
  85. if e.key {
  86. key = "key for "
  87. }
  88. return fmt.Sprintf(
  89. "invalid %sRouteConfiguration.%s: %s%s",
  90. key,
  91. e.field,
  92. e.reason,
  93. cause)
  94. }
  95. var _ error = RouteConfigurationValidationError{}
  96. var _ interface {
  97. Field() string
  98. Reason() string
  99. Key() bool
  100. Cause() error
  101. ErrorName() string
  102. } = RouteConfigurationValidationError{}
  103. // Validate checks the field values on Route with the rules defined in the
  104. // proto definition for this message. If any rules are violated, an error is returned.
  105. func (m *Route) Validate() error {
  106. if m == nil {
  107. return nil
  108. }
  109. if m.GetMatch() == nil {
  110. return RouteValidationError{
  111. field: "Match",
  112. reason: "value is required",
  113. }
  114. }
  115. if v, ok := interface{}(m.GetMatch()).(interface{ Validate() error }); ok {
  116. if err := v.Validate(); err != nil {
  117. return RouteValidationError{
  118. field: "Match",
  119. reason: "embedded message failed validation",
  120. cause: err,
  121. }
  122. }
  123. }
  124. if m.GetRoute() == nil {
  125. return RouteValidationError{
  126. field: "Route",
  127. reason: "value is required",
  128. }
  129. }
  130. if v, ok := interface{}(m.GetRoute()).(interface{ Validate() error }); ok {
  131. if err := v.Validate(); err != nil {
  132. return RouteValidationError{
  133. field: "Route",
  134. reason: "embedded message failed validation",
  135. cause: err,
  136. }
  137. }
  138. }
  139. return nil
  140. }
  141. // RouteValidationError is the validation error returned by Route.Validate if
  142. // the designated constraints aren't met.
  143. type RouteValidationError struct {
  144. field string
  145. reason string
  146. cause error
  147. key bool
  148. }
  149. // Field function returns field value.
  150. func (e RouteValidationError) Field() string { return e.field }
  151. // Reason function returns reason value.
  152. func (e RouteValidationError) Reason() string { return e.reason }
  153. // Cause function returns cause value.
  154. func (e RouteValidationError) Cause() error { return e.cause }
  155. // Key function returns key value.
  156. func (e RouteValidationError) Key() bool { return e.key }
  157. // ErrorName returns error name.
  158. func (e RouteValidationError) ErrorName() string { return "RouteValidationError" }
  159. // Error satisfies the builtin error interface
  160. func (e RouteValidationError) Error() string {
  161. cause := ""
  162. if e.cause != nil {
  163. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  164. }
  165. key := ""
  166. if e.key {
  167. key = "key for "
  168. }
  169. return fmt.Sprintf(
  170. "invalid %sRoute.%s: %s%s",
  171. key,
  172. e.field,
  173. e.reason,
  174. cause)
  175. }
  176. var _ error = RouteValidationError{}
  177. var _ interface {
  178. Field() string
  179. Reason() string
  180. Key() bool
  181. Cause() error
  182. ErrorName() string
  183. } = RouteValidationError{}
  184. // Validate checks the field values on RouteMatch with the rules defined in the
  185. // proto definition for this message. If any rules are violated, an error is returned.
  186. func (m *RouteMatch) Validate() error {
  187. if m == nil {
  188. return nil
  189. }
  190. if v, ok := interface{}(m.GetMethod()).(interface{ Validate() error }); ok {
  191. if err := v.Validate(); err != nil {
  192. return RouteMatchValidationError{
  193. field: "Method",
  194. reason: "embedded message failed validation",
  195. cause: err,
  196. }
  197. }
  198. }
  199. for idx, item := range m.GetHeaders() {
  200. _, _ = idx, item
  201. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  202. if err := v.Validate(); err != nil {
  203. return RouteMatchValidationError{
  204. field: fmt.Sprintf("Headers[%v]", idx),
  205. reason: "embedded message failed validation",
  206. cause: err,
  207. }
  208. }
  209. }
  210. }
  211. return nil
  212. }
  213. // RouteMatchValidationError is the validation error returned by
  214. // RouteMatch.Validate if the designated constraints aren't met.
  215. type RouteMatchValidationError struct {
  216. field string
  217. reason string
  218. cause error
  219. key bool
  220. }
  221. // Field function returns field value.
  222. func (e RouteMatchValidationError) Field() string { return e.field }
  223. // Reason function returns reason value.
  224. func (e RouteMatchValidationError) Reason() string { return e.reason }
  225. // Cause function returns cause value.
  226. func (e RouteMatchValidationError) Cause() error { return e.cause }
  227. // Key function returns key value.
  228. func (e RouteMatchValidationError) Key() bool { return e.key }
  229. // ErrorName returns error name.
  230. func (e RouteMatchValidationError) ErrorName() string { return "RouteMatchValidationError" }
  231. // Error satisfies the builtin error interface
  232. func (e RouteMatchValidationError) Error() string {
  233. cause := ""
  234. if e.cause != nil {
  235. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  236. }
  237. key := ""
  238. if e.key {
  239. key = "key for "
  240. }
  241. return fmt.Sprintf(
  242. "invalid %sRouteMatch.%s: %s%s",
  243. key,
  244. e.field,
  245. e.reason,
  246. cause)
  247. }
  248. var _ error = RouteMatchValidationError{}
  249. var _ interface {
  250. Field() string
  251. Reason() string
  252. Key() bool
  253. Cause() error
  254. ErrorName() string
  255. } = RouteMatchValidationError{}
  256. // Validate checks the field values on RouteAction with the rules defined in
  257. // the proto definition for this message. If any rules are violated, an error
  258. // is returned.
  259. func (m *RouteAction) Validate() error {
  260. if m == nil {
  261. return nil
  262. }
  263. switch m.ClusterSpecifier.(type) {
  264. case *RouteAction_Cluster:
  265. // no validation rules for Cluster
  266. case *RouteAction_WeightedClusters:
  267. if v, ok := interface{}(m.GetWeightedClusters()).(interface{ Validate() error }); ok {
  268. if err := v.Validate(); err != nil {
  269. return RouteActionValidationError{
  270. field: "WeightedClusters",
  271. reason: "embedded message failed validation",
  272. cause: err,
  273. }
  274. }
  275. }
  276. default:
  277. return RouteActionValidationError{
  278. field: "ClusterSpecifier",
  279. reason: "value is required",
  280. }
  281. }
  282. return nil
  283. }
  284. // RouteActionValidationError is the validation error returned by
  285. // RouteAction.Validate if the designated constraints aren't met.
  286. type RouteActionValidationError struct {
  287. field string
  288. reason string
  289. cause error
  290. key bool
  291. }
  292. // Field function returns field value.
  293. func (e RouteActionValidationError) Field() string { return e.field }
  294. // Reason function returns reason value.
  295. func (e RouteActionValidationError) Reason() string { return e.reason }
  296. // Cause function returns cause value.
  297. func (e RouteActionValidationError) Cause() error { return e.cause }
  298. // Key function returns key value.
  299. func (e RouteActionValidationError) Key() bool { return e.key }
  300. // ErrorName returns error name.
  301. func (e RouteActionValidationError) ErrorName() string { return "RouteActionValidationError" }
  302. // Error satisfies the builtin error interface
  303. func (e RouteActionValidationError) Error() string {
  304. cause := ""
  305. if e.cause != nil {
  306. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  307. }
  308. key := ""
  309. if e.key {
  310. key = "key for "
  311. }
  312. return fmt.Sprintf(
  313. "invalid %sRouteAction.%s: %s%s",
  314. key,
  315. e.field,
  316. e.reason,
  317. cause)
  318. }
  319. var _ error = RouteActionValidationError{}
  320. var _ interface {
  321. Field() string
  322. Reason() string
  323. Key() bool
  324. Cause() error
  325. ErrorName() string
  326. } = RouteActionValidationError{}
  327. // Validate checks the field values on MethodMatch with the rules defined in
  328. // the proto definition for this message. If any rules are violated, an error
  329. // is returned.
  330. func (m *MethodMatch) Validate() error {
  331. if m == nil {
  332. return nil
  333. }
  334. if v, ok := interface{}(m.GetName()).(interface{ Validate() error }); ok {
  335. if err := v.Validate(); err != nil {
  336. return MethodMatchValidationError{
  337. field: "Name",
  338. reason: "embedded message failed validation",
  339. cause: err,
  340. }
  341. }
  342. }
  343. for key, val := range m.GetParamsMatch() {
  344. _ = val
  345. // no validation rules for ParamsMatch[key]
  346. if v, ok := interface{}(val).(interface{ Validate() error }); ok {
  347. if err := v.Validate(); err != nil {
  348. return MethodMatchValidationError{
  349. field: fmt.Sprintf("ParamsMatch[%v]", key),
  350. reason: "embedded message failed validation",
  351. cause: err,
  352. }
  353. }
  354. }
  355. }
  356. return nil
  357. }
  358. // MethodMatchValidationError is the validation error returned by
  359. // MethodMatch.Validate if the designated constraints aren't met.
  360. type MethodMatchValidationError struct {
  361. field string
  362. reason string
  363. cause error
  364. key bool
  365. }
  366. // Field function returns field value.
  367. func (e MethodMatchValidationError) Field() string { return e.field }
  368. // Reason function returns reason value.
  369. func (e MethodMatchValidationError) Reason() string { return e.reason }
  370. // Cause function returns cause value.
  371. func (e MethodMatchValidationError) Cause() error { return e.cause }
  372. // Key function returns key value.
  373. func (e MethodMatchValidationError) Key() bool { return e.key }
  374. // ErrorName returns error name.
  375. func (e MethodMatchValidationError) ErrorName() string { return "MethodMatchValidationError" }
  376. // Error satisfies the builtin error interface
  377. func (e MethodMatchValidationError) Error() string {
  378. cause := ""
  379. if e.cause != nil {
  380. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  381. }
  382. key := ""
  383. if e.key {
  384. key = "key for "
  385. }
  386. return fmt.Sprintf(
  387. "invalid %sMethodMatch.%s: %s%s",
  388. key,
  389. e.field,
  390. e.reason,
  391. cause)
  392. }
  393. var _ error = MethodMatchValidationError{}
  394. var _ interface {
  395. Field() string
  396. Reason() string
  397. Key() bool
  398. Cause() error
  399. ErrorName() string
  400. } = MethodMatchValidationError{}
  401. // Validate checks the field values on MethodMatch_ParameterMatchSpecifier with
  402. // the rules defined in the proto definition for this message. If any rules
  403. // are violated, an error is returned.
  404. func (m *MethodMatch_ParameterMatchSpecifier) Validate() error {
  405. if m == nil {
  406. return nil
  407. }
  408. switch m.ParameterMatchSpecifier.(type) {
  409. case *MethodMatch_ParameterMatchSpecifier_ExactMatch:
  410. // no validation rules for ExactMatch
  411. case *MethodMatch_ParameterMatchSpecifier_RangeMatch:
  412. if v, ok := interface{}(m.GetRangeMatch()).(interface{ Validate() error }); ok {
  413. if err := v.Validate(); err != nil {
  414. return MethodMatch_ParameterMatchSpecifierValidationError{
  415. field: "RangeMatch",
  416. reason: "embedded message failed validation",
  417. cause: err,
  418. }
  419. }
  420. }
  421. }
  422. return nil
  423. }
  424. // MethodMatch_ParameterMatchSpecifierValidationError is the validation error
  425. // returned by MethodMatch_ParameterMatchSpecifier.Validate if the designated
  426. // constraints aren't met.
  427. type MethodMatch_ParameterMatchSpecifierValidationError struct {
  428. field string
  429. reason string
  430. cause error
  431. key bool
  432. }
  433. // Field function returns field value.
  434. func (e MethodMatch_ParameterMatchSpecifierValidationError) Field() string { return e.field }
  435. // Reason function returns reason value.
  436. func (e MethodMatch_ParameterMatchSpecifierValidationError) Reason() string { return e.reason }
  437. // Cause function returns cause value.
  438. func (e MethodMatch_ParameterMatchSpecifierValidationError) Cause() error { return e.cause }
  439. // Key function returns key value.
  440. func (e MethodMatch_ParameterMatchSpecifierValidationError) Key() bool { return e.key }
  441. // ErrorName returns error name.
  442. func (e MethodMatch_ParameterMatchSpecifierValidationError) ErrorName() string {
  443. return "MethodMatch_ParameterMatchSpecifierValidationError"
  444. }
  445. // Error satisfies the builtin error interface
  446. func (e MethodMatch_ParameterMatchSpecifierValidationError) Error() string {
  447. cause := ""
  448. if e.cause != nil {
  449. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  450. }
  451. key := ""
  452. if e.key {
  453. key = "key for "
  454. }
  455. return fmt.Sprintf(
  456. "invalid %sMethodMatch_ParameterMatchSpecifier.%s: %s%s",
  457. key,
  458. e.field,
  459. e.reason,
  460. cause)
  461. }
  462. var _ error = MethodMatch_ParameterMatchSpecifierValidationError{}
  463. var _ interface {
  464. Field() string
  465. Reason() string
  466. Key() bool
  467. Cause() error
  468. ErrorName() string
  469. } = MethodMatch_ParameterMatchSpecifierValidationError{}