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

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