/pkg/api/envoy/extensions/filters/http/grpc_stats/v3/config.pb.validate.go

https://github.com/datawire/ambassador · Go · 203 lines · 132 code · 41 blank · 30 comment · 17 complexity · d977b0c07b569016f6d217d3d8ed05e0 MD5 · raw file

  1. // Code generated by protoc-gen-validate. DO NOT EDIT.
  2. // source: envoy/extensions/filters/http/grpc_stats/v3/config.proto
  3. package envoy_extensions_filters_http_grpc_stats_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 _config_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 FilterConfig 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 *FilterConfig) Validate() error {
  37. if m == nil {
  38. return nil
  39. }
  40. // no validation rules for EmitFilterState
  41. // no validation rules for EnableUpstreamStats
  42. switch m.PerMethodStatSpecifier.(type) {
  43. case *FilterConfig_IndividualMethodStatsAllowlist:
  44. if v, ok := interface{}(m.GetIndividualMethodStatsAllowlist()).(interface{ Validate() error }); ok {
  45. if err := v.Validate(); err != nil {
  46. return FilterConfigValidationError{
  47. field: "IndividualMethodStatsAllowlist",
  48. reason: "embedded message failed validation",
  49. cause: err,
  50. }
  51. }
  52. }
  53. case *FilterConfig_StatsForAllMethods:
  54. if v, ok := interface{}(m.GetStatsForAllMethods()).(interface{ Validate() error }); ok {
  55. if err := v.Validate(); err != nil {
  56. return FilterConfigValidationError{
  57. field: "StatsForAllMethods",
  58. reason: "embedded message failed validation",
  59. cause: err,
  60. }
  61. }
  62. }
  63. }
  64. return nil
  65. }
  66. // FilterConfigValidationError is the validation error returned by
  67. // FilterConfig.Validate if the designated constraints aren't met.
  68. type FilterConfigValidationError struct {
  69. field string
  70. reason string
  71. cause error
  72. key bool
  73. }
  74. // Field function returns field value.
  75. func (e FilterConfigValidationError) Field() string { return e.field }
  76. // Reason function returns reason value.
  77. func (e FilterConfigValidationError) Reason() string { return e.reason }
  78. // Cause function returns cause value.
  79. func (e FilterConfigValidationError) Cause() error { return e.cause }
  80. // Key function returns key value.
  81. func (e FilterConfigValidationError) Key() bool { return e.key }
  82. // ErrorName returns error name.
  83. func (e FilterConfigValidationError) ErrorName() string { return "FilterConfigValidationError" }
  84. // Error satisfies the builtin error interface
  85. func (e FilterConfigValidationError) Error() string {
  86. cause := ""
  87. if e.cause != nil {
  88. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  89. }
  90. key := ""
  91. if e.key {
  92. key = "key for "
  93. }
  94. return fmt.Sprintf(
  95. "invalid %sFilterConfig.%s: %s%s",
  96. key,
  97. e.field,
  98. e.reason,
  99. cause)
  100. }
  101. var _ error = FilterConfigValidationError{}
  102. var _ interface {
  103. Field() string
  104. Reason() string
  105. Key() bool
  106. Cause() error
  107. ErrorName() string
  108. } = FilterConfigValidationError{}
  109. // Validate checks the field values on FilterObject with the rules defined in
  110. // the proto definition for this message. If any rules are violated, an error
  111. // is returned.
  112. func (m *FilterObject) Validate() error {
  113. if m == nil {
  114. return nil
  115. }
  116. // no validation rules for RequestMessageCount
  117. // no validation rules for ResponseMessageCount
  118. return nil
  119. }
  120. // FilterObjectValidationError is the validation error returned by
  121. // FilterObject.Validate if the designated constraints aren't met.
  122. type FilterObjectValidationError struct {
  123. field string
  124. reason string
  125. cause error
  126. key bool
  127. }
  128. // Field function returns field value.
  129. func (e FilterObjectValidationError) Field() string { return e.field }
  130. // Reason function returns reason value.
  131. func (e FilterObjectValidationError) Reason() string { return e.reason }
  132. // Cause function returns cause value.
  133. func (e FilterObjectValidationError) Cause() error { return e.cause }
  134. // Key function returns key value.
  135. func (e FilterObjectValidationError) Key() bool { return e.key }
  136. // ErrorName returns error name.
  137. func (e FilterObjectValidationError) ErrorName() string { return "FilterObjectValidationError" }
  138. // Error satisfies the builtin error interface
  139. func (e FilterObjectValidationError) Error() string {
  140. cause := ""
  141. if e.cause != nil {
  142. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  143. }
  144. key := ""
  145. if e.key {
  146. key = "key for "
  147. }
  148. return fmt.Sprintf(
  149. "invalid %sFilterObject.%s: %s%s",
  150. key,
  151. e.field,
  152. e.reason,
  153. cause)
  154. }
  155. var _ error = FilterObjectValidationError{}
  156. var _ interface {
  157. Field() string
  158. Reason() string
  159. Key() bool
  160. Cause() error
  161. ErrorName() string
  162. } = FilterObjectValidationError{}