/envoy/service/auth/v4alpha/attribute_context.pb.validate.go

https://github.com/envoyproxy/go-control-plane · Go · 408 lines · 261 code · 81 blank · 66 comment · 41 complexity · 49b5a339cacc9cce688282788dd8993c MD5 · raw file

  1. // Code generated by protoc-gen-validate. DO NOT EDIT.
  2. // source: envoy/service/auth/v4alpha/attribute_context.proto
  3. package envoy_service_auth_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 _attribute_context_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 AttributeContext with the rules defined
  34. // in the proto definition for this message. If any rules are violated, an
  35. // error is returned.
  36. func (m *AttributeContext) Validate() error {
  37. if m == nil {
  38. return nil
  39. }
  40. if v, ok := interface{}(m.GetSource()).(interface{ Validate() error }); ok {
  41. if err := v.Validate(); err != nil {
  42. return AttributeContextValidationError{
  43. field: "Source",
  44. reason: "embedded message failed validation",
  45. cause: err,
  46. }
  47. }
  48. }
  49. if v, ok := interface{}(m.GetDestination()).(interface{ Validate() error }); ok {
  50. if err := v.Validate(); err != nil {
  51. return AttributeContextValidationError{
  52. field: "Destination",
  53. reason: "embedded message failed validation",
  54. cause: err,
  55. }
  56. }
  57. }
  58. if v, ok := interface{}(m.GetRequest()).(interface{ Validate() error }); ok {
  59. if err := v.Validate(); err != nil {
  60. return AttributeContextValidationError{
  61. field: "Request",
  62. reason: "embedded message failed validation",
  63. cause: err,
  64. }
  65. }
  66. }
  67. // no validation rules for ContextExtensions
  68. if v, ok := interface{}(m.GetMetadataContext()).(interface{ Validate() error }); ok {
  69. if err := v.Validate(); err != nil {
  70. return AttributeContextValidationError{
  71. field: "MetadataContext",
  72. reason: "embedded message failed validation",
  73. cause: err,
  74. }
  75. }
  76. }
  77. return nil
  78. }
  79. // AttributeContextValidationError is the validation error returned by
  80. // AttributeContext.Validate if the designated constraints aren't met.
  81. type AttributeContextValidationError struct {
  82. field string
  83. reason string
  84. cause error
  85. key bool
  86. }
  87. // Field function returns field value.
  88. func (e AttributeContextValidationError) Field() string { return e.field }
  89. // Reason function returns reason value.
  90. func (e AttributeContextValidationError) Reason() string { return e.reason }
  91. // Cause function returns cause value.
  92. func (e AttributeContextValidationError) Cause() error { return e.cause }
  93. // Key function returns key value.
  94. func (e AttributeContextValidationError) Key() bool { return e.key }
  95. // ErrorName returns error name.
  96. func (e AttributeContextValidationError) ErrorName() string { return "AttributeContextValidationError" }
  97. // Error satisfies the builtin error interface
  98. func (e AttributeContextValidationError) Error() string {
  99. cause := ""
  100. if e.cause != nil {
  101. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  102. }
  103. key := ""
  104. if e.key {
  105. key = "key for "
  106. }
  107. return fmt.Sprintf(
  108. "invalid %sAttributeContext.%s: %s%s",
  109. key,
  110. e.field,
  111. e.reason,
  112. cause)
  113. }
  114. var _ error = AttributeContextValidationError{}
  115. var _ interface {
  116. Field() string
  117. Reason() string
  118. Key() bool
  119. Cause() error
  120. ErrorName() string
  121. } = AttributeContextValidationError{}
  122. // Validate checks the field values on AttributeContext_Peer with the rules
  123. // defined in the proto definition for this message. If any rules are
  124. // violated, an error is returned.
  125. func (m *AttributeContext_Peer) Validate() error {
  126. if m == nil {
  127. return nil
  128. }
  129. if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok {
  130. if err := v.Validate(); err != nil {
  131. return AttributeContext_PeerValidationError{
  132. field: "Address",
  133. reason: "embedded message failed validation",
  134. cause: err,
  135. }
  136. }
  137. }
  138. // no validation rules for Service
  139. // no validation rules for Labels
  140. // no validation rules for Principal
  141. // no validation rules for Certificate
  142. return nil
  143. }
  144. // AttributeContext_PeerValidationError is the validation error returned by
  145. // AttributeContext_Peer.Validate if the designated constraints aren't met.
  146. type AttributeContext_PeerValidationError struct {
  147. field string
  148. reason string
  149. cause error
  150. key bool
  151. }
  152. // Field function returns field value.
  153. func (e AttributeContext_PeerValidationError) Field() string { return e.field }
  154. // Reason function returns reason value.
  155. func (e AttributeContext_PeerValidationError) Reason() string { return e.reason }
  156. // Cause function returns cause value.
  157. func (e AttributeContext_PeerValidationError) Cause() error { return e.cause }
  158. // Key function returns key value.
  159. func (e AttributeContext_PeerValidationError) Key() bool { return e.key }
  160. // ErrorName returns error name.
  161. func (e AttributeContext_PeerValidationError) ErrorName() string {
  162. return "AttributeContext_PeerValidationError"
  163. }
  164. // Error satisfies the builtin error interface
  165. func (e AttributeContext_PeerValidationError) Error() string {
  166. cause := ""
  167. if e.cause != nil {
  168. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  169. }
  170. key := ""
  171. if e.key {
  172. key = "key for "
  173. }
  174. return fmt.Sprintf(
  175. "invalid %sAttributeContext_Peer.%s: %s%s",
  176. key,
  177. e.field,
  178. e.reason,
  179. cause)
  180. }
  181. var _ error = AttributeContext_PeerValidationError{}
  182. var _ interface {
  183. Field() string
  184. Reason() string
  185. Key() bool
  186. Cause() error
  187. ErrorName() string
  188. } = AttributeContext_PeerValidationError{}
  189. // Validate checks the field values on AttributeContext_Request with the rules
  190. // defined in the proto definition for this message. If any rules are
  191. // violated, an error is returned.
  192. func (m *AttributeContext_Request) Validate() error {
  193. if m == nil {
  194. return nil
  195. }
  196. if v, ok := interface{}(m.GetTime()).(interface{ Validate() error }); ok {
  197. if err := v.Validate(); err != nil {
  198. return AttributeContext_RequestValidationError{
  199. field: "Time",
  200. reason: "embedded message failed validation",
  201. cause: err,
  202. }
  203. }
  204. }
  205. if v, ok := interface{}(m.GetHttp()).(interface{ Validate() error }); ok {
  206. if err := v.Validate(); err != nil {
  207. return AttributeContext_RequestValidationError{
  208. field: "Http",
  209. reason: "embedded message failed validation",
  210. cause: err,
  211. }
  212. }
  213. }
  214. return nil
  215. }
  216. // AttributeContext_RequestValidationError is the validation error returned by
  217. // AttributeContext_Request.Validate if the designated constraints aren't met.
  218. type AttributeContext_RequestValidationError struct {
  219. field string
  220. reason string
  221. cause error
  222. key bool
  223. }
  224. // Field function returns field value.
  225. func (e AttributeContext_RequestValidationError) Field() string { return e.field }
  226. // Reason function returns reason value.
  227. func (e AttributeContext_RequestValidationError) Reason() string { return e.reason }
  228. // Cause function returns cause value.
  229. func (e AttributeContext_RequestValidationError) Cause() error { return e.cause }
  230. // Key function returns key value.
  231. func (e AttributeContext_RequestValidationError) Key() bool { return e.key }
  232. // ErrorName returns error name.
  233. func (e AttributeContext_RequestValidationError) ErrorName() string {
  234. return "AttributeContext_RequestValidationError"
  235. }
  236. // Error satisfies the builtin error interface
  237. func (e AttributeContext_RequestValidationError) Error() string {
  238. cause := ""
  239. if e.cause != nil {
  240. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  241. }
  242. key := ""
  243. if e.key {
  244. key = "key for "
  245. }
  246. return fmt.Sprintf(
  247. "invalid %sAttributeContext_Request.%s: %s%s",
  248. key,
  249. e.field,
  250. e.reason,
  251. cause)
  252. }
  253. var _ error = AttributeContext_RequestValidationError{}
  254. var _ interface {
  255. Field() string
  256. Reason() string
  257. Key() bool
  258. Cause() error
  259. ErrorName() string
  260. } = AttributeContext_RequestValidationError{}
  261. // Validate checks the field values on AttributeContext_HttpRequest with the
  262. // rules defined in the proto definition for this message. If any rules are
  263. // violated, an error is returned.
  264. func (m *AttributeContext_HttpRequest) Validate() error {
  265. if m == nil {
  266. return nil
  267. }
  268. // no validation rules for Id
  269. // no validation rules for Method
  270. // no validation rules for Headers
  271. // no validation rules for Path
  272. // no validation rules for Host
  273. // no validation rules for Scheme
  274. // no validation rules for Query
  275. // no validation rules for Fragment
  276. // no validation rules for Size
  277. // no validation rules for Protocol
  278. // no validation rules for Body
  279. // no validation rules for RawBody
  280. return nil
  281. }
  282. // AttributeContext_HttpRequestValidationError is the validation error returned
  283. // by AttributeContext_HttpRequest.Validate if the designated constraints
  284. // aren't met.
  285. type AttributeContext_HttpRequestValidationError struct {
  286. field string
  287. reason string
  288. cause error
  289. key bool
  290. }
  291. // Field function returns field value.
  292. func (e AttributeContext_HttpRequestValidationError) Field() string { return e.field }
  293. // Reason function returns reason value.
  294. func (e AttributeContext_HttpRequestValidationError) Reason() string { return e.reason }
  295. // Cause function returns cause value.
  296. func (e AttributeContext_HttpRequestValidationError) Cause() error { return e.cause }
  297. // Key function returns key value.
  298. func (e AttributeContext_HttpRequestValidationError) Key() bool { return e.key }
  299. // ErrorName returns error name.
  300. func (e AttributeContext_HttpRequestValidationError) ErrorName() string {
  301. return "AttributeContext_HttpRequestValidationError"
  302. }
  303. // Error satisfies the builtin error interface
  304. func (e AttributeContext_HttpRequestValidationError) Error() string {
  305. cause := ""
  306. if e.cause != nil {
  307. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  308. }
  309. key := ""
  310. if e.key {
  311. key = "key for "
  312. }
  313. return fmt.Sprintf(
  314. "invalid %sAttributeContext_HttpRequest.%s: %s%s",
  315. key,
  316. e.field,
  317. e.reason,
  318. cause)
  319. }
  320. var _ error = AttributeContext_HttpRequestValidationError{}
  321. var _ interface {
  322. Field() string
  323. Reason() string
  324. Key() bool
  325. Cause() error
  326. ErrorName() string
  327. } = AttributeContext_HttpRequestValidationError{}