/pkg/api/envoy/config/grpc_credential/v2alpha/file_based_metadata.pb.validate.go

https://github.com/datawire/ambassador · Go · 118 lines · 80 code · 21 blank · 17 comment · 8 complexity · 5de9e3c3778d4924c4c3074267a8f83e MD5 · raw file

  1. // Code generated by protoc-gen-validate. DO NOT EDIT.
  2. // source: envoy/config/grpc_credential/v2alpha/file_based_metadata.proto
  3. package envoy_config_grpc_credential_v2alpha
  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 _file_based_metadata_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 FileBasedMetadataConfig 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 *FileBasedMetadataConfig) Validate() error {
  37. if m == nil {
  38. return nil
  39. }
  40. if v, ok := interface{}(m.GetSecretData()).(interface{ Validate() error }); ok {
  41. if err := v.Validate(); err != nil {
  42. return FileBasedMetadataConfigValidationError{
  43. field: "SecretData",
  44. reason: "embedded message failed validation",
  45. cause: err,
  46. }
  47. }
  48. }
  49. // no validation rules for HeaderKey
  50. // no validation rules for HeaderPrefix
  51. return nil
  52. }
  53. // FileBasedMetadataConfigValidationError is the validation error returned by
  54. // FileBasedMetadataConfig.Validate if the designated constraints aren't met.
  55. type FileBasedMetadataConfigValidationError struct {
  56. field string
  57. reason string
  58. cause error
  59. key bool
  60. }
  61. // Field function returns field value.
  62. func (e FileBasedMetadataConfigValidationError) Field() string { return e.field }
  63. // Reason function returns reason value.
  64. func (e FileBasedMetadataConfigValidationError) Reason() string { return e.reason }
  65. // Cause function returns cause value.
  66. func (e FileBasedMetadataConfigValidationError) Cause() error { return e.cause }
  67. // Key function returns key value.
  68. func (e FileBasedMetadataConfigValidationError) Key() bool { return e.key }
  69. // ErrorName returns error name.
  70. func (e FileBasedMetadataConfigValidationError) ErrorName() string {
  71. return "FileBasedMetadataConfigValidationError"
  72. }
  73. // Error satisfies the builtin error interface
  74. func (e FileBasedMetadataConfigValidationError) Error() string {
  75. cause := ""
  76. if e.cause != nil {
  77. cause = fmt.Sprintf(" | caused by: %v", e.cause)
  78. }
  79. key := ""
  80. if e.key {
  81. key = "key for "
  82. }
  83. return fmt.Sprintf(
  84. "invalid %sFileBasedMetadataConfig.%s: %s%s",
  85. key,
  86. e.field,
  87. e.reason,
  88. cause)
  89. }
  90. var _ error = FileBasedMetadataConfigValidationError{}
  91. var _ interface {
  92. Field() string
  93. Reason() string
  94. Key() bool
  95. Cause() error
  96. ErrorName() string
  97. } = FileBasedMetadataConfigValidationError{}