/vendor/github.com/envoyproxy/go-control-plane/envoy/config/core/v3/protocol.pb.validate.go

https://github.com/cloudfoundry/bosh-cli · Go · 2683 lines · 1954 code · 400 blank · 329 comment · 446 complexity · cb805f0461d00a20a4cbff2e7daccb6e MD5 · raw file

Large files are truncated click here to view the full file

  1. // Code generated by protoc-gen-validate. DO NOT EDIT.
  2. // source: envoy/config/core/v3/protocol.proto
  3. package envoy_config_core_v3
  4. import (
  5. "bytes"
  6. "errors"
  7. "fmt"
  8. "net"
  9. "net/mail"
  10. "net/url"
  11. "regexp"
  12. "sort"
  13. "strings"
  14. "time"
  15. "unicode/utf8"
  16. "google.golang.org/protobuf/types/known/anypb"
  17. )
  18. // ensure the imports are used
  19. var (
  20. _ = bytes.MinRead
  21. _ = errors.New("")
  22. _ = fmt.Print
  23. _ = utf8.UTFMax
  24. _ = (*regexp.Regexp)(nil)
  25. _ = (*strings.Reader)(nil)
  26. _ = net.IPv4len
  27. _ = time.Duration(0)
  28. _ = (*url.URL)(nil)
  29. _ = (*mail.Address)(nil)
  30. _ = anypb.Any{}
  31. _ = sort.Sort
  32. )
  33. // Validate checks the field values on TcpProtocolOptions with the rules
  34. // defined in the proto definition for this message. If any rules are
  35. // violated, the first error encountered is returned, or nil if there are no violations.
  36. func (m *TcpProtocolOptions) Validate() error {
  37. return m.validate(false)
  38. }
  39. // ValidateAll checks the field values on TcpProtocolOptions with the rules
  40. // defined in the proto definition for this message. If any rules are
  41. // violated, the result is a list of violation errors wrapped in
  42. // TcpProtocolOptionsMultiError, or nil if none found.
  43. func (m *TcpProtocolOptions) ValidateAll() error {
  44. return m.validate(true)
  45. }
  46. func (m *TcpProtocolOptions) validate(all bool) error {
  47. if m == nil {
  48. return nil
  49. }
  50. var errors []error
  51. if len(errors) > 0 {
  52. return TcpProtocolOptionsMultiError(errors)
  53. }
  54. return nil
  55. }
  56. // TcpProtocolOptionsMultiError is an error wrapping multiple validation errors
  57. // returned by TcpProtocolOptions.ValidateAll() if the designated constraints
  58. // aren't met.
  59. type TcpProtocolOptionsMultiError []error
  60. // Error returns a concatenation of all the error messages it wraps.
  61. func (m TcpProtocolOptionsMultiError) Error() string {
  62. var msgs []string
  63. for _, err := range m {
  64. msgs = append(msgs, err.Error())
  65. }
  66. return strings.Join(msgs, "; ")
  67. }
  68. // AllErrors returns a list of validation violation errors.
  69. func (m TcpProtocolOptionsMultiError) AllErrors() []error { return m }
  70. // TcpProtocolOptionsValidationError is the validation error returned by
  71. // TcpProtocolOptions.Validate if the designated constraints aren't met.
  72. type TcpProtocolOptionsValidationError struct {
  73. field string
  74. reason string
  75. cause error
  76. key bool
  77. }
  78. // Field function returns field value.
  79. func (e TcpProtocolOptionsValidationError) Field() string { return e.field }
  80. // Reason function returns reason value.
  81. func (e TcpProtocolOptionsValidationError) Reason() string { return e.reason }
  82. // Cause function returns cause value.
  83. func (e TcpProtocolOptionsValidationError) Cause() error { return e.cause }
  84. // Key function returns key value.
  85. func (e TcpProtocolOptionsValidationError) Key() bool { return e.key }
  86. // ErrorName returns error name.
  87. func (e TcpProtocolOptionsValidationError) ErrorName() string {
  88. return "TcpProtocolOptionsValidationError"
  89. }
  90. // Error satisfies the builtin error interface
  91. func (e TcpProtocolOptionsValidationError) Error() string {
  92. cause := ""
  93. if e.cause != nil {
  94. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  95. }
  96. key := ""
  97. if e.key {
  98. key = "key for "
  99. }
  100. return fmt.Sprintf(
  101. "invalid %sTcpProtocolOptions.%s: %s%s",
  102. key,
  103. e.field,
  104. e.reason,
  105. cause)
  106. }
  107. var _ error = TcpProtocolOptionsValidationError{}
  108. var _ interface {
  109. Field() string
  110. Reason() string
  111. Key() bool
  112. Cause() error
  113. ErrorName() string
  114. } = TcpProtocolOptionsValidationError{}
  115. // Validate checks the field values on QuicKeepAliveSettings with the rules
  116. // defined in the proto definition for this message. If any rules are
  117. // violated, the first error encountered is returned, or nil if there are no violations.
  118. func (m *QuicKeepAliveSettings) Validate() error {
  119. return m.validate(false)
  120. }
  121. // ValidateAll checks the field values on QuicKeepAliveSettings with the rules
  122. // defined in the proto definition for this message. If any rules are
  123. // violated, the result is a list of violation errors wrapped in
  124. // QuicKeepAliveSettingsMultiError, or nil if none found.
  125. func (m *QuicKeepAliveSettings) ValidateAll() error {
  126. return m.validate(true)
  127. }
  128. func (m *QuicKeepAliveSettings) validate(all bool) error {
  129. if m == nil {
  130. return nil
  131. }
  132. var errors []error
  133. if d := m.GetMaxInterval(); d != nil {
  134. dur, err := d.AsDuration(), d.CheckValid()
  135. if err != nil {
  136. err = QuicKeepAliveSettingsValidationError{
  137. field: "MaxInterval",
  138. reason: "value is not a valid duration",
  139. cause: err,
  140. }
  141. if !all {
  142. return err
  143. }
  144. errors = append(errors, err)
  145. } else {
  146. lte := time.Duration(0*time.Second + 0*time.Nanosecond)
  147. gte := time.Duration(1*time.Second + 0*time.Nanosecond)
  148. if dur > lte && dur < gte {
  149. err := QuicKeepAliveSettingsValidationError{
  150. field: "MaxInterval",
  151. reason: "value must be outside range (0s, 1s)",
  152. }
  153. if !all {
  154. return err
  155. }
  156. errors = append(errors, err)
  157. }
  158. }
  159. }
  160. if d := m.GetInitialInterval(); d != nil {
  161. dur, err := d.AsDuration(), d.CheckValid()
  162. if err != nil {
  163. err = QuicKeepAliveSettingsValidationError{
  164. field: "InitialInterval",
  165. reason: "value is not a valid duration",
  166. cause: err,
  167. }
  168. if !all {
  169. return err
  170. }
  171. errors = append(errors, err)
  172. } else {
  173. lte := time.Duration(0*time.Second + 0*time.Nanosecond)
  174. gte := time.Duration(1*time.Second + 0*time.Nanosecond)
  175. if dur > lte && dur < gte {
  176. err := QuicKeepAliveSettingsValidationError{
  177. field: "InitialInterval",
  178. reason: "value must be outside range (0s, 1s)",
  179. }
  180. if !all {
  181. return err
  182. }
  183. errors = append(errors, err)
  184. }
  185. }
  186. }
  187. if len(errors) > 0 {
  188. return QuicKeepAliveSettingsMultiError(errors)
  189. }
  190. return nil
  191. }
  192. // QuicKeepAliveSettingsMultiError is an error wrapping multiple validation
  193. // errors returned by QuicKeepAliveSettings.ValidateAll() if the designated
  194. // constraints aren't met.
  195. type QuicKeepAliveSettingsMultiError []error
  196. // Error returns a concatenation of all the error messages it wraps.
  197. func (m QuicKeepAliveSettingsMultiError) Error() string {
  198. var msgs []string
  199. for _, err := range m {
  200. msgs = append(msgs, err.Error())
  201. }
  202. return strings.Join(msgs, "; ")
  203. }
  204. // AllErrors returns a list of validation violation errors.
  205. func (m QuicKeepAliveSettingsMultiError) AllErrors() []error { return m }
  206. // QuicKeepAliveSettingsValidationError is the validation error returned by
  207. // QuicKeepAliveSettings.Validate if the designated constraints aren't met.
  208. type QuicKeepAliveSettingsValidationError struct {
  209. field string
  210. reason string
  211. cause error
  212. key bool
  213. }
  214. // Field function returns field value.
  215. func (e QuicKeepAliveSettingsValidationError) Field() string { return e.field }
  216. // Reason function returns reason value.
  217. func (e QuicKeepAliveSettingsValidationError) Reason() string { return e.reason }
  218. // Cause function returns cause value.
  219. func (e QuicKeepAliveSettingsValidationError) Cause() error { return e.cause }
  220. // Key function returns key value.
  221. func (e QuicKeepAliveSettingsValidationError) Key() bool { return e.key }
  222. // ErrorName returns error name.
  223. func (e QuicKeepAliveSettingsValidationError) ErrorName() string {
  224. return "QuicKeepAliveSettingsValidationError"
  225. }
  226. // Error satisfies the builtin error interface
  227. func (e QuicKeepAliveSettingsValidationError) Error() string {
  228. cause := ""
  229. if e.cause != nil {
  230. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  231. }
  232. key := ""
  233. if e.key {
  234. key = "key for "
  235. }
  236. return fmt.Sprintf(
  237. "invalid %sQuicKeepAliveSettings.%s: %s%s",
  238. key,
  239. e.field,
  240. e.reason,
  241. cause)
  242. }
  243. var _ error = QuicKeepAliveSettingsValidationError{}
  244. var _ interface {
  245. Field() string
  246. Reason() string
  247. Key() bool
  248. Cause() error
  249. ErrorName() string
  250. } = QuicKeepAliveSettingsValidationError{}
  251. // Validate checks the field values on QuicProtocolOptions with the rules
  252. // defined in the proto definition for this message. If any rules are
  253. // violated, the first error encountered is returned, or nil if there are no violations.
  254. func (m *QuicProtocolOptions) Validate() error {
  255. return m.validate(false)
  256. }
  257. // ValidateAll checks the field values on QuicProtocolOptions with the rules
  258. // defined in the proto definition for this message. If any rules are
  259. // violated, the result is a list of violation errors wrapped in
  260. // QuicProtocolOptionsMultiError, or nil if none found.
  261. func (m *QuicProtocolOptions) ValidateAll() error {
  262. return m.validate(true)
  263. }
  264. func (m *QuicProtocolOptions) validate(all bool) error {
  265. if m == nil {
  266. return nil
  267. }
  268. var errors []error
  269. if wrapper := m.GetMaxConcurrentStreams(); wrapper != nil {
  270. if wrapper.GetValue() < 1 {
  271. err := QuicProtocolOptionsValidationError{
  272. field: "MaxConcurrentStreams",
  273. reason: "value must be greater than or equal to 1",
  274. }
  275. if !all {
  276. return err
  277. }
  278. errors = append(errors, err)
  279. }
  280. }
  281. if wrapper := m.GetInitialStreamWindowSize(); wrapper != nil {
  282. if val := wrapper.GetValue(); val < 1 || val > 16777216 {
  283. err := QuicProtocolOptionsValidationError{
  284. field: "InitialStreamWindowSize",
  285. reason: "value must be inside range [1, 16777216]",
  286. }
  287. if !all {
  288. return err
  289. }
  290. errors = append(errors, err)
  291. }
  292. }
  293. if wrapper := m.GetInitialConnectionWindowSize(); wrapper != nil {
  294. if val := wrapper.GetValue(); val < 1 || val > 25165824 {
  295. err := QuicProtocolOptionsValidationError{
  296. field: "InitialConnectionWindowSize",
  297. reason: "value must be inside range [1, 25165824]",
  298. }
  299. if !all {
  300. return err
  301. }
  302. errors = append(errors, err)
  303. }
  304. }
  305. if wrapper := m.GetNumTimeoutsToTriggerPortMigration(); wrapper != nil {
  306. if val := wrapper.GetValue(); val < 0 || val > 1 {
  307. err := QuicProtocolOptionsValidationError{
  308. field: "NumTimeoutsToTriggerPortMigration",
  309. reason: "value must be inside range [0, 1]",
  310. }
  311. if !all {
  312. return err
  313. }
  314. errors = append(errors, err)
  315. }
  316. }
  317. if all {
  318. switch v := interface{}(m.GetConnectionKeepalive()).(type) {
  319. case interface{ ValidateAll() error }:
  320. if err := v.ValidateAll(); err != nil {
  321. errors = append(errors, QuicProtocolOptionsValidationError{
  322. field: "ConnectionKeepalive",
  323. reason: "embedded message failed validation",
  324. cause: err,
  325. })
  326. }
  327. case interface{ Validate() error }:
  328. if err := v.Validate(); err != nil {
  329. errors = append(errors, QuicProtocolOptionsValidationError{
  330. field: "ConnectionKeepalive",
  331. reason: "embedded message failed validation",
  332. cause: err,
  333. })
  334. }
  335. }
  336. } else if v, ok := interface{}(m.GetConnectionKeepalive()).(interface{ Validate() error }); ok {
  337. if err := v.Validate(); err != nil {
  338. return QuicProtocolOptionsValidationError{
  339. field: "ConnectionKeepalive",
  340. reason: "embedded message failed validation",
  341. cause: err,
  342. }
  343. }
  344. }
  345. if len(errors) > 0 {
  346. return QuicProtocolOptionsMultiError(errors)
  347. }
  348. return nil
  349. }
  350. // QuicProtocolOptionsMultiError is an error wrapping multiple validation
  351. // errors returned by QuicProtocolOptions.ValidateAll() if the designated
  352. // constraints aren't met.
  353. type QuicProtocolOptionsMultiError []error
  354. // Error returns a concatenation of all the error messages it wraps.
  355. func (m QuicProtocolOptionsMultiError) Error() string {
  356. var msgs []string
  357. for _, err := range m {
  358. msgs = append(msgs, err.Error())
  359. }
  360. return strings.Join(msgs, "; ")
  361. }
  362. // AllErrors returns a list of validation violation errors.
  363. func (m QuicProtocolOptionsMultiError) AllErrors() []error { return m }
  364. // QuicProtocolOptionsValidationError is the validation error returned by
  365. // QuicProtocolOptions.Validate if the designated constraints aren't met.
  366. type QuicProtocolOptionsValidationError struct {
  367. field string
  368. reason string
  369. cause error
  370. key bool
  371. }
  372. // Field function returns field value.
  373. func (e QuicProtocolOptionsValidationError) Field() string { return e.field }
  374. // Reason function returns reason value.
  375. func (e QuicProtocolOptionsValidationError) Reason() string { return e.reason }
  376. // Cause function returns cause value.
  377. func (e QuicProtocolOptionsValidationError) Cause() error { return e.cause }
  378. // Key function returns key value.
  379. func (e QuicProtocolOptionsValidationError) Key() bool { return e.key }
  380. // ErrorName returns error name.
  381. func (e QuicProtocolOptionsValidationError) ErrorName() string {
  382. return "QuicProtocolOptionsValidationError"
  383. }
  384. // Error satisfies the builtin error interface
  385. func (e QuicProtocolOptionsValidationError) Error() string {
  386. cause := ""
  387. if e.cause != nil {
  388. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  389. }
  390. key := ""
  391. if e.key {
  392. key = "key for "
  393. }
  394. return fmt.Sprintf(
  395. "invalid %sQuicProtocolOptions.%s: %s%s",
  396. key,
  397. e.field,
  398. e.reason,
  399. cause)
  400. }
  401. var _ error = QuicProtocolOptionsValidationError{}
  402. var _ interface {
  403. Field() string
  404. Reason() string
  405. Key() bool
  406. Cause() error
  407. ErrorName() string
  408. } = QuicProtocolOptionsValidationError{}
  409. // Validate checks the field values on UpstreamHttpProtocolOptions with the
  410. // rules defined in the proto definition for this message. If any rules are
  411. // violated, the first error encountered is returned, or nil if there are no violations.
  412. func (m *UpstreamHttpProtocolOptions) Validate() error {
  413. return m.validate(false)
  414. }
  415. // ValidateAll checks the field values on UpstreamHttpProtocolOptions with the
  416. // rules defined in the proto definition for this message. If any rules are
  417. // violated, the result is a list of violation errors wrapped in
  418. // UpstreamHttpProtocolOptionsMultiError, or nil if none found.
  419. func (m *UpstreamHttpProtocolOptions) ValidateAll() error {
  420. return m.validate(true)
  421. }
  422. func (m *UpstreamHttpProtocolOptions) validate(all bool) error {
  423. if m == nil {
  424. return nil
  425. }
  426. var errors []error
  427. // no validation rules for AutoSni
  428. // no validation rules for AutoSanValidation
  429. if m.GetOverrideAutoSniHeader() != "" {
  430. if !_UpstreamHttpProtocolOptions_OverrideAutoSniHeader_Pattern.MatchString(m.GetOverrideAutoSniHeader()) {
  431. err := UpstreamHttpProtocolOptionsValidationError{
  432. field: "OverrideAutoSniHeader",
  433. reason: "value does not match regex pattern \"^:?[0-9a-zA-Z!#$%&'*+-.^_|~`]+$\"",
  434. }
  435. if !all {
  436. return err
  437. }
  438. errors = append(errors, err)
  439. }
  440. }
  441. if len(errors) > 0 {
  442. return UpstreamHttpProtocolOptionsMultiError(errors)
  443. }
  444. return nil
  445. }
  446. // UpstreamHttpProtocolOptionsMultiError is an error wrapping multiple
  447. // validation errors returned by UpstreamHttpProtocolOptions.ValidateAll() if
  448. // the designated constraints aren't met.
  449. type UpstreamHttpProtocolOptionsMultiError []error
  450. // Error returns a concatenation of all the error messages it wraps.
  451. func (m UpstreamHttpProtocolOptionsMultiError) Error() string {
  452. var msgs []string
  453. for _, err := range m {
  454. msgs = append(msgs, err.Error())
  455. }
  456. return strings.Join(msgs, "; ")
  457. }
  458. // AllErrors returns a list of validation violation errors.
  459. func (m UpstreamHttpProtocolOptionsMultiError) AllErrors() []error { return m }
  460. // UpstreamHttpProtocolOptionsValidationError is the validation error returned
  461. // by UpstreamHttpProtocolOptions.Validate if the designated constraints
  462. // aren't met.
  463. type UpstreamHttpProtocolOptionsValidationError struct {
  464. field string
  465. reason string
  466. cause error
  467. key bool
  468. }
  469. // Field function returns field value.
  470. func (e UpstreamHttpProtocolOptionsValidationError) Field() string { return e.field }
  471. // Reason function returns reason value.
  472. func (e UpstreamHttpProtocolOptionsValidationError) Reason() string { return e.reason }
  473. // Cause function returns cause value.
  474. func (e UpstreamHttpProtocolOptionsValidationError) Cause() error { return e.cause }
  475. // Key function returns key value.
  476. func (e UpstreamHttpProtocolOptionsValidationError) Key() bool { return e.key }
  477. // ErrorName returns error name.
  478. func (e UpstreamHttpProtocolOptionsValidationError) ErrorName() string {
  479. return "UpstreamHttpProtocolOptionsValidationError"
  480. }
  481. // Error satisfies the builtin error interface
  482. func (e UpstreamHttpProtocolOptionsValidationError) Error() string {
  483. cause := ""
  484. if e.cause != nil {
  485. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  486. }
  487. key := ""
  488. if e.key {
  489. key = "key for "
  490. }
  491. return fmt.Sprintf(
  492. "invalid %sUpstreamHttpProtocolOptions.%s: %s%s",
  493. key,
  494. e.field,
  495. e.reason,
  496. cause)
  497. }
  498. var _ error = UpstreamHttpProtocolOptionsValidationError{}
  499. var _ interface {
  500. Field() string
  501. Reason() string
  502. Key() bool
  503. Cause() error
  504. ErrorName() string
  505. } = UpstreamHttpProtocolOptionsValidationError{}
  506. var _UpstreamHttpProtocolOptions_OverrideAutoSniHeader_Pattern = regexp.MustCompile("^:?[0-9a-zA-Z!#$%&'*+-.^_|~`]+$")
  507. // Validate checks the field values on AlternateProtocolsCacheOptions with the
  508. // rules defined in the proto definition for this message. If any rules are
  509. // violated, the first error encountered is returned, or nil if there are no violations.
  510. func (m *AlternateProtocolsCacheOptions) Validate() error {
  511. return m.validate(false)
  512. }
  513. // ValidateAll checks the field values on AlternateProtocolsCacheOptions with
  514. // the rules defined in the proto definition for this message. If any rules
  515. // are violated, the result is a list of violation errors wrapped in
  516. // AlternateProtocolsCacheOptionsMultiError, or nil if none found.
  517. func (m *AlternateProtocolsCacheOptions) ValidateAll() error {
  518. return m.validate(true)
  519. }
  520. func (m *AlternateProtocolsCacheOptions) validate(all bool) error {
  521. if m == nil {
  522. return nil
  523. }
  524. var errors []error
  525. if utf8.RuneCountInString(m.GetName()) < 1 {
  526. err := AlternateProtocolsCacheOptionsValidationError{
  527. field: "Name",
  528. reason: "value length must be at least 1 runes",
  529. }
  530. if !all {
  531. return err
  532. }
  533. errors = append(errors, err)
  534. }
  535. if wrapper := m.GetMaxEntries(); wrapper != nil {
  536. if wrapper.GetValue() <= 0 {
  537. err := AlternateProtocolsCacheOptionsValidationError{
  538. field: "MaxEntries",
  539. reason: "value must be greater than 0",
  540. }
  541. if !all {
  542. return err
  543. }
  544. errors = append(errors, err)
  545. }
  546. }
  547. if all {
  548. switch v := interface{}(m.GetKeyValueStoreConfig()).(type) {
  549. case interface{ ValidateAll() error }:
  550. if err := v.ValidateAll(); err != nil {
  551. errors = append(errors, AlternateProtocolsCacheOptionsValidationError{
  552. field: "KeyValueStoreConfig",
  553. reason: "embedded message failed validation",
  554. cause: err,
  555. })
  556. }
  557. case interface{ Validate() error }:
  558. if err := v.Validate(); err != nil {
  559. errors = append(errors, AlternateProtocolsCacheOptionsValidationError{
  560. field: "KeyValueStoreConfig",
  561. reason: "embedded message failed validation",
  562. cause: err,
  563. })
  564. }
  565. }
  566. } else if v, ok := interface{}(m.GetKeyValueStoreConfig()).(interface{ Validate() error }); ok {
  567. if err := v.Validate(); err != nil {
  568. return AlternateProtocolsCacheOptionsValidationError{
  569. field: "KeyValueStoreConfig",
  570. reason: "embedded message failed validation",
  571. cause: err,
  572. }
  573. }
  574. }
  575. if len(errors) > 0 {
  576. return AlternateProtocolsCacheOptionsMultiError(errors)
  577. }
  578. return nil
  579. }
  580. // AlternateProtocolsCacheOptionsMultiError is an error wrapping multiple
  581. // validation errors returned by AlternateProtocolsCacheOptions.ValidateAll()
  582. // if the designated constraints aren't met.
  583. type AlternateProtocolsCacheOptionsMultiError []error
  584. // Error returns a concatenation of all the error messages it wraps.
  585. func (m AlternateProtocolsCacheOptionsMultiError) Error() string {
  586. var msgs []string
  587. for _, err := range m {
  588. msgs = append(msgs, err.Error())
  589. }
  590. return strings.Join(msgs, "; ")
  591. }
  592. // AllErrors returns a list of validation violation errors.
  593. func (m AlternateProtocolsCacheOptionsMultiError) AllErrors() []error { return m }
  594. // AlternateProtocolsCacheOptionsValidationError is the validation error
  595. // returned by AlternateProtocolsCacheOptions.Validate if the designated
  596. // constraints aren't met.
  597. type AlternateProtocolsCacheOptionsValidationError struct {
  598. field string
  599. reason string
  600. cause error
  601. key bool
  602. }
  603. // Field function returns field value.
  604. func (e AlternateProtocolsCacheOptionsValidationError) Field() string { return e.field }
  605. // Reason function returns reason value.
  606. func (e AlternateProtocolsCacheOptionsValidationError) Reason() string { return e.reason }
  607. // Cause function returns cause value.
  608. func (e AlternateProtocolsCacheOptionsValidationError) Cause() error { return e.cause }
  609. // Key function returns key value.
  610. func (e AlternateProtocolsCacheOptionsValidationError) Key() bool { return e.key }
  611. // ErrorName returns error name.
  612. func (e AlternateProtocolsCacheOptionsValidationError) ErrorName() string {
  613. return "AlternateProtocolsCacheOptionsValidationError"
  614. }
  615. // Error satisfies the builtin error interface
  616. func (e AlternateProtocolsCacheOptionsValidationError) Error() string {
  617. cause := ""
  618. if e.cause != nil {
  619. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  620. }
  621. key := ""
  622. if e.key {
  623. key = "key for "
  624. }
  625. return fmt.Sprintf(
  626. "invalid %sAlternateProtocolsCacheOptions.%s: %s%s",
  627. key,
  628. e.field,
  629. e.reason,
  630. cause)
  631. }
  632. var _ error = AlternateProtocolsCacheOptionsValidationError{}
  633. var _ interface {
  634. Field() string
  635. Reason() string
  636. Key() bool
  637. Cause() error
  638. ErrorName() string
  639. } = AlternateProtocolsCacheOptionsValidationError{}
  640. // Validate checks the field values on HttpProtocolOptions with the rules
  641. // defined in the proto definition for this message. If any rules are
  642. // violated, the first error encountered is returned, or nil if there are no violations.
  643. func (m *HttpProtocolOptions) Validate() error {
  644. return m.validate(false)
  645. }
  646. // ValidateAll checks the field values on HttpProtocolOptions with the rules
  647. // defined in the proto definition for this message. If any rules are
  648. // violated, the result is a list of violation errors wrapped in
  649. // HttpProtocolOptionsMultiError, or nil if none found.
  650. func (m *HttpProtocolOptions) ValidateAll() error {
  651. return m.validate(true)
  652. }
  653. func (m *HttpProtocolOptions) validate(all bool) error {
  654. if m == nil {
  655. return nil
  656. }
  657. var errors []error
  658. if all {
  659. switch v := interface{}(m.GetIdleTimeout()).(type) {
  660. case interface{ ValidateAll() error }:
  661. if err := v.ValidateAll(); err != nil {
  662. errors = append(errors, HttpProtocolOptionsValidationError{
  663. field: "IdleTimeout",
  664. reason: "embedded message failed validation",
  665. cause: err,
  666. })
  667. }
  668. case interface{ Validate() error }:
  669. if err := v.Validate(); err != nil {
  670. errors = append(errors, HttpProtocolOptionsValidationError{
  671. field: "IdleTimeout",
  672. reason: "embedded message failed validation",
  673. cause: err,
  674. })
  675. }
  676. }
  677. } else if v, ok := interface{}(m.GetIdleTimeout()).(interface{ Validate() error }); ok {
  678. if err := v.Validate(); err != nil {
  679. return HttpProtocolOptionsValidationError{
  680. field: "IdleTimeout",
  681. reason: "embedded message failed validation",
  682. cause: err,
  683. }
  684. }
  685. }
  686. if all {
  687. switch v := interface{}(m.GetMaxConnectionDuration()).(type) {
  688. case interface{ ValidateAll() error }:
  689. if err := v.ValidateAll(); err != nil {
  690. errors = append(errors, HttpProtocolOptionsValidationError{
  691. field: "MaxConnectionDuration",
  692. reason: "embedded message failed validation",
  693. cause: err,
  694. })
  695. }
  696. case interface{ Validate() error }:
  697. if err := v.Validate(); err != nil {
  698. errors = append(errors, HttpProtocolOptionsValidationError{
  699. field: "MaxConnectionDuration",
  700. reason: "embedded message failed validation",
  701. cause: err,
  702. })
  703. }
  704. }
  705. } else if v, ok := interface{}(m.GetMaxConnectionDuration()).(interface{ Validate() error }); ok {
  706. if err := v.Validate(); err != nil {
  707. return HttpProtocolOptionsValidationError{
  708. field: "MaxConnectionDuration",
  709. reason: "embedded message failed validation",
  710. cause: err,
  711. }
  712. }
  713. }
  714. if wrapper := m.GetMaxHeadersCount(); wrapper != nil {
  715. if wrapper.GetValue() < 1 {
  716. err := HttpProtocolOptionsValidationError{
  717. field: "MaxHeadersCount",
  718. reason: "value must be greater than or equal to 1",
  719. }
  720. if !all {
  721. return err
  722. }
  723. errors = append(errors, err)
  724. }
  725. }
  726. if all {
  727. switch v := interface{}(m.GetMaxStreamDuration()).(type) {
  728. case interface{ ValidateAll() error }:
  729. if err := v.ValidateAll(); err != nil {
  730. errors = append(errors, HttpProtocolOptionsValidationError{
  731. field: "MaxStreamDuration",
  732. reason: "embedded message failed validation",
  733. cause: err,
  734. })
  735. }
  736. case interface{ Validate() error }:
  737. if err := v.Validate(); err != nil {
  738. errors = append(errors, HttpProtocolOptionsValidationError{
  739. field: "MaxStreamDuration",
  740. reason: "embedded message failed validation",
  741. cause: err,
  742. })
  743. }
  744. }
  745. } else if v, ok := interface{}(m.GetMaxStreamDuration()).(interface{ Validate() error }); ok {
  746. if err := v.Validate(); err != nil {
  747. return HttpProtocolOptionsValidationError{
  748. field: "MaxStreamDuration",
  749. reason: "embedded message failed validation",
  750. cause: err,
  751. }
  752. }
  753. }
  754. // no validation rules for HeadersWithUnderscoresAction
  755. if all {
  756. switch v := interface{}(m.GetMaxRequestsPerConnection()).(type) {
  757. case interface{ ValidateAll() error }:
  758. if err := v.ValidateAll(); err != nil {
  759. errors = append(errors, HttpProtocolOptionsValidationError{
  760. field: "MaxRequestsPerConnection",
  761. reason: "embedded message failed validation",
  762. cause: err,
  763. })
  764. }
  765. case interface{ Validate() error }:
  766. if err := v.Validate(); err != nil {
  767. errors = append(errors, HttpProtocolOptionsValidationError{
  768. field: "MaxRequestsPerConnection",
  769. reason: "embedded message failed validation",
  770. cause: err,
  771. })
  772. }
  773. }
  774. } else if v, ok := interface{}(m.GetMaxRequestsPerConnection()).(interface{ Validate() error }); ok {
  775. if err := v.Validate(); err != nil {
  776. return HttpProtocolOptionsValidationError{
  777. field: "MaxRequestsPerConnection",
  778. reason: "embedded message failed validation",
  779. cause: err,
  780. }
  781. }
  782. }
  783. if len(errors) > 0 {
  784. return HttpProtocolOptionsMultiError(errors)
  785. }
  786. return nil
  787. }
  788. // HttpProtocolOptionsMultiError is an error wrapping multiple validation
  789. // errors returned by HttpProtocolOptions.ValidateAll() if the designated
  790. // constraints aren't met.
  791. type HttpProtocolOptionsMultiError []error
  792. // Error returns a concatenation of all the error messages it wraps.
  793. func (m HttpProtocolOptionsMultiError) Error() string {
  794. var msgs []string
  795. for _, err := range m {
  796. msgs = append(msgs, err.Error())
  797. }
  798. return strings.Join(msgs, "; ")
  799. }
  800. // AllErrors returns a list of validation violation errors.
  801. func (m HttpProtocolOptionsMultiError) AllErrors() []error { return m }
  802. // HttpProtocolOptionsValidationError is the validation error returned by
  803. // HttpProtocolOptions.Validate if the designated constraints aren't met.
  804. type HttpProtocolOptionsValidationError struct {
  805. field string
  806. reason string
  807. cause error
  808. key bool
  809. }
  810. // Field function returns field value.
  811. func (e HttpProtocolOptionsValidationError) Field() string { return e.field }
  812. // Reason function returns reason value.
  813. func (e HttpProtocolOptionsValidationError) Reason() string { return e.reason }
  814. // Cause function returns cause value.
  815. func (e HttpProtocolOptionsValidationError) Cause() error { return e.cause }
  816. // Key function returns key value.
  817. func (e HttpProtocolOptionsValidationError) Key() bool { return e.key }
  818. // ErrorName returns error name.
  819. func (e HttpProtocolOptionsValidationError) ErrorName() string {
  820. return "HttpProtocolOptionsValidationError"
  821. }
  822. // Error satisfies the builtin error interface
  823. func (e HttpProtocolOptionsValidationError) Error() string {
  824. cause := ""
  825. if e.cause != nil {
  826. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  827. }
  828. key := ""
  829. if e.key {
  830. key = "key for "
  831. }
  832. return fmt.Sprintf(
  833. "invalid %sHttpProtocolOptions.%s: %s%s",
  834. key,
  835. e.field,
  836. e.reason,
  837. cause)
  838. }
  839. var _ error = HttpProtocolOptionsValidationError{}
  840. var _ interface {
  841. Field() string
  842. Reason() string
  843. Key() bool
  844. Cause() error
  845. ErrorName() string
  846. } = HttpProtocolOptionsValidationError{}
  847. // Validate checks the field values on Http1ProtocolOptions with the rules
  848. // defined in the proto definition for this message. If any rules are
  849. // violated, the first error encountered is returned, or nil if there are no violations.
  850. func (m *Http1ProtocolOptions) Validate() error {
  851. return m.validate(false)
  852. }
  853. // ValidateAll checks the field values on Http1ProtocolOptions with the rules
  854. // defined in the proto definition for this message. If any rules are
  855. // violated, the result is a list of violation errors wrapped in
  856. // Http1ProtocolOptionsMultiError, or nil if none found.
  857. func (m *Http1ProtocolOptions) ValidateAll() error {
  858. return m.validate(true)
  859. }
  860. func (m *Http1ProtocolOptions) validate(all bool) error {
  861. if m == nil {
  862. return nil
  863. }
  864. var errors []error
  865. if all {
  866. switch v := interface{}(m.GetAllowAbsoluteUrl()).(type) {
  867. case interface{ ValidateAll() error }:
  868. if err := v.ValidateAll(); err != nil {
  869. errors = append(errors, Http1ProtocolOptionsValidationError{
  870. field: "AllowAbsoluteUrl",
  871. reason: "embedded message failed validation",
  872. cause: err,
  873. })
  874. }
  875. case interface{ Validate() error }:
  876. if err := v.Validate(); err != nil {
  877. errors = append(errors, Http1ProtocolOptionsValidationError{
  878. field: "AllowAbsoluteUrl",
  879. reason: "embedded message failed validation",
  880. cause: err,
  881. })
  882. }
  883. }
  884. } else if v, ok := interface{}(m.GetAllowAbsoluteUrl()).(interface{ Validate() error }); ok {
  885. if err := v.Validate(); err != nil {
  886. return Http1ProtocolOptionsValidationError{
  887. field: "AllowAbsoluteUrl",
  888. reason: "embedded message failed validation",
  889. cause: err,
  890. }
  891. }
  892. }
  893. // no validation rules for AcceptHttp_10
  894. // no validation rules for DefaultHostForHttp_10
  895. if all {
  896. switch v := interface{}(m.GetHeaderKeyFormat()).(type) {
  897. case interface{ ValidateAll() error }:
  898. if err := v.ValidateAll(); err != nil {
  899. errors = append(errors, Http1ProtocolOptionsValidationError{
  900. field: "HeaderKeyFormat",
  901. reason: "embedded message failed validation",
  902. cause: err,
  903. })
  904. }
  905. case interface{ Validate() error }:
  906. if err := v.Validate(); err != nil {
  907. errors = append(errors, Http1ProtocolOptionsValidationError{
  908. field: "HeaderKeyFormat",
  909. reason: "embedded message failed validation",
  910. cause: err,
  911. })
  912. }
  913. }
  914. } else if v, ok := interface{}(m.GetHeaderKeyFormat()).(interface{ Validate() error }); ok {
  915. if err := v.Validate(); err != nil {
  916. return Http1ProtocolOptionsValidationError{
  917. field: "HeaderKeyFormat",
  918. reason: "embedded message failed validation",
  919. cause: err,
  920. }
  921. }
  922. }
  923. // no validation rules for EnableTrailers
  924. // no validation rules for AllowChunkedLength
  925. if all {
  926. switch v := interface{}(m.GetOverrideStreamErrorOnInvalidHttpMessage()).(type) {
  927. case interface{ ValidateAll() error }:
  928. if err := v.ValidateAll(); err != nil {
  929. errors = append(errors, Http1ProtocolOptionsValidationError{
  930. field: "OverrideStreamErrorOnInvalidHttpMessage",
  931. reason: "embedded message failed validation",
  932. cause: err,
  933. })
  934. }
  935. case interface{ Validate() error }:
  936. if err := v.Validate(); err != nil {
  937. errors = append(errors, Http1ProtocolOptionsValidationError{
  938. field: "OverrideStreamErrorOnInvalidHttpMessage",
  939. reason: "embedded message failed validation",
  940. cause: err,
  941. })
  942. }
  943. }
  944. } else if v, ok := interface{}(m.GetOverrideStreamErrorOnInvalidHttpMessage()).(interface{ Validate() error }); ok {
  945. if err := v.Validate(); err != nil {
  946. return Http1ProtocolOptionsValidationError{
  947. field: "OverrideStreamErrorOnInvalidHttpMessage",
  948. reason: "embedded message failed validation",
  949. cause: err,
  950. }
  951. }
  952. }
  953. if len(errors) > 0 {
  954. return Http1ProtocolOptionsMultiError(errors)
  955. }
  956. return nil
  957. }
  958. // Http1ProtocolOptionsMultiError is an error wrapping multiple validation
  959. // errors returned by Http1ProtocolOptions.ValidateAll() if the designated
  960. // constraints aren't met.
  961. type Http1ProtocolOptionsMultiError []error
  962. // Error returns a concatenation of all the error messages it wraps.
  963. func (m Http1ProtocolOptionsMultiError) Error() string {
  964. var msgs []string
  965. for _, err := range m {
  966. msgs = append(msgs, err.Error())
  967. }
  968. return strings.Join(msgs, "; ")
  969. }
  970. // AllErrors returns a list of validation violation errors.
  971. func (m Http1ProtocolOptionsMultiError) AllErrors() []error { return m }
  972. // Http1ProtocolOptionsValidationError is the validation error returned by
  973. // Http1ProtocolOptions.Validate if the designated constraints aren't met.
  974. type Http1ProtocolOptionsValidationError struct {
  975. field string
  976. reason string
  977. cause error
  978. key bool
  979. }
  980. // Field function returns field value.
  981. func (e Http1ProtocolOptionsValidationError) Field() string { return e.field }
  982. // Reason function returns reason value.
  983. func (e Http1ProtocolOptionsValidationError) Reason() string { return e.reason }
  984. // Cause function returns cause value.
  985. func (e Http1ProtocolOptionsValidationError) Cause() error { return e.cause }
  986. // Key function returns key value.
  987. func (e Http1ProtocolOptionsValidationError) Key() bool { return e.key }
  988. // ErrorName returns error name.
  989. func (e Http1ProtocolOptionsValidationError) ErrorName() string {
  990. return "Http1ProtocolOptionsValidationError"
  991. }
  992. // Error satisfies the builtin error interface
  993. func (e Http1ProtocolOptionsValidationError) Error() string {
  994. cause := ""
  995. if e.cause != nil {
  996. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  997. }
  998. key := ""
  999. if e.key {
  1000. key = "key for "
  1001. }
  1002. return fmt.Sprintf(
  1003. "invalid %sHttp1ProtocolOptions.%s: %s%s",
  1004. key,
  1005. e.field,
  1006. e.reason,
  1007. cause)
  1008. }
  1009. var _ error = Http1ProtocolOptionsValidationError{}
  1010. var _ interface {
  1011. Field() string
  1012. Reason() string
  1013. Key() bool
  1014. Cause() error
  1015. ErrorName() string
  1016. } = Http1ProtocolOptionsValidationError{}
  1017. // Validate checks the field values on KeepaliveSettings with the rules defined
  1018. // in the proto definition for this message. If any rules are violated, the
  1019. // first error encountered is returned, or nil if there are no violations.
  1020. func (m *KeepaliveSettings) Validate() error {
  1021. return m.validate(false)
  1022. }
  1023. // ValidateAll checks the field values on KeepaliveSettings with the rules
  1024. // defined in the proto definition for this message. If any rules are
  1025. // violated, the result is a list of violation errors wrapped in
  1026. // KeepaliveSettingsMultiError, or nil if none found.
  1027. func (m *KeepaliveSettings) ValidateAll() error {
  1028. return m.validate(true)
  1029. }
  1030. func (m *KeepaliveSettings) validate(all bool) error {
  1031. if m == nil {
  1032. return nil
  1033. }
  1034. var errors []error
  1035. if d := m.GetInterval(); d != nil {
  1036. dur, err := d.AsDuration(), d.CheckValid()
  1037. if err != nil {
  1038. err = KeepaliveSettingsValidationError{
  1039. field: "Interval",
  1040. reason: "value is not a valid duration",
  1041. cause: err,
  1042. }
  1043. if !all {
  1044. return err
  1045. }
  1046. errors = append(errors, err)
  1047. } else {
  1048. gte := time.Duration(0*time.Second + 1000000*time.Nanosecond)
  1049. if dur < gte {
  1050. err := KeepaliveSettingsValidationError{
  1051. field: "Interval",
  1052. reason: "value must be greater than or equal to 1ms",
  1053. }
  1054. if !all {
  1055. return err
  1056. }
  1057. errors = append(errors, err)
  1058. }
  1059. }
  1060. }
  1061. if m.GetTimeout() == nil {
  1062. err := KeepaliveSettingsValidationError{
  1063. field: "Timeout",
  1064. reason: "value is required",
  1065. }
  1066. if !all {
  1067. return err
  1068. }
  1069. errors = append(errors, err)
  1070. }
  1071. if d := m.GetTimeout(); d != nil {
  1072. dur, err := d.AsDuration(), d.CheckValid()
  1073. if err != nil {
  1074. err = KeepaliveSettingsValidationError{
  1075. field: "Timeout",
  1076. reason: "value is not a valid duration",
  1077. cause: err,
  1078. }
  1079. if !all {
  1080. return err
  1081. }
  1082. errors = append(errors, err)
  1083. } else {
  1084. gte := time.Duration(0*time.Second + 1000000*time.Nanosecond)
  1085. if dur < gte {
  1086. err := KeepaliveSettingsValidationError{
  1087. field: "Timeout",
  1088. reason: "value must be greater than or equal to 1ms",
  1089. }
  1090. if !all {
  1091. return err
  1092. }
  1093. errors = append(errors, err)
  1094. }
  1095. }
  1096. }
  1097. if all {
  1098. switch v := interface{}(m.GetIntervalJitter()).(type) {
  1099. case interface{ ValidateAll() error }:
  1100. if err := v.ValidateAll(); err != nil {
  1101. errors = append(errors, KeepaliveSettingsValidationError{
  1102. field: "IntervalJitter",
  1103. reason: "embedded message failed validation",
  1104. cause: err,
  1105. })
  1106. }
  1107. case interface{ Validate() error }:
  1108. if err := v.Validate(); err != nil {
  1109. errors = append(errors, KeepaliveSettingsValidationError{
  1110. field: "IntervalJitter",
  1111. reason: "embedded message failed validation",
  1112. cause: err,
  1113. })
  1114. }
  1115. }
  1116. } else if v, ok := interface{}(m.GetIntervalJitter()).(interface{ Validate() error }); ok {
  1117. if err := v.Validate(); err != nil {
  1118. return KeepaliveSettingsValidationError{
  1119. field: "IntervalJitter",
  1120. reason: "embedded message failed validation",
  1121. cause: err,
  1122. }
  1123. }
  1124. }
  1125. if d := m.GetConnectionIdleInterval(); d != nil {
  1126. dur, err := d.AsDuration(), d.CheckValid()
  1127. if err != nil {
  1128. err = KeepaliveSettingsValidationError{
  1129. field: "ConnectionIdleInterval",
  1130. reason: "value is not a valid duration",
  1131. cause: err,
  1132. }
  1133. if !all {
  1134. return err
  1135. }
  1136. errors = append(errors, err)
  1137. } else {
  1138. gte := time.Duration(0*time.Second + 1000000*time.Nanosecond)
  1139. if dur < gte {
  1140. err := KeepaliveSettingsValidationError{
  1141. field: "ConnectionIdleInterval",
  1142. reason: "value must be greater than or equal to 1ms",
  1143. }
  1144. if !all {
  1145. return err
  1146. }
  1147. errors = append(errors, err)
  1148. }
  1149. }
  1150. }
  1151. if len(errors) > 0 {
  1152. return KeepaliveSettingsMultiError(errors)
  1153. }
  1154. return nil
  1155. }
  1156. // KeepaliveSettingsMultiError is an error wrapping multiple validation errors
  1157. // returned by KeepaliveSettings.ValidateAll() if the designated constraints
  1158. // aren't met.
  1159. type KeepaliveSettingsMultiError []error
  1160. // Error returns a concatenation of all the error messages it wraps.
  1161. func (m KeepaliveSettingsMultiError) Error() string {
  1162. var msgs []string
  1163. for _, err := range m {
  1164. msgs = append(msgs, err.Error())
  1165. }
  1166. return strings.Join(msgs, "; ")
  1167. }
  1168. // AllErrors returns a list of validation violation errors.
  1169. func (m KeepaliveSettingsMultiError) AllErrors() []error { return m }
  1170. // KeepaliveSettingsValidationError is the validation error returned by
  1171. // KeepaliveSettings.Validate if the designated constraints aren't met.
  1172. type KeepaliveSettingsValidationError struct {
  1173. field string
  1174. reason string
  1175. cause error
  1176. key bool
  1177. }
  1178. // Field function returns field value.
  1179. func (e KeepaliveSettingsValidationError) Field() string { return e.field }
  1180. // Reason function returns reason value.
  1181. func (e KeepaliveSettingsValidationError) Reason() string { return e.reason }
  1182. // Cause function returns cause value.
  1183. func (e KeepaliveSettingsValidationError) Cause() error { return e.cause }
  1184. // Key function returns key value.
  1185. func (e KeepaliveSettingsValidationError) Key() bool { return e.key }
  1186. // ErrorName returns error name.
  1187. func (e KeepaliveSettingsValidationError) ErrorName() string {
  1188. return "KeepaliveSettingsValidationError"
  1189. }
  1190. // Error satisfies the builtin error interface
  1191. func (e KeepaliveSettingsValidationError) Error() string {
  1192. cause := ""
  1193. if e.cause != nil {
  1194. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  1195. }
  1196. key := ""
  1197. if e.key {
  1198. key = "key for "
  1199. }
  1200. return fmt.Sprintf(
  1201. "invalid %sKeepaliveSettings.%s: %s%s",
  1202. key,
  1203. e.field,
  1204. e.reason,
  1205. cause)
  1206. }
  1207. var _ error = KeepaliveSettingsValidationError{}
  1208. var _ interface {
  1209. Field() string
  1210. Reason() string
  1211. Key() bool
  1212. Cause() error
  1213. ErrorName() string
  1214. } = KeepaliveSettingsValidationError{}
  1215. // Validate checks the field values on Http2ProtocolOptions with the rules
  1216. // defined in the proto definition for this message. If any rules are
  1217. // violated, the first error encountered is returned, or nil if there are no violations.
  1218. func (m *Http2ProtocolOptions) Validate() error {
  1219. return m.validate(false)
  1220. }
  1221. // ValidateAll checks the field values on Http2ProtocolOptions with the rules
  1222. // defined in the proto definition for this message. If any rules are
  1223. // violated, the result is a list of violation errors wrapped in
  1224. // Http2ProtocolOptionsMultiError, or nil if none found.
  1225. func (m *Http2ProtocolOptions) ValidateAll() error {
  1226. return m.validate(true)
  1227. }
  1228. func (m *Http2ProtocolOptions) validate(all bool) error {
  1229. if m == nil {
  1230. return nil
  1231. }
  1232. var errors []error
  1233. if all {
  1234. switch v := interface{}(m.GetHpackTableSize()).(type) {
  1235. case interface{ ValidateAll() error }:
  1236. if err := v.ValidateAll(); err != nil {
  1237. errors = append(errors, Http2ProtocolOptionsValidationError{
  1238. field: "HpackTableSize",
  1239. reason: "embedded message failed validation",
  1240. cause: err,
  1241. })
  1242. }
  1243. case interface{ Validate() error }:
  1244. if err := v.Validate(); err != nil {
  1245. errors = append(errors, Http2ProtocolOptionsValidationError{
  1246. field: "HpackTableSize",
  1247. reason: "embedded message failed validation",
  1248. cause: err,
  1249. })
  1250. }
  1251. }
  1252. } else if v, ok := interface{}(m.GetHpackTableSize()).(interface{ Validate() error }); ok {
  1253. if err := v.Validate(); err != nil {
  1254. return Http2ProtocolOptionsValidationError{
  1255. field: "HpackTableSize",
  1256. reason: "embedded message failed validation",
  1257. cause: err,
  1258. }
  1259. }
  1260. }
  1261. if wrapper := m.GetMaxConcurrentStreams(); wrapper != nil {
  1262. if val := wrapper.GetValue(); val < 1 || val > 2147483647 {
  1263. err := Http2ProtocolOptionsValidationError{
  1264. field: "MaxConcurrentStreams",
  1265. reason: "value must be inside range [1, 2147483647]",
  1266. }
  1267. if !all {
  1268. return err
  1269. }
  1270. errors = append(errors, err)
  1271. }
  1272. }
  1273. if wrapper := m.GetInitialStreamWindowSize(); wrapper != nil {
  1274. if val := wrapper.GetValue(); val < 65535 || val > 2147483647 {
  1275. err := Http2ProtocolOptionsValidationError{
  1276. field: "InitialStreamWindowSize",
  1277. reason: "value must be inside range [65535, 2147483647]",
  1278. }
  1279. if !all {
  1280. return err
  1281. }
  1282. errors = append(errors, err)
  1283. }
  1284. }
  1285. if wrapper := m.GetInitialConnectionWindowSize(); wrapper != nil {
  1286. if val := wrapper.GetValue(); val < 65535 || val > 2147483647 {
  1287. err := Http2ProtocolOptionsValidationError{
  1288. field: "InitialConnectionWindowSize",
  1289. reason: "value must be inside range [65535, 2147483647]",
  1290. }
  1291. if !all {
  1292. return err
  1293. }
  1294. errors = append(errors, err)
  1295. }
  1296. }
  1297. // no validation rules for AllowConnect
  1298. // no validation rules for AllowMetadata
  1299. if wrapper := m.GetMaxOutboundFrames(); wrapper != nil {
  1300. if wrapper.GetValue() < 1 {
  1301. err := Http2ProtocolOptionsValidationError{
  1302. field: "MaxOutboundFrames",
  1303. reason: "value must be greater than or equal to 1",
  1304. }
  1305. if !all {
  1306. return err
  1307. }
  1308. errors = append(errors, err)
  1309. }
  1310. }
  1311. if wrapper := m.GetMaxOutboundControlFrames(); wrapper != nil {
  1312. if wrapper.GetValue() < 1 {
  1313. err := Http2ProtocolOptionsValidationError{
  1314. field: "MaxOutboundControlFrames",
  1315. reason: "value must be greater than or equal to 1",
  1316. }
  1317. if !all {
  1318. return err
  1319. }
  1320. errors = append(errors, err)
  1321. }
  1322. }
  1323. if all {
  1324. switch v := interface{}(m.GetMaxConsecutiveInboundFramesWithEmptyPayload()).(type) {
  1325. case interface{ ValidateAll() error }:
  1326. if err := v.ValidateAll(); err != nil {
  1327. errors = append(errors, Http2ProtocolOptionsValidationError{
  1328. field: "MaxConsecutiveInboundFramesWithEmptyPayload",
  1329. reason: "embedded message failed validation",
  1330. cause: err,
  1331. })
  1332. }
  1333. case interface{ Validate() error }:
  1334. if err := v.Validate(); err != nil {
  1335. errors = append(errors, Http2ProtocolOptionsValidationError{
  1336. field: "MaxConsecutiveInboundFramesWithEmptyPayload",
  1337. reason: "embedded message failed validation",
  1338. cause: err,
  1339. })
  1340. }
  1341. }
  1342. } else if v, ok := interface{}(m.GetMaxConsecutiveInboundFramesWithEmptyPayload()).(interface{ Validate() error }); ok {
  1343. if err := v.Validate(); err != nil {
  1344. return Http2ProtocolOptionsValidationError{
  1345. field: "MaxConsecutiveInboundFramesWithEmptyPayload",
  1346. reason: "embedded message failed validation",
  1347. cause: err,
  1348. }
  1349. }
  1350. }
  1351. if all {
  1352. switch v := interface{}(m.GetMaxInboundPriorityFramesPerStream()).(type) {
  1353. case interface{ ValidateAll() error }:
  1354. if err := v.ValidateAll(); err != nil {
  1355. errors = append(errors, Http2ProtocolOptionsValidationError{
  1356. field: "MaxInboundPriorityFramesPerStream",
  1357. reason: "embedded message failed validation",
  1358. cause: err,
  1359. })
  1360. }
  1361. case interface{ Validate() error }:
  1362. if err := v.Validate(); err != nil {
  1363. errors = append(errors, Http2ProtocolOptionsValidationError{
  1364. field: "MaxInboundPriorityFramesPerStream",
  1365. reason: "embedded message failed validation",
  1366. cause: err,
  1367. })
  1368. }
  1369. }
  1370. } else if v, ok := interface{}(m.GetMaxInboundPriorityFramesPerStream()).(interface{ Validate() error }); ok {
  1371. if err := v.Validate(); err != nil {
  1372. return Http2ProtocolOptionsValidationError{
  1373. field: "MaxInboundPriorityFramesPerStream",
  1374. reason: "embedded message failed validation",
  1375. cause: err,
  1376. }
  1377. }
  1378. }
  1379. if wrapper := m.GetMaxInboundWindowUpdateFramesPerDataFrameSent(); wrapper != nil {
  1380. if wrapper.GetValue() < 1 {
  1381. err := Http2ProtocolOptionsValidationError{
  1382. field: "MaxInboundWindowUpdateFramesPerDataFrameSent",
  1383. reason: "value must be greater than or equal to 1",
  1384. }
  1385. if !all {
  1386. return err
  1387. }
  1388. errors = append(errors, err)
  1389. }
  1390. }
  1391. // no validation rules for StreamErrorOnInvalidHttpMessaging
  1392. if all {
  1393. switch v := interface{}(m.GetOverrideStreamErrorOnInvalidHttpMessage()).(type) {
  1394. case interface{ ValidateAll() error }:
  1395. if err := v.ValidateAll(); err != nil {
  1396. errors = append(errors, Http2ProtocolOptionsValidationError{
  1397. field: "OverrideStreamErrorOnInvalidHttpMessage",
  1398. reason: "embedded message failed validation",
  1399. cause: err,
  1400. })
  1401. }
  1402. case interface{ Validate() error }:
  1403. if err := v.Validate(); err != nil {
  1404. errors = append(errors, Http2ProtocolOptionsValidationError{
  1405. field: "OverrideStreamErrorOnInvalidHttpMessage",
  1406. reason: "embedded message failed validation",
  1407. cause: err,
  1408. })
  1409. }
  1410. }
  1411. } else if v, ok := interface{}(m.GetOverrideStreamErrorOnInvalidHttpMessage()).(interface{ Validate() error }); ok {
  1412. if err := v.Validate(); err != nil {
  1413. return Http2ProtocolOptionsValidationError{
  1414. field: "OverrideStreamErrorOnInvalidHttpMessage",
  1415. reason: "embedded message failed validation",
  1416. cause: err,
  1417. }
  1418. }
  1419. }
  1420. for idx, item := range m.GetCustomSettingsParameters() {
  1421. _, _ = idx, item
  1422. if all {
  1423. switch v := interface{}(item).(type) {
  1424. case interface{ ValidateAll() error }:
  1425. if err := v.ValidateAll(); err != nil {
  1426. errors = append(errors, Http2ProtocolOptionsValidationError{
  1427. field: fmt.Sprintf("CustomSettingsParameters[%v]", idx),
  1428. reason: "embedded message failed validation",
  1429. cause: err,
  1430. })
  1431. }
  1432. case interface{ Validate() error }:
  1433. if err := v.Validate(); err != nil {
  1434. errors = append(errors, Http2ProtocolOptionsValidationError{
  1435. field: fmt.Sprintf("CustomSettingsParameters[%v]", idx),
  1436. reason: "embedded message failed validation",
  1437. cause: err,
  1438. })
  1439. }
  1440. }
  1441. } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  1442. if err := v.Validate(); err != nil {
  1443. return Http2ProtocolOptionsValidationError{
  1444. field: fmt.Sprintf("CustomSettingsParameters[%v]", idx),
  1445. reason: "embedded message failed validation",
  1446. cause: err,
  1447. }
  1448. }
  1449. }
  1450. }
  1451. if all {
  1452. switch v := interface{}(m.GetConnectionKeepalive()).(type) {
  1453. case interface{ ValidateAll() error }:
  1454. if err := v.ValidateAll(); err != nil {
  1455. errors = append(errors, Http2ProtocolOptionsValidationError{
  1456. field: "ConnectionKeepalive",
  1457. reason: "embedded message failed validation",
  1458. cause: err,
  1459. })
  1460. }
  1461. case interface{ Validate() error }:
  1462. if err := v.Validate(); err != nil {
  1463. errors = append(errors, Http2ProtocolOptionsValidationError{
  1464. field: "ConnectionKeepalive",
  1465. reason: "embedded message failed validation",
  1466. cause: err,
  1467. })
  1468. }
  1469. }
  1470. } else if v, ok := interface{}(m.GetConnectionKeepalive()).(interface{ Validate() error }); ok {
  1471. if err := v.Validate(); err != nil {
  1472. return Http2ProtocolOptionsValidationError{
  1473. field: "ConnectionKeepalive",
  1474. reason: "embedded message failed validation",
  1475. cause: err,
  1476. }
  1477. }
  1478. }
  1479. if len(errors) > 0 {
  1480. return Http2ProtocolOptionsMultiError(errors)
  1481. }
  1482. return nil
  1483. }
  1484. // Http2ProtocolOptionsMultiError is an error wrapping multiple validation
  1485. // errors returned by Http2ProtocolOptions.ValidateAll() if the designated
  1486. // constraints aren't met.
  1487. type Http2ProtocolOptionsMultiError []error
  1488. // Error returns a concatenation of all the error messages it wraps.
  1489. func (m Http2ProtocolOptionsMultiError) Error() string {
  1490. var msgs []string
  1491. for _, err := range m {
  1492. msgs = append(msgs, err.Error())
  1493. }
  1494. return strings.Join(msgs, "; ")
  1495. }
  1496. // AllErrors returns a list of validation violation errors.
  1497. func (m Http2ProtocolOptionsMultiError) AllErrors() []error { return m }
  1498. // Http2ProtocolOptionsValidationError is the validation error returned by
  1499. // Http2ProtocolOptions.Validate if the designated constraints aren't met.
  1500. type Http2ProtocolOptionsValidationError struct {
  1501. field string
  1502. reason string
  1503. cause error
  1504. key bool
  1505. }
  1506. // Field function returns field value.
  1507. func (e Http2ProtocolOptionsValidationError) Field() string { return e.field }
  1508. // Reason function returns reason value.
  1509. func (e Http2ProtocolOptionsValidationError) Reason() string { return e.reason }
  1510. // Cause function returns cause value.
  1511. func (e Http2ProtocolOptionsValidationError) Cause() error { return e.cause }
  1512. // Key function returns key value.
  1513. func (e Http2ProtocolOptionsValidationError) Key() bool { return e.key }
  1514. // ErrorName returns error name.
  1515. func (e Http2ProtocolOptionsValidationError) ErrorName() string {
  1516. return "Http2ProtocolOptionsValidationError"
  1517. }
  1518. // Error satisfies the builtin error interface
  1519. func (e Http2ProtocolOptionsValidationError) Error() string {
  1520. cause := ""
  1521. if