/pkg/api/envoy/config/filter/accesslog/v2/accesslog.pb.validate.go

https://github.com/datawire/ambassador · Go · 1339 lines · 926 code · 254 blank · 159 comment · 158 complexity · 441b009f1fadeaec6832018dd98cc925 MD5 · raw file

  1. // Code generated by protoc-gen-validate. DO NOT EDIT.
  2. // source: envoy/config/filter/accesslog/v2/accesslog.proto
  3. package envoy_config_filter_accesslog_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 _accesslog_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 AccessLog with the rules defined in the
  34. // proto definition for this message. If any rules are violated, an error is returned.
  35. func (m *AccessLog) Validate() error {
  36. if m == nil {
  37. return nil
  38. }
  39. // no validation rules for Name
  40. if v, ok := interface{}(m.GetFilter()).(interface{ Validate() error }); ok {
  41. if err := v.Validate(); err != nil {
  42. return AccessLogValidationError{
  43. field: "Filter",
  44. reason: "embedded message failed validation",
  45. cause: err,
  46. }
  47. }
  48. }
  49. switch m.ConfigType.(type) {
  50. case *AccessLog_Config:
  51. if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok {
  52. if err := v.Validate(); err != nil {
  53. return AccessLogValidationError{
  54. field: "Config",
  55. reason: "embedded message failed validation",
  56. cause: err,
  57. }
  58. }
  59. }
  60. case *AccessLog_TypedConfig:
  61. if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok {
  62. if err := v.Validate(); err != nil {
  63. return AccessLogValidationError{
  64. field: "TypedConfig",
  65. reason: "embedded message failed validation",
  66. cause: err,
  67. }
  68. }
  69. }
  70. }
  71. return nil
  72. }
  73. // AccessLogValidationError is the validation error returned by
  74. // AccessLog.Validate if the designated constraints aren't met.
  75. type AccessLogValidationError struct {
  76. field string
  77. reason string
  78. cause error
  79. key bool
  80. }
  81. // Field function returns field value.
  82. func (e AccessLogValidationError) Field() string { return e.field }
  83. // Reason function returns reason value.
  84. func (e AccessLogValidationError) Reason() string { return e.reason }
  85. // Cause function returns cause value.
  86. func (e AccessLogValidationError) Cause() error { return e.cause }
  87. // Key function returns key value.
  88. func (e AccessLogValidationError) Key() bool { return e.key }
  89. // ErrorName returns error name.
  90. func (e AccessLogValidationError) ErrorName() string { return "AccessLogValidationError" }
  91. // Error satisfies the builtin error interface
  92. func (e AccessLogValidationError) Error() string {
  93. cause := ""
  94. if e.cause != nil {
  95. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  96. }
  97. key := ""
  98. if e.key {
  99. key = "key for "
  100. }
  101. return fmt.Sprintf(
  102. "invalid %sAccessLog.%s: %s%s",
  103. key,
  104. e.field,
  105. e.reason,
  106. cause)
  107. }
  108. var _ error = AccessLogValidationError{}
  109. var _ interface {
  110. Field() string
  111. Reason() string
  112. Key() bool
  113. Cause() error
  114. ErrorName() string
  115. } = AccessLogValidationError{}
  116. // Validate checks the field values on AccessLogFilter with the rules defined
  117. // in the proto definition for this message. If any rules are violated, an
  118. // error is returned.
  119. func (m *AccessLogFilter) Validate() error {
  120. if m == nil {
  121. return nil
  122. }
  123. switch m.FilterSpecifier.(type) {
  124. case *AccessLogFilter_StatusCodeFilter:
  125. if v, ok := interface{}(m.GetStatusCodeFilter()).(interface{ Validate() error }); ok {
  126. if err := v.Validate(); err != nil {
  127. return AccessLogFilterValidationError{
  128. field: "StatusCodeFilter",
  129. reason: "embedded message failed validation",
  130. cause: err,
  131. }
  132. }
  133. }
  134. case *AccessLogFilter_DurationFilter:
  135. if v, ok := interface{}(m.GetDurationFilter()).(interface{ Validate() error }); ok {
  136. if err := v.Validate(); err != nil {
  137. return AccessLogFilterValidationError{
  138. field: "DurationFilter",
  139. reason: "embedded message failed validation",
  140. cause: err,
  141. }
  142. }
  143. }
  144. case *AccessLogFilter_NotHealthCheckFilter:
  145. if v, ok := interface{}(m.GetNotHealthCheckFilter()).(interface{ Validate() error }); ok {
  146. if err := v.Validate(); err != nil {
  147. return AccessLogFilterValidationError{
  148. field: "NotHealthCheckFilter",
  149. reason: "embedded message failed validation",
  150. cause: err,
  151. }
  152. }
  153. }
  154. case *AccessLogFilter_TraceableFilter:
  155. if v, ok := interface{}(m.GetTraceableFilter()).(interface{ Validate() error }); ok {
  156. if err := v.Validate(); err != nil {
  157. return AccessLogFilterValidationError{
  158. field: "TraceableFilter",
  159. reason: "embedded message failed validation",
  160. cause: err,
  161. }
  162. }
  163. }
  164. case *AccessLogFilter_RuntimeFilter:
  165. if v, ok := interface{}(m.GetRuntimeFilter()).(interface{ Validate() error }); ok {
  166. if err := v.Validate(); err != nil {
  167. return AccessLogFilterValidationError{
  168. field: "RuntimeFilter",
  169. reason: "embedded message failed validation",
  170. cause: err,
  171. }
  172. }
  173. }
  174. case *AccessLogFilter_AndFilter:
  175. if v, ok := interface{}(m.GetAndFilter()).(interface{ Validate() error }); ok {
  176. if err := v.Validate(); err != nil {
  177. return AccessLogFilterValidationError{
  178. field: "AndFilter",
  179. reason: "embedded message failed validation",
  180. cause: err,
  181. }
  182. }
  183. }
  184. case *AccessLogFilter_OrFilter:
  185. if v, ok := interface{}(m.GetOrFilter()).(interface{ Validate() error }); ok {
  186. if err := v.Validate(); err != nil {
  187. return AccessLogFilterValidationError{
  188. field: "OrFilter",
  189. reason: "embedded message failed validation",
  190. cause: err,
  191. }
  192. }
  193. }
  194. case *AccessLogFilter_HeaderFilter:
  195. if v, ok := interface{}(m.GetHeaderFilter()).(interface{ Validate() error }); ok {
  196. if err := v.Validate(); err != nil {
  197. return AccessLogFilterValidationError{
  198. field: "HeaderFilter",
  199. reason: "embedded message failed validation",
  200. cause: err,
  201. }
  202. }
  203. }
  204. case *AccessLogFilter_ResponseFlagFilter:
  205. if v, ok := interface{}(m.GetResponseFlagFilter()).(interface{ Validate() error }); ok {
  206. if err := v.Validate(); err != nil {
  207. return AccessLogFilterValidationError{
  208. field: "ResponseFlagFilter",
  209. reason: "embedded message failed validation",
  210. cause: err,
  211. }
  212. }
  213. }
  214. case *AccessLogFilter_GrpcStatusFilter:
  215. if v, ok := interface{}(m.GetGrpcStatusFilter()).(interface{ Validate() error }); ok {
  216. if err := v.Validate(); err != nil {
  217. return AccessLogFilterValidationError{
  218. field: "GrpcStatusFilter",
  219. reason: "embedded message failed validation",
  220. cause: err,
  221. }
  222. }
  223. }
  224. case *AccessLogFilter_ExtensionFilter:
  225. if v, ok := interface{}(m.GetExtensionFilter()).(interface{ Validate() error }); ok {
  226. if err := v.Validate(); err != nil {
  227. return AccessLogFilterValidationError{
  228. field: "ExtensionFilter",
  229. reason: "embedded message failed validation",
  230. cause: err,
  231. }
  232. }
  233. }
  234. default:
  235. return AccessLogFilterValidationError{
  236. field: "FilterSpecifier",
  237. reason: "value is required",
  238. }
  239. }
  240. return nil
  241. }
  242. // AccessLogFilterValidationError is the validation error returned by
  243. // AccessLogFilter.Validate if the designated constraints aren't met.
  244. type AccessLogFilterValidationError struct {
  245. field string
  246. reason string
  247. cause error
  248. key bool
  249. }
  250. // Field function returns field value.
  251. func (e AccessLogFilterValidationError) Field() string { return e.field }
  252. // Reason function returns reason value.
  253. func (e AccessLogFilterValidationError) Reason() string { return e.reason }
  254. // Cause function returns cause value.
  255. func (e AccessLogFilterValidationError) Cause() error { return e.cause }
  256. // Key function returns key value.
  257. func (e AccessLogFilterValidationError) Key() bool { return e.key }
  258. // ErrorName returns error name.
  259. func (e AccessLogFilterValidationError) ErrorName() string { return "AccessLogFilterValidationError" }
  260. // Error satisfies the builtin error interface
  261. func (e AccessLogFilterValidationError) Error() string {
  262. cause := ""
  263. if e.cause != nil {
  264. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  265. }
  266. key := ""
  267. if e.key {
  268. key = "key for "
  269. }
  270. return fmt.Sprintf(
  271. "invalid %sAccessLogFilter.%s: %s%s",
  272. key,
  273. e.field,
  274. e.reason,
  275. cause)
  276. }
  277. var _ error = AccessLogFilterValidationError{}
  278. var _ interface {
  279. Field() string
  280. Reason() string
  281. Key() bool
  282. Cause() error
  283. ErrorName() string
  284. } = AccessLogFilterValidationError{}
  285. // Validate checks the field values on ComparisonFilter with the rules defined
  286. // in the proto definition for this message. If any rules are violated, an
  287. // error is returned.
  288. func (m *ComparisonFilter) Validate() error {
  289. if m == nil {
  290. return nil
  291. }
  292. if _, ok := ComparisonFilter_Op_name[int32(m.GetOp())]; !ok {
  293. return ComparisonFilterValidationError{
  294. field: "Op",
  295. reason: "value must be one of the defined enum values",
  296. }
  297. }
  298. if v, ok := interface{}(m.GetValue()).(interface{ Validate() error }); ok {
  299. if err := v.Validate(); err != nil {
  300. return ComparisonFilterValidationError{
  301. field: "Value",
  302. reason: "embedded message failed validation",
  303. cause: err,
  304. }
  305. }
  306. }
  307. return nil
  308. }
  309. // ComparisonFilterValidationError is the validation error returned by
  310. // ComparisonFilter.Validate if the designated constraints aren't met.
  311. type ComparisonFilterValidationError struct {
  312. field string
  313. reason string
  314. cause error
  315. key bool
  316. }
  317. // Field function returns field value.
  318. func (e ComparisonFilterValidationError) Field() string { return e.field }
  319. // Reason function returns reason value.
  320. func (e ComparisonFilterValidationError) Reason() string { return e.reason }
  321. // Cause function returns cause value.
  322. func (e ComparisonFilterValidationError) Cause() error { return e.cause }
  323. // Key function returns key value.
  324. func (e ComparisonFilterValidationError) Key() bool { return e.key }
  325. // ErrorName returns error name.
  326. func (e ComparisonFilterValidationError) ErrorName() string { return "ComparisonFilterValidationError" }
  327. // Error satisfies the builtin error interface
  328. func (e ComparisonFilterValidationError) Error() string {
  329. cause := ""
  330. if e.cause != nil {
  331. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  332. }
  333. key := ""
  334. if e.key {
  335. key = "key for "
  336. }
  337. return fmt.Sprintf(
  338. "invalid %sComparisonFilter.%s: %s%s",
  339. key,
  340. e.field,
  341. e.reason,
  342. cause)
  343. }
  344. var _ error = ComparisonFilterValidationError{}
  345. var _ interface {
  346. Field() string
  347. Reason() string
  348. Key() bool
  349. Cause() error
  350. ErrorName() string
  351. } = ComparisonFilterValidationError{}
  352. // Validate checks the field values on StatusCodeFilter with the rules defined
  353. // in the proto definition for this message. If any rules are violated, an
  354. // error is returned.
  355. func (m *StatusCodeFilter) Validate() error {
  356. if m == nil {
  357. return nil
  358. }
  359. if m.GetComparison() == nil {
  360. return StatusCodeFilterValidationError{
  361. field: "Comparison",
  362. reason: "value is required",
  363. }
  364. }
  365. if v, ok := interface{}(m.GetComparison()).(interface{ Validate() error }); ok {
  366. if err := v.Validate(); err != nil {
  367. return StatusCodeFilterValidationError{
  368. field: "Comparison",
  369. reason: "embedded message failed validation",
  370. cause: err,
  371. }
  372. }
  373. }
  374. return nil
  375. }
  376. // StatusCodeFilterValidationError is the validation error returned by
  377. // StatusCodeFilter.Validate if the designated constraints aren't met.
  378. type StatusCodeFilterValidationError struct {
  379. field string
  380. reason string
  381. cause error
  382. key bool
  383. }
  384. // Field function returns field value.
  385. func (e StatusCodeFilterValidationError) Field() string { return e.field }
  386. // Reason function returns reason value.
  387. func (e StatusCodeFilterValidationError) Reason() string { return e.reason }
  388. // Cause function returns cause value.
  389. func (e StatusCodeFilterValidationError) Cause() error { return e.cause }
  390. // Key function returns key value.
  391. func (e StatusCodeFilterValidationError) Key() bool { return e.key }
  392. // ErrorName returns error name.
  393. func (e StatusCodeFilterValidationError) ErrorName() string { return "StatusCodeFilterValidationError" }
  394. // Error satisfies the builtin error interface
  395. func (e StatusCodeFilterValidationError) Error() string {
  396. cause := ""
  397. if e.cause != nil {
  398. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  399. }
  400. key := ""
  401. if e.key {
  402. key = "key for "
  403. }
  404. return fmt.Sprintf(
  405. "invalid %sStatusCodeFilter.%s: %s%s",
  406. key,
  407. e.field,
  408. e.reason,
  409. cause)
  410. }
  411. var _ error = StatusCodeFilterValidationError{}
  412. var _ interface {
  413. Field() string
  414. Reason() string
  415. Key() bool
  416. Cause() error
  417. ErrorName() string
  418. } = StatusCodeFilterValidationError{}
  419. // Validate checks the field values on DurationFilter with the rules defined in
  420. // the proto definition for this message. If any rules are violated, an error
  421. // is returned.
  422. func (m *DurationFilter) Validate() error {
  423. if m == nil {
  424. return nil
  425. }
  426. if m.GetComparison() == nil {
  427. return DurationFilterValidationError{
  428. field: "Comparison",
  429. reason: "value is required",
  430. }
  431. }
  432. if v, ok := interface{}(m.GetComparison()).(interface{ Validate() error }); ok {
  433. if err := v.Validate(); err != nil {
  434. return DurationFilterValidationError{
  435. field: "Comparison",
  436. reason: "embedded message failed validation",
  437. cause: err,
  438. }
  439. }
  440. }
  441. return nil
  442. }
  443. // DurationFilterValidationError is the validation error returned by
  444. // DurationFilter.Validate if the designated constraints aren't met.
  445. type DurationFilterValidationError struct {
  446. field string
  447. reason string
  448. cause error
  449. key bool
  450. }
  451. // Field function returns field value.
  452. func (e DurationFilterValidationError) Field() string { return e.field }
  453. // Reason function returns reason value.
  454. func (e DurationFilterValidationError) Reason() string { return e.reason }
  455. // Cause function returns cause value.
  456. func (e DurationFilterValidationError) Cause() error { return e.cause }
  457. // Key function returns key value.
  458. func (e DurationFilterValidationError) Key() bool { return e.key }
  459. // ErrorName returns error name.
  460. func (e DurationFilterValidationError) ErrorName() string { return "DurationFilterValidationError" }
  461. // Error satisfies the builtin error interface
  462. func (e DurationFilterValidationError) Error() string {
  463. cause := ""
  464. if e.cause != nil {
  465. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  466. }
  467. key := ""
  468. if e.key {
  469. key = "key for "
  470. }
  471. return fmt.Sprintf(
  472. "invalid %sDurationFilter.%s: %s%s",
  473. key,
  474. e.field,
  475. e.reason,
  476. cause)
  477. }
  478. var _ error = DurationFilterValidationError{}
  479. var _ interface {
  480. Field() string
  481. Reason() string
  482. Key() bool
  483. Cause() error
  484. ErrorName() string
  485. } = DurationFilterValidationError{}
  486. // Validate checks the field values on NotHealthCheckFilter with the rules
  487. // defined in the proto definition for this message. If any rules are
  488. // violated, an error is returned.
  489. func (m *NotHealthCheckFilter) Validate() error {
  490. if m == nil {
  491. return nil
  492. }
  493. return nil
  494. }
  495. // NotHealthCheckFilterValidationError is the validation error returned by
  496. // NotHealthCheckFilter.Validate if the designated constraints aren't met.
  497. type NotHealthCheckFilterValidationError struct {
  498. field string
  499. reason string
  500. cause error
  501. key bool
  502. }
  503. // Field function returns field value.
  504. func (e NotHealthCheckFilterValidationError) Field() string { return e.field }
  505. // Reason function returns reason value.
  506. func (e NotHealthCheckFilterValidationError) Reason() string { return e.reason }
  507. // Cause function returns cause value.
  508. func (e NotHealthCheckFilterValidationError) Cause() error { return e.cause }
  509. // Key function returns key value.
  510. func (e NotHealthCheckFilterValidationError) Key() bool { return e.key }
  511. // ErrorName returns error name.
  512. func (e NotHealthCheckFilterValidationError) ErrorName() string {
  513. return "NotHealthCheckFilterValidationError"
  514. }
  515. // Error satisfies the builtin error interface
  516. func (e NotHealthCheckFilterValidationError) Error() string {
  517. cause := ""
  518. if e.cause != nil {
  519. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  520. }
  521. key := ""
  522. if e.key {
  523. key = "key for "
  524. }
  525. return fmt.Sprintf(
  526. "invalid %sNotHealthCheckFilter.%s: %s%s",
  527. key,
  528. e.field,
  529. e.reason,
  530. cause)
  531. }
  532. var _ error = NotHealthCheckFilterValidationError{}
  533. var _ interface {
  534. Field() string
  535. Reason() string
  536. Key() bool
  537. Cause() error
  538. ErrorName() string
  539. } = NotHealthCheckFilterValidationError{}
  540. // Validate checks the field values on TraceableFilter with the rules defined
  541. // in the proto definition for this message. If any rules are violated, an
  542. // error is returned.
  543. func (m *TraceableFilter) Validate() error {
  544. if m == nil {
  545. return nil
  546. }
  547. return nil
  548. }
  549. // TraceableFilterValidationError is the validation error returned by
  550. // TraceableFilter.Validate if the designated constraints aren't met.
  551. type TraceableFilterValidationError struct {
  552. field string
  553. reason string
  554. cause error
  555. key bool
  556. }
  557. // Field function returns field value.
  558. func (e TraceableFilterValidationError) Field() string { return e.field }
  559. // Reason function returns reason value.
  560. func (e TraceableFilterValidationError) Reason() string { return e.reason }
  561. // Cause function returns cause value.
  562. func (e TraceableFilterValidationError) Cause() error { return e.cause }
  563. // Key function returns key value.
  564. func (e TraceableFilterValidationError) Key() bool { return e.key }
  565. // ErrorName returns error name.
  566. func (e TraceableFilterValidationError) ErrorName() string { return "TraceableFilterValidationError" }
  567. // Error satisfies the builtin error interface
  568. func (e TraceableFilterValidationError) Error() string {
  569. cause := ""
  570. if e.cause != nil {
  571. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  572. }
  573. key := ""
  574. if e.key {
  575. key = "key for "
  576. }
  577. return fmt.Sprintf(
  578. "invalid %sTraceableFilter.%s: %s%s",
  579. key,
  580. e.field,
  581. e.reason,
  582. cause)
  583. }
  584. var _ error = TraceableFilterValidationError{}
  585. var _ interface {
  586. Field() string
  587. Reason() string
  588. Key() bool
  589. Cause() error
  590. ErrorName() string
  591. } = TraceableFilterValidationError{}
  592. // Validate checks the field values on RuntimeFilter with the rules defined in
  593. // the proto definition for this message. If any rules are violated, an error
  594. // is returned.
  595. func (m *RuntimeFilter) Validate() error {
  596. if m == nil {
  597. return nil
  598. }
  599. if len(m.GetRuntimeKey()) < 1 {
  600. return RuntimeFilterValidationError{
  601. field: "RuntimeKey",
  602. reason: "value length must be at least 1 bytes",
  603. }
  604. }
  605. if v, ok := interface{}(m.GetPercentSampled()).(interface{ Validate() error }); ok {
  606. if err := v.Validate(); err != nil {
  607. return RuntimeFilterValidationError{
  608. field: "PercentSampled",
  609. reason: "embedded message failed validation",
  610. cause: err,
  611. }
  612. }
  613. }
  614. // no validation rules for UseIndependentRandomness
  615. return nil
  616. }
  617. // RuntimeFilterValidationError is the validation error returned by
  618. // RuntimeFilter.Validate if the designated constraints aren't met.
  619. type RuntimeFilterValidationError struct {
  620. field string
  621. reason string
  622. cause error
  623. key bool
  624. }
  625. // Field function returns field value.
  626. func (e RuntimeFilterValidationError) Field() string { return e.field }
  627. // Reason function returns reason value.
  628. func (e RuntimeFilterValidationError) Reason() string { return e.reason }
  629. // Cause function returns cause value.
  630. func (e RuntimeFilterValidationError) Cause() error { return e.cause }
  631. // Key function returns key value.
  632. func (e RuntimeFilterValidationError) Key() bool { return e.key }
  633. // ErrorName returns error name.
  634. func (e RuntimeFilterValidationError) ErrorName() string { return "RuntimeFilterValidationError" }
  635. // Error satisfies the builtin error interface
  636. func (e RuntimeFilterValidationError) Error() string {
  637. cause := ""
  638. if e.cause != nil {
  639. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  640. }
  641. key := ""
  642. if e.key {
  643. key = "key for "
  644. }
  645. return fmt.Sprintf(
  646. "invalid %sRuntimeFilter.%s: %s%s",
  647. key,
  648. e.field,
  649. e.reason,
  650. cause)
  651. }
  652. var _ error = RuntimeFilterValidationError{}
  653. var _ interface {
  654. Field() string
  655. Reason() string
  656. Key() bool
  657. Cause() error
  658. ErrorName() string
  659. } = RuntimeFilterValidationError{}
  660. // Validate checks the field values on AndFilter with the rules defined in the
  661. // proto definition for this message. If any rules are violated, an error is returned.
  662. func (m *AndFilter) Validate() error {
  663. if m == nil {
  664. return nil
  665. }
  666. if len(m.GetFilters()) < 2 {
  667. return AndFilterValidationError{
  668. field: "Filters",
  669. reason: "value must contain at least 2 item(s)",
  670. }
  671. }
  672. for idx, item := range m.GetFilters() {
  673. _, _ = idx, item
  674. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  675. if err := v.Validate(); err != nil {
  676. return AndFilterValidationError{
  677. field: fmt.Sprintf("Filters[%v]", idx),
  678. reason: "embedded message failed validation",
  679. cause: err,
  680. }
  681. }
  682. }
  683. }
  684. return nil
  685. }
  686. // AndFilterValidationError is the validation error returned by
  687. // AndFilter.Validate if the designated constraints aren't met.
  688. type AndFilterValidationError struct {
  689. field string
  690. reason string
  691. cause error
  692. key bool
  693. }
  694. // Field function returns field value.
  695. func (e AndFilterValidationError) Field() string { return e.field }
  696. // Reason function returns reason value.
  697. func (e AndFilterValidationError) Reason() string { return e.reason }
  698. // Cause function returns cause value.
  699. func (e AndFilterValidationError) Cause() error { return e.cause }
  700. // Key function returns key value.
  701. func (e AndFilterValidationError) Key() bool { return e.key }
  702. // ErrorName returns error name.
  703. func (e AndFilterValidationError) ErrorName() string { return "AndFilterValidationError" }
  704. // Error satisfies the builtin error interface
  705. func (e AndFilterValidationError) Error() string {
  706. cause := ""
  707. if e.cause != nil {
  708. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  709. }
  710. key := ""
  711. if e.key {
  712. key = "key for "
  713. }
  714. return fmt.Sprintf(
  715. "invalid %sAndFilter.%s: %s%s",
  716. key,
  717. e.field,
  718. e.reason,
  719. cause)
  720. }
  721. var _ error = AndFilterValidationError{}
  722. var _ interface {
  723. Field() string
  724. Reason() string
  725. Key() bool
  726. Cause() error
  727. ErrorName() string
  728. } = AndFilterValidationError{}
  729. // Validate checks the field values on OrFilter with the rules defined in the
  730. // proto definition for this message. If any rules are violated, an error is returned.
  731. func (m *OrFilter) Validate() error {
  732. if m == nil {
  733. return nil
  734. }
  735. if len(m.GetFilters()) < 2 {
  736. return OrFilterValidationError{
  737. field: "Filters",
  738. reason: "value must contain at least 2 item(s)",
  739. }
  740. }
  741. for idx, item := range m.GetFilters() {
  742. _, _ = idx, item
  743. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  744. if err := v.Validate(); err != nil {
  745. return OrFilterValidationError{
  746. field: fmt.Sprintf("Filters[%v]", idx),
  747. reason: "embedded message failed validation",
  748. cause: err,
  749. }
  750. }
  751. }
  752. }
  753. return nil
  754. }
  755. // OrFilterValidationError is the validation error returned by
  756. // OrFilter.Validate if the designated constraints aren't met.
  757. type OrFilterValidationError struct {
  758. field string
  759. reason string
  760. cause error
  761. key bool
  762. }
  763. // Field function returns field value.
  764. func (e OrFilterValidationError) Field() string { return e.field }
  765. // Reason function returns reason value.
  766. func (e OrFilterValidationError) Reason() string { return e.reason }
  767. // Cause function returns cause value.
  768. func (e OrFilterValidationError) Cause() error { return e.cause }
  769. // Key function returns key value.
  770. func (e OrFilterValidationError) Key() bool { return e.key }
  771. // ErrorName returns error name.
  772. func (e OrFilterValidationError) ErrorName() string { return "OrFilterValidationError" }
  773. // Error satisfies the builtin error interface
  774. func (e OrFilterValidationError) Error() string {
  775. cause := ""
  776. if e.cause != nil {
  777. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  778. }
  779. key := ""
  780. if e.key {
  781. key = "key for "
  782. }
  783. return fmt.Sprintf(
  784. "invalid %sOrFilter.%s: %s%s",
  785. key,
  786. e.field,
  787. e.reason,
  788. cause)
  789. }
  790. var _ error = OrFilterValidationError{}
  791. var _ interface {
  792. Field() string
  793. Reason() string
  794. Key() bool
  795. Cause() error
  796. ErrorName() string
  797. } = OrFilterValidationError{}
  798. // Validate checks the field values on HeaderFilter with the rules defined in
  799. // the proto definition for this message. If any rules are violated, an error
  800. // is returned.
  801. func (m *HeaderFilter) Validate() error {
  802. if m == nil {
  803. return nil
  804. }
  805. if m.GetHeader() == nil {
  806. return HeaderFilterValidationError{
  807. field: "Header",
  808. reason: "value is required",
  809. }
  810. }
  811. if v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok {
  812. if err := v.Validate(); err != nil {
  813. return HeaderFilterValidationError{
  814. field: "Header",
  815. reason: "embedded message failed validation",
  816. cause: err,
  817. }
  818. }
  819. }
  820. return nil
  821. }
  822. // HeaderFilterValidationError is the validation error returned by
  823. // HeaderFilter.Validate if the designated constraints aren't met.
  824. type HeaderFilterValidationError struct {
  825. field string
  826. reason string
  827. cause error
  828. key bool
  829. }
  830. // Field function returns field value.
  831. func (e HeaderFilterValidationError) Field() string { return e.field }
  832. // Reason function returns reason value.
  833. func (e HeaderFilterValidationError) Reason() string { return e.reason }
  834. // Cause function returns cause value.
  835. func (e HeaderFilterValidationError) Cause() error { return e.cause }
  836. // Key function returns key value.
  837. func (e HeaderFilterValidationError) Key() bool { return e.key }
  838. // ErrorName returns error name.
  839. func (e HeaderFilterValidationError) ErrorName() string { return "HeaderFilterValidationError" }
  840. // Error satisfies the builtin error interface
  841. func (e HeaderFilterValidationError) Error() string {
  842. cause := ""
  843. if e.cause != nil {
  844. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  845. }
  846. key := ""
  847. if e.key {
  848. key = "key for "
  849. }
  850. return fmt.Sprintf(
  851. "invalid %sHeaderFilter.%s: %s%s",
  852. key,
  853. e.field,
  854. e.reason,
  855. cause)
  856. }
  857. var _ error = HeaderFilterValidationError{}
  858. var _ interface {
  859. Field() string
  860. Reason() string
  861. Key() bool
  862. Cause() error
  863. ErrorName() string
  864. } = HeaderFilterValidationError{}
  865. // Validate checks the field values on ResponseFlagFilter with the rules
  866. // defined in the proto definition for this message. If any rules are
  867. // violated, an error is returned.
  868. func (m *ResponseFlagFilter) Validate() error {
  869. if m == nil {
  870. return nil
  871. }
  872. for idx, item := range m.GetFlags() {
  873. _, _ = idx, item
  874. if _, ok := _ResponseFlagFilter_Flags_InLookup[item]; !ok {
  875. return ResponseFlagFilterValidationError{
  876. field: fmt.Sprintf("Flags[%v]", idx),
  877. reason: "value must be in list [LH UH UT LR UR UF UC UO NR DI FI RL UAEX RLSE DC URX SI IH DPE]",
  878. }
  879. }
  880. }
  881. return nil
  882. }
  883. // ResponseFlagFilterValidationError is the validation error returned by
  884. // ResponseFlagFilter.Validate if the designated constraints aren't met.
  885. type ResponseFlagFilterValidationError struct {
  886. field string
  887. reason string
  888. cause error
  889. key bool
  890. }
  891. // Field function returns field value.
  892. func (e ResponseFlagFilterValidationError) Field() string { return e.field }
  893. // Reason function returns reason value.
  894. func (e ResponseFlagFilterValidationError) Reason() string { return e.reason }
  895. // Cause function returns cause value.
  896. func (e ResponseFlagFilterValidationError) Cause() error { return e.cause }
  897. // Key function returns key value.
  898. func (e ResponseFlagFilterValidationError) Key() bool { return e.key }
  899. // ErrorName returns error name.
  900. func (e ResponseFlagFilterValidationError) ErrorName() string {
  901. return "ResponseFlagFilterValidationError"
  902. }
  903. // Error satisfies the builtin error interface
  904. func (e ResponseFlagFilterValidationError) Error() string {
  905. cause := ""
  906. if e.cause != nil {
  907. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  908. }
  909. key := ""
  910. if e.key {
  911. key = "key for "
  912. }
  913. return fmt.Sprintf(
  914. "invalid %sResponseFlagFilter.%s: %s%s",
  915. key,
  916. e.field,
  917. e.reason,
  918. cause)
  919. }
  920. var _ error = ResponseFlagFilterValidationError{}
  921. var _ interface {
  922. Field() string
  923. Reason() string
  924. Key() bool
  925. Cause() error
  926. ErrorName() string
  927. } = ResponseFlagFilterValidationError{}
  928. var _ResponseFlagFilter_Flags_InLookup = map[string]struct{}{
  929. "LH": {},
  930. "UH": {},
  931. "UT": {},
  932. "LR": {},
  933. "UR": {},
  934. "UF": {},
  935. "UC": {},
  936. "UO": {},
  937. "NR": {},
  938. "DI": {},
  939. "FI": {},
  940. "RL": {},
  941. "UAEX": {},
  942. "RLSE": {},
  943. "DC": {},
  944. "URX": {},
  945. "SI": {},
  946. "IH": {},
  947. "DPE": {},
  948. }
  949. // Validate checks the field values on GrpcStatusFilter with the rules defined
  950. // in the proto definition for this message. If any rules are violated, an
  951. // error is returned.
  952. func (m *GrpcStatusFilter) Validate() error {
  953. if m == nil {
  954. return nil
  955. }
  956. for idx, item := range m.GetStatuses() {
  957. _, _ = idx, item
  958. if _, ok := GrpcStatusFilter_Status_name[int32(item)]; !ok {
  959. return GrpcStatusFilterValidationError{
  960. field: fmt.Sprintf("Statuses[%v]", idx),
  961. reason: "value must be one of the defined enum values",
  962. }
  963. }
  964. }
  965. // no validation rules for Exclude
  966. return nil
  967. }
  968. // GrpcStatusFilterValidationError is the validation error returned by
  969. // GrpcStatusFilter.Validate if the designated constraints aren't met.
  970. type GrpcStatusFilterValidationError struct {
  971. field string
  972. reason string
  973. cause error
  974. key bool
  975. }
  976. // Field function returns field value.
  977. func (e GrpcStatusFilterValidationError) Field() string { return e.field }
  978. // Reason function returns reason value.
  979. func (e GrpcStatusFilterValidationError) Reason() string { return e.reason }
  980. // Cause function returns cause value.
  981. func (e GrpcStatusFilterValidationError) Cause() error { return e.cause }
  982. // Key function returns key value.
  983. func (e GrpcStatusFilterValidationError) Key() bool { return e.key }
  984. // ErrorName returns error name.
  985. func (e GrpcStatusFilterValidationError) ErrorName() string { return "GrpcStatusFilterValidationError" }
  986. // Error satisfies the builtin error interface
  987. func (e GrpcStatusFilterValidationError) Error() string {
  988. cause := ""
  989. if e.cause != nil {
  990. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  991. }
  992. key := ""
  993. if e.key {
  994. key = "key for "
  995. }
  996. return fmt.Sprintf(
  997. "invalid %sGrpcStatusFilter.%s: %s%s",
  998. key,
  999. e.field,
  1000. e.reason,
  1001. cause)
  1002. }
  1003. var _ error = GrpcStatusFilterValidationError{}
  1004. var _ interface {
  1005. Field() string
  1006. Reason() string
  1007. Key() bool
  1008. Cause() error
  1009. ErrorName() string
  1010. } = GrpcStatusFilterValidationError{}
  1011. // Validate checks the field values on ExtensionFilter with the rules defined
  1012. // in the proto definition for this message. If any rules are violated, an
  1013. // error is returned.
  1014. func (m *ExtensionFilter) Validate() error {
  1015. if m == nil {
  1016. return nil
  1017. }
  1018. // no validation rules for Name
  1019. switch m.ConfigType.(type) {
  1020. case *ExtensionFilter_Config:
  1021. if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok {
  1022. if err := v.Validate(); err != nil {
  1023. return ExtensionFilterValidationError{
  1024. field: "Config",
  1025. reason: "embedded message failed validation",
  1026. cause: err,
  1027. }
  1028. }
  1029. }
  1030. case *ExtensionFilter_TypedConfig:
  1031. if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok {
  1032. if err := v.Validate(); err != nil {
  1033. return ExtensionFilterValidationError{
  1034. field: "TypedConfig",
  1035. reason: "embedded message failed validation",
  1036. cause: err,
  1037. }
  1038. }
  1039. }
  1040. }
  1041. return nil
  1042. }
  1043. // ExtensionFilterValidationError is the validation error returned by
  1044. // ExtensionFilter.Validate if the designated constraints aren't met.
  1045. type ExtensionFilterValidationError struct {
  1046. field string
  1047. reason string
  1048. cause error
  1049. key bool
  1050. }
  1051. // Field function returns field value.
  1052. func (e ExtensionFilterValidationError) Field() string { return e.field }
  1053. // Reason function returns reason value.
  1054. func (e ExtensionFilterValidationError) Reason() string { return e.reason }
  1055. // Cause function returns cause value.
  1056. func (e ExtensionFilterValidationError) Cause() error { return e.cause }
  1057. // Key function returns key value.
  1058. func (e ExtensionFilterValidationError) Key() bool { return e.key }
  1059. // ErrorName returns error name.
  1060. func (e ExtensionFilterValidationError) ErrorName() string { return "ExtensionFilterValidationError" }
  1061. // Error satisfies the builtin error interface
  1062. func (e ExtensionFilterValidationError) Error() string {
  1063. cause := ""
  1064. if e.cause != nil {
  1065. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  1066. }
  1067. key := ""
  1068. if e.key {
  1069. key = "key for "
  1070. }
  1071. return fmt.Sprintf(
  1072. "invalid %sExtensionFilter.%s: %s%s",
  1073. key,
  1074. e.field,
  1075. e.reason,
  1076. cause)
  1077. }
  1078. var _ error = ExtensionFilterValidationError{}
  1079. var _ interface {
  1080. Field() string
  1081. Reason() string
  1082. Key() bool
  1083. Cause() error
  1084. ErrorName() string
  1085. } = ExtensionFilterValidationError{}