/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/core/base.pb.validate.go

https://github.com/open-policy-agent/opa-istio-plugin · Go · 1639 lines · 1106 code · 321 blank · 212 comment · 185 complexity · 4e0b327c7e26238c2742ea0eaeb32a24 MD5 · raw file

  1. // Code generated by protoc-gen-validate. DO NOT EDIT.
  2. // source: envoy/api/v2/core/base.proto
  3. package envoy_api_v2_core
  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. // Validate checks the field values on Locality with the rules defined in the
  32. // proto definition for this message. If any rules are violated, an error is returned.
  33. func (m *Locality) Validate() error {
  34. if m == nil {
  35. return nil
  36. }
  37. // no validation rules for Region
  38. // no validation rules for Zone
  39. // no validation rules for SubZone
  40. return nil
  41. }
  42. // LocalityValidationError is the validation error returned by
  43. // Locality.Validate if the designated constraints aren't met.
  44. type LocalityValidationError struct {
  45. field string
  46. reason string
  47. cause error
  48. key bool
  49. }
  50. // Field function returns field value.
  51. func (e LocalityValidationError) Field() string { return e.field }
  52. // Reason function returns reason value.
  53. func (e LocalityValidationError) Reason() string { return e.reason }
  54. // Cause function returns cause value.
  55. func (e LocalityValidationError) Cause() error { return e.cause }
  56. // Key function returns key value.
  57. func (e LocalityValidationError) Key() bool { return e.key }
  58. // ErrorName returns error name.
  59. func (e LocalityValidationError) ErrorName() string { return "LocalityValidationError" }
  60. // Error satisfies the builtin error interface
  61. func (e LocalityValidationError) Error() string {
  62. cause := ""
  63. if e.cause != nil {
  64. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  65. }
  66. key := ""
  67. if e.key {
  68. key = "key for "
  69. }
  70. return fmt.Sprintf(
  71. "invalid %sLocality.%s: %s%s",
  72. key,
  73. e.field,
  74. e.reason,
  75. cause)
  76. }
  77. var _ error = LocalityValidationError{}
  78. var _ interface {
  79. Field() string
  80. Reason() string
  81. Key() bool
  82. Cause() error
  83. ErrorName() string
  84. } = LocalityValidationError{}
  85. // Validate checks the field values on BuildVersion with the rules defined in
  86. // the proto definition for this message. If any rules are violated, an error
  87. // is returned.
  88. func (m *BuildVersion) Validate() error {
  89. if m == nil {
  90. return nil
  91. }
  92. if v, ok := interface{}(m.GetVersion()).(interface{ Validate() error }); ok {
  93. if err := v.Validate(); err != nil {
  94. return BuildVersionValidationError{
  95. field: "Version",
  96. reason: "embedded message failed validation",
  97. cause: err,
  98. }
  99. }
  100. }
  101. if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
  102. if err := v.Validate(); err != nil {
  103. return BuildVersionValidationError{
  104. field: "Metadata",
  105. reason: "embedded message failed validation",
  106. cause: err,
  107. }
  108. }
  109. }
  110. return nil
  111. }
  112. // BuildVersionValidationError is the validation error returned by
  113. // BuildVersion.Validate if the designated constraints aren't met.
  114. type BuildVersionValidationError struct {
  115. field string
  116. reason string
  117. cause error
  118. key bool
  119. }
  120. // Field function returns field value.
  121. func (e BuildVersionValidationError) Field() string { return e.field }
  122. // Reason function returns reason value.
  123. func (e BuildVersionValidationError) Reason() string { return e.reason }
  124. // Cause function returns cause value.
  125. func (e BuildVersionValidationError) Cause() error { return e.cause }
  126. // Key function returns key value.
  127. func (e BuildVersionValidationError) Key() bool { return e.key }
  128. // ErrorName returns error name.
  129. func (e BuildVersionValidationError) ErrorName() string { return "BuildVersionValidationError" }
  130. // Error satisfies the builtin error interface
  131. func (e BuildVersionValidationError) Error() string {
  132. cause := ""
  133. if e.cause != nil {
  134. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  135. }
  136. key := ""
  137. if e.key {
  138. key = "key for "
  139. }
  140. return fmt.Sprintf(
  141. "invalid %sBuildVersion.%s: %s%s",
  142. key,
  143. e.field,
  144. e.reason,
  145. cause)
  146. }
  147. var _ error = BuildVersionValidationError{}
  148. var _ interface {
  149. Field() string
  150. Reason() string
  151. Key() bool
  152. Cause() error
  153. ErrorName() string
  154. } = BuildVersionValidationError{}
  155. // Validate checks the field values on Extension with the rules defined in the
  156. // proto definition for this message. If any rules are violated, an error is returned.
  157. func (m *Extension) Validate() error {
  158. if m == nil {
  159. return nil
  160. }
  161. // no validation rules for Name
  162. // no validation rules for Category
  163. // no validation rules for TypeDescriptor
  164. if v, ok := interface{}(m.GetVersion()).(interface{ Validate() error }); ok {
  165. if err := v.Validate(); err != nil {
  166. return ExtensionValidationError{
  167. field: "Version",
  168. reason: "embedded message failed validation",
  169. cause: err,
  170. }
  171. }
  172. }
  173. // no validation rules for Disabled
  174. return nil
  175. }
  176. // ExtensionValidationError is the validation error returned by
  177. // Extension.Validate if the designated constraints aren't met.
  178. type ExtensionValidationError struct {
  179. field string
  180. reason string
  181. cause error
  182. key bool
  183. }
  184. // Field function returns field value.
  185. func (e ExtensionValidationError) Field() string { return e.field }
  186. // Reason function returns reason value.
  187. func (e ExtensionValidationError) Reason() string { return e.reason }
  188. // Cause function returns cause value.
  189. func (e ExtensionValidationError) Cause() error { return e.cause }
  190. // Key function returns key value.
  191. func (e ExtensionValidationError) Key() bool { return e.key }
  192. // ErrorName returns error name.
  193. func (e ExtensionValidationError) ErrorName() string { return "ExtensionValidationError" }
  194. // Error satisfies the builtin error interface
  195. func (e ExtensionValidationError) Error() string {
  196. cause := ""
  197. if e.cause != nil {
  198. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  199. }
  200. key := ""
  201. if e.key {
  202. key = "key for "
  203. }
  204. return fmt.Sprintf(
  205. "invalid %sExtension.%s: %s%s",
  206. key,
  207. e.field,
  208. e.reason,
  209. cause)
  210. }
  211. var _ error = ExtensionValidationError{}
  212. var _ interface {
  213. Field() string
  214. Reason() string
  215. Key() bool
  216. Cause() error
  217. ErrorName() string
  218. } = ExtensionValidationError{}
  219. // Validate checks the field values on Node with the rules defined in the proto
  220. // definition for this message. If any rules are violated, an error is returned.
  221. func (m *Node) Validate() error {
  222. if m == nil {
  223. return nil
  224. }
  225. // no validation rules for Id
  226. // no validation rules for Cluster
  227. if v, ok := interface{}(m.GetMetadata()).(interface{ Validate() error }); ok {
  228. if err := v.Validate(); err != nil {
  229. return NodeValidationError{
  230. field: "Metadata",
  231. reason: "embedded message failed validation",
  232. cause: err,
  233. }
  234. }
  235. }
  236. if v, ok := interface{}(m.GetLocality()).(interface{ Validate() error }); ok {
  237. if err := v.Validate(); err != nil {
  238. return NodeValidationError{
  239. field: "Locality",
  240. reason: "embedded message failed validation",
  241. cause: err,
  242. }
  243. }
  244. }
  245. // no validation rules for BuildVersion
  246. // no validation rules for UserAgentName
  247. for idx, item := range m.GetExtensions() {
  248. _, _ = idx, item
  249. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  250. if err := v.Validate(); err != nil {
  251. return NodeValidationError{
  252. field: fmt.Sprintf("Extensions[%v]", idx),
  253. reason: "embedded message failed validation",
  254. cause: err,
  255. }
  256. }
  257. }
  258. }
  259. for idx, item := range m.GetListeningAddresses() {
  260. _, _ = idx, item
  261. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  262. if err := v.Validate(); err != nil {
  263. return NodeValidationError{
  264. field: fmt.Sprintf("ListeningAddresses[%v]", idx),
  265. reason: "embedded message failed validation",
  266. cause: err,
  267. }
  268. }
  269. }
  270. }
  271. switch m.UserAgentVersionType.(type) {
  272. case *Node_UserAgentVersion:
  273. // no validation rules for UserAgentVersion
  274. case *Node_UserAgentBuildVersion:
  275. if v, ok := interface{}(m.GetUserAgentBuildVersion()).(interface{ Validate() error }); ok {
  276. if err := v.Validate(); err != nil {
  277. return NodeValidationError{
  278. field: "UserAgentBuildVersion",
  279. reason: "embedded message failed validation",
  280. cause: err,
  281. }
  282. }
  283. }
  284. }
  285. return nil
  286. }
  287. // NodeValidationError is the validation error returned by Node.Validate if the
  288. // designated constraints aren't met.
  289. type NodeValidationError struct {
  290. field string
  291. reason string
  292. cause error
  293. key bool
  294. }
  295. // Field function returns field value.
  296. func (e NodeValidationError) Field() string { return e.field }
  297. // Reason function returns reason value.
  298. func (e NodeValidationError) Reason() string { return e.reason }
  299. // Cause function returns cause value.
  300. func (e NodeValidationError) Cause() error { return e.cause }
  301. // Key function returns key value.
  302. func (e NodeValidationError) Key() bool { return e.key }
  303. // ErrorName returns error name.
  304. func (e NodeValidationError) ErrorName() string { return "NodeValidationError" }
  305. // Error satisfies the builtin error interface
  306. func (e NodeValidationError) Error() string {
  307. cause := ""
  308. if e.cause != nil {
  309. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  310. }
  311. key := ""
  312. if e.key {
  313. key = "key for "
  314. }
  315. return fmt.Sprintf(
  316. "invalid %sNode.%s: %s%s",
  317. key,
  318. e.field,
  319. e.reason,
  320. cause)
  321. }
  322. var _ error = NodeValidationError{}
  323. var _ interface {
  324. Field() string
  325. Reason() string
  326. Key() bool
  327. Cause() error
  328. ErrorName() string
  329. } = NodeValidationError{}
  330. // Validate checks the field values on Metadata with the rules defined in the
  331. // proto definition for this message. If any rules are violated, an error is returned.
  332. func (m *Metadata) Validate() error {
  333. if m == nil {
  334. return nil
  335. }
  336. for key, val := range m.GetFilterMetadata() {
  337. _ = val
  338. // no validation rules for FilterMetadata[key]
  339. if v, ok := interface{}(val).(interface{ Validate() error }); ok {
  340. if err := v.Validate(); err != nil {
  341. return MetadataValidationError{
  342. field: fmt.Sprintf("FilterMetadata[%v]", key),
  343. reason: "embedded message failed validation",
  344. cause: err,
  345. }
  346. }
  347. }
  348. }
  349. return nil
  350. }
  351. // MetadataValidationError is the validation error returned by
  352. // Metadata.Validate if the designated constraints aren't met.
  353. type MetadataValidationError struct {
  354. field string
  355. reason string
  356. cause error
  357. key bool
  358. }
  359. // Field function returns field value.
  360. func (e MetadataValidationError) Field() string { return e.field }
  361. // Reason function returns reason value.
  362. func (e MetadataValidationError) Reason() string { return e.reason }
  363. // Cause function returns cause value.
  364. func (e MetadataValidationError) Cause() error { return e.cause }
  365. // Key function returns key value.
  366. func (e MetadataValidationError) Key() bool { return e.key }
  367. // ErrorName returns error name.
  368. func (e MetadataValidationError) ErrorName() string { return "MetadataValidationError" }
  369. // Error satisfies the builtin error interface
  370. func (e MetadataValidationError) Error() string {
  371. cause := ""
  372. if e.cause != nil {
  373. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  374. }
  375. key := ""
  376. if e.key {
  377. key = "key for "
  378. }
  379. return fmt.Sprintf(
  380. "invalid %sMetadata.%s: %s%s",
  381. key,
  382. e.field,
  383. e.reason,
  384. cause)
  385. }
  386. var _ error = MetadataValidationError{}
  387. var _ interface {
  388. Field() string
  389. Reason() string
  390. Key() bool
  391. Cause() error
  392. ErrorName() string
  393. } = MetadataValidationError{}
  394. // Validate checks the field values on RuntimeUInt32 with the rules defined in
  395. // the proto definition for this message. If any rules are violated, an error
  396. // is returned.
  397. func (m *RuntimeUInt32) Validate() error {
  398. if m == nil {
  399. return nil
  400. }
  401. // no validation rules for DefaultValue
  402. if len(m.GetRuntimeKey()) < 1 {
  403. return RuntimeUInt32ValidationError{
  404. field: "RuntimeKey",
  405. reason: "value length must be at least 1 bytes",
  406. }
  407. }
  408. return nil
  409. }
  410. // RuntimeUInt32ValidationError is the validation error returned by
  411. // RuntimeUInt32.Validate if the designated constraints aren't met.
  412. type RuntimeUInt32ValidationError struct {
  413. field string
  414. reason string
  415. cause error
  416. key bool
  417. }
  418. // Field function returns field value.
  419. func (e RuntimeUInt32ValidationError) Field() string { return e.field }
  420. // Reason function returns reason value.
  421. func (e RuntimeUInt32ValidationError) Reason() string { return e.reason }
  422. // Cause function returns cause value.
  423. func (e RuntimeUInt32ValidationError) Cause() error { return e.cause }
  424. // Key function returns key value.
  425. func (e RuntimeUInt32ValidationError) Key() bool { return e.key }
  426. // ErrorName returns error name.
  427. func (e RuntimeUInt32ValidationError) ErrorName() string { return "RuntimeUInt32ValidationError" }
  428. // Error satisfies the builtin error interface
  429. func (e RuntimeUInt32ValidationError) Error() string {
  430. cause := ""
  431. if e.cause != nil {
  432. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  433. }
  434. key := ""
  435. if e.key {
  436. key = "key for "
  437. }
  438. return fmt.Sprintf(
  439. "invalid %sRuntimeUInt32.%s: %s%s",
  440. key,
  441. e.field,
  442. e.reason,
  443. cause)
  444. }
  445. var _ error = RuntimeUInt32ValidationError{}
  446. var _ interface {
  447. Field() string
  448. Reason() string
  449. Key() bool
  450. Cause() error
  451. ErrorName() string
  452. } = RuntimeUInt32ValidationError{}
  453. // Validate checks the field values on RuntimeDouble with the rules defined in
  454. // the proto definition for this message. If any rules are violated, an error
  455. // is returned.
  456. func (m *RuntimeDouble) Validate() error {
  457. if m == nil {
  458. return nil
  459. }
  460. // no validation rules for DefaultValue
  461. if len(m.GetRuntimeKey()) < 1 {
  462. return RuntimeDoubleValidationError{
  463. field: "RuntimeKey",
  464. reason: "value length must be at least 1 bytes",
  465. }
  466. }
  467. return nil
  468. }
  469. // RuntimeDoubleValidationError is the validation error returned by
  470. // RuntimeDouble.Validate if the designated constraints aren't met.
  471. type RuntimeDoubleValidationError struct {
  472. field string
  473. reason string
  474. cause error
  475. key bool
  476. }
  477. // Field function returns field value.
  478. func (e RuntimeDoubleValidationError) Field() string { return e.field }
  479. // Reason function returns reason value.
  480. func (e RuntimeDoubleValidationError) Reason() string { return e.reason }
  481. // Cause function returns cause value.
  482. func (e RuntimeDoubleValidationError) Cause() error { return e.cause }
  483. // Key function returns key value.
  484. func (e RuntimeDoubleValidationError) Key() bool { return e.key }
  485. // ErrorName returns error name.
  486. func (e RuntimeDoubleValidationError) ErrorName() string { return "RuntimeDoubleValidationError" }
  487. // Error satisfies the builtin error interface
  488. func (e RuntimeDoubleValidationError) 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 %sRuntimeDouble.%s: %s%s",
  499. key,
  500. e.field,
  501. e.reason,
  502. cause)
  503. }
  504. var _ error = RuntimeDoubleValidationError{}
  505. var _ interface {
  506. Field() string
  507. Reason() string
  508. Key() bool
  509. Cause() error
  510. ErrorName() string
  511. } = RuntimeDoubleValidationError{}
  512. // Validate checks the field values on RuntimeFeatureFlag 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 *RuntimeFeatureFlag) Validate() error {
  516. if m == nil {
  517. return nil
  518. }
  519. if m.GetDefaultValue() == nil {
  520. return RuntimeFeatureFlagValidationError{
  521. field: "DefaultValue",
  522. reason: "value is required",
  523. }
  524. }
  525. if v, ok := interface{}(m.GetDefaultValue()).(interface{ Validate() error }); ok {
  526. if err := v.Validate(); err != nil {
  527. return RuntimeFeatureFlagValidationError{
  528. field: "DefaultValue",
  529. reason: "embedded message failed validation",
  530. cause: err,
  531. }
  532. }
  533. }
  534. if len(m.GetRuntimeKey()) < 1 {
  535. return RuntimeFeatureFlagValidationError{
  536. field: "RuntimeKey",
  537. reason: "value length must be at least 1 bytes",
  538. }
  539. }
  540. return nil
  541. }
  542. // RuntimeFeatureFlagValidationError is the validation error returned by
  543. // RuntimeFeatureFlag.Validate if the designated constraints aren't met.
  544. type RuntimeFeatureFlagValidationError struct {
  545. field string
  546. reason string
  547. cause error
  548. key bool
  549. }
  550. // Field function returns field value.
  551. func (e RuntimeFeatureFlagValidationError) Field() string { return e.field }
  552. // Reason function returns reason value.
  553. func (e RuntimeFeatureFlagValidationError) Reason() string { return e.reason }
  554. // Cause function returns cause value.
  555. func (e RuntimeFeatureFlagValidationError) Cause() error { return e.cause }
  556. // Key function returns key value.
  557. func (e RuntimeFeatureFlagValidationError) Key() bool { return e.key }
  558. // ErrorName returns error name.
  559. func (e RuntimeFeatureFlagValidationError) ErrorName() string {
  560. return "RuntimeFeatureFlagValidationError"
  561. }
  562. // Error satisfies the builtin error interface
  563. func (e RuntimeFeatureFlagValidationError) Error() string {
  564. cause := ""
  565. if e.cause != nil {
  566. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  567. }
  568. key := ""
  569. if e.key {
  570. key = "key for "
  571. }
  572. return fmt.Sprintf(
  573. "invalid %sRuntimeFeatureFlag.%s: %s%s",
  574. key,
  575. e.field,
  576. e.reason,
  577. cause)
  578. }
  579. var _ error = RuntimeFeatureFlagValidationError{}
  580. var _ interface {
  581. Field() string
  582. Reason() string
  583. Key() bool
  584. Cause() error
  585. ErrorName() string
  586. } = RuntimeFeatureFlagValidationError{}
  587. // Validate checks the field values on HeaderValue with the rules defined in
  588. // the proto definition for this message. If any rules are violated, an error
  589. // is returned.
  590. func (m *HeaderValue) Validate() error {
  591. if m == nil {
  592. return nil
  593. }
  594. if l := len(m.GetKey()); l < 1 || l > 16384 {
  595. return HeaderValueValidationError{
  596. field: "Key",
  597. reason: "value length must be between 1 and 16384 bytes, inclusive",
  598. }
  599. }
  600. if !_HeaderValue_Key_Pattern.MatchString(m.GetKey()) {
  601. return HeaderValueValidationError{
  602. field: "Key",
  603. reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
  604. }
  605. }
  606. if len(m.GetValue()) > 16384 {
  607. return HeaderValueValidationError{
  608. field: "Value",
  609. reason: "value length must be at most 16384 bytes",
  610. }
  611. }
  612. if !_HeaderValue_Value_Pattern.MatchString(m.GetValue()) {
  613. return HeaderValueValidationError{
  614. field: "Value",
  615. reason: "value does not match regex pattern \"^[^\\x00\\n\\r]*$\"",
  616. }
  617. }
  618. return nil
  619. }
  620. // HeaderValueValidationError is the validation error returned by
  621. // HeaderValue.Validate if the designated constraints aren't met.
  622. type HeaderValueValidationError struct {
  623. field string
  624. reason string
  625. cause error
  626. key bool
  627. }
  628. // Field function returns field value.
  629. func (e HeaderValueValidationError) Field() string { return e.field }
  630. // Reason function returns reason value.
  631. func (e HeaderValueValidationError) Reason() string { return e.reason }
  632. // Cause function returns cause value.
  633. func (e HeaderValueValidationError) Cause() error { return e.cause }
  634. // Key function returns key value.
  635. func (e HeaderValueValidationError) Key() bool { return e.key }
  636. // ErrorName returns error name.
  637. func (e HeaderValueValidationError) ErrorName() string { return "HeaderValueValidationError" }
  638. // Error satisfies the builtin error interface
  639. func (e HeaderValueValidationError) Error() string {
  640. cause := ""
  641. if e.cause != nil {
  642. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  643. }
  644. key := ""
  645. if e.key {
  646. key = "key for "
  647. }
  648. return fmt.Sprintf(
  649. "invalid %sHeaderValue.%s: %s%s",
  650. key,
  651. e.field,
  652. e.reason,
  653. cause)
  654. }
  655. var _ error = HeaderValueValidationError{}
  656. var _ interface {
  657. Field() string
  658. Reason() string
  659. Key() bool
  660. Cause() error
  661. ErrorName() string
  662. } = HeaderValueValidationError{}
  663. var _HeaderValue_Key_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
  664. var _HeaderValue_Value_Pattern = regexp.MustCompile("^[^\x00\n\r]*$")
  665. // Validate checks the field values on HeaderValueOption with the rules defined
  666. // in the proto definition for this message. If any rules are violated, an
  667. // error is returned.
  668. func (m *HeaderValueOption) Validate() error {
  669. if m == nil {
  670. return nil
  671. }
  672. if m.GetHeader() == nil {
  673. return HeaderValueOptionValidationError{
  674. field: "Header",
  675. reason: "value is required",
  676. }
  677. }
  678. if v, ok := interface{}(m.GetHeader()).(interface{ Validate() error }); ok {
  679. if err := v.Validate(); err != nil {
  680. return HeaderValueOptionValidationError{
  681. field: "Header",
  682. reason: "embedded message failed validation",
  683. cause: err,
  684. }
  685. }
  686. }
  687. if v, ok := interface{}(m.GetAppend()).(interface{ Validate() error }); ok {
  688. if err := v.Validate(); err != nil {
  689. return HeaderValueOptionValidationError{
  690. field: "Append",
  691. reason: "embedded message failed validation",
  692. cause: err,
  693. }
  694. }
  695. }
  696. return nil
  697. }
  698. // HeaderValueOptionValidationError is the validation error returned by
  699. // HeaderValueOption.Validate if the designated constraints aren't met.
  700. type HeaderValueOptionValidationError struct {
  701. field string
  702. reason string
  703. cause error
  704. key bool
  705. }
  706. // Field function returns field value.
  707. func (e HeaderValueOptionValidationError) Field() string { return e.field }
  708. // Reason function returns reason value.
  709. func (e HeaderValueOptionValidationError) Reason() string { return e.reason }
  710. // Cause function returns cause value.
  711. func (e HeaderValueOptionValidationError) Cause() error { return e.cause }
  712. // Key function returns key value.
  713. func (e HeaderValueOptionValidationError) Key() bool { return e.key }
  714. // ErrorName returns error name.
  715. func (e HeaderValueOptionValidationError) ErrorName() string {
  716. return "HeaderValueOptionValidationError"
  717. }
  718. // Error satisfies the builtin error interface
  719. func (e HeaderValueOptionValidationError) Error() string {
  720. cause := ""
  721. if e.cause != nil {
  722. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  723. }
  724. key := ""
  725. if e.key {
  726. key = "key for "
  727. }
  728. return fmt.Sprintf(
  729. "invalid %sHeaderValueOption.%s: %s%s",
  730. key,
  731. e.field,
  732. e.reason,
  733. cause)
  734. }
  735. var _ error = HeaderValueOptionValidationError{}
  736. var _ interface {
  737. Field() string
  738. Reason() string
  739. Key() bool
  740. Cause() error
  741. ErrorName() string
  742. } = HeaderValueOptionValidationError{}
  743. // Validate checks the field values on HeaderMap with the rules defined in the
  744. // proto definition for this message. If any rules are violated, an error is returned.
  745. func (m *HeaderMap) Validate() error {
  746. if m == nil {
  747. return nil
  748. }
  749. for idx, item := range m.GetHeaders() {
  750. _, _ = idx, item
  751. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  752. if err := v.Validate(); err != nil {
  753. return HeaderMapValidationError{
  754. field: fmt.Sprintf("Headers[%v]", idx),
  755. reason: "embedded message failed validation",
  756. cause: err,
  757. }
  758. }
  759. }
  760. }
  761. return nil
  762. }
  763. // HeaderMapValidationError is the validation error returned by
  764. // HeaderMap.Validate if the designated constraints aren't met.
  765. type HeaderMapValidationError struct {
  766. field string
  767. reason string
  768. cause error
  769. key bool
  770. }
  771. // Field function returns field value.
  772. func (e HeaderMapValidationError) Field() string { return e.field }
  773. // Reason function returns reason value.
  774. func (e HeaderMapValidationError) Reason() string { return e.reason }
  775. // Cause function returns cause value.
  776. func (e HeaderMapValidationError) Cause() error { return e.cause }
  777. // Key function returns key value.
  778. func (e HeaderMapValidationError) Key() bool { return e.key }
  779. // ErrorName returns error name.
  780. func (e HeaderMapValidationError) ErrorName() string { return "HeaderMapValidationError" }
  781. // Error satisfies the builtin error interface
  782. func (e HeaderMapValidationError) Error() string {
  783. cause := ""
  784. if e.cause != nil {
  785. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  786. }
  787. key := ""
  788. if e.key {
  789. key = "key for "
  790. }
  791. return fmt.Sprintf(
  792. "invalid %sHeaderMap.%s: %s%s",
  793. key,
  794. e.field,
  795. e.reason,
  796. cause)
  797. }
  798. var _ error = HeaderMapValidationError{}
  799. var _ interface {
  800. Field() string
  801. Reason() string
  802. Key() bool
  803. Cause() error
  804. ErrorName() string
  805. } = HeaderMapValidationError{}
  806. // Validate checks the field values on DataSource with the rules defined in the
  807. // proto definition for this message. If any rules are violated, an error is returned.
  808. func (m *DataSource) Validate() error {
  809. if m == nil {
  810. return nil
  811. }
  812. switch m.Specifier.(type) {
  813. case *DataSource_Filename:
  814. if len(m.GetFilename()) < 1 {
  815. return DataSourceValidationError{
  816. field: "Filename",
  817. reason: "value length must be at least 1 bytes",
  818. }
  819. }
  820. case *DataSource_InlineBytes:
  821. if len(m.GetInlineBytes()) < 1 {
  822. return DataSourceValidationError{
  823. field: "InlineBytes",
  824. reason: "value length must be at least 1 bytes",
  825. }
  826. }
  827. case *DataSource_InlineString:
  828. if len(m.GetInlineString()) < 1 {
  829. return DataSourceValidationError{
  830. field: "InlineString",
  831. reason: "value length must be at least 1 bytes",
  832. }
  833. }
  834. default:
  835. return DataSourceValidationError{
  836. field: "Specifier",
  837. reason: "value is required",
  838. }
  839. }
  840. return nil
  841. }
  842. // DataSourceValidationError is the validation error returned by
  843. // DataSource.Validate if the designated constraints aren't met.
  844. type DataSourceValidationError struct {
  845. field string
  846. reason string
  847. cause error
  848. key bool
  849. }
  850. // Field function returns field value.
  851. func (e DataSourceValidationError) Field() string { return e.field }
  852. // Reason function returns reason value.
  853. func (e DataSourceValidationError) Reason() string { return e.reason }
  854. // Cause function returns cause value.
  855. func (e DataSourceValidationError) Cause() error { return e.cause }
  856. // Key function returns key value.
  857. func (e DataSourceValidationError) Key() bool { return e.key }
  858. // ErrorName returns error name.
  859. func (e DataSourceValidationError) ErrorName() string { return "DataSourceValidationError" }
  860. // Error satisfies the builtin error interface
  861. func (e DataSourceValidationError) Error() string {
  862. cause := ""
  863. if e.cause != nil {
  864. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  865. }
  866. key := ""
  867. if e.key {
  868. key = "key for "
  869. }
  870. return fmt.Sprintf(
  871. "invalid %sDataSource.%s: %s%s",
  872. key,
  873. e.field,
  874. e.reason,
  875. cause)
  876. }
  877. var _ error = DataSourceValidationError{}
  878. var _ interface {
  879. Field() string
  880. Reason() string
  881. Key() bool
  882. Cause() error
  883. ErrorName() string
  884. } = DataSourceValidationError{}
  885. // Validate checks the field values on RetryPolicy with the rules defined in
  886. // the proto definition for this message. If any rules are violated, an error
  887. // is returned.
  888. func (m *RetryPolicy) Validate() error {
  889. if m == nil {
  890. return nil
  891. }
  892. if v, ok := interface{}(m.GetRetryBackOff()).(interface{ Validate() error }); ok {
  893. if err := v.Validate(); err != nil {
  894. return RetryPolicyValidationError{
  895. field: "RetryBackOff",
  896. reason: "embedded message failed validation",
  897. cause: err,
  898. }
  899. }
  900. }
  901. if v, ok := interface{}(m.GetNumRetries()).(interface{ Validate() error }); ok {
  902. if err := v.Validate(); err != nil {
  903. return RetryPolicyValidationError{
  904. field: "NumRetries",
  905. reason: "embedded message failed validation",
  906. cause: err,
  907. }
  908. }
  909. }
  910. return nil
  911. }
  912. // RetryPolicyValidationError is the validation error returned by
  913. // RetryPolicy.Validate if the designated constraints aren't met.
  914. type RetryPolicyValidationError struct {
  915. field string
  916. reason string
  917. cause error
  918. key bool
  919. }
  920. // Field function returns field value.
  921. func (e RetryPolicyValidationError) Field() string { return e.field }
  922. // Reason function returns reason value.
  923. func (e RetryPolicyValidationError) Reason() string { return e.reason }
  924. // Cause function returns cause value.
  925. func (e RetryPolicyValidationError) Cause() error { return e.cause }
  926. // Key function returns key value.
  927. func (e RetryPolicyValidationError) Key() bool { return e.key }
  928. // ErrorName returns error name.
  929. func (e RetryPolicyValidationError) ErrorName() string { return "RetryPolicyValidationError" }
  930. // Error satisfies the builtin error interface
  931. func (e RetryPolicyValidationError) Error() string {
  932. cause := ""
  933. if e.cause != nil {
  934. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  935. }
  936. key := ""
  937. if e.key {
  938. key = "key for "
  939. }
  940. return fmt.Sprintf(
  941. "invalid %sRetryPolicy.%s: %s%s",
  942. key,
  943. e.field,
  944. e.reason,
  945. cause)
  946. }
  947. var _ error = RetryPolicyValidationError{}
  948. var _ interface {
  949. Field() string
  950. Reason() string
  951. Key() bool
  952. Cause() error
  953. ErrorName() string
  954. } = RetryPolicyValidationError{}
  955. // Validate checks the field values on RemoteDataSource with the rules defined
  956. // in the proto definition for this message. If any rules are violated, an
  957. // error is returned.
  958. func (m *RemoteDataSource) Validate() error {
  959. if m == nil {
  960. return nil
  961. }
  962. if m.GetHttpUri() == nil {
  963. return RemoteDataSourceValidationError{
  964. field: "HttpUri",
  965. reason: "value is required",
  966. }
  967. }
  968. if v, ok := interface{}(m.GetHttpUri()).(interface{ Validate() error }); ok {
  969. if err := v.Validate(); err != nil {
  970. return RemoteDataSourceValidationError{
  971. field: "HttpUri",
  972. reason: "embedded message failed validation",
  973. cause: err,
  974. }
  975. }
  976. }
  977. if len(m.GetSha256()) < 1 {
  978. return RemoteDataSourceValidationError{
  979. field: "Sha256",
  980. reason: "value length must be at least 1 bytes",
  981. }
  982. }
  983. if v, ok := interface{}(m.GetRetryPolicy()).(interface{ Validate() error }); ok {
  984. if err := v.Validate(); err != nil {
  985. return RemoteDataSourceValidationError{
  986. field: "RetryPolicy",
  987. reason: "embedded message failed validation",
  988. cause: err,
  989. }
  990. }
  991. }
  992. return nil
  993. }
  994. // RemoteDataSourceValidationError is the validation error returned by
  995. // RemoteDataSource.Validate if the designated constraints aren't met.
  996. type RemoteDataSourceValidationError struct {
  997. field string
  998. reason string
  999. cause error
  1000. key bool
  1001. }
  1002. // Field function returns field value.
  1003. func (e RemoteDataSourceValidationError) Field() string { return e.field }
  1004. // Reason function returns reason value.
  1005. func (e RemoteDataSourceValidationError) Reason() string { return e.reason }
  1006. // Cause function returns cause value.
  1007. func (e RemoteDataSourceValidationError) Cause() error { return e.cause }
  1008. // Key function returns key value.
  1009. func (e RemoteDataSourceValidationError) Key() bool { return e.key }
  1010. // ErrorName returns error name.
  1011. func (e RemoteDataSourceValidationError) ErrorName() string { return "RemoteDataSourceValidationError" }
  1012. // Error satisfies the builtin error interface
  1013. func (e RemoteDataSourceValidationError) Error() string {
  1014. cause := ""
  1015. if e.cause != nil {
  1016. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  1017. }
  1018. key := ""
  1019. if e.key {
  1020. key = "key for "
  1021. }
  1022. return fmt.Sprintf(
  1023. "invalid %sRemoteDataSource.%s: %s%s",
  1024. key,
  1025. e.field,
  1026. e.reason,
  1027. cause)
  1028. }
  1029. var _ error = RemoteDataSourceValidationError{}
  1030. var _ interface {
  1031. Field() string
  1032. Reason() string
  1033. Key() bool
  1034. Cause() error
  1035. ErrorName() string
  1036. } = RemoteDataSourceValidationError{}
  1037. // Validate checks the field values on AsyncDataSource with the rules defined
  1038. // in the proto definition for this message. If any rules are violated, an
  1039. // error is returned.
  1040. func (m *AsyncDataSource) Validate() error {
  1041. if m == nil {
  1042. return nil
  1043. }
  1044. switch m.Specifier.(type) {
  1045. case *AsyncDataSource_Local:
  1046. if v, ok := interface{}(m.GetLocal()).(interface{ Validate() error }); ok {
  1047. if err := v.Validate(); err != nil {
  1048. return AsyncDataSourceValidationError{
  1049. field: "Local",
  1050. reason: "embedded message failed validation",
  1051. cause: err,
  1052. }
  1053. }
  1054. }
  1055. case *AsyncDataSource_Remote:
  1056. if v, ok := interface{}(m.GetRemote()).(interface{ Validate() error }); ok {
  1057. if err := v.Validate(); err != nil {
  1058. return AsyncDataSourceValidationError{
  1059. field: "Remote",
  1060. reason: "embedded message failed validation",
  1061. cause: err,
  1062. }
  1063. }
  1064. }
  1065. default:
  1066. return AsyncDataSourceValidationError{
  1067. field: "Specifier",
  1068. reason: "value is required",
  1069. }
  1070. }
  1071. return nil
  1072. }
  1073. // AsyncDataSourceValidationError is the validation error returned by
  1074. // AsyncDataSource.Validate if the designated constraints aren't met.
  1075. type AsyncDataSourceValidationError struct {
  1076. field string
  1077. reason string
  1078. cause error
  1079. key bool
  1080. }
  1081. // Field function returns field value.
  1082. func (e AsyncDataSourceValidationError) Field() string { return e.field }
  1083. // Reason function returns reason value.
  1084. func (e AsyncDataSourceValidationError) Reason() string { return e.reason }
  1085. // Cause function returns cause value.
  1086. func (e AsyncDataSourceValidationError) Cause() error { return e.cause }
  1087. // Key function returns key value.
  1088. func (e AsyncDataSourceValidationError) Key() bool { return e.key }
  1089. // ErrorName returns error name.
  1090. func (e AsyncDataSourceValidationError) ErrorName() string { return "AsyncDataSourceValidationError" }
  1091. // Error satisfies the builtin error interface
  1092. func (e AsyncDataSourceValidationError) Error() string {
  1093. cause := ""
  1094. if e.cause != nil {
  1095. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  1096. }
  1097. key := ""
  1098. if e.key {
  1099. key = "key for "
  1100. }
  1101. return fmt.Sprintf(
  1102. "invalid %sAsyncDataSource.%s: %s%s",
  1103. key,
  1104. e.field,
  1105. e.reason,
  1106. cause)
  1107. }
  1108. var _ error = AsyncDataSourceValidationError{}
  1109. var _ interface {
  1110. Field() string
  1111. Reason() string
  1112. Key() bool
  1113. Cause() error
  1114. ErrorName() string
  1115. } = AsyncDataSourceValidationError{}
  1116. // Validate checks the field values on TransportSocket with the rules defined
  1117. // in the proto definition for this message. If any rules are violated, an
  1118. // error is returned.
  1119. func (m *TransportSocket) Validate() error {
  1120. if m == nil {
  1121. return nil
  1122. }
  1123. if len(m.GetName()) < 1 {
  1124. return TransportSocketValidationError{
  1125. field: "Name",
  1126. reason: "value length must be at least 1 bytes",
  1127. }
  1128. }
  1129. switch m.ConfigType.(type) {
  1130. case *TransportSocket_Config:
  1131. if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok {
  1132. if err := v.Validate(); err != nil {
  1133. return TransportSocketValidationError{
  1134. field: "Config",
  1135. reason: "embedded message failed validation",
  1136. cause: err,
  1137. }
  1138. }
  1139. }
  1140. case *TransportSocket_TypedConfig:
  1141. if v, ok := interface{}(m.GetTypedConfig()).(interface{ Validate() error }); ok {
  1142. if err := v.Validate(); err != nil {
  1143. return TransportSocketValidationError{
  1144. field: "TypedConfig",
  1145. reason: "embedded message failed validation",
  1146. cause: err,
  1147. }
  1148. }
  1149. }
  1150. }
  1151. return nil
  1152. }
  1153. // TransportSocketValidationError is the validation error returned by
  1154. // TransportSocket.Validate if the designated constraints aren't met.
  1155. type TransportSocketValidationError struct {
  1156. field string
  1157. reason string
  1158. cause error
  1159. key bool
  1160. }
  1161. // Field function returns field value.
  1162. func (e TransportSocketValidationError) Field() string { return e.field }
  1163. // Reason function returns reason value.
  1164. func (e TransportSocketValidationError) Reason() string { return e.reason }
  1165. // Cause function returns cause value.
  1166. func (e TransportSocketValidationError) Cause() error { return e.cause }
  1167. // Key function returns key value.
  1168. func (e TransportSocketValidationError) Key() bool { return e.key }
  1169. // ErrorName returns error name.
  1170. func (e TransportSocketValidationError) ErrorName() string { return "TransportSocketValidationError" }
  1171. // Error satisfies the builtin error interface
  1172. func (e TransportSocketValidationError) Error() string {
  1173. cause := ""
  1174. if e.cause != nil {
  1175. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  1176. }
  1177. key := ""
  1178. if e.key {
  1179. key = "key for "
  1180. }
  1181. return fmt.Sprintf(
  1182. "invalid %sTransportSocket.%s: %s%s",
  1183. key,
  1184. e.field,
  1185. e.reason,
  1186. cause)
  1187. }
  1188. var _ error = TransportSocketValidationError{}
  1189. var _ interface {
  1190. Field() string
  1191. Reason() string
  1192. Key() bool
  1193. Cause() error
  1194. ErrorName() string
  1195. } = TransportSocketValidationError{}
  1196. // Validate checks the field values on RuntimeFractionalPercent with the rules
  1197. // defined in the proto definition for this message. If any rules are
  1198. // violated, an error is returned.
  1199. func (m *RuntimeFractionalPercent) Validate() error {
  1200. if m == nil {
  1201. return nil
  1202. }
  1203. if m.GetDefaultValue() == nil {
  1204. return RuntimeFractionalPercentValidationError{
  1205. field: "DefaultValue",
  1206. reason: "value is required",
  1207. }
  1208. }
  1209. if v, ok := interface{}(m.GetDefaultValue()).(interface{ Validate() error }); ok {
  1210. if err := v.Validate(); err != nil {
  1211. return RuntimeFractionalPercentValidationError{
  1212. field: "DefaultValue",
  1213. reason: "embedded message failed validation",
  1214. cause: err,
  1215. }
  1216. }
  1217. }
  1218. // no validation rules for RuntimeKey
  1219. return nil
  1220. }
  1221. // RuntimeFractionalPercentValidationError is the validation error returned by
  1222. // RuntimeFractionalPercent.Validate if the designated constraints aren't met.
  1223. type RuntimeFractionalPercentValidationError struct {
  1224. field string
  1225. reason string
  1226. cause error
  1227. key bool
  1228. }
  1229. // Field function returns field value.
  1230. func (e RuntimeFractionalPercentValidationError) Field() string { return e.field }
  1231. // Reason function returns reason value.
  1232. func (e RuntimeFractionalPercentValidationError) Reason() string { return e.reason }
  1233. // Cause function returns cause value.
  1234. func (e RuntimeFractionalPercentValidationError) Cause() error { return e.cause }
  1235. // Key function returns key value.
  1236. func (e RuntimeFractionalPercentValidationError) Key() bool { return e.key }
  1237. // ErrorName returns error name.
  1238. func (e RuntimeFractionalPercentValidationError) ErrorName() string {
  1239. return "RuntimeFractionalPercentValidationError"
  1240. }
  1241. // Error satisfies the builtin error interface
  1242. func (e RuntimeFractionalPercentValidationError) Error() string {
  1243. cause := ""
  1244. if e.cause != nil {
  1245. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  1246. }
  1247. key := ""
  1248. if e.key {
  1249. key = "key for "
  1250. }
  1251. return fmt.Sprintf(
  1252. "invalid %sRuntimeFractionalPercent.%s: %s%s",
  1253. key,
  1254. e.field,
  1255. e.reason,
  1256. cause)
  1257. }
  1258. var _ error = RuntimeFractionalPercentValidationError{}
  1259. var _ interface {
  1260. Field() string
  1261. Reason() string
  1262. Key() bool
  1263. Cause() error
  1264. ErrorName() string
  1265. } = RuntimeFractionalPercentValidationError{}
  1266. // Validate checks the field values on ControlPlane with the rules defined in
  1267. // the proto definition for this message. If any rules are violated, an error
  1268. // is returned.
  1269. func (m *ControlPlane) Validate() error {
  1270. if m == nil {
  1271. return nil
  1272. }
  1273. // no validation rules for Identifier
  1274. return nil
  1275. }
  1276. // ControlPlaneValidationError is the validation error returned by
  1277. // ControlPlane.Validate if the designated constraints aren't met.
  1278. type ControlPlaneValidationError struct {
  1279. field string
  1280. reason string
  1281. cause error
  1282. key bool
  1283. }
  1284. // Field function returns field value.
  1285. func (e ControlPlaneValidationError) Field() string { return e.field }
  1286. // Reason function returns reason value.
  1287. func (e ControlPlaneValidationError) Reason() string { return e.reason }
  1288. // Cause function returns cause value.
  1289. func (e ControlPlaneValidationError) Cause() error { return e.cause }
  1290. // Key function returns key value.
  1291. func (e ControlPlaneValidationError) Key() bool { return e.key }
  1292. // ErrorName returns error name.
  1293. func (e ControlPlaneValidationError) ErrorName() string { return "ControlPlaneValidationError" }
  1294. // Error satisfies the builtin error interface
  1295. func (e ControlPlaneValidationError) Error() string {
  1296. cause := ""
  1297. if e.cause != nil {
  1298. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  1299. }
  1300. key := ""
  1301. if e.key {
  1302. key = "key for "
  1303. }
  1304. return fmt.Sprintf(
  1305. "invalid %sControlPlane.%s: %s%s",
  1306. key,
  1307. e.field,
  1308. e.reason,
  1309. cause)
  1310. }
  1311. var _ error = ControlPlaneValidationError{}
  1312. var _ interface {
  1313. Field() string
  1314. Reason() string
  1315. Key() bool
  1316. Cause() error
  1317. ErrorName() string
  1318. } = ControlPlaneValidationError{}