/pkg/api/envoy/admin/v4alpha/server_info.pb.validate.go

https://github.com/datawire/ambassador · Go · 286 lines · 166 code · 66 blank · 54 comment · 28 complexity · 142441ddcf893b631314a93b1e230408 MD5 · raw file

  1. // Code generated by protoc-gen-validate. DO NOT EDIT.
  2. // source: envoy/admin/v4alpha/server_info.proto
  3. package envoy_admin_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 _server_info_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 ServerInfo with the rules defined in the
  34. // proto definition for this message. If any rules are violated, an error is returned.
  35. func (m *ServerInfo) Validate() error {
  36. if m == nil {
  37. return nil
  38. }
  39. // no validation rules for Version
  40. // no validation rules for State
  41. if v, ok := interface{}(m.GetUptimeCurrentEpoch()).(interface{ Validate() error }); ok {
  42. if err := v.Validate(); err != nil {
  43. return ServerInfoValidationError{
  44. field: "UptimeCurrentEpoch",
  45. reason: "embedded message failed validation",
  46. cause: err,
  47. }
  48. }
  49. }
  50. if v, ok := interface{}(m.GetUptimeAllEpochs()).(interface{ Validate() error }); ok {
  51. if err := v.Validate(); err != nil {
  52. return ServerInfoValidationError{
  53. field: "UptimeAllEpochs",
  54. reason: "embedded message failed validation",
  55. cause: err,
  56. }
  57. }
  58. }
  59. // no validation rules for HotRestartVersion
  60. if v, ok := interface{}(m.GetCommandLineOptions()).(interface{ Validate() error }); ok {
  61. if err := v.Validate(); err != nil {
  62. return ServerInfoValidationError{
  63. field: "CommandLineOptions",
  64. reason: "embedded message failed validation",
  65. cause: err,
  66. }
  67. }
  68. }
  69. return nil
  70. }
  71. // ServerInfoValidationError is the validation error returned by
  72. // ServerInfo.Validate if the designated constraints aren't met.
  73. type ServerInfoValidationError struct {
  74. field string
  75. reason string
  76. cause error
  77. key bool
  78. }
  79. // Field function returns field value.
  80. func (e ServerInfoValidationError) Field() string { return e.field }
  81. // Reason function returns reason value.
  82. func (e ServerInfoValidationError) Reason() string { return e.reason }
  83. // Cause function returns cause value.
  84. func (e ServerInfoValidationError) Cause() error { return e.cause }
  85. // Key function returns key value.
  86. func (e ServerInfoValidationError) Key() bool { return e.key }
  87. // ErrorName returns error name.
  88. func (e ServerInfoValidationError) ErrorName() string { return "ServerInfoValidationError" }
  89. // Error satisfies the builtin error interface
  90. func (e ServerInfoValidationError) Error() string {
  91. cause := ""
  92. if e.cause != nil {
  93. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  94. }
  95. key := ""
  96. if e.key {
  97. key = "key for "
  98. }
  99. return fmt.Sprintf(
  100. "invalid %sServerInfo.%s: %s%s",
  101. key,
  102. e.field,
  103. e.reason,
  104. cause)
  105. }
  106. var _ error = ServerInfoValidationError{}
  107. var _ interface {
  108. Field() string
  109. Reason() string
  110. Key() bool
  111. Cause() error
  112. ErrorName() string
  113. } = ServerInfoValidationError{}
  114. // Validate checks the field values on CommandLineOptions with the rules
  115. // defined in the proto definition for this message. If any rules are
  116. // violated, an error is returned.
  117. func (m *CommandLineOptions) Validate() error {
  118. if m == nil {
  119. return nil
  120. }
  121. // no validation rules for BaseId
  122. // no validation rules for UseDynamicBaseId
  123. // no validation rules for BaseIdPath
  124. // no validation rules for Concurrency
  125. // no validation rules for ConfigPath
  126. // no validation rules for ConfigYaml
  127. // no validation rules for AllowUnknownStaticFields
  128. // no validation rules for RejectUnknownDynamicFields
  129. // no validation rules for IgnoreUnknownDynamicFields
  130. // no validation rules for AdminAddressPath
  131. // no validation rules for LocalAddressIpVersion
  132. // no validation rules for LogLevel
  133. // no validation rules for ComponentLogLevel
  134. // no validation rules for LogFormat
  135. // no validation rules for LogFormatEscaped
  136. // no validation rules for LogPath
  137. // no validation rules for ServiceCluster
  138. // no validation rules for ServiceNode
  139. // no validation rules for ServiceZone
  140. if v, ok := interface{}(m.GetFileFlushInterval()).(interface{ Validate() error }); ok {
  141. if err := v.Validate(); err != nil {
  142. return CommandLineOptionsValidationError{
  143. field: "FileFlushInterval",
  144. reason: "embedded message failed validation",
  145. cause: err,
  146. }
  147. }
  148. }
  149. if v, ok := interface{}(m.GetDrainTime()).(interface{ Validate() error }); ok {
  150. if err := v.Validate(); err != nil {
  151. return CommandLineOptionsValidationError{
  152. field: "DrainTime",
  153. reason: "embedded message failed validation",
  154. cause: err,
  155. }
  156. }
  157. }
  158. // no validation rules for DrainStrategy
  159. if v, ok := interface{}(m.GetParentShutdownTime()).(interface{ Validate() error }); ok {
  160. if err := v.Validate(); err != nil {
  161. return CommandLineOptionsValidationError{
  162. field: "ParentShutdownTime",
  163. reason: "embedded message failed validation",
  164. cause: err,
  165. }
  166. }
  167. }
  168. // no validation rules for Mode
  169. // no validation rules for DisableHotRestart
  170. // no validation rules for EnableMutexTracing
  171. // no validation rules for RestartEpoch
  172. // no validation rules for CpusetThreads
  173. // no validation rules for BootstrapVersion
  174. return nil
  175. }
  176. // CommandLineOptionsValidationError is the validation error returned by
  177. // CommandLineOptions.Validate if the designated constraints aren't met.
  178. type CommandLineOptionsValidationError struct {
  179. field string
  180. reason string
  181. cause error
  182. key bool
  183. }
  184. // Field function returns field value.
  185. func (e CommandLineOptionsValidationError) Field() string { return e.field }
  186. // Reason function returns reason value.
  187. func (e CommandLineOptionsValidationError) Reason() string { return e.reason }
  188. // Cause function returns cause value.
  189. func (e CommandLineOptionsValidationError) Cause() error { return e.cause }
  190. // Key function returns key value.
  191. func (e CommandLineOptionsValidationError) Key() bool { return e.key }
  192. // ErrorName returns error name.
  193. func (e CommandLineOptionsValidationError) ErrorName() string {
  194. return "CommandLineOptionsValidationError"
  195. }
  196. // Error satisfies the builtin error interface
  197. func (e CommandLineOptionsValidationError) Error() string {
  198. cause := ""
  199. if e.cause != nil {
  200. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  201. }
  202. key := ""
  203. if e.key {
  204. key = "key for "
  205. }
  206. return fmt.Sprintf(
  207. "invalid %sCommandLineOptions.%s: %s%s",
  208. key,
  209. e.field,
  210. e.reason,
  211. cause)
  212. }
  213. var _ error = CommandLineOptionsValidationError{}
  214. var _ interface {
  215. Field() string
  216. Reason() string
  217. Key() bool
  218. Cause() error
  219. ErrorName() string
  220. } = CommandLineOptionsValidationError{}