/pkg/api/envoy/api/v2/core/base.pb.validate.go

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