/pkg/api/envoy/config/core/v4alpha/grpc_method_list.pb.validate.go

https://github.com/datawire/ambassador · Go · 198 lines · 136 code · 36 blank · 26 comment · 16 complexity · 41374c76290b92e988f161acd9eb7011 MD5 · raw file

  1. // Code generated by protoc-gen-validate. DO NOT EDIT.
  2. // source: envoy/config/core/v4alpha/grpc_method_list.proto
  3. package envoy_config_core_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 _grpc_method_list_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 GrpcMethodList 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 *GrpcMethodList) Validate() error {
  37. if m == nil {
  38. return nil
  39. }
  40. for idx, item := range m.GetServices() {
  41. _, _ = idx, item
  42. if v, ok := interface{}(item).(interface{ Validate() error }); ok {
  43. if err := v.Validate(); err != nil {
  44. return GrpcMethodListValidationError{
  45. field: fmt.Sprintf("Services[%v]", idx),
  46. reason: "embedded message failed validation",
  47. cause: err,
  48. }
  49. }
  50. }
  51. }
  52. return nil
  53. }
  54. // GrpcMethodListValidationError is the validation error returned by
  55. // GrpcMethodList.Validate if the designated constraints aren't met.
  56. type GrpcMethodListValidationError struct {
  57. field string
  58. reason string
  59. cause error
  60. key bool
  61. }
  62. // Field function returns field value.
  63. func (e GrpcMethodListValidationError) Field() string { return e.field }
  64. // Reason function returns reason value.
  65. func (e GrpcMethodListValidationError) Reason() string { return e.reason }
  66. // Cause function returns cause value.
  67. func (e GrpcMethodListValidationError) Cause() error { return e.cause }
  68. // Key function returns key value.
  69. func (e GrpcMethodListValidationError) Key() bool { return e.key }
  70. // ErrorName returns error name.
  71. func (e GrpcMethodListValidationError) ErrorName() string { return "GrpcMethodListValidationError" }
  72. // Error satisfies the builtin error interface
  73. func (e GrpcMethodListValidationError) Error() string {
  74. cause := ""
  75. if e.cause != nil {
  76. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  77. }
  78. key := ""
  79. if e.key {
  80. key = "key for "
  81. }
  82. return fmt.Sprintf(
  83. "invalid %sGrpcMethodList.%s: %s%s",
  84. key,
  85. e.field,
  86. e.reason,
  87. cause)
  88. }
  89. var _ error = GrpcMethodListValidationError{}
  90. var _ interface {
  91. Field() string
  92. Reason() string
  93. Key() bool
  94. Cause() error
  95. ErrorName() string
  96. } = GrpcMethodListValidationError{}
  97. // Validate checks the field values on GrpcMethodList_Service with the rules
  98. // defined in the proto definition for this message. If any rules are
  99. // violated, an error is returned.
  100. func (m *GrpcMethodList_Service) Validate() error {
  101. if m == nil {
  102. return nil
  103. }
  104. if len(m.GetName()) < 1 {
  105. return GrpcMethodList_ServiceValidationError{
  106. field: "Name",
  107. reason: "value length must be at least 1 bytes",
  108. }
  109. }
  110. if len(m.GetMethodNames()) < 1 {
  111. return GrpcMethodList_ServiceValidationError{
  112. field: "MethodNames",
  113. reason: "value must contain at least 1 item(s)",
  114. }
  115. }
  116. return nil
  117. }
  118. // GrpcMethodList_ServiceValidationError is the validation error returned by
  119. // GrpcMethodList_Service.Validate if the designated constraints aren't met.
  120. type GrpcMethodList_ServiceValidationError struct {
  121. field string
  122. reason string
  123. cause error
  124. key bool
  125. }
  126. // Field function returns field value.
  127. func (e GrpcMethodList_ServiceValidationError) Field() string { return e.field }
  128. // Reason function returns reason value.
  129. func (e GrpcMethodList_ServiceValidationError) Reason() string { return e.reason }
  130. // Cause function returns cause value.
  131. func (e GrpcMethodList_ServiceValidationError) Cause() error { return e.cause }
  132. // Key function returns key value.
  133. func (e GrpcMethodList_ServiceValidationError) Key() bool { return e.key }
  134. // ErrorName returns error name.
  135. func (e GrpcMethodList_ServiceValidationError) ErrorName() string {
  136. return "GrpcMethodList_ServiceValidationError"
  137. }
  138. // Error satisfies the builtin error interface
  139. func (e GrpcMethodList_ServiceValidationError) 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 %sGrpcMethodList_Service.%s: %s%s",
  150. key,
  151. e.field,
  152. e.reason,
  153. cause)
  154. }
  155. var _ error = GrpcMethodList_ServiceValidationError{}
  156. var _ interface {
  157. Field() string
  158. Reason() string
  159. Key() bool
  160. Cause() error
  161. ErrorName() string
  162. } = GrpcMethodList_ServiceValidationError{}