/pkg/api/envoy/config/filter/network/redis_proxy/v2/redis_proxy.pb.validate.go

https://github.com/datawire/ambassador · Go · 621 lines · 422 code · 114 blank · 85 comment · 70 complexity · e0c7e27907d68fdea6310c4e772cb164 MD5 · raw file

  1. // Code generated by protoc-gen-validate. DO NOT EDIT.
  2. // source: envoy/config/filter/network/redis_proxy/v2/redis_proxy.proto
  3. package envoy_config_filter_network_redis_proxy_v2
  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 _redis_proxy_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 RedisProxy with the rules defined in the
  34. // proto definition for this message. If any rules are violated, an error is returned.
  35. func (m *RedisProxy) Validate() error {
  36. if m == nil {
  37. return nil
  38. }
  39. if len(m.GetStatPrefix()) < 1 {
  40. return RedisProxyValidationError{
  41. field: "StatPrefix",
  42. reason: "value length must be at least 1 bytes",
  43. }
  44. }
  45. // no validation rules for Cluster
  46. if m.GetSettings() == nil {
  47. return RedisProxyValidationError{
  48. field: "Settings",
  49. reason: "value is required",
  50. }
  51. }
  52. if v, ok := interface{}(m.GetSettings()).(interface{ Validate() error }); ok {
  53. if err := v.Validate(); err != nil {
  54. return RedisProxyValidationError{
  55. field: "Settings",
  56. reason: "embedded message failed validation",
  57. cause: err,
  58. }
  59. }
  60. }
  61. // no validation rules for LatencyInMicros
  62. if v, ok := interface{}(m.GetPrefixRoutes()).(interface{ Validate() error }); ok {
  63. if err := v.Validate(); err != nil {
  64. return RedisProxyValidationError{
  65. field: "PrefixRoutes",
  66. reason: "embedded message failed validation",
  67. cause: err,
  68. }
  69. }
  70. }
  71. if v, ok := interface{}(m.GetDownstreamAuthPassword()).(interface{ Validate() error }); ok {
  72. if err := v.Validate(); err != nil {
  73. return RedisProxyValidationError{
  74. field: "DownstreamAuthPassword",
  75. reason: "embedded message failed validation",
  76. cause: err,
  77. }
  78. }
  79. }
  80. return nil
  81. }
  82. // RedisProxyValidationError is the validation error returned by
  83. // RedisProxy.Validate if the designated constraints aren't met.
  84. type RedisProxyValidationError struct {
  85. field string
  86. reason string
  87. cause error
  88. key bool
  89. }
  90. // Field function returns field value.
  91. func (e RedisProxyValidationError) Field() string { return e.field }
  92. // Reason function returns reason value.
  93. func (e RedisProxyValidationError) Reason() string { return e.reason }
  94. // Cause function returns cause value.
  95. func (e RedisProxyValidationError) Cause() error { return e.cause }
  96. // Key function returns key value.
  97. func (e RedisProxyValidationError) Key() bool { return e.key }
  98. // ErrorName returns error name.
  99. func (e RedisProxyValidationError) ErrorName() string { return "RedisProxyValidationError" }
  100. // Error satisfies the builtin error interface
  101. func (e RedisProxyValidationError) Error() string {
  102. cause := ""
  103. if e.cause != nil {
  104. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  105. }
  106. key := ""
  107. if e.key {
  108. key = "key for "
  109. }
  110. return fmt.Sprintf(
  111. "invalid %sRedisProxy.%s: %s%s",
  112. key,
  113. e.field,
  114. e.reason,
  115. cause)
  116. }
  117. var _ error = RedisProxyValidationError{}
  118. var _ interface {
  119. Field() string
  120. Reason() string
  121. Key() bool
  122. Cause() error
  123. ErrorName() string
  124. } = RedisProxyValidationError{}
  125. // Validate checks the field values on RedisProtocolOptions with the rules
  126. // defined in the proto definition for this message. If any rules are
  127. // violated, an error is returned.
  128. func (m *RedisProtocolOptions) Validate() error {
  129. if m == nil {
  130. return nil
  131. }
  132. if v, ok := interface{}(m.GetAuthPassword()).(interface{ Validate() error }); ok {
  133. if err := v.Validate(); err != nil {
  134. return RedisProtocolOptionsValidationError{
  135. field: "AuthPassword",
  136. reason: "embedded message failed validation",
  137. cause: err,
  138. }
  139. }
  140. }
  141. return nil
  142. }
  143. // RedisProtocolOptionsValidationError is the validation error returned by
  144. // RedisProtocolOptions.Validate if the designated constraints aren't met.
  145. type RedisProtocolOptionsValidationError struct {
  146. field string
  147. reason string
  148. cause error
  149. key bool
  150. }
  151. // Field function returns field value.
  152. func (e RedisProtocolOptionsValidationError) Field() string { return e.field }
  153. // Reason function returns reason value.
  154. func (e RedisProtocolOptionsValidationError) Reason() string { return e.reason }
  155. // Cause function returns cause value.
  156. func (e RedisProtocolOptionsValidationError) Cause() error { return e.cause }
  157. // Key function returns key value.
  158. func (e RedisProtocolOptionsValidationError) Key() bool { return e.key }
  159. // ErrorName returns error name.
  160. func (e RedisProtocolOptionsValidationError) ErrorName() string {
  161. return "RedisProtocolOptionsValidationError"
  162. }
  163. // Error satisfies the builtin error interface
  164. func (e RedisProtocolOptionsValidationError) Error() string {
  165. cause := ""
  166. if e.cause != nil {
  167. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  168. }
  169. key := ""
  170. if e.key {
  171. key = "key for "
  172. }
  173. return fmt.Sprintf(
  174. "invalid %sRedisProtocolOptions.%s: %s%s",
  175. key,
  176. e.field,
  177. e.reason,
  178. cause)
  179. }
  180. var _ error = RedisProtocolOptionsValidationError{}
  181. var _ interface {
  182. Field() string
  183. Reason() string
  184. Key() bool
  185. Cause() error
  186. ErrorName() string
  187. } = RedisProtocolOptionsValidationError{}
  188. // Validate checks the field values on RedisProxy_ConnPoolSettings with the
  189. // rules defined in the proto definition for this message. If any rules are
  190. // violated, an error is returned.
  191. func (m *RedisProxy_ConnPoolSettings) Validate() error {
  192. if m == nil {
  193. return nil
  194. }
  195. if m.GetOpTimeout() == nil {
  196. return RedisProxy_ConnPoolSettingsValidationError{
  197. field: "OpTimeout",
  198. reason: "value is required",
  199. }
  200. }
  201. // no validation rules for EnableHashtagging
  202. // no validation rules for EnableRedirection
  203. // no validation rules for MaxBufferSizeBeforeFlush
  204. if v, ok := interface{}(m.GetBufferFlushTimeout()).(interface{ Validate() error }); ok {
  205. if err := v.Validate(); err != nil {
  206. return RedisProxy_ConnPoolSettingsValidationError{
  207. field: "BufferFlushTimeout",
  208. reason: "embedded message failed validation",
  209. cause: err,
  210. }
  211. }
  212. }
  213. if v, ok := interface{}(m.GetMaxUpstreamUnknownConnections()).(interface{ Validate() error }); ok {
  214. if err := v.Validate(); err != nil {
  215. return RedisProxy_ConnPoolSettingsValidationError{
  216. field: "MaxUpstreamUnknownConnections",
  217. reason: "embedded message failed validation",
  218. cause: err,
  219. }
  220. }
  221. }
  222. // no validation rules for EnableCommandStats
  223. if _, ok := RedisProxy_ConnPoolSettings_ReadPolicy_name[int32(m.GetReadPolicy())]; !ok {
  224. return RedisProxy_ConnPoolSettingsValidationError{
  225. field: "ReadPolicy",
  226. reason: "value must be one of the defined enum values",
  227. }
  228. }
  229. return nil
  230. }
  231. // RedisProxy_ConnPoolSettingsValidationError is the validation error returned
  232. // by RedisProxy_ConnPoolSettings.Validate if the designated constraints
  233. // aren't met.
  234. type RedisProxy_ConnPoolSettingsValidationError struct {
  235. field string
  236. reason string
  237. cause error
  238. key bool
  239. }
  240. // Field function returns field value.
  241. func (e RedisProxy_ConnPoolSettingsValidationError) Field() string { return e.field }
  242. // Reason function returns reason value.
  243. func (e RedisProxy_ConnPoolSettingsValidationError) Reason() string { return e.reason }
  244. // Cause function returns cause value.
  245. func (e RedisProxy_ConnPoolSettingsValidationError) Cause() error { return e.cause }
  246. // Key function returns key value.
  247. func (e RedisProxy_ConnPoolSettingsValidationError) Key() bool { return e.key }
  248. // ErrorName returns error name.
  249. func (e RedisProxy_ConnPoolSettingsValidationError) ErrorName() string {
  250. return "RedisProxy_ConnPoolSettingsValidationError"
  251. }
  252. // Error satisfies the builtin error interface
  253. func (e RedisProxy_ConnPoolSettingsValidationError) Error() string {
  254. cause := ""
  255. if e.cause != nil {
  256. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  257. }
  258. key := ""
  259. if e.key {
  260. key = "key for "
  261. }
  262. return fmt.Sprintf(
  263. "invalid %sRedisProxy_ConnPoolSettings.%s: %s%s",
  264. key,
  265. e.field,
  266. e.reason,
  267. cause)
  268. }
  269. var _ error = RedisProxy_ConnPoolSettingsValidationError{}
  270. var _ interface {
  271. Field() string
  272. Reason() string
  273. Key() bool
  274. Cause() error
  275. ErrorName() string
  276. } = RedisProxy_ConnPoolSettingsValidationError{}
  277. // Validate checks the field values on RedisProxy_PrefixRoutes with the rules
  278. // defined in the proto definition for this message. If any rules are
  279. // violated, an error is returned.
  280. func (m *RedisProxy_PrefixRoutes) Validate() error {
  281. if m == nil {
  282. return nil
  283. }
  284. for idx, item := range m.GetRoutes() {
  285. _, _ = idx, item
  286. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  287. if err := v.Validate(); err != nil {
  288. return RedisProxy_PrefixRoutesValidationError{
  289. field: fmt.Sprintf("Routes[%v]", idx),
  290. reason: "embedded message failed validation",
  291. cause: err,
  292. }
  293. }
  294. }
  295. }
  296. // no validation rules for CaseInsensitive
  297. // no validation rules for CatchAllCluster
  298. if v, ok := interface{}(m.GetCatchAllRoute()).(interface{ Validate() error }); ok {
  299. if err := v.Validate(); err != nil {
  300. return RedisProxy_PrefixRoutesValidationError{
  301. field: "CatchAllRoute",
  302. reason: "embedded message failed validation",
  303. cause: err,
  304. }
  305. }
  306. }
  307. return nil
  308. }
  309. // RedisProxy_PrefixRoutesValidationError is the validation error returned by
  310. // RedisProxy_PrefixRoutes.Validate if the designated constraints aren't met.
  311. type RedisProxy_PrefixRoutesValidationError struct {
  312. field string
  313. reason string
  314. cause error
  315. key bool
  316. }
  317. // Field function returns field value.
  318. func (e RedisProxy_PrefixRoutesValidationError) Field() string { return e.field }
  319. // Reason function returns reason value.
  320. func (e RedisProxy_PrefixRoutesValidationError) Reason() string { return e.reason }
  321. // Cause function returns cause value.
  322. func (e RedisProxy_PrefixRoutesValidationError) Cause() error { return e.cause }
  323. // Key function returns key value.
  324. func (e RedisProxy_PrefixRoutesValidationError) Key() bool { return e.key }
  325. // ErrorName returns error name.
  326. func (e RedisProxy_PrefixRoutesValidationError) ErrorName() string {
  327. return "RedisProxy_PrefixRoutesValidationError"
  328. }
  329. // Error satisfies the builtin error interface
  330. func (e RedisProxy_PrefixRoutesValidationError) Error() string {
  331. cause := ""
  332. if e.cause != nil {
  333. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  334. }
  335. key := ""
  336. if e.key {
  337. key = "key for "
  338. }
  339. return fmt.Sprintf(
  340. "invalid %sRedisProxy_PrefixRoutes.%s: %s%s",
  341. key,
  342. e.field,
  343. e.reason,
  344. cause)
  345. }
  346. var _ error = RedisProxy_PrefixRoutesValidationError{}
  347. var _ interface {
  348. Field() string
  349. Reason() string
  350. Key() bool
  351. Cause() error
  352. ErrorName() string
  353. } = RedisProxy_PrefixRoutesValidationError{}
  354. // Validate checks the field values on RedisProxy_PrefixRoutes_Route with the
  355. // rules defined in the proto definition for this message. If any rules are
  356. // violated, an error is returned.
  357. func (m *RedisProxy_PrefixRoutes_Route) Validate() error {
  358. if m == nil {
  359. return nil
  360. }
  361. // no validation rules for Prefix
  362. // no validation rules for RemovePrefix
  363. if len(m.GetCluster()) < 1 {
  364. return RedisProxy_PrefixRoutes_RouteValidationError{
  365. field: "Cluster",
  366. reason: "value length must be at least 1 bytes",
  367. }
  368. }
  369. for idx, item := range m.GetRequestMirrorPolicy() {
  370. _, _ = idx, item
  371. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  372. if err := v.Validate(); err != nil {
  373. return RedisProxy_PrefixRoutes_RouteValidationError{
  374. field: fmt.Sprintf("RequestMirrorPolicy[%v]", idx),
  375. reason: "embedded message failed validation",
  376. cause: err,
  377. }
  378. }
  379. }
  380. }
  381. return nil
  382. }
  383. // RedisProxy_PrefixRoutes_RouteValidationError is the validation error
  384. // returned by RedisProxy_PrefixRoutes_Route.Validate if the designated
  385. // constraints aren't met.
  386. type RedisProxy_PrefixRoutes_RouteValidationError struct {
  387. field string
  388. reason string
  389. cause error
  390. key bool
  391. }
  392. // Field function returns field value.
  393. func (e RedisProxy_PrefixRoutes_RouteValidationError) Field() string { return e.field }
  394. // Reason function returns reason value.
  395. func (e RedisProxy_PrefixRoutes_RouteValidationError) Reason() string { return e.reason }
  396. // Cause function returns cause value.
  397. func (e RedisProxy_PrefixRoutes_RouteValidationError) Cause() error { return e.cause }
  398. // Key function returns key value.
  399. func (e RedisProxy_PrefixRoutes_RouteValidationError) Key() bool { return e.key }
  400. // ErrorName returns error name.
  401. func (e RedisProxy_PrefixRoutes_RouteValidationError) ErrorName() string {
  402. return "RedisProxy_PrefixRoutes_RouteValidationError"
  403. }
  404. // Error satisfies the builtin error interface
  405. func (e RedisProxy_PrefixRoutes_RouteValidationError) Error() string {
  406. cause := ""
  407. if e.cause != nil {
  408. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  409. }
  410. key := ""
  411. if e.key {
  412. key = "key for "
  413. }
  414. return fmt.Sprintf(
  415. "invalid %sRedisProxy_PrefixRoutes_Route.%s: %s%s",
  416. key,
  417. e.field,
  418. e.reason,
  419. cause)
  420. }
  421. var _ error = RedisProxy_PrefixRoutes_RouteValidationError{}
  422. var _ interface {
  423. Field() string
  424. Reason() string
  425. Key() bool
  426. Cause() error
  427. ErrorName() string
  428. } = RedisProxy_PrefixRoutes_RouteValidationError{}
  429. // Validate checks the field values on
  430. // RedisProxy_PrefixRoutes_Route_RequestMirrorPolicy with the rules defined in
  431. // the proto definition for this message. If any rules are violated, an error
  432. // is returned.
  433. func (m *RedisProxy_PrefixRoutes_Route_RequestMirrorPolicy) Validate() error {
  434. if m == nil {
  435. return nil
  436. }
  437. if len(m.GetCluster()) < 1 {
  438. return RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError{
  439. field: "Cluster",
  440. reason: "value length must be at least 1 bytes",
  441. }
  442. }
  443. if v, ok := interface{}(m.GetRuntimeFraction()).(interface{ Validate() error }); ok {
  444. if err := v.Validate(); err != nil {
  445. return RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError{
  446. field: "RuntimeFraction",
  447. reason: "embedded message failed validation",
  448. cause: err,
  449. }
  450. }
  451. }
  452. // no validation rules for ExcludeReadCommands
  453. return nil
  454. }
  455. // RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError is the
  456. // validation error returned by
  457. // RedisProxy_PrefixRoutes_Route_RequestMirrorPolicy.Validate if the
  458. // designated constraints aren't met.
  459. type RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError struct {
  460. field string
  461. reason string
  462. cause error
  463. key bool
  464. }
  465. // Field function returns field value.
  466. func (e RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError) Field() string {
  467. return e.field
  468. }
  469. // Reason function returns reason value.
  470. func (e RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError) Reason() string {
  471. return e.reason
  472. }
  473. // Cause function returns cause value.
  474. func (e RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError) Cause() error {
  475. return e.cause
  476. }
  477. // Key function returns key value.
  478. func (e RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError) Key() bool { return e.key }
  479. // ErrorName returns error name.
  480. func (e RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError) ErrorName() string {
  481. return "RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError"
  482. }
  483. // Error satisfies the builtin error interface
  484. func (e RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError) Error() string {
  485. cause := ""
  486. if e.cause != nil {
  487. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  488. }
  489. key := ""
  490. if e.key {
  491. key = "key for "
  492. }
  493. return fmt.Sprintf(
  494. "invalid %sRedisProxy_PrefixRoutes_Route_RequestMirrorPolicy.%s: %s%s",
  495. key,
  496. e.field,
  497. e.reason,
  498. cause)
  499. }
  500. var _ error = RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError{}
  501. var _ interface {
  502. Field() string
  503. Reason() string
  504. Key() bool
  505. Cause() error
  506. ErrorName() string
  507. } = RedisProxy_PrefixRoutes_Route_RequestMirrorPolicyValidationError{}