/vendor/github.com/envoyproxy/go-control-plane/envoy/api/v2/auth/tls.pb.validate.go

https://github.com/knative/pkg · Go · 544 lines · 398 code · 94 blank · 52 comment · 81 complexity · 41573a3cbd1eb9d72879181d47d074b6 MD5 · raw file

  1. // Code generated by protoc-gen-validate. DO NOT EDIT.
  2. // source: envoy/api/v2/auth/tls.proto
  3. package envoy_api_v2_auth
  4. import (
  5. "bytes"
  6. "errors"
  7. "fmt"
  8. "net"
  9. "net/mail"
  10. "net/url"
  11. "regexp"
  12. "strings"
  13. "time"
  14. "unicode/utf8"
  15. "google.golang.org/protobuf/types/known/anypb"
  16. )
  17. // ensure the imports are used
  18. var (
  19. _ = bytes.MinRead
  20. _ = errors.New("")
  21. _ = fmt.Print
  22. _ = utf8.UTFMax
  23. _ = (*regexp.Regexp)(nil)
  24. _ = (*strings.Reader)(nil)
  25. _ = net.IPv4len
  26. _ = time.Duration(0)
  27. _ = (*url.URL)(nil)
  28. _ = (*mail.Address)(nil)
  29. _ = anypb.Any{}
  30. )
  31. // Validate checks the field values on UpstreamTlsContext with the rules
  32. // defined in the proto definition for this message. If any rules are
  33. // violated, an error is returned.
  34. func (m *UpstreamTlsContext) Validate() error {
  35. if m == nil {
  36. return nil
  37. }
  38. if v, ok := interface{}(m.GetCommonTlsContext()).(interface{ Validate() error }); ok {
  39. if err := v.Validate(); err != nil {
  40. return UpstreamTlsContextValidationError{
  41. field: "CommonTlsContext",
  42. reason: "embedded message failed validation",
  43. cause: err,
  44. }
  45. }
  46. }
  47. if len(m.GetSni()) > 255 {
  48. return UpstreamTlsContextValidationError{
  49. field: "Sni",
  50. reason: "value length must be at most 255 bytes",
  51. }
  52. }
  53. // no validation rules for AllowRenegotiation
  54. if v, ok := interface{}(m.GetMaxSessionKeys()).(interface{ Validate() error }); ok {
  55. if err := v.Validate(); err != nil {
  56. return UpstreamTlsContextValidationError{
  57. field: "MaxSessionKeys",
  58. reason: "embedded message failed validation",
  59. cause: err,
  60. }
  61. }
  62. }
  63. return nil
  64. }
  65. // UpstreamTlsContextValidationError is the validation error returned by
  66. // UpstreamTlsContext.Validate if the designated constraints aren't met.
  67. type UpstreamTlsContextValidationError struct {
  68. field string
  69. reason string
  70. cause error
  71. key bool
  72. }
  73. // Field function returns field value.
  74. func (e UpstreamTlsContextValidationError) Field() string { return e.field }
  75. // Reason function returns reason value.
  76. func (e UpstreamTlsContextValidationError) Reason() string { return e.reason }
  77. // Cause function returns cause value.
  78. func (e UpstreamTlsContextValidationError) Cause() error { return e.cause }
  79. // Key function returns key value.
  80. func (e UpstreamTlsContextValidationError) Key() bool { return e.key }
  81. // ErrorName returns error name.
  82. func (e UpstreamTlsContextValidationError) ErrorName() string {
  83. return "UpstreamTlsContextValidationError"
  84. }
  85. // Error satisfies the builtin error interface
  86. func (e UpstreamTlsContextValidationError) Error() string {
  87. cause := ""
  88. if e.cause != nil {
  89. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  90. }
  91. key := ""
  92. if e.key {
  93. key = "key for "
  94. }
  95. return fmt.Sprintf(
  96. "invalid %sUpstreamTlsContext.%s: %s%s",
  97. key,
  98. e.field,
  99. e.reason,
  100. cause)
  101. }
  102. var _ error = UpstreamTlsContextValidationError{}
  103. var _ interface {
  104. Field() string
  105. Reason() string
  106. Key() bool
  107. Cause() error
  108. ErrorName() string
  109. } = UpstreamTlsContextValidationError{}
  110. // Validate checks the field values on DownstreamTlsContext with the rules
  111. // defined in the proto definition for this message. If any rules are
  112. // violated, an error is returned.
  113. func (m *DownstreamTlsContext) Validate() error {
  114. if m == nil {
  115. return nil
  116. }
  117. if v, ok := interface{}(m.GetCommonTlsContext()).(interface{ Validate() error }); ok {
  118. if err := v.Validate(); err != nil {
  119. return DownstreamTlsContextValidationError{
  120. field: "CommonTlsContext",
  121. reason: "embedded message failed validation",
  122. cause: err,
  123. }
  124. }
  125. }
  126. if v, ok := interface{}(m.GetRequireClientCertificate()).(interface{ Validate() error }); ok {
  127. if err := v.Validate(); err != nil {
  128. return DownstreamTlsContextValidationError{
  129. field: "RequireClientCertificate",
  130. reason: "embedded message failed validation",
  131. cause: err,
  132. }
  133. }
  134. }
  135. if v, ok := interface{}(m.GetRequireSni()).(interface{ Validate() error }); ok {
  136. if err := v.Validate(); err != nil {
  137. return DownstreamTlsContextValidationError{
  138. field: "RequireSni",
  139. reason: "embedded message failed validation",
  140. cause: err,
  141. }
  142. }
  143. }
  144. if d := m.GetSessionTimeout(); d != nil {
  145. dur, err := d.AsDuration(), d.CheckValid()
  146. if err != nil {
  147. return DownstreamTlsContextValidationError{
  148. field: "SessionTimeout",
  149. reason: "value is not a valid duration",
  150. cause: err,
  151. }
  152. }
  153. lt := time.Duration(4294967296*time.Second + 0*time.Nanosecond)
  154. gte := time.Duration(0*time.Second + 0*time.Nanosecond)
  155. if dur < gte || dur >= lt {
  156. return DownstreamTlsContextValidationError{
  157. field: "SessionTimeout",
  158. reason: "value must be inside range [0s, 1193046h28m16s)",
  159. }
  160. }
  161. }
  162. switch m.SessionTicketKeysType.(type) {
  163. case *DownstreamTlsContext_SessionTicketKeys:
  164. if v, ok := interface{}(m.GetSessionTicketKeys()).(interface{ Validate() error }); ok {
  165. if err := v.Validate(); err != nil {
  166. return DownstreamTlsContextValidationError{
  167. field: "SessionTicketKeys",
  168. reason: "embedded message failed validation",
  169. cause: err,
  170. }
  171. }
  172. }
  173. case *DownstreamTlsContext_SessionTicketKeysSdsSecretConfig:
  174. if v, ok := interface{}(m.GetSessionTicketKeysSdsSecretConfig()).(interface{ Validate() error }); ok {
  175. if err := v.Validate(); err != nil {
  176. return DownstreamTlsContextValidationError{
  177. field: "SessionTicketKeysSdsSecretConfig",
  178. reason: "embedded message failed validation",
  179. cause: err,
  180. }
  181. }
  182. }
  183. case *DownstreamTlsContext_DisableStatelessSessionResumption:
  184. // no validation rules for DisableStatelessSessionResumption
  185. }
  186. return nil
  187. }
  188. // DownstreamTlsContextValidationError is the validation error returned by
  189. // DownstreamTlsContext.Validate if the designated constraints aren't met.
  190. type DownstreamTlsContextValidationError struct {
  191. field string
  192. reason string
  193. cause error
  194. key bool
  195. }
  196. // Field function returns field value.
  197. func (e DownstreamTlsContextValidationError) Field() string { return e.field }
  198. // Reason function returns reason value.
  199. func (e DownstreamTlsContextValidationError) Reason() string { return e.reason }
  200. // Cause function returns cause value.
  201. func (e DownstreamTlsContextValidationError) Cause() error { return e.cause }
  202. // Key function returns key value.
  203. func (e DownstreamTlsContextValidationError) Key() bool { return e.key }
  204. // ErrorName returns error name.
  205. func (e DownstreamTlsContextValidationError) ErrorName() string {
  206. return "DownstreamTlsContextValidationError"
  207. }
  208. // Error satisfies the builtin error interface
  209. func (e DownstreamTlsContextValidationError) Error() string {
  210. cause := ""
  211. if e.cause != nil {
  212. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  213. }
  214. key := ""
  215. if e.key {
  216. key = "key for "
  217. }
  218. return fmt.Sprintf(
  219. "invalid %sDownstreamTlsContext.%s: %s%s",
  220. key,
  221. e.field,
  222. e.reason,
  223. cause)
  224. }
  225. var _ error = DownstreamTlsContextValidationError{}
  226. var _ interface {
  227. Field() string
  228. Reason() string
  229. Key() bool
  230. Cause() error
  231. ErrorName() string
  232. } = DownstreamTlsContextValidationError{}
  233. // Validate checks the field values on CommonTlsContext with the rules defined
  234. // in the proto definition for this message. If any rules are violated, an
  235. // error is returned.
  236. func (m *CommonTlsContext) Validate() error {
  237. if m == nil {
  238. return nil
  239. }
  240. if v, ok := interface{}(m.GetTlsParams()).(interface{ Validate() error }); ok {
  241. if err := v.Validate(); err != nil {
  242. return CommonTlsContextValidationError{
  243. field: "TlsParams",
  244. reason: "embedded message failed validation",
  245. cause: err,
  246. }
  247. }
  248. }
  249. for idx, item := range m.GetTlsCertificates() {
  250. _, _ = idx, item
  251. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  252. if err := v.Validate(); err != nil {
  253. return CommonTlsContextValidationError{
  254. field: fmt.Sprintf("TlsCertificates[%v]", idx),
  255. reason: "embedded message failed validation",
  256. cause: err,
  257. }
  258. }
  259. }
  260. }
  261. if len(m.GetTlsCertificateSdsSecretConfigs()) > 1 {
  262. return CommonTlsContextValidationError{
  263. field: "TlsCertificateSdsSecretConfigs",
  264. reason: "value must contain no more than 1 item(s)",
  265. }
  266. }
  267. for idx, item := range m.GetTlsCertificateSdsSecretConfigs() {
  268. _, _ = idx, item
  269. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  270. if err := v.Validate(); err != nil {
  271. return CommonTlsContextValidationError{
  272. field: fmt.Sprintf("TlsCertificateSdsSecretConfigs[%v]", idx),
  273. reason: "embedded message failed validation",
  274. cause: err,
  275. }
  276. }
  277. }
  278. }
  279. switch m.ValidationContextType.(type) {
  280. case *CommonTlsContext_ValidationContext:
  281. if v, ok := interface{}(m.GetValidationContext()).(interface{ Validate() error }); ok {
  282. if err := v.Validate(); err != nil {
  283. return CommonTlsContextValidationError{
  284. field: "ValidationContext",
  285. reason: "embedded message failed validation",
  286. cause: err,
  287. }
  288. }
  289. }
  290. case *CommonTlsContext_ValidationContextSdsSecretConfig:
  291. if v, ok := interface{}(m.GetValidationContextSdsSecretConfig()).(interface{ Validate() error }); ok {
  292. if err := v.Validate(); err != nil {
  293. return CommonTlsContextValidationError{
  294. field: "ValidationContextSdsSecretConfig",
  295. reason: "embedded message failed validation",
  296. cause: err,
  297. }
  298. }
  299. }
  300. case *CommonTlsContext_CombinedValidationContext:
  301. if v, ok := interface{}(m.GetCombinedValidationContext()).(interface{ Validate() error }); ok {
  302. if err := v.Validate(); err != nil {
  303. return CommonTlsContextValidationError{
  304. field: "CombinedValidationContext",
  305. reason: "embedded message failed validation",
  306. cause: err,
  307. }
  308. }
  309. }
  310. }
  311. return nil
  312. }
  313. // CommonTlsContextValidationError is the validation error returned by
  314. // CommonTlsContext.Validate if the designated constraints aren't met.
  315. type CommonTlsContextValidationError struct {
  316. field string
  317. reason string
  318. cause error
  319. key bool
  320. }
  321. // Field function returns field value.
  322. func (e CommonTlsContextValidationError) Field() string { return e.field }
  323. // Reason function returns reason value.
  324. func (e CommonTlsContextValidationError) Reason() string { return e.reason }
  325. // Cause function returns cause value.
  326. func (e CommonTlsContextValidationError) Cause() error { return e.cause }
  327. // Key function returns key value.
  328. func (e CommonTlsContextValidationError) Key() bool { return e.key }
  329. // ErrorName returns error name.
  330. func (e CommonTlsContextValidationError) ErrorName() string { return "CommonTlsContextValidationError" }
  331. // Error satisfies the builtin error interface
  332. func (e CommonTlsContextValidationError) Error() string {
  333. cause := ""
  334. if e.cause != nil {
  335. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  336. }
  337. key := ""
  338. if e.key {
  339. key = "key for "
  340. }
  341. return fmt.Sprintf(
  342. "invalid %sCommonTlsContext.%s: %s%s",
  343. key,
  344. e.field,
  345. e.reason,
  346. cause)
  347. }
  348. var _ error = CommonTlsContextValidationError{}
  349. var _ interface {
  350. Field() string
  351. Reason() string
  352. Key() bool
  353. Cause() error
  354. ErrorName() string
  355. } = CommonTlsContextValidationError{}
  356. // Validate checks the field values on
  357. // CommonTlsContext_CombinedCertificateValidationContext with the rules
  358. // defined in the proto definition for this message. If any rules are
  359. // violated, an error is returned.
  360. func (m *CommonTlsContext_CombinedCertificateValidationContext) Validate() error {
  361. if m == nil {
  362. return nil
  363. }
  364. if m.GetDefaultValidationContext() == nil {
  365. return CommonTlsContext_CombinedCertificateValidationContextValidationError{
  366. field: "DefaultValidationContext",
  367. reason: "value is required",
  368. }
  369. }
  370. if v, ok := interface{}(m.GetDefaultValidationContext()).(interface{ Validate() error }); ok {
  371. if err := v.Validate(); err != nil {
  372. return CommonTlsContext_CombinedCertificateValidationContextValidationError{
  373. field: "DefaultValidationContext",
  374. reason: "embedded message failed validation",
  375. cause: err,
  376. }
  377. }
  378. }
  379. if m.GetValidationContextSdsSecretConfig() == nil {
  380. return CommonTlsContext_CombinedCertificateValidationContextValidationError{
  381. field: "ValidationContextSdsSecretConfig",
  382. reason: "value is required",
  383. }
  384. }
  385. if v, ok := interface{}(m.GetValidationContextSdsSecretConfig()).(interface{ Validate() error }); ok {
  386. if err := v.Validate(); err != nil {
  387. return CommonTlsContext_CombinedCertificateValidationContextValidationError{
  388. field: "ValidationContextSdsSecretConfig",
  389. reason: "embedded message failed validation",
  390. cause: err,
  391. }
  392. }
  393. }
  394. return nil
  395. }
  396. // CommonTlsContext_CombinedCertificateValidationContextValidationError is the
  397. // validation error returned by
  398. // CommonTlsContext_CombinedCertificateValidationContext.Validate if the
  399. // designated constraints aren't met.
  400. type CommonTlsContext_CombinedCertificateValidationContextValidationError struct {
  401. field string
  402. reason string
  403. cause error
  404. key bool
  405. }
  406. // Field function returns field value.
  407. func (e CommonTlsContext_CombinedCertificateValidationContextValidationError) Field() string {
  408. return e.field
  409. }
  410. // Reason function returns reason value.
  411. func (e CommonTlsContext_CombinedCertificateValidationContextValidationError) Reason() string {
  412. return e.reason
  413. }
  414. // Cause function returns cause value.
  415. func (e CommonTlsContext_CombinedCertificateValidationContextValidationError) Cause() error {
  416. return e.cause
  417. }
  418. // Key function returns key value.
  419. func (e CommonTlsContext_CombinedCertificateValidationContextValidationError) Key() bool {
  420. return e.key
  421. }
  422. // ErrorName returns error name.
  423. func (e CommonTlsContext_CombinedCertificateValidationContextValidationError) ErrorName() string {
  424. return "CommonTlsContext_CombinedCertificateValidationContextValidationError"
  425. }
  426. // Error satisfies the builtin error interface
  427. func (e CommonTlsContext_CombinedCertificateValidationContextValidationError) Error() string {
  428. cause := ""
  429. if e.cause != nil {
  430. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  431. }
  432. key := ""
  433. if e.key {
  434. key = "key for "
  435. }
  436. return fmt.Sprintf(
  437. "invalid %sCommonTlsContext_CombinedCertificateValidationContext.%s: %s%s",
  438. key,
  439. e.field,
  440. e.reason,
  441. cause)
  442. }
  443. var _ error = CommonTlsContext_CombinedCertificateValidationContextValidationError{}
  444. var _ interface {
  445. Field() string
  446. Reason() string
  447. Key() bool
  448. Cause() error
  449. ErrorName() string
  450. } = CommonTlsContext_CombinedCertificateValidationContextValidationError{}