/pkg/api/envoy/config/core/v4alpha/base.pb.validate.go

https://github.com/datawire/ambassador · Go · 1628 lines · 1097 code · 319 blank · 212 comment · 182 complexity · f78ab3ad59707ea6ab0b91b3705a95f2 MD5 · raw file

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