/pkg/api/envoy/extensions/filters/http/jwt_authn/v3/config.pb.validate.go

https://github.com/datawire/ambassador · Go · 1015 lines · 700 code · 196 blank · 119 comment · 122 complexity · 4ecdf501e49ef274e23f831b6efccacb MD5 · raw file

  1. // Code generated by protoc-gen-validate. DO NOT EDIT.
  2. // source: envoy/extensions/filters/http/jwt_authn/v3/config.proto
  3. package envoy_extensions_filters_http_jwt_authn_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 _config_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 JwtProvider with the rules defined in
  34. // the proto definition for this message. If any rules are violated, an error
  35. // is returned.
  36. func (m *JwtProvider) Validate() error {
  37. if m == nil {
  38. return nil
  39. }
  40. if len(m.GetIssuer()) < 1 {
  41. return JwtProviderValidationError{
  42. field: "Issuer",
  43. reason: "value length must be at least 1 bytes",
  44. }
  45. }
  46. // no validation rules for Forward
  47. for idx, item := range m.GetFromHeaders() {
  48. _, _ = idx, item
  49. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  50. if err := v.Validate(); err != nil {
  51. return JwtProviderValidationError{
  52. field: fmt.Sprintf("FromHeaders[%v]", idx),
  53. reason: "embedded message failed validation",
  54. cause: err,
  55. }
  56. }
  57. }
  58. }
  59. if !_JwtProvider_ForwardPayloadHeader_Pattern.MatchString(m.GetForwardPayloadHeader()) {
  60. return JwtProviderValidationError{
  61. field: "ForwardPayloadHeader",
  62. reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
  63. }
  64. }
  65. // no validation rules for PayloadInMetadata
  66. switch m.JwksSourceSpecifier.(type) {
  67. case *JwtProvider_RemoteJwks:
  68. if v, ok := interface{}(m.GetRemoteJwks()).(interface{ Validate() error }); ok {
  69. if err := v.Validate(); err != nil {
  70. return JwtProviderValidationError{
  71. field: "RemoteJwks",
  72. reason: "embedded message failed validation",
  73. cause: err,
  74. }
  75. }
  76. }
  77. case *JwtProvider_LocalJwks:
  78. if v, ok := interface{}(m.GetLocalJwks()).(interface{ Validate() error }); ok {
  79. if err := v.Validate(); err != nil {
  80. return JwtProviderValidationError{
  81. field: "LocalJwks",
  82. reason: "embedded message failed validation",
  83. cause: err,
  84. }
  85. }
  86. }
  87. default:
  88. return JwtProviderValidationError{
  89. field: "JwksSourceSpecifier",
  90. reason: "value is required",
  91. }
  92. }
  93. return nil
  94. }
  95. // JwtProviderValidationError is the validation error returned by
  96. // JwtProvider.Validate if the designated constraints aren't met.
  97. type JwtProviderValidationError struct {
  98. field string
  99. reason string
  100. cause error
  101. key bool
  102. }
  103. // Field function returns field value.
  104. func (e JwtProviderValidationError) Field() string { return e.field }
  105. // Reason function returns reason value.
  106. func (e JwtProviderValidationError) Reason() string { return e.reason }
  107. // Cause function returns cause value.
  108. func (e JwtProviderValidationError) Cause() error { return e.cause }
  109. // Key function returns key value.
  110. func (e JwtProviderValidationError) Key() bool { return e.key }
  111. // ErrorName returns error name.
  112. func (e JwtProviderValidationError) ErrorName() string { return "JwtProviderValidationError" }
  113. // Error satisfies the builtin error interface
  114. func (e JwtProviderValidationError) Error() string {
  115. cause := ""
  116. if e.cause != nil {
  117. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  118. }
  119. key := ""
  120. if e.key {
  121. key = "key for "
  122. }
  123. return fmt.Sprintf(
  124. "invalid %sJwtProvider.%s: %s%s",
  125. key,
  126. e.field,
  127. e.reason,
  128. cause)
  129. }
  130. var _ error = JwtProviderValidationError{}
  131. var _ interface {
  132. Field() string
  133. Reason() string
  134. Key() bool
  135. Cause() error
  136. ErrorName() string
  137. } = JwtProviderValidationError{}
  138. var _JwtProvider_ForwardPayloadHeader_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
  139. // Validate checks the field values on RemoteJwks with the rules defined in the
  140. // proto definition for this message. If any rules are violated, an error is returned.
  141. func (m *RemoteJwks) Validate() error {
  142. if m == nil {
  143. return nil
  144. }
  145. if v, ok := interface{}(m.GetHttpUri()).(interface{ Validate() error }); ok {
  146. if err := v.Validate(); err != nil {
  147. return RemoteJwksValidationError{
  148. field: "HttpUri",
  149. reason: "embedded message failed validation",
  150. cause: err,
  151. }
  152. }
  153. }
  154. if v, ok := interface{}(m.GetCacheDuration()).(interface{ Validate() error }); ok {
  155. if err := v.Validate(); err != nil {
  156. return RemoteJwksValidationError{
  157. field: "CacheDuration",
  158. reason: "embedded message failed validation",
  159. cause: err,
  160. }
  161. }
  162. }
  163. return nil
  164. }
  165. // RemoteJwksValidationError is the validation error returned by
  166. // RemoteJwks.Validate if the designated constraints aren't met.
  167. type RemoteJwksValidationError struct {
  168. field string
  169. reason string
  170. cause error
  171. key bool
  172. }
  173. // Field function returns field value.
  174. func (e RemoteJwksValidationError) Field() string { return e.field }
  175. // Reason function returns reason value.
  176. func (e RemoteJwksValidationError) Reason() string { return e.reason }
  177. // Cause function returns cause value.
  178. func (e RemoteJwksValidationError) Cause() error { return e.cause }
  179. // Key function returns key value.
  180. func (e RemoteJwksValidationError) Key() bool { return e.key }
  181. // ErrorName returns error name.
  182. func (e RemoteJwksValidationError) ErrorName() string { return "RemoteJwksValidationError" }
  183. // Error satisfies the builtin error interface
  184. func (e RemoteJwksValidationError) Error() string {
  185. cause := ""
  186. if e.cause != nil {
  187. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  188. }
  189. key := ""
  190. if e.key {
  191. key = "key for "
  192. }
  193. return fmt.Sprintf(
  194. "invalid %sRemoteJwks.%s: %s%s",
  195. key,
  196. e.field,
  197. e.reason,
  198. cause)
  199. }
  200. var _ error = RemoteJwksValidationError{}
  201. var _ interface {
  202. Field() string
  203. Reason() string
  204. Key() bool
  205. Cause() error
  206. ErrorName() string
  207. } = RemoteJwksValidationError{}
  208. // Validate checks the field values on JwtHeader with the rules defined in the
  209. // proto definition for this message. If any rules are violated, an error is returned.
  210. func (m *JwtHeader) Validate() error {
  211. if m == nil {
  212. return nil
  213. }
  214. if len(m.GetName()) < 1 {
  215. return JwtHeaderValidationError{
  216. field: "Name",
  217. reason: "value length must be at least 1 bytes",
  218. }
  219. }
  220. if !_JwtHeader_Name_Pattern.MatchString(m.GetName()) {
  221. return JwtHeaderValidationError{
  222. field: "Name",
  223. reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
  224. }
  225. }
  226. if !_JwtHeader_ValuePrefix_Pattern.MatchString(m.GetValuePrefix()) {
  227. return JwtHeaderValidationError{
  228. field: "ValuePrefix",
  229. reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
  230. }
  231. }
  232. return nil
  233. }
  234. // JwtHeaderValidationError is the validation error returned by
  235. // JwtHeader.Validate if the designated constraints aren't met.
  236. type JwtHeaderValidationError struct {
  237. field string
  238. reason string
  239. cause error
  240. key bool
  241. }
  242. // Field function returns field value.
  243. func (e JwtHeaderValidationError) Field() string { return e.field }
  244. // Reason function returns reason value.
  245. func (e JwtHeaderValidationError) Reason() string { return e.reason }
  246. // Cause function returns cause value.
  247. func (e JwtHeaderValidationError) Cause() error { return e.cause }
  248. // Key function returns key value.
  249. func (e JwtHeaderValidationError) Key() bool { return e.key }
  250. // ErrorName returns error name.
  251. func (e JwtHeaderValidationError) ErrorName() string { return "JwtHeaderValidationError" }
  252. // Error satisfies the builtin error interface
  253. func (e JwtHeaderValidationError) Error() string {
  254. cause := ""
  255. if e.cause != nil {
  256. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  257. }
  258. key := ""
  259. if e.key {
  260. key = "key for "
  261. }
  262. return fmt.Sprintf(
  263. "invalid %sJwtHeader.%s: %s%s",
  264. key,
  265. e.field,
  266. e.reason,
  267. cause)
  268. }
  269. var _ error = JwtHeaderValidationError{}
  270. var _ interface {
  271. Field() string
  272. Reason() string
  273. Key() bool
  274. Cause() error
  275. ErrorName() string
  276. } = JwtHeaderValidationError{}
  277. var _JwtHeader_Name_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
  278. var _JwtHeader_ValuePrefix_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
  279. // Validate checks the field values on ProviderWithAudiences with the rules
  280. // defined in the proto definition for this message. If any rules are
  281. // violated, an error is returned.
  282. func (m *ProviderWithAudiences) Validate() error {
  283. if m == nil {
  284. return nil
  285. }
  286. // no validation rules for ProviderName
  287. return nil
  288. }
  289. // ProviderWithAudiencesValidationError is the validation error returned by
  290. // ProviderWithAudiences.Validate if the designated constraints aren't met.
  291. type ProviderWithAudiencesValidationError struct {
  292. field string
  293. reason string
  294. cause error
  295. key bool
  296. }
  297. // Field function returns field value.
  298. func (e ProviderWithAudiencesValidationError) Field() string { return e.field }
  299. // Reason function returns reason value.
  300. func (e ProviderWithAudiencesValidationError) Reason() string { return e.reason }
  301. // Cause function returns cause value.
  302. func (e ProviderWithAudiencesValidationError) Cause() error { return e.cause }
  303. // Key function returns key value.
  304. func (e ProviderWithAudiencesValidationError) Key() bool { return e.key }
  305. // ErrorName returns error name.
  306. func (e ProviderWithAudiencesValidationError) ErrorName() string {
  307. return "ProviderWithAudiencesValidationError"
  308. }
  309. // Error satisfies the builtin error interface
  310. func (e ProviderWithAudiencesValidationError) Error() string {
  311. cause := ""
  312. if e.cause != nil {
  313. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  314. }
  315. key := ""
  316. if e.key {
  317. key = "key for "
  318. }
  319. return fmt.Sprintf(
  320. "invalid %sProviderWithAudiences.%s: %s%s",
  321. key,
  322. e.field,
  323. e.reason,
  324. cause)
  325. }
  326. var _ error = ProviderWithAudiencesValidationError{}
  327. var _ interface {
  328. Field() string
  329. Reason() string
  330. Key() bool
  331. Cause() error
  332. ErrorName() string
  333. } = ProviderWithAudiencesValidationError{}
  334. // Validate checks the field values on JwtRequirement with the rules defined in
  335. // the proto definition for this message. If any rules are violated, an error
  336. // is returned.
  337. func (m *JwtRequirement) Validate() error {
  338. if m == nil {
  339. return nil
  340. }
  341. switch m.RequiresType.(type) {
  342. case *JwtRequirement_ProviderName:
  343. // no validation rules for ProviderName
  344. case *JwtRequirement_ProviderAndAudiences:
  345. if v, ok := interface{}(m.GetProviderAndAudiences()).(interface{ Validate() error }); ok {
  346. if err := v.Validate(); err != nil {
  347. return JwtRequirementValidationError{
  348. field: "ProviderAndAudiences",
  349. reason: "embedded message failed validation",
  350. cause: err,
  351. }
  352. }
  353. }
  354. case *JwtRequirement_RequiresAny:
  355. if v, ok := interface{}(m.GetRequiresAny()).(interface{ Validate() error }); ok {
  356. if err := v.Validate(); err != nil {
  357. return JwtRequirementValidationError{
  358. field: "RequiresAny",
  359. reason: "embedded message failed validation",
  360. cause: err,
  361. }
  362. }
  363. }
  364. case *JwtRequirement_RequiresAll:
  365. if v, ok := interface{}(m.GetRequiresAll()).(interface{ Validate() error }); ok {
  366. if err := v.Validate(); err != nil {
  367. return JwtRequirementValidationError{
  368. field: "RequiresAll",
  369. reason: "embedded message failed validation",
  370. cause: err,
  371. }
  372. }
  373. }
  374. case *JwtRequirement_AllowMissingOrFailed:
  375. if v, ok := interface{}(m.GetAllowMissingOrFailed()).(interface{ Validate() error }); ok {
  376. if err := v.Validate(); err != nil {
  377. return JwtRequirementValidationError{
  378. field: "AllowMissingOrFailed",
  379. reason: "embedded message failed validation",
  380. cause: err,
  381. }
  382. }
  383. }
  384. case *JwtRequirement_AllowMissing:
  385. if v, ok := interface{}(m.GetAllowMissing()).(interface{ Validate() error }); ok {
  386. if err := v.Validate(); err != nil {
  387. return JwtRequirementValidationError{
  388. field: "AllowMissing",
  389. reason: "embedded message failed validation",
  390. cause: err,
  391. }
  392. }
  393. }
  394. }
  395. return nil
  396. }
  397. // JwtRequirementValidationError is the validation error returned by
  398. // JwtRequirement.Validate if the designated constraints aren't met.
  399. type JwtRequirementValidationError struct {
  400. field string
  401. reason string
  402. cause error
  403. key bool
  404. }
  405. // Field function returns field value.
  406. func (e JwtRequirementValidationError) Field() string { return e.field }
  407. // Reason function returns reason value.
  408. func (e JwtRequirementValidationError) Reason() string { return e.reason }
  409. // Cause function returns cause value.
  410. func (e JwtRequirementValidationError) Cause() error { return e.cause }
  411. // Key function returns key value.
  412. func (e JwtRequirementValidationError) Key() bool { return e.key }
  413. // ErrorName returns error name.
  414. func (e JwtRequirementValidationError) ErrorName() string { return "JwtRequirementValidationError" }
  415. // Error satisfies the builtin error interface
  416. func (e JwtRequirementValidationError) Error() string {
  417. cause := ""
  418. if e.cause != nil {
  419. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  420. }
  421. key := ""
  422. if e.key {
  423. key = "key for "
  424. }
  425. return fmt.Sprintf(
  426. "invalid %sJwtRequirement.%s: %s%s",
  427. key,
  428. e.field,
  429. e.reason,
  430. cause)
  431. }
  432. var _ error = JwtRequirementValidationError{}
  433. var _ interface {
  434. Field() string
  435. Reason() string
  436. Key() bool
  437. Cause() error
  438. ErrorName() string
  439. } = JwtRequirementValidationError{}
  440. // Validate checks the field values on JwtRequirementOrList with the rules
  441. // defined in the proto definition for this message. If any rules are
  442. // violated, an error is returned.
  443. func (m *JwtRequirementOrList) Validate() error {
  444. if m == nil {
  445. return nil
  446. }
  447. if len(m.GetRequirements()) < 2 {
  448. return JwtRequirementOrListValidationError{
  449. field: "Requirements",
  450. reason: "value must contain at least 2 item(s)",
  451. }
  452. }
  453. for idx, item := range m.GetRequirements() {
  454. _, _ = idx, item
  455. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  456. if err := v.Validate(); err != nil {
  457. return JwtRequirementOrListValidationError{
  458. field: fmt.Sprintf("Requirements[%v]", idx),
  459. reason: "embedded message failed validation",
  460. cause: err,
  461. }
  462. }
  463. }
  464. }
  465. return nil
  466. }
  467. // JwtRequirementOrListValidationError is the validation error returned by
  468. // JwtRequirementOrList.Validate if the designated constraints aren't met.
  469. type JwtRequirementOrListValidationError struct {
  470. field string
  471. reason string
  472. cause error
  473. key bool
  474. }
  475. // Field function returns field value.
  476. func (e JwtRequirementOrListValidationError) Field() string { return e.field }
  477. // Reason function returns reason value.
  478. func (e JwtRequirementOrListValidationError) Reason() string { return e.reason }
  479. // Cause function returns cause value.
  480. func (e JwtRequirementOrListValidationError) Cause() error { return e.cause }
  481. // Key function returns key value.
  482. func (e JwtRequirementOrListValidationError) Key() bool { return e.key }
  483. // ErrorName returns error name.
  484. func (e JwtRequirementOrListValidationError) ErrorName() string {
  485. return "JwtRequirementOrListValidationError"
  486. }
  487. // Error satisfies the builtin error interface
  488. func (e JwtRequirementOrListValidationError) Error() string {
  489. cause := ""
  490. if e.cause != nil {
  491. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  492. }
  493. key := ""
  494. if e.key {
  495. key = "key for "
  496. }
  497. return fmt.Sprintf(
  498. "invalid %sJwtRequirementOrList.%s: %s%s",
  499. key,
  500. e.field,
  501. e.reason,
  502. cause)
  503. }
  504. var _ error = JwtRequirementOrListValidationError{}
  505. var _ interface {
  506. Field() string
  507. Reason() string
  508. Key() bool
  509. Cause() error
  510. ErrorName() string
  511. } = JwtRequirementOrListValidationError{}
  512. // Validate checks the field values on JwtRequirementAndList with the rules
  513. // defined in the proto definition for this message. If any rules are
  514. // violated, an error is returned.
  515. func (m *JwtRequirementAndList) Validate() error {
  516. if m == nil {
  517. return nil
  518. }
  519. if len(m.GetRequirements()) < 2 {
  520. return JwtRequirementAndListValidationError{
  521. field: "Requirements",
  522. reason: "value must contain at least 2 item(s)",
  523. }
  524. }
  525. for idx, item := range m.GetRequirements() {
  526. _, _ = idx, item
  527. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  528. if err := v.Validate(); err != nil {
  529. return JwtRequirementAndListValidationError{
  530. field: fmt.Sprintf("Requirements[%v]", idx),
  531. reason: "embedded message failed validation",
  532. cause: err,
  533. }
  534. }
  535. }
  536. }
  537. return nil
  538. }
  539. // JwtRequirementAndListValidationError is the validation error returned by
  540. // JwtRequirementAndList.Validate if the designated constraints aren't met.
  541. type JwtRequirementAndListValidationError struct {
  542. field string
  543. reason string
  544. cause error
  545. key bool
  546. }
  547. // Field function returns field value.
  548. func (e JwtRequirementAndListValidationError) Field() string { return e.field }
  549. // Reason function returns reason value.
  550. func (e JwtRequirementAndListValidationError) Reason() string { return e.reason }
  551. // Cause function returns cause value.
  552. func (e JwtRequirementAndListValidationError) Cause() error { return e.cause }
  553. // Key function returns key value.
  554. func (e JwtRequirementAndListValidationError) Key() bool { return e.key }
  555. // ErrorName returns error name.
  556. func (e JwtRequirementAndListValidationError) ErrorName() string {
  557. return "JwtRequirementAndListValidationError"
  558. }
  559. // Error satisfies the builtin error interface
  560. func (e JwtRequirementAndListValidationError) Error() string {
  561. cause := ""
  562. if e.cause != nil {
  563. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  564. }
  565. key := ""
  566. if e.key {
  567. key = "key for "
  568. }
  569. return fmt.Sprintf(
  570. "invalid %sJwtRequirementAndList.%s: %s%s",
  571. key,
  572. e.field,
  573. e.reason,
  574. cause)
  575. }
  576. var _ error = JwtRequirementAndListValidationError{}
  577. var _ interface {
  578. Field() string
  579. Reason() string
  580. Key() bool
  581. Cause() error
  582. ErrorName() string
  583. } = JwtRequirementAndListValidationError{}
  584. // Validate checks the field values on RequirementRule with the rules defined
  585. // in the proto definition for this message. If any rules are violated, an
  586. // error is returned.
  587. func (m *RequirementRule) Validate() error {
  588. if m == nil {
  589. return nil
  590. }
  591. if m.GetMatch() == nil {
  592. return RequirementRuleValidationError{
  593. field: "Match",
  594. reason: "value is required",
  595. }
  596. }
  597. if v, ok := interface{}(m.GetMatch()).(interface{ Validate() error }); ok {
  598. if err := v.Validate(); err != nil {
  599. return RequirementRuleValidationError{
  600. field: "Match",
  601. reason: "embedded message failed validation",
  602. cause: err,
  603. }
  604. }
  605. }
  606. if v, ok := interface{}(m.GetRequires()).(interface{ Validate() error }); ok {
  607. if err := v.Validate(); err != nil {
  608. return RequirementRuleValidationError{
  609. field: "Requires",
  610. reason: "embedded message failed validation",
  611. cause: err,
  612. }
  613. }
  614. }
  615. return nil
  616. }
  617. // RequirementRuleValidationError is the validation error returned by
  618. // RequirementRule.Validate if the designated constraints aren't met.
  619. type RequirementRuleValidationError struct {
  620. field string
  621. reason string
  622. cause error
  623. key bool
  624. }
  625. // Field function returns field value.
  626. func (e RequirementRuleValidationError) Field() string { return e.field }
  627. // Reason function returns reason value.
  628. func (e RequirementRuleValidationError) Reason() string { return e.reason }
  629. // Cause function returns cause value.
  630. func (e RequirementRuleValidationError) Cause() error { return e.cause }
  631. // Key function returns key value.
  632. func (e RequirementRuleValidationError) Key() bool { return e.key }
  633. // ErrorName returns error name.
  634. func (e RequirementRuleValidationError) ErrorName() string { return "RequirementRuleValidationError" }
  635. // Error satisfies the builtin error interface
  636. func (e RequirementRuleValidationError) 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 %sRequirementRule.%s: %s%s",
  647. key,
  648. e.field,
  649. e.reason,
  650. cause)
  651. }
  652. var _ error = RequirementRuleValidationError{}
  653. var _ interface {
  654. Field() string
  655. Reason() string
  656. Key() bool
  657. Cause() error
  658. ErrorName() string
  659. } = RequirementRuleValidationError{}
  660. // Validate checks the field values on FilterStateRule with the rules defined
  661. // in the proto definition for this message. If any rules are violated, an
  662. // error is returned.
  663. func (m *FilterStateRule) Validate() error {
  664. if m == nil {
  665. return nil
  666. }
  667. if len(m.GetName()) < 1 {
  668. return FilterStateRuleValidationError{
  669. field: "Name",
  670. reason: "value length must be at least 1 bytes",
  671. }
  672. }
  673. for key, val := range m.GetRequires() {
  674. _ = val
  675. // no validation rules for Requires[key]
  676. if v, ok := interface{}(val).(interface{ Validate() error }); ok {
  677. if err := v.Validate(); err != nil {
  678. return FilterStateRuleValidationError{
  679. field: fmt.Sprintf("Requires[%v]", key),
  680. reason: "embedded message failed validation",
  681. cause: err,
  682. }
  683. }
  684. }
  685. }
  686. return nil
  687. }
  688. // FilterStateRuleValidationError is the validation error returned by
  689. // FilterStateRule.Validate if the designated constraints aren't met.
  690. type FilterStateRuleValidationError struct {
  691. field string
  692. reason string
  693. cause error
  694. key bool
  695. }
  696. // Field function returns field value.
  697. func (e FilterStateRuleValidationError) Field() string { return e.field }
  698. // Reason function returns reason value.
  699. func (e FilterStateRuleValidationError) Reason() string { return e.reason }
  700. // Cause function returns cause value.
  701. func (e FilterStateRuleValidationError) Cause() error { return e.cause }
  702. // Key function returns key value.
  703. func (e FilterStateRuleValidationError) Key() bool { return e.key }
  704. // ErrorName returns error name.
  705. func (e FilterStateRuleValidationError) ErrorName() string { return "FilterStateRuleValidationError" }
  706. // Error satisfies the builtin error interface
  707. func (e FilterStateRuleValidationError) Error() string {
  708. cause := ""
  709. if e.cause != nil {
  710. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  711. }
  712. key := ""
  713. if e.key {
  714. key = "key for "
  715. }
  716. return fmt.Sprintf(
  717. "invalid %sFilterStateRule.%s: %s%s",
  718. key,
  719. e.field,
  720. e.reason,
  721. cause)
  722. }
  723. var _ error = FilterStateRuleValidationError{}
  724. var _ interface {
  725. Field() string
  726. Reason() string
  727. Key() bool
  728. Cause() error
  729. ErrorName() string
  730. } = FilterStateRuleValidationError{}
  731. // Validate checks the field values on JwtAuthentication with the rules defined
  732. // in the proto definition for this message. If any rules are violated, an
  733. // error is returned.
  734. func (m *JwtAuthentication) Validate() error {
  735. if m == nil {
  736. return nil
  737. }
  738. for key, val := range m.GetProviders() {
  739. _ = val
  740. // no validation rules for Providers[key]
  741. if v, ok := interface{}(val).(interface{ Validate() error }); ok {
  742. if err := v.Validate(); err != nil {
  743. return JwtAuthenticationValidationError{
  744. field: fmt.Sprintf("Providers[%v]", key),
  745. reason: "embedded message failed validation",
  746. cause: err,
  747. }
  748. }
  749. }
  750. }
  751. for idx, item := range m.GetRules() {
  752. _, _ = idx, item
  753. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  754. if err := v.Validate(); err != nil {
  755. return JwtAuthenticationValidationError{
  756. field: fmt.Sprintf("Rules[%v]", idx),
  757. reason: "embedded message failed validation",
  758. cause: err,
  759. }
  760. }
  761. }
  762. }
  763. if v, ok := interface{}(m.GetFilterStateRules()).(interface{ Validate() error }); ok {
  764. if err := v.Validate(); err != nil {
  765. return JwtAuthenticationValidationError{
  766. field: "FilterStateRules",
  767. reason: "embedded message failed validation",
  768. cause: err,
  769. }
  770. }
  771. }
  772. // no validation rules for BypassCorsPreflight
  773. return nil
  774. }
  775. // JwtAuthenticationValidationError is the validation error returned by
  776. // JwtAuthentication.Validate if the designated constraints aren't met.
  777. type JwtAuthenticationValidationError struct {
  778. field string
  779. reason string
  780. cause error
  781. key bool
  782. }
  783. // Field function returns field value.
  784. func (e JwtAuthenticationValidationError) Field() string { return e.field }
  785. // Reason function returns reason value.
  786. func (e JwtAuthenticationValidationError) Reason() string { return e.reason }
  787. // Cause function returns cause value.
  788. func (e JwtAuthenticationValidationError) Cause() error { return e.cause }
  789. // Key function returns key value.
  790. func (e JwtAuthenticationValidationError) Key() bool { return e.key }
  791. // ErrorName returns error name.
  792. func (e JwtAuthenticationValidationError) ErrorName() string {
  793. return "JwtAuthenticationValidationError"
  794. }
  795. // Error satisfies the builtin error interface
  796. func (e JwtAuthenticationValidationError) Error() string {
  797. cause := ""
  798. if e.cause != nil {
  799. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  800. }
  801. key := ""
  802. if e.key {
  803. key = "key for "
  804. }
  805. return fmt.Sprintf(
  806. "invalid %sJwtAuthentication.%s: %s%s",
  807. key,
  808. e.field,
  809. e.reason,
  810. cause)
  811. }
  812. var _ error = JwtAuthenticationValidationError{}
  813. var _ interface {
  814. Field() string
  815. Reason() string
  816. Key() bool
  817. Cause() error
  818. ErrorName() string
  819. } = JwtAuthenticationValidationError{}