/envoy/service/status/v4alpha/csds.pb.validate.go

https://github.com/envoyproxy/go-control-plane · Go · 440 lines · 306 code · 84 blank · 50 comment · 55 complexity · e1a1f482da0869a42fa5b6419bbd72ed MD5 · raw file

  1. // Code generated by protoc-gen-validate. DO NOT EDIT.
  2. // source: envoy/service/status/v4alpha/csds.proto
  3. package envoy_service_status_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 _csds_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 ClientStatusRequest 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 *ClientStatusRequest) Validate() error {
  37. if m == nil {
  38. return nil
  39. }
  40. for idx, item := range m.GetNodeMatchers() {
  41. _, _ = idx, item
  42. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  43. if err := v.Validate(); err != nil {
  44. return ClientStatusRequestValidationError{
  45. field: fmt.Sprintf("NodeMatchers[%v]", idx),
  46. reason: "embedded message failed validation",
  47. cause: err,
  48. }
  49. }
  50. }
  51. }
  52. if v, ok := interface{}(m.GetNode()).(interface{ Validate() error }); ok {
  53. if err := v.Validate(); err != nil {
  54. return ClientStatusRequestValidationError{
  55. field: "Node",
  56. reason: "embedded message failed validation",
  57. cause: err,
  58. }
  59. }
  60. }
  61. return nil
  62. }
  63. // ClientStatusRequestValidationError is the validation error returned by
  64. // ClientStatusRequest.Validate if the designated constraints aren't met.
  65. type ClientStatusRequestValidationError struct {
  66. field string
  67. reason string
  68. cause error
  69. key bool
  70. }
  71. // Field function returns field value.
  72. func (e ClientStatusRequestValidationError) Field() string { return e.field }
  73. // Reason function returns reason value.
  74. func (e ClientStatusRequestValidationError) Reason() string { return e.reason }
  75. // Cause function returns cause value.
  76. func (e ClientStatusRequestValidationError) Cause() error { return e.cause }
  77. // Key function returns key value.
  78. func (e ClientStatusRequestValidationError) Key() bool { return e.key }
  79. // ErrorName returns error name.
  80. func (e ClientStatusRequestValidationError) ErrorName() string {
  81. return "ClientStatusRequestValidationError"
  82. }
  83. // Error satisfies the builtin error interface
  84. func (e ClientStatusRequestValidationError) Error() string {
  85. cause := ""
  86. if e.cause != nil {
  87. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  88. }
  89. key := ""
  90. if e.key {
  91. key = "key for "
  92. }
  93. return fmt.Sprintf(
  94. "invalid %sClientStatusRequest.%s: %s%s",
  95. key,
  96. e.field,
  97. e.reason,
  98. cause)
  99. }
  100. var _ error = ClientStatusRequestValidationError{}
  101. var _ interface {
  102. Field() string
  103. Reason() string
  104. Key() bool
  105. Cause() error
  106. ErrorName() string
  107. } = ClientStatusRequestValidationError{}
  108. // Validate checks the field values on PerXdsConfig with the rules defined in
  109. // the proto definition for this message. If any rules are violated, an error
  110. // is returned.
  111. func (m *PerXdsConfig) Validate() error {
  112. if m == nil {
  113. return nil
  114. }
  115. switch m.StatusConfig.(type) {
  116. case *PerXdsConfig_Status:
  117. // no validation rules for Status
  118. case *PerXdsConfig_ClientStatus:
  119. // no validation rules for ClientStatus
  120. }
  121. switch m.PerXdsConfig.(type) {
  122. case *PerXdsConfig_ListenerConfig:
  123. if v, ok := interface{}(m.GetListenerConfig()).(interface{ Validate() error }); ok {
  124. if err := v.Validate(); err != nil {
  125. return PerXdsConfigValidationError{
  126. field: "ListenerConfig",
  127. reason: "embedded message failed validation",
  128. cause: err,
  129. }
  130. }
  131. }
  132. case *PerXdsConfig_ClusterConfig:
  133. if v, ok := interface{}(m.GetClusterConfig()).(interface{ Validate() error }); ok {
  134. if err := v.Validate(); err != nil {
  135. return PerXdsConfigValidationError{
  136. field: "ClusterConfig",
  137. reason: "embedded message failed validation",
  138. cause: err,
  139. }
  140. }
  141. }
  142. case *PerXdsConfig_RouteConfig:
  143. if v, ok := interface{}(m.GetRouteConfig()).(interface{ Validate() error }); ok {
  144. if err := v.Validate(); err != nil {
  145. return PerXdsConfigValidationError{
  146. field: "RouteConfig",
  147. reason: "embedded message failed validation",
  148. cause: err,
  149. }
  150. }
  151. }
  152. case *PerXdsConfig_ScopedRouteConfig:
  153. if v, ok := interface{}(m.GetScopedRouteConfig()).(interface{ Validate() error }); ok {
  154. if err := v.Validate(); err != nil {
  155. return PerXdsConfigValidationError{
  156. field: "ScopedRouteConfig",
  157. reason: "embedded message failed validation",
  158. cause: err,
  159. }
  160. }
  161. }
  162. case *PerXdsConfig_EndpointConfig:
  163. if v, ok := interface{}(m.GetEndpointConfig()).(interface{ Validate() error }); ok {
  164. if err := v.Validate(); err != nil {
  165. return PerXdsConfigValidationError{
  166. field: "EndpointConfig",
  167. reason: "embedded message failed validation",
  168. cause: err,
  169. }
  170. }
  171. }
  172. }
  173. return nil
  174. }
  175. // PerXdsConfigValidationError is the validation error returned by
  176. // PerXdsConfig.Validate if the designated constraints aren't met.
  177. type PerXdsConfigValidationError struct {
  178. field string
  179. reason string
  180. cause error
  181. key bool
  182. }
  183. // Field function returns field value.
  184. func (e PerXdsConfigValidationError) Field() string { return e.field }
  185. // Reason function returns reason value.
  186. func (e PerXdsConfigValidationError) Reason() string { return e.reason }
  187. // Cause function returns cause value.
  188. func (e PerXdsConfigValidationError) Cause() error { return e.cause }
  189. // Key function returns key value.
  190. func (e PerXdsConfigValidationError) Key() bool { return e.key }
  191. // ErrorName returns error name.
  192. func (e PerXdsConfigValidationError) ErrorName() string { return "PerXdsConfigValidationError" }
  193. // Error satisfies the builtin error interface
  194. func (e PerXdsConfigValidationError) Error() string {
  195. cause := ""
  196. if e.cause != nil {
  197. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  198. }
  199. key := ""
  200. if e.key {
  201. key = "key for "
  202. }
  203. return fmt.Sprintf(
  204. "invalid %sPerXdsConfig.%s: %s%s",
  205. key,
  206. e.field,
  207. e.reason,
  208. cause)
  209. }
  210. var _ error = PerXdsConfigValidationError{}
  211. var _ interface {
  212. Field() string
  213. Reason() string
  214. Key() bool
  215. Cause() error
  216. ErrorName() string
  217. } = PerXdsConfigValidationError{}
  218. // Validate checks the field values on ClientConfig with the rules defined in
  219. // the proto definition for this message. If any rules are violated, an error
  220. // is returned.
  221. func (m *ClientConfig) Validate() error {
  222. if m == nil {
  223. return nil
  224. }
  225. if v, ok := interface{}(m.GetNode()).(interface{ Validate() error }); ok {
  226. if err := v.Validate(); err != nil {
  227. return ClientConfigValidationError{
  228. field: "Node",
  229. reason: "embedded message failed validation",
  230. cause: err,
  231. }
  232. }
  233. }
  234. for idx, item := range m.GetXdsConfig() {
  235. _, _ = idx, item
  236. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  237. if err := v.Validate(); err != nil {
  238. return ClientConfigValidationError{
  239. field: fmt.Sprintf("XdsConfig[%v]", idx),
  240. reason: "embedded message failed validation",
  241. cause: err,
  242. }
  243. }
  244. }
  245. }
  246. return nil
  247. }
  248. // ClientConfigValidationError is the validation error returned by
  249. // ClientConfig.Validate if the designated constraints aren't met.
  250. type ClientConfigValidationError struct {
  251. field string
  252. reason string
  253. cause error
  254. key bool
  255. }
  256. // Field function returns field value.
  257. func (e ClientConfigValidationError) Field() string { return e.field }
  258. // Reason function returns reason value.
  259. func (e ClientConfigValidationError) Reason() string { return e.reason }
  260. // Cause function returns cause value.
  261. func (e ClientConfigValidationError) Cause() error { return e.cause }
  262. // Key function returns key value.
  263. func (e ClientConfigValidationError) Key() bool { return e.key }
  264. // ErrorName returns error name.
  265. func (e ClientConfigValidationError) ErrorName() string { return "ClientConfigValidationError" }
  266. // Error satisfies the builtin error interface
  267. func (e ClientConfigValidationError) Error() string {
  268. cause := ""
  269. if e.cause != nil {
  270. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  271. }
  272. key := ""
  273. if e.key {
  274. key = "key for "
  275. }
  276. return fmt.Sprintf(
  277. "invalid %sClientConfig.%s: %s%s",
  278. key,
  279. e.field,
  280. e.reason,
  281. cause)
  282. }
  283. var _ error = ClientConfigValidationError{}
  284. var _ interface {
  285. Field() string
  286. Reason() string
  287. Key() bool
  288. Cause() error
  289. ErrorName() string
  290. } = ClientConfigValidationError{}
  291. // Validate checks the field values on ClientStatusResponse with the rules
  292. // defined in the proto definition for this message. If any rules are
  293. // violated, an error is returned.
  294. func (m *ClientStatusResponse) Validate() error {
  295. if m == nil {
  296. return nil
  297. }
  298. for idx, item := range m.GetConfig() {
  299. _, _ = idx, item
  300. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  301. if err := v.Validate(); err != nil {
  302. return ClientStatusResponseValidationError{
  303. field: fmt.Sprintf("Config[%v]", idx),
  304. reason: "embedded message failed validation",
  305. cause: err,
  306. }
  307. }
  308. }
  309. }
  310. return nil
  311. }
  312. // ClientStatusResponseValidationError is the validation error returned by
  313. // ClientStatusResponse.Validate if the designated constraints aren't met.
  314. type ClientStatusResponseValidationError struct {
  315. field string
  316. reason string
  317. cause error
  318. key bool
  319. }
  320. // Field function returns field value.
  321. func (e ClientStatusResponseValidationError) Field() string { return e.field }
  322. // Reason function returns reason value.
  323. func (e ClientStatusResponseValidationError) Reason() string { return e.reason }
  324. // Cause function returns cause value.
  325. func (e ClientStatusResponseValidationError) Cause() error { return e.cause }
  326. // Key function returns key value.
  327. func (e ClientStatusResponseValidationError) Key() bool { return e.key }
  328. // ErrorName returns error name.
  329. func (e ClientStatusResponseValidationError) ErrorName() string {
  330. return "ClientStatusResponseValidationError"
  331. }
  332. // Error satisfies the builtin error interface
  333. func (e ClientStatusResponseValidationError) Error() string {
  334. cause := ""
  335. if e.cause != nil {
  336. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  337. }
  338. key := ""
  339. if e.key {
  340. key = "key for "
  341. }
  342. return fmt.Sprintf(
  343. "invalid %sClientStatusResponse.%s: %s%s",
  344. key,
  345. e.field,
  346. e.reason,
  347. cause)
  348. }
  349. var _ error = ClientStatusResponseValidationError{}
  350. var _ interface {
  351. Field() string
  352. Reason() string
  353. Key() bool
  354. Cause() error
  355. ErrorName() string
  356. } = ClientStatusResponseValidationError{}