/vendor/github.com/envoyproxy/go-control-plane/envoy/admin/v3/clusters.pb.validate.go

https://github.com/XiaoMi/naftis · Go · 436 lines · 293 code · 86 blank · 57 comment · 53 complexity · 2f8320340e2c0f8f793c2cbfafb6f29a MD5 · raw file

  1. // Code generated by protoc-gen-validate. DO NOT EDIT.
  2. // source: envoy/admin/v3/clusters.proto
  3. package envoy_admin_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. v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
  17. )
  18. // ensure the imports are used
  19. var (
  20. _ = bytes.MinRead
  21. _ = errors.New("")
  22. _ = fmt.Print
  23. _ = utf8.UTFMax
  24. _ = (*regexp.Regexp)(nil)
  25. _ = (*strings.Reader)(nil)
  26. _ = net.IPv4len
  27. _ = time.Duration(0)
  28. _ = (*url.URL)(nil)
  29. _ = (*mail.Address)(nil)
  30. _ = ptypes.DynamicAny{}
  31. _ = v3.HealthStatus(0)
  32. )
  33. // define the regex for a UUID once up-front
  34. var _clusters_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}$")
  35. // Validate checks the field values on Clusters with the rules defined in the
  36. // proto definition for this message. If any rules are violated, an error is returned.
  37. func (m *Clusters) Validate() error {
  38. if m == nil {
  39. return nil
  40. }
  41. for idx, item := range m.GetClusterStatuses() {
  42. _, _ = idx, item
  43. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  44. if err := v.Validate(); err != nil {
  45. return ClustersValidationError{
  46. field: fmt.Sprintf("ClusterStatuses[%v]", idx),
  47. reason: "embedded message failed validation",
  48. cause: err,
  49. }
  50. }
  51. }
  52. }
  53. return nil
  54. }
  55. // ClustersValidationError is the validation error returned by
  56. // Clusters.Validate if the designated constraints aren't met.
  57. type ClustersValidationError struct {
  58. field string
  59. reason string
  60. cause error
  61. key bool
  62. }
  63. // Field function returns field value.
  64. func (e ClustersValidationError) Field() string { return e.field }
  65. // Reason function returns reason value.
  66. func (e ClustersValidationError) Reason() string { return e.reason }
  67. // Cause function returns cause value.
  68. func (e ClustersValidationError) Cause() error { return e.cause }
  69. // Key function returns key value.
  70. func (e ClustersValidationError) Key() bool { return e.key }
  71. // ErrorName returns error name.
  72. func (e ClustersValidationError) ErrorName() string { return "ClustersValidationError" }
  73. // Error satisfies the builtin error interface
  74. func (e ClustersValidationError) Error() string {
  75. cause := ""
  76. if e.cause != nil {
  77. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  78. }
  79. key := ""
  80. if e.key {
  81. key = "key for "
  82. }
  83. return fmt.Sprintf(
  84. "invalid %sClusters.%s: %s%s",
  85. key,
  86. e.field,
  87. e.reason,
  88. cause)
  89. }
  90. var _ error = ClustersValidationError{}
  91. var _ interface {
  92. Field() string
  93. Reason() string
  94. Key() bool
  95. Cause() error
  96. ErrorName() string
  97. } = ClustersValidationError{}
  98. // Validate checks the field values on ClusterStatus with the rules defined in
  99. // the proto definition for this message. If any rules are violated, an error
  100. // is returned.
  101. func (m *ClusterStatus) Validate() error {
  102. if m == nil {
  103. return nil
  104. }
  105. // no validation rules for Name
  106. // no validation rules for AddedViaApi
  107. if v, ok := interface{}(m.GetSuccessRateEjectionThreshold()).(interface{ Validate() error }); ok {
  108. if err := v.Validate(); err != nil {
  109. return ClusterStatusValidationError{
  110. field: "SuccessRateEjectionThreshold",
  111. reason: "embedded message failed validation",
  112. cause: err,
  113. }
  114. }
  115. }
  116. for idx, item := range m.GetHostStatuses() {
  117. _, _ = idx, item
  118. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  119. if err := v.Validate(); err != nil {
  120. return ClusterStatusValidationError{
  121. field: fmt.Sprintf("HostStatuses[%v]", idx),
  122. reason: "embedded message failed validation",
  123. cause: err,
  124. }
  125. }
  126. }
  127. }
  128. if v, ok := interface{}(m.GetLocalOriginSuccessRateEjectionThreshold()).(interface{ Validate() error }); ok {
  129. if err := v.Validate(); err != nil {
  130. return ClusterStatusValidationError{
  131. field: "LocalOriginSuccessRateEjectionThreshold",
  132. reason: "embedded message failed validation",
  133. cause: err,
  134. }
  135. }
  136. }
  137. return nil
  138. }
  139. // ClusterStatusValidationError is the validation error returned by
  140. // ClusterStatus.Validate if the designated constraints aren't met.
  141. type ClusterStatusValidationError struct {
  142. field string
  143. reason string
  144. cause error
  145. key bool
  146. }
  147. // Field function returns field value.
  148. func (e ClusterStatusValidationError) Field() string { return e.field }
  149. // Reason function returns reason value.
  150. func (e ClusterStatusValidationError) Reason() string { return e.reason }
  151. // Cause function returns cause value.
  152. func (e ClusterStatusValidationError) Cause() error { return e.cause }
  153. // Key function returns key value.
  154. func (e ClusterStatusValidationError) Key() bool { return e.key }
  155. // ErrorName returns error name.
  156. func (e ClusterStatusValidationError) ErrorName() string { return "ClusterStatusValidationError" }
  157. // Error satisfies the builtin error interface
  158. func (e ClusterStatusValidationError) Error() string {
  159. cause := ""
  160. if e.cause != nil {
  161. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  162. }
  163. key := ""
  164. if e.key {
  165. key = "key for "
  166. }
  167. return fmt.Sprintf(
  168. "invalid %sClusterStatus.%s: %s%s",
  169. key,
  170. e.field,
  171. e.reason,
  172. cause)
  173. }
  174. var _ error = ClusterStatusValidationError{}
  175. var _ interface {
  176. Field() string
  177. Reason() string
  178. Key() bool
  179. Cause() error
  180. ErrorName() string
  181. } = ClusterStatusValidationError{}
  182. // Validate checks the field values on HostStatus with the rules defined in the
  183. // proto definition for this message. If any rules are violated, an error is returned.
  184. func (m *HostStatus) Validate() error {
  185. if m == nil {
  186. return nil
  187. }
  188. if v, ok := interface{}(m.GetAddress()).(interface{ Validate() error }); ok {
  189. if err := v.Validate(); err != nil {
  190. return HostStatusValidationError{
  191. field: "Address",
  192. reason: "embedded message failed validation",
  193. cause: err,
  194. }
  195. }
  196. }
  197. for idx, item := range m.GetStats() {
  198. _, _ = idx, item
  199. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  200. if err := v.Validate(); err != nil {
  201. return HostStatusValidationError{
  202. field: fmt.Sprintf("Stats[%v]", idx),
  203. reason: "embedded message failed validation",
  204. cause: err,
  205. }
  206. }
  207. }
  208. }
  209. if v, ok := interface{}(m.GetHealthStatus()).(interface{ Validate() error }); ok {
  210. if err := v.Validate(); err != nil {
  211. return HostStatusValidationError{
  212. field: "HealthStatus",
  213. reason: "embedded message failed validation",
  214. cause: err,
  215. }
  216. }
  217. }
  218. if v, ok := interface{}(m.GetSuccessRate()).(interface{ Validate() error }); ok {
  219. if err := v.Validate(); err != nil {
  220. return HostStatusValidationError{
  221. field: "SuccessRate",
  222. reason: "embedded message failed validation",
  223. cause: err,
  224. }
  225. }
  226. }
  227. // no validation rules for Weight
  228. // no validation rules for Hostname
  229. // no validation rules for Priority
  230. if v, ok := interface{}(m.GetLocalOriginSuccessRate()).(interface{ Validate() error }); ok {
  231. if err := v.Validate(); err != nil {
  232. return HostStatusValidationError{
  233. field: "LocalOriginSuccessRate",
  234. reason: "embedded message failed validation",
  235. cause: err,
  236. }
  237. }
  238. }
  239. if v, ok := interface{}(m.GetLocality()).(interface{ Validate() error }); ok {
  240. if err := v.Validate(); err != nil {
  241. return HostStatusValidationError{
  242. field: "Locality",
  243. reason: "embedded message failed validation",
  244. cause: err,
  245. }
  246. }
  247. }
  248. return nil
  249. }
  250. // HostStatusValidationError is the validation error returned by
  251. // HostStatus.Validate if the designated constraints aren't met.
  252. type HostStatusValidationError struct {
  253. field string
  254. reason string
  255. cause error
  256. key bool
  257. }
  258. // Field function returns field value.
  259. func (e HostStatusValidationError) Field() string { return e.field }
  260. // Reason function returns reason value.
  261. func (e HostStatusValidationError) Reason() string { return e.reason }
  262. // Cause function returns cause value.
  263. func (e HostStatusValidationError) Cause() error { return e.cause }
  264. // Key function returns key value.
  265. func (e HostStatusValidationError) Key() bool { return e.key }
  266. // ErrorName returns error name.
  267. func (e HostStatusValidationError) ErrorName() string { return "HostStatusValidationError" }
  268. // Error satisfies the builtin error interface
  269. func (e HostStatusValidationError) Error() string {
  270. cause := ""
  271. if e.cause != nil {
  272. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  273. }
  274. key := ""
  275. if e.key {
  276. key = "key for "
  277. }
  278. return fmt.Sprintf(
  279. "invalid %sHostStatus.%s: %s%s",
  280. key,
  281. e.field,
  282. e.reason,
  283. cause)
  284. }
  285. var _ error = HostStatusValidationError{}
  286. var _ interface {
  287. Field() string
  288. Reason() string
  289. Key() bool
  290. Cause() error
  291. ErrorName() string
  292. } = HostStatusValidationError{}
  293. // Validate checks the field values on HostHealthStatus with the rules defined
  294. // in the proto definition for this message. If any rules are violated, an
  295. // error is returned.
  296. func (m *HostHealthStatus) Validate() error {
  297. if m == nil {
  298. return nil
  299. }
  300. // no validation rules for FailedActiveHealthCheck
  301. // no validation rules for FailedOutlierCheck
  302. // no validation rules for FailedActiveDegradedCheck
  303. // no validation rules for PendingDynamicRemoval
  304. // no validation rules for PendingActiveHc
  305. // no validation rules for EdsHealthStatus
  306. return nil
  307. }
  308. // HostHealthStatusValidationError is the validation error returned by
  309. // HostHealthStatus.Validate if the designated constraints aren't met.
  310. type HostHealthStatusValidationError struct {
  311. field string
  312. reason string
  313. cause error
  314. key bool
  315. }
  316. // Field function returns field value.
  317. func (e HostHealthStatusValidationError) Field() string { return e.field }
  318. // Reason function returns reason value.
  319. func (e HostHealthStatusValidationError) Reason() string { return e.reason }
  320. // Cause function returns cause value.
  321. func (e HostHealthStatusValidationError) Cause() error { return e.cause }
  322. // Key function returns key value.
  323. func (e HostHealthStatusValidationError) Key() bool { return e.key }
  324. // ErrorName returns error name.
  325. func (e HostHealthStatusValidationError) ErrorName() string { return "HostHealthStatusValidationError" }
  326. // Error satisfies the builtin error interface
  327. func (e HostHealthStatusValidationError) Error() string {
  328. cause := ""
  329. if e.cause != nil {
  330. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  331. }
  332. key := ""
  333. if e.key {
  334. key = "key for "
  335. }
  336. return fmt.Sprintf(
  337. "invalid %sHostHealthStatus.%s: %s%s",
  338. key,
  339. e.field,
  340. e.reason,
  341. cause)
  342. }
  343. var _ error = HostHealthStatusValidationError{}
  344. var _ interface {
  345. Field() string
  346. Reason() string
  347. Key() bool
  348. Cause() error
  349. ErrorName() string
  350. } = HostHealthStatusValidationError{}