/pkg/api/envoy/service/status/v3/csds.pb.validate.go

https://github.com/datawire/ambassador · Go · 422 lines · 293 code · 80 blank · 49 comment · 51 complexity · 085de5cd347d4223a75ade8b55846350 MD5 · raw file

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