/pkg/api/envoy/extensions/filters/network/redis_proxy/v3/redis_proxy.pb.validate.go

https://github.com/datawire/ambassador · Go · 641 lines · 440 code · 116 blank · 85 comment · 76 complexity · e005a0061045bed6d45b04da97a03fdb MD5 · raw file

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