/pkg/api/envoy/config/filter/network/zookeeper_proxy/v1alpha1/zookeeper_proxy.pb.validate.go

https://github.com/datawire/ambassador · Go · 121 lines · 84 code · 21 blank · 16 comment · 9 complexity · 67d5ffcf6b317b1811ea30d5699b2d83 MD5 · raw file

  1. // Code generated by protoc-gen-validate. DO NOT EDIT.
  2. // source: envoy/config/filter/network/zookeeper_proxy/v1alpha1/zookeeper_proxy.proto
  3. package envoy_config_filter_network_zookeeper_proxy_v1alpha1
  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 _zookeeper_proxy_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 ZooKeeperProxy with the rules defined in
  34. // the proto definition for this message. If any rules are violated, an error
  35. // is returned.
  36. func (m *ZooKeeperProxy) Validate() error {
  37. if m == nil {
  38. return nil
  39. }
  40. if len(m.GetStatPrefix()) < 1 {
  41. return ZooKeeperProxyValidationError{
  42. field: "StatPrefix",
  43. reason: "value length must be at least 1 bytes",
  44. }
  45. }
  46. // no validation rules for AccessLog
  47. if v, ok := interface{}(m.GetMaxPacketBytes()).(interface{ Validate() error }); ok {
  48. if err := v.Validate(); err != nil {
  49. return ZooKeeperProxyValidationError{
  50. field: "MaxPacketBytes",
  51. reason: "embedded message failed validation",
  52. cause: err,
  53. }
  54. }
  55. }
  56. return nil
  57. }
  58. // ZooKeeperProxyValidationError is the validation error returned by
  59. // ZooKeeperProxy.Validate if the designated constraints aren't met.
  60. type ZooKeeperProxyValidationError struct {
  61. field string
  62. reason string
  63. cause error
  64. key bool
  65. }
  66. // Field function returns field value.
  67. func (e ZooKeeperProxyValidationError) Field() string { return e.field }
  68. // Reason function returns reason value.
  69. func (e ZooKeeperProxyValidationError) Reason() string { return e.reason }
  70. // Cause function returns cause value.
  71. func (e ZooKeeperProxyValidationError) Cause() error { return e.cause }
  72. // Key function returns key value.
  73. func (e ZooKeeperProxyValidationError) Key() bool { return e.key }
  74. // ErrorName returns error name.
  75. func (e ZooKeeperProxyValidationError) ErrorName() string { return "ZooKeeperProxyValidationError" }
  76. // Error satisfies the builtin error interface
  77. func (e ZooKeeperProxyValidationError) Error() string {
  78. cause := ""
  79. if e.cause != nil {
  80. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  81. }
  82. key := ""
  83. if e.key {
  84. key = "key for "
  85. }
  86. return fmt.Sprintf(
  87. "invalid %sZooKeeperProxy.%s: %s%s",
  88. key,
  89. e.field,
  90. e.reason,
  91. cause)
  92. }
  93. var _ error = ZooKeeperProxyValidationError{}
  94. var _ interface {
  95. Field() string
  96. Reason() string
  97. Key() bool
  98. Cause() error
  99. ErrorName() string
  100. } = ZooKeeperProxyValidationError{}