/pkg/api/envoy/extensions/filters/http/grpc_json_transcoder/v3/transcoder.pb.validate.go

https://github.com/datawire/ambassador · Go · 221 lines · 138 code · 46 blank · 37 comment · 15 complexity · 5712700db4ec0919768ef61460ee05c1 MD5 · raw file

  1. // Code generated by protoc-gen-validate. DO NOT EDIT.
  2. // source: envoy/extensions/filters/http/grpc_json_transcoder/v3/transcoder.proto
  3. package envoy_extensions_filters_http_grpc_json_transcoder_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 _transcoder_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 GrpcJsonTranscoder with the rules
  34. // defined in the proto definition for this message. If any rules are
  35. // violated, an error is returned.
  36. func (m *GrpcJsonTranscoder) Validate() error {
  37. if m == nil {
  38. return nil
  39. }
  40. if len(m.GetServices()) < 1 {
  41. return GrpcJsonTranscoderValidationError{
  42. field: "Services",
  43. reason: "value must contain at least 1 item(s)",
  44. }
  45. }
  46. if v, ok := interface{}(m.GetPrintOptions()).(interface{ Validate() error }); ok {
  47. if err := v.Validate(); err != nil {
  48. return GrpcJsonTranscoderValidationError{
  49. field: "PrintOptions",
  50. reason: "embedded message failed validation",
  51. cause: err,
  52. }
  53. }
  54. }
  55. // no validation rules for MatchIncomingRequestRoute
  56. // no validation rules for AutoMapping
  57. // no validation rules for IgnoreUnknownQueryParameters
  58. // no validation rules for ConvertGrpcStatus
  59. switch m.DescriptorSet.(type) {
  60. case *GrpcJsonTranscoder_ProtoDescriptor:
  61. // no validation rules for ProtoDescriptor
  62. case *GrpcJsonTranscoder_ProtoDescriptorBin:
  63. // no validation rules for ProtoDescriptorBin
  64. default:
  65. return GrpcJsonTranscoderValidationError{
  66. field: "DescriptorSet",
  67. reason: "value is required",
  68. }
  69. }
  70. return nil
  71. }
  72. // GrpcJsonTranscoderValidationError is the validation error returned by
  73. // GrpcJsonTranscoder.Validate if the designated constraints aren't met.
  74. type GrpcJsonTranscoderValidationError struct {
  75. field string
  76. reason string
  77. cause error
  78. key bool
  79. }
  80. // Field function returns field value.
  81. func (e GrpcJsonTranscoderValidationError) Field() string { return e.field }
  82. // Reason function returns reason value.
  83. func (e GrpcJsonTranscoderValidationError) Reason() string { return e.reason }
  84. // Cause function returns cause value.
  85. func (e GrpcJsonTranscoderValidationError) Cause() error { return e.cause }
  86. // Key function returns key value.
  87. func (e GrpcJsonTranscoderValidationError) Key() bool { return e.key }
  88. // ErrorName returns error name.
  89. func (e GrpcJsonTranscoderValidationError) ErrorName() string {
  90. return "GrpcJsonTranscoderValidationError"
  91. }
  92. // Error satisfies the builtin error interface
  93. func (e GrpcJsonTranscoderValidationError) Error() string {
  94. cause := ""
  95. if e.cause != nil {
  96. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  97. }
  98. key := ""
  99. if e.key {
  100. key = "key for "
  101. }
  102. return fmt.Sprintf(
  103. "invalid %sGrpcJsonTranscoder.%s: %s%s",
  104. key,
  105. e.field,
  106. e.reason,
  107. cause)
  108. }
  109. var _ error = GrpcJsonTranscoderValidationError{}
  110. var _ interface {
  111. Field() string
  112. Reason() string
  113. Key() bool
  114. Cause() error
  115. ErrorName() string
  116. } = GrpcJsonTranscoderValidationError{}
  117. // Validate checks the field values on GrpcJsonTranscoder_PrintOptions with the
  118. // rules defined in the proto definition for this message. If any rules are
  119. // violated, an error is returned.
  120. func (m *GrpcJsonTranscoder_PrintOptions) Validate() error {
  121. if m == nil {
  122. return nil
  123. }
  124. // no validation rules for AddWhitespace
  125. // no validation rules for AlwaysPrintPrimitiveFields
  126. // no validation rules for AlwaysPrintEnumsAsInts
  127. // no validation rules for PreserveProtoFieldNames
  128. return nil
  129. }
  130. // GrpcJsonTranscoder_PrintOptionsValidationError is the validation error
  131. // returned by GrpcJsonTranscoder_PrintOptions.Validate if the designated
  132. // constraints aren't met.
  133. type GrpcJsonTranscoder_PrintOptionsValidationError struct {
  134. field string
  135. reason string
  136. cause error
  137. key bool
  138. }
  139. // Field function returns field value.
  140. func (e GrpcJsonTranscoder_PrintOptionsValidationError) Field() string { return e.field }
  141. // Reason function returns reason value.
  142. func (e GrpcJsonTranscoder_PrintOptionsValidationError) Reason() string { return e.reason }
  143. // Cause function returns cause value.
  144. func (e GrpcJsonTranscoder_PrintOptionsValidationError) Cause() error { return e.cause }
  145. // Key function returns key value.
  146. func (e GrpcJsonTranscoder_PrintOptionsValidationError) Key() bool { return e.key }
  147. // ErrorName returns error name.
  148. func (e GrpcJsonTranscoder_PrintOptionsValidationError) ErrorName() string {
  149. return "GrpcJsonTranscoder_PrintOptionsValidationError"
  150. }
  151. // Error satisfies the builtin error interface
  152. func (e GrpcJsonTranscoder_PrintOptionsValidationError) Error() string {
  153. cause := ""
  154. if e.cause != nil {
  155. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  156. }
  157. key := ""
  158. if e.key {
  159. key = "key for "
  160. }
  161. return fmt.Sprintf(
  162. "invalid %sGrpcJsonTranscoder_PrintOptions.%s: %s%s",
  163. key,
  164. e.field,
  165. e.reason,
  166. cause)
  167. }
  168. var _ error = GrpcJsonTranscoder_PrintOptionsValidationError{}
  169. var _ interface {
  170. Field() string
  171. Reason() string
  172. Key() bool
  173. Cause() error
  174. ErrorName() string
  175. } = GrpcJsonTranscoder_PrintOptionsValidationError{}