/pkg/api/envoy/config/accesslog/v4alpha/accesslog.pb.validate.go

https://github.com/datawire/ambassador · Go · 1317 lines · 908 code · 250 blank · 159 comment · 152 complexity · 1a14e69468c4d4c8963a631f55b58ab8 MD5 · raw file

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