/envoy/service/accesslog/v4alpha/als.pb.validate.go

https://github.com/envoyproxy/go-control-plane · Go · 488 lines · 336 code · 89 blank · 63 comment · 51 complexity · 519bcf2ef116830778bd271aa8d9d57e MD5 · raw file

  1. // Code generated by protoc-gen-validate. DO NOT EDIT.
  2. // source: envoy/service/accesslog/v4alpha/als.proto
  3. package envoy_service_accesslog_v4alpha
  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 _als_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 StreamAccessLogsResponse with the rules
  34. // defined in the proto definition for this message. If any rules are
  35. // violated, an error is returned.
  36. func (m *StreamAccessLogsResponse) Validate() error {
  37. if m == nil {
  38. return nil
  39. }
  40. return nil
  41. }
  42. // StreamAccessLogsResponseValidationError is the validation error returned by
  43. // StreamAccessLogsResponse.Validate if the designated constraints aren't met.
  44. type StreamAccessLogsResponseValidationError struct {
  45. field string
  46. reason string
  47. cause error
  48. key bool
  49. }
  50. // Field function returns field value.
  51. func (e StreamAccessLogsResponseValidationError) Field() string { return e.field }
  52. // Reason function returns reason value.
  53. func (e StreamAccessLogsResponseValidationError) Reason() string { return e.reason }
  54. // Cause function returns cause value.
  55. func (e StreamAccessLogsResponseValidationError) Cause() error { return e.cause }
  56. // Key function returns key value.
  57. func (e StreamAccessLogsResponseValidationError) Key() bool { return e.key }
  58. // ErrorName returns error name.
  59. func (e StreamAccessLogsResponseValidationError) ErrorName() string {
  60. return "StreamAccessLogsResponseValidationError"
  61. }
  62. // Error satisfies the builtin error interface
  63. func (e StreamAccessLogsResponseValidationError) Error() string {
  64. cause := ""
  65. if e.cause != nil {
  66. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  67. }
  68. key := ""
  69. if e.key {
  70. key = "key for "
  71. }
  72. return fmt.Sprintf(
  73. "invalid %sStreamAccessLogsResponse.%s: %s%s",
  74. key,
  75. e.field,
  76. e.reason,
  77. cause)
  78. }
  79. var _ error = StreamAccessLogsResponseValidationError{}
  80. var _ interface {
  81. Field() string
  82. Reason() string
  83. Key() bool
  84. Cause() error
  85. ErrorName() string
  86. } = StreamAccessLogsResponseValidationError{}
  87. // Validate checks the field values on StreamAccessLogsMessage with the rules
  88. // defined in the proto definition for this message. If any rules are
  89. // violated, an error is returned.
  90. func (m *StreamAccessLogsMessage) Validate() error {
  91. if m == nil {
  92. return nil
  93. }
  94. if v, ok := interface{}(m.GetIdentifier()).(interface{ Validate() error }); ok {
  95. if err := v.Validate(); err != nil {
  96. return StreamAccessLogsMessageValidationError{
  97. field: "Identifier",
  98. reason: "embedded message failed validation",
  99. cause: err,
  100. }
  101. }
  102. }
  103. switch m.LogEntries.(type) {
  104. case *StreamAccessLogsMessage_HttpLogs:
  105. if v, ok := interface{}(m.GetHttpLogs()).(interface{ Validate() error }); ok {
  106. if err := v.Validate(); err != nil {
  107. return StreamAccessLogsMessageValidationError{
  108. field: "HttpLogs",
  109. reason: "embedded message failed validation",
  110. cause: err,
  111. }
  112. }
  113. }
  114. case *StreamAccessLogsMessage_TcpLogs:
  115. if v, ok := interface{}(m.GetTcpLogs()).(interface{ Validate() error }); ok {
  116. if err := v.Validate(); err != nil {
  117. return StreamAccessLogsMessageValidationError{
  118. field: "TcpLogs",
  119. reason: "embedded message failed validation",
  120. cause: err,
  121. }
  122. }
  123. }
  124. default:
  125. return StreamAccessLogsMessageValidationError{
  126. field: "LogEntries",
  127. reason: "value is required",
  128. }
  129. }
  130. return nil
  131. }
  132. // StreamAccessLogsMessageValidationError is the validation error returned by
  133. // StreamAccessLogsMessage.Validate if the designated constraints aren't met.
  134. type StreamAccessLogsMessageValidationError struct {
  135. field string
  136. reason string
  137. cause error
  138. key bool
  139. }
  140. // Field function returns field value.
  141. func (e StreamAccessLogsMessageValidationError) Field() string { return e.field }
  142. // Reason function returns reason value.
  143. func (e StreamAccessLogsMessageValidationError) Reason() string { return e.reason }
  144. // Cause function returns cause value.
  145. func (e StreamAccessLogsMessageValidationError) Cause() error { return e.cause }
  146. // Key function returns key value.
  147. func (e StreamAccessLogsMessageValidationError) Key() bool { return e.key }
  148. // ErrorName returns error name.
  149. func (e StreamAccessLogsMessageValidationError) ErrorName() string {
  150. return "StreamAccessLogsMessageValidationError"
  151. }
  152. // Error satisfies the builtin error interface
  153. func (e StreamAccessLogsMessageValidationError) Error() string {
  154. cause := ""
  155. if e.cause != nil {
  156. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  157. }
  158. key := ""
  159. if e.key {
  160. key = "key for "
  161. }
  162. return fmt.Sprintf(
  163. "invalid %sStreamAccessLogsMessage.%s: %s%s",
  164. key,
  165. e.field,
  166. e.reason,
  167. cause)
  168. }
  169. var _ error = StreamAccessLogsMessageValidationError{}
  170. var _ interface {
  171. Field() string
  172. Reason() string
  173. Key() bool
  174. Cause() error
  175. ErrorName() string
  176. } = StreamAccessLogsMessageValidationError{}
  177. // Validate checks the field values on StreamAccessLogsMessage_Identifier with
  178. // the rules defined in the proto definition for this message. If any rules
  179. // are violated, an error is returned.
  180. func (m *StreamAccessLogsMessage_Identifier) Validate() error {
  181. if m == nil {
  182. return nil
  183. }
  184. if m.GetNode() == nil {
  185. return StreamAccessLogsMessage_IdentifierValidationError{
  186. field: "Node",
  187. reason: "value is required",
  188. }
  189. }
  190. if v, ok := interface{}(m.GetNode()).(interface{ Validate() error }); ok {
  191. if err := v.Validate(); err != nil {
  192. return StreamAccessLogsMessage_IdentifierValidationError{
  193. field: "Node",
  194. reason: "embedded message failed validation",
  195. cause: err,
  196. }
  197. }
  198. }
  199. if utf8.RuneCountInString(m.GetLogName()) < 1 {
  200. return StreamAccessLogsMessage_IdentifierValidationError{
  201. field: "LogName",
  202. reason: "value length must be at least 1 runes",
  203. }
  204. }
  205. return nil
  206. }
  207. // StreamAccessLogsMessage_IdentifierValidationError is the validation error
  208. // returned by StreamAccessLogsMessage_Identifier.Validate if the designated
  209. // constraints aren't met.
  210. type StreamAccessLogsMessage_IdentifierValidationError struct {
  211. field string
  212. reason string
  213. cause error
  214. key bool
  215. }
  216. // Field function returns field value.
  217. func (e StreamAccessLogsMessage_IdentifierValidationError) Field() string { return e.field }
  218. // Reason function returns reason value.
  219. func (e StreamAccessLogsMessage_IdentifierValidationError) Reason() string { return e.reason }
  220. // Cause function returns cause value.
  221. func (e StreamAccessLogsMessage_IdentifierValidationError) Cause() error { return e.cause }
  222. // Key function returns key value.
  223. func (e StreamAccessLogsMessage_IdentifierValidationError) Key() bool { return e.key }
  224. // ErrorName returns error name.
  225. func (e StreamAccessLogsMessage_IdentifierValidationError) ErrorName() string {
  226. return "StreamAccessLogsMessage_IdentifierValidationError"
  227. }
  228. // Error satisfies the builtin error interface
  229. func (e StreamAccessLogsMessage_IdentifierValidationError) Error() string {
  230. cause := ""
  231. if e.cause != nil {
  232. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  233. }
  234. key := ""
  235. if e.key {
  236. key = "key for "
  237. }
  238. return fmt.Sprintf(
  239. "invalid %sStreamAccessLogsMessage_Identifier.%s: %s%s",
  240. key,
  241. e.field,
  242. e.reason,
  243. cause)
  244. }
  245. var _ error = StreamAccessLogsMessage_IdentifierValidationError{}
  246. var _ interface {
  247. Field() string
  248. Reason() string
  249. Key() bool
  250. Cause() error
  251. ErrorName() string
  252. } = StreamAccessLogsMessage_IdentifierValidationError{}
  253. // Validate checks the field values on
  254. // StreamAccessLogsMessage_HTTPAccessLogEntries with the rules defined in the
  255. // proto definition for this message. If any rules are violated, an error is returned.
  256. func (m *StreamAccessLogsMessage_HTTPAccessLogEntries) Validate() error {
  257. if m == nil {
  258. return nil
  259. }
  260. if len(m.GetLogEntry()) < 1 {
  261. return StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError{
  262. field: "LogEntry",
  263. reason: "value must contain at least 1 item(s)",
  264. }
  265. }
  266. for idx, item := range m.GetLogEntry() {
  267. _, _ = idx, item
  268. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  269. if err := v.Validate(); err != nil {
  270. return StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError{
  271. field: fmt.Sprintf("LogEntry[%v]", idx),
  272. reason: "embedded message failed validation",
  273. cause: err,
  274. }
  275. }
  276. }
  277. }
  278. return nil
  279. }
  280. // StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError is the
  281. // validation error returned by
  282. // StreamAccessLogsMessage_HTTPAccessLogEntries.Validate if the designated
  283. // constraints aren't met.
  284. type StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError struct {
  285. field string
  286. reason string
  287. cause error
  288. key bool
  289. }
  290. // Field function returns field value.
  291. func (e StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError) Field() string { return e.field }
  292. // Reason function returns reason value.
  293. func (e StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError) Reason() string { return e.reason }
  294. // Cause function returns cause value.
  295. func (e StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError) Cause() error { return e.cause }
  296. // Key function returns key value.
  297. func (e StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError) Key() bool { return e.key }
  298. // ErrorName returns error name.
  299. func (e StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError) ErrorName() string {
  300. return "StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError"
  301. }
  302. // Error satisfies the builtin error interface
  303. func (e StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError) Error() string {
  304. cause := ""
  305. if e.cause != nil {
  306. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  307. }
  308. key := ""
  309. if e.key {
  310. key = "key for "
  311. }
  312. return fmt.Sprintf(
  313. "invalid %sStreamAccessLogsMessage_HTTPAccessLogEntries.%s: %s%s",
  314. key,
  315. e.field,
  316. e.reason,
  317. cause)
  318. }
  319. var _ error = StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError{}
  320. var _ interface {
  321. Field() string
  322. Reason() string
  323. Key() bool
  324. Cause() error
  325. ErrorName() string
  326. } = StreamAccessLogsMessage_HTTPAccessLogEntriesValidationError{}
  327. // Validate checks the field values on
  328. // StreamAccessLogsMessage_TCPAccessLogEntries with the rules defined in the
  329. // proto definition for this message. If any rules are violated, an error is returned.
  330. func (m *StreamAccessLogsMessage_TCPAccessLogEntries) Validate() error {
  331. if m == nil {
  332. return nil
  333. }
  334. if len(m.GetLogEntry()) < 1 {
  335. return StreamAccessLogsMessage_TCPAccessLogEntriesValidationError{
  336. field: "LogEntry",
  337. reason: "value must contain at least 1 item(s)",
  338. }
  339. }
  340. for idx, item := range m.GetLogEntry() {
  341. _, _ = idx, item
  342. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  343. if err := v.Validate(); err != nil {
  344. return StreamAccessLogsMessage_TCPAccessLogEntriesValidationError{
  345. field: fmt.Sprintf("LogEntry[%v]", idx),
  346. reason: "embedded message failed validation",
  347. cause: err,
  348. }
  349. }
  350. }
  351. }
  352. return nil
  353. }
  354. // StreamAccessLogsMessage_TCPAccessLogEntriesValidationError is the validation
  355. // error returned by StreamAccessLogsMessage_TCPAccessLogEntries.Validate if
  356. // the designated constraints aren't met.
  357. type StreamAccessLogsMessage_TCPAccessLogEntriesValidationError struct {
  358. field string
  359. reason string
  360. cause error
  361. key bool
  362. }
  363. // Field function returns field value.
  364. func (e StreamAccessLogsMessage_TCPAccessLogEntriesValidationError) Field() string { return e.field }
  365. // Reason function returns reason value.
  366. func (e StreamAccessLogsMessage_TCPAccessLogEntriesValidationError) Reason() string { return e.reason }
  367. // Cause function returns cause value.
  368. func (e StreamAccessLogsMessage_TCPAccessLogEntriesValidationError) Cause() error { return e.cause }
  369. // Key function returns key value.
  370. func (e StreamAccessLogsMessage_TCPAccessLogEntriesValidationError) Key() bool { return e.key }
  371. // ErrorName returns error name.
  372. func (e StreamAccessLogsMessage_TCPAccessLogEntriesValidationError) ErrorName() string {
  373. return "StreamAccessLogsMessage_TCPAccessLogEntriesValidationError"
  374. }
  375. // Error satisfies the builtin error interface
  376. func (e StreamAccessLogsMessage_TCPAccessLogEntriesValidationError) Error() string {
  377. cause := ""
  378. if e.cause != nil {
  379. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  380. }
  381. key := ""
  382. if e.key {
  383. key = "key for "
  384. }
  385. return fmt.Sprintf(
  386. "invalid %sStreamAccessLogsMessage_TCPAccessLogEntries.%s: %s%s",
  387. key,
  388. e.field,
  389. e.reason,
  390. cause)
  391. }
  392. var _ error = StreamAccessLogsMessage_TCPAccessLogEntriesValidationError{}
  393. var _ interface {
  394. Field() string
  395. Reason() string
  396. Key() bool
  397. Cause() error
  398. ErrorName() string
  399. } = StreamAccessLogsMessage_TCPAccessLogEntriesValidationError{}