/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.pb.validate.go

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