/vendor/github.com/cilium/proxy/go/cilium/api/accesslog.pb.validate.go

https://github.com/cilium/cilium · Go · 517 lines · 313 code · 119 blank · 85 comment · 51 complexity · 7ad94bbb619c2c619d3772651ae1d0bc MD5 · raw file

  1. // Code generated by protoc-gen-validate. DO NOT EDIT.
  2. // source: cilium/api/accesslog.proto
  3. package cilium
  4. import (
  5. "bytes"
  6. "errors"
  7. "fmt"
  8. "net"
  9. "net/mail"
  10. "net/url"
  11. "regexp"
  12. "strings"
  13. "time"
  14. "unicode/utf8"
  15. "github.com/golang/protobuf/ptypes"
  16. )
  17. // ensure the imports are used
  18. var (
  19. _ = bytes.MinRead
  20. _ = errors.New("")
  21. _ = fmt.Print
  22. _ = utf8.UTFMax
  23. _ = (*regexp.Regexp)(nil)
  24. _ = (*strings.Reader)(nil)
  25. _ = net.IPv4len
  26. _ = time.Duration(0)
  27. _ = (*url.URL)(nil)
  28. _ = (*mail.Address)(nil)
  29. _ = ptypes.DynamicAny{}
  30. )
  31. // define the regex for a UUID once up-front
  32. var _accesslog_uuidPattern = regexp.MustCompile("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$")
  33. // Validate checks the field values on KeyValue with the rules defined in the
  34. // proto definition for this message. If any rules are violated, an error is returned.
  35. func (m *KeyValue) Validate() error {
  36. if m == nil {
  37. return nil
  38. }
  39. // no validation rules for Key
  40. // no validation rules for Value
  41. return nil
  42. }
  43. // KeyValueValidationError is the validation error returned by
  44. // KeyValue.Validate if the designated constraints aren't met.
  45. type KeyValueValidationError struct {
  46. field string
  47. reason string
  48. cause error
  49. key bool
  50. }
  51. // Field function returns field value.
  52. func (e KeyValueValidationError) Field() string { return e.field }
  53. // Reason function returns reason value.
  54. func (e KeyValueValidationError) Reason() string { return e.reason }
  55. // Cause function returns cause value.
  56. func (e KeyValueValidationError) Cause() error { return e.cause }
  57. // Key function returns key value.
  58. func (e KeyValueValidationError) Key() bool { return e.key }
  59. // ErrorName returns error name.
  60. func (e KeyValueValidationError) ErrorName() string { return "KeyValueValidationError" }
  61. // Error satisfies the builtin error interface
  62. func (e KeyValueValidationError) Error() string {
  63. cause := ""
  64. if e.cause != nil {
  65. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  66. }
  67. key := ""
  68. if e.key {
  69. key = "key for "
  70. }
  71. return fmt.Sprintf(
  72. "invalid %sKeyValue.%s: %s%s",
  73. key,
  74. e.field,
  75. e.reason,
  76. cause)
  77. }
  78. var _ error = KeyValueValidationError{}
  79. var _ interface {
  80. Field() string
  81. Reason() string
  82. Key() bool
  83. Cause() error
  84. ErrorName() string
  85. } = KeyValueValidationError{}
  86. // Validate checks the field values on HttpLogEntry with the rules defined in
  87. // the proto definition for this message. If any rules are violated, an error
  88. // is returned.
  89. func (m *HttpLogEntry) Validate() error {
  90. if m == nil {
  91. return nil
  92. }
  93. // no validation rules for HttpProtocol
  94. // no validation rules for Scheme
  95. // no validation rules for Host
  96. // no validation rules for Path
  97. // no validation rules for Method
  98. for idx, item := range m.GetHeaders() {
  99. _, _ = idx, item
  100. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  101. if err := v.Validate(); err != nil {
  102. return HttpLogEntryValidationError{
  103. field: fmt.Sprintf("Headers[%v]", idx),
  104. reason: "embedded message failed validation",
  105. cause: err,
  106. }
  107. }
  108. }
  109. }
  110. // no validation rules for Status
  111. for idx, item := range m.GetMissingHeaders() {
  112. _, _ = idx, item
  113. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  114. if err := v.Validate(); err != nil {
  115. return HttpLogEntryValidationError{
  116. field: fmt.Sprintf("MissingHeaders[%v]", idx),
  117. reason: "embedded message failed validation",
  118. cause: err,
  119. }
  120. }
  121. }
  122. }
  123. for idx, item := range m.GetRejectedHeaders() {
  124. _, _ = idx, item
  125. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  126. if err := v.Validate(); err != nil {
  127. return HttpLogEntryValidationError{
  128. field: fmt.Sprintf("RejectedHeaders[%v]", idx),
  129. reason: "embedded message failed validation",
  130. cause: err,
  131. }
  132. }
  133. }
  134. }
  135. return nil
  136. }
  137. // HttpLogEntryValidationError is the validation error returned by
  138. // HttpLogEntry.Validate if the designated constraints aren't met.
  139. type HttpLogEntryValidationError struct {
  140. field string
  141. reason string
  142. cause error
  143. key bool
  144. }
  145. // Field function returns field value.
  146. func (e HttpLogEntryValidationError) Field() string { return e.field }
  147. // Reason function returns reason value.
  148. func (e HttpLogEntryValidationError) Reason() string { return e.reason }
  149. // Cause function returns cause value.
  150. func (e HttpLogEntryValidationError) Cause() error { return e.cause }
  151. // Key function returns key value.
  152. func (e HttpLogEntryValidationError) Key() bool { return e.key }
  153. // ErrorName returns error name.
  154. func (e HttpLogEntryValidationError) ErrorName() string { return "HttpLogEntryValidationError" }
  155. // Error satisfies the builtin error interface
  156. func (e HttpLogEntryValidationError) Error() string {
  157. cause := ""
  158. if e.cause != nil {
  159. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  160. }
  161. key := ""
  162. if e.key {
  163. key = "key for "
  164. }
  165. return fmt.Sprintf(
  166. "invalid %sHttpLogEntry.%s: %s%s",
  167. key,
  168. e.field,
  169. e.reason,
  170. cause)
  171. }
  172. var _ error = HttpLogEntryValidationError{}
  173. var _ interface {
  174. Field() string
  175. Reason() string
  176. Key() bool
  177. Cause() error
  178. ErrorName() string
  179. } = HttpLogEntryValidationError{}
  180. // Validate checks the field values on KafkaLogEntry with the rules defined in
  181. // the proto definition for this message. If any rules are violated, an error
  182. // is returned.
  183. func (m *KafkaLogEntry) Validate() error {
  184. if m == nil {
  185. return nil
  186. }
  187. // no validation rules for CorrelationId
  188. // no validation rules for ErrorCode
  189. // no validation rules for ApiVersion
  190. // no validation rules for ApiKey
  191. return nil
  192. }
  193. // KafkaLogEntryValidationError is the validation error returned by
  194. // KafkaLogEntry.Validate if the designated constraints aren't met.
  195. type KafkaLogEntryValidationError struct {
  196. field string
  197. reason string
  198. cause error
  199. key bool
  200. }
  201. // Field function returns field value.
  202. func (e KafkaLogEntryValidationError) Field() string { return e.field }
  203. // Reason function returns reason value.
  204. func (e KafkaLogEntryValidationError) Reason() string { return e.reason }
  205. // Cause function returns cause value.
  206. func (e KafkaLogEntryValidationError) Cause() error { return e.cause }
  207. // Key function returns key value.
  208. func (e KafkaLogEntryValidationError) Key() bool { return e.key }
  209. // ErrorName returns error name.
  210. func (e KafkaLogEntryValidationError) ErrorName() string { return "KafkaLogEntryValidationError" }
  211. // Error satisfies the builtin error interface
  212. func (e KafkaLogEntryValidationError) Error() string {
  213. cause := ""
  214. if e.cause != nil {
  215. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  216. }
  217. key := ""
  218. if e.key {
  219. key = "key for "
  220. }
  221. return fmt.Sprintf(
  222. "invalid %sKafkaLogEntry.%s: %s%s",
  223. key,
  224. e.field,
  225. e.reason,
  226. cause)
  227. }
  228. var _ error = KafkaLogEntryValidationError{}
  229. var _ interface {
  230. Field() string
  231. Reason() string
  232. Key() bool
  233. Cause() error
  234. ErrorName() string
  235. } = KafkaLogEntryValidationError{}
  236. // Validate checks the field values on L7LogEntry with the rules defined in the
  237. // proto definition for this message. If any rules are violated, an error is returned.
  238. func (m *L7LogEntry) Validate() error {
  239. if m == nil {
  240. return nil
  241. }
  242. // no validation rules for Proto
  243. // no validation rules for Fields
  244. return nil
  245. }
  246. // L7LogEntryValidationError is the validation error returned by
  247. // L7LogEntry.Validate if the designated constraints aren't met.
  248. type L7LogEntryValidationError struct {
  249. field string
  250. reason string
  251. cause error
  252. key bool
  253. }
  254. // Field function returns field value.
  255. func (e L7LogEntryValidationError) Field() string { return e.field }
  256. // Reason function returns reason value.
  257. func (e L7LogEntryValidationError) Reason() string { return e.reason }
  258. // Cause function returns cause value.
  259. func (e L7LogEntryValidationError) Cause() error { return e.cause }
  260. // Key function returns key value.
  261. func (e L7LogEntryValidationError) Key() bool { return e.key }
  262. // ErrorName returns error name.
  263. func (e L7LogEntryValidationError) ErrorName() string { return "L7LogEntryValidationError" }
  264. // Error satisfies the builtin error interface
  265. func (e L7LogEntryValidationError) Error() string {
  266. cause := ""
  267. if e.cause != nil {
  268. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  269. }
  270. key := ""
  271. if e.key {
  272. key = "key for "
  273. }
  274. return fmt.Sprintf(
  275. "invalid %sL7LogEntry.%s: %s%s",
  276. key,
  277. e.field,
  278. e.reason,
  279. cause)
  280. }
  281. var _ error = L7LogEntryValidationError{}
  282. var _ interface {
  283. Field() string
  284. Reason() string
  285. Key() bool
  286. Cause() error
  287. ErrorName() string
  288. } = L7LogEntryValidationError{}
  289. // Validate checks the field values on LogEntry with the rules defined in the
  290. // proto definition for this message. If any rules are violated, an error is returned.
  291. func (m *LogEntry) Validate() error {
  292. if m == nil {
  293. return nil
  294. }
  295. // no validation rules for Timestamp
  296. // no validation rules for IsIngress
  297. // no validation rules for EntryType
  298. // no validation rules for PolicyName
  299. // no validation rules for CiliumRuleRef
  300. // no validation rules for SourceSecurityId
  301. // no validation rules for DestinationSecurityId
  302. // no validation rules for SourceAddress
  303. // no validation rules for DestinationAddress
  304. // no validation rules for HttpProtocol
  305. // no validation rules for Scheme
  306. // no validation rules for Host
  307. // no validation rules for Path
  308. // no validation rules for Method
  309. // no validation rules for Status
  310. for idx, item := range m.GetHeaders() {
  311. _, _ = idx, item
  312. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  313. if err := v.Validate(); err != nil {
  314. return LogEntryValidationError{
  315. field: fmt.Sprintf("Headers[%v]", idx),
  316. reason: "embedded message failed validation",
  317. cause: err,
  318. }
  319. }
  320. }
  321. }
  322. switch m.L7.(type) {
  323. case *LogEntry_Http:
  324. if v, ok := interface{}(m.GetHttp()).(interface{ Validate() error }); ok {
  325. if err := v.Validate(); err != nil {
  326. return LogEntryValidationError{
  327. field: "Http",
  328. reason: "embedded message failed validation",
  329. cause: err,
  330. }
  331. }
  332. }
  333. case *LogEntry_Kafka:
  334. if v, ok := interface{}(m.GetKafka()).(interface{ Validate() error }); ok {
  335. if err := v.Validate(); err != nil {
  336. return LogEntryValidationError{
  337. field: "Kafka",
  338. reason: "embedded message failed validation",
  339. cause: err,
  340. }
  341. }
  342. }
  343. case *LogEntry_GenericL7:
  344. if v, ok := interface{}(m.GetGenericL7()).(interface{ Validate() error }); ok {
  345. if err := v.Validate(); err != nil {
  346. return LogEntryValidationError{
  347. field: "GenericL7",
  348. reason: "embedded message failed validation",
  349. cause: err,
  350. }
  351. }
  352. }
  353. }
  354. return nil
  355. }
  356. // LogEntryValidationError is the validation error returned by
  357. // LogEntry.Validate if the designated constraints aren't met.
  358. type LogEntryValidationError struct {
  359. field string
  360. reason string
  361. cause error
  362. key bool
  363. }
  364. // Field function returns field value.
  365. func (e LogEntryValidationError) Field() string { return e.field }
  366. // Reason function returns reason value.
  367. func (e LogEntryValidationError) Reason() string { return e.reason }
  368. // Cause function returns cause value.
  369. func (e LogEntryValidationError) Cause() error { return e.cause }
  370. // Key function returns key value.
  371. func (e LogEntryValidationError) Key() bool { return e.key }
  372. // ErrorName returns error name.
  373. func (e LogEntryValidationError) ErrorName() string { return "LogEntryValidationError" }
  374. // Error satisfies the builtin error interface
  375. func (e LogEntryValidationError) Error() string {
  376. cause := ""
  377. if e.cause != nil {
  378. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  379. }
  380. key := ""
  381. if e.key {
  382. key = "key for "
  383. }
  384. return fmt.Sprintf(
  385. "invalid %sLogEntry.%s: %s%s",
  386. key,
  387. e.field,
  388. e.reason,
  389. cause)
  390. }
  391. var _ error = LogEntryValidationError{}
  392. var _ interface {
  393. Field() string
  394. Reason() string
  395. Key() bool
  396. Cause() error
  397. ErrorName() string
  398. } = LogEntryValidationError{}