audit-go/gen/go/audit/v1/routable_event.pb.validate.go
Christian Schaible 3472ce1585 Merged PR 723282: chore: Update dependencies
Security-concept-update-needed: false.

JIRA Work Item: STACKITALO-97
2025-01-27 15:55:38 +00:00

574 lines
15 KiB
Go

// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: audit/v1/routable_event.proto
package auditV1
import (
"bytes"
"errors"
"fmt"
"net"
"net/mail"
"net/url"
"regexp"
"sort"
"strings"
"time"
"unicode/utf8"
"google.golang.org/protobuf/types/known/anypb"
)
// ensure the imports are used
var (
_ = bytes.MinRead
_ = errors.New("")
_ = fmt.Print
_ = utf8.UTFMax
_ = (*regexp.Regexp)(nil)
_ = (*strings.Reader)(nil)
_ = net.IPv4len
_ = time.Duration(0)
_ = (*url.URL)(nil)
_ = (*mail.Address)(nil)
_ = anypb.Any{}
_ = sort.Sort
)
// Validate checks the field values on ObjectIdentifier with the rules defined
// in the proto definition for this message. If any rules are violated, the
// first error encountered is returned, or nil if there are no violations.
func (m *ObjectIdentifier) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ObjectIdentifier with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// ObjectIdentifierMultiError, or nil if none found.
func (m *ObjectIdentifier) ValidateAll() error {
return m.validate(true)
}
func (m *ObjectIdentifier) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for Identifier
// no validation rules for Type
if len(errors) > 0 {
return ObjectIdentifierMultiError(errors)
}
return nil
}
// ObjectIdentifierMultiError is an error wrapping multiple validation errors
// returned by ObjectIdentifier.ValidateAll() if the designated constraints
// aren't met.
type ObjectIdentifierMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ObjectIdentifierMultiError) Error() string {
msgs := make([]string, 0, len(m))
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m ObjectIdentifierMultiError) AllErrors() []error { return m }
// ObjectIdentifierValidationError is the validation error returned by
// ObjectIdentifier.Validate if the designated constraints aren't met.
type ObjectIdentifierValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ObjectIdentifierValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ObjectIdentifierValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ObjectIdentifierValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ObjectIdentifierValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ObjectIdentifierValidationError) ErrorName() string { return "ObjectIdentifierValidationError" }
// Error satisfies the builtin error interface
func (e ObjectIdentifierValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sObjectIdentifier.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ObjectIdentifierValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ObjectIdentifierValidationError{}
// Validate checks the field values on EncryptedData with the rules defined in
// the proto definition for this message. If any rules are violated, the first
// error encountered is returned, or nil if there are no violations.
func (m *EncryptedData) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on EncryptedData with the rules defined
// in the proto definition for this message. If any rules are violated, the
// result is a list of violation errors wrapped in EncryptedDataMultiError, or
// nil if none found.
func (m *EncryptedData) ValidateAll() error {
return m.validate(true)
}
func (m *EncryptedData) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for Data
// no validation rules for ProtobufType
// no validation rules for EncryptedPassword
// no validation rules for KeyVersion
if len(errors) > 0 {
return EncryptedDataMultiError(errors)
}
return nil
}
// EncryptedDataMultiError is an error wrapping multiple validation errors
// returned by EncryptedData.ValidateAll() if the designated constraints
// aren't met.
type EncryptedDataMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m EncryptedDataMultiError) Error() string {
msgs := make([]string, 0, len(m))
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m EncryptedDataMultiError) AllErrors() []error { return m }
// EncryptedDataValidationError is the validation error returned by
// EncryptedData.Validate if the designated constraints aren't met.
type EncryptedDataValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e EncryptedDataValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e EncryptedDataValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e EncryptedDataValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e EncryptedDataValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e EncryptedDataValidationError) ErrorName() string { return "EncryptedDataValidationError" }
// Error satisfies the builtin error interface
func (e EncryptedDataValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sEncryptedData.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = EncryptedDataValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = EncryptedDataValidationError{}
// Validate checks the field values on UnencryptedData with the rules defined
// in the proto definition for this message. If any rules are violated, the
// first error encountered is returned, or nil if there are no violations.
func (m *UnencryptedData) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on UnencryptedData with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// UnencryptedDataMultiError, or nil if none found.
func (m *UnencryptedData) ValidateAll() error {
return m.validate(true)
}
func (m *UnencryptedData) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for Data
// no validation rules for ProtobufType
if len(errors) > 0 {
return UnencryptedDataMultiError(errors)
}
return nil
}
// UnencryptedDataMultiError is an error wrapping multiple validation errors
// returned by UnencryptedData.ValidateAll() if the designated constraints
// aren't met.
type UnencryptedDataMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m UnencryptedDataMultiError) Error() string {
msgs := make([]string, 0, len(m))
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m UnencryptedDataMultiError) AllErrors() []error { return m }
// UnencryptedDataValidationError is the validation error returned by
// UnencryptedData.Validate if the designated constraints aren't met.
type UnencryptedDataValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e UnencryptedDataValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e UnencryptedDataValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e UnencryptedDataValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e UnencryptedDataValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e UnencryptedDataValidationError) ErrorName() string { return "UnencryptedDataValidationError" }
// Error satisfies the builtin error interface
func (e UnencryptedDataValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sUnencryptedData.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = UnencryptedDataValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = UnencryptedDataValidationError{}
// Validate checks the field values on RoutableAuditEvent with the rules
// defined in the proto definition for this message. If any rules are
// violated, the first error encountered is returned, or nil if there are no violations.
func (m *RoutableAuditEvent) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on RoutableAuditEvent with the rules
// defined in the proto definition for this message. If any rules are
// violated, the result is a list of violation errors wrapped in
// RoutableAuditEventMultiError, or nil if none found.
func (m *RoutableAuditEvent) ValidateAll() error {
return m.validate(true)
}
func (m *RoutableAuditEvent) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for OperationName
// no validation rules for Visibility
if all {
switch v := interface{}(m.GetObjectIdentifier()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, RoutableAuditEventValidationError{
field: "ObjectIdentifier",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, RoutableAuditEventValidationError{
field: "ObjectIdentifier",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetObjectIdentifier()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RoutableAuditEventValidationError{
field: "ObjectIdentifier",
reason: "embedded message failed validation",
cause: err,
}
}
}
switch v := m.Data.(type) {
case *RoutableAuditEvent_UnencryptedData:
if v == nil {
err := RoutableAuditEventValidationError{
field: "Data",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
if all {
switch v := interface{}(m.GetUnencryptedData()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, RoutableAuditEventValidationError{
field: "UnencryptedData",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, RoutableAuditEventValidationError{
field: "UnencryptedData",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetUnencryptedData()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RoutableAuditEventValidationError{
field: "UnencryptedData",
reason: "embedded message failed validation",
cause: err,
}
}
}
case *RoutableAuditEvent_EncryptedData:
if v == nil {
err := RoutableAuditEventValidationError{
field: "Data",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
if all {
switch v := interface{}(m.GetEncryptedData()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, RoutableAuditEventValidationError{
field: "EncryptedData",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, RoutableAuditEventValidationError{
field: "EncryptedData",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetEncryptedData()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return RoutableAuditEventValidationError{
field: "EncryptedData",
reason: "embedded message failed validation",
cause: err,
}
}
}
default:
_ = v // ensures v is used
}
if len(errors) > 0 {
return RoutableAuditEventMultiError(errors)
}
return nil
}
// RoutableAuditEventMultiError is an error wrapping multiple validation errors
// returned by RoutableAuditEvent.ValidateAll() if the designated constraints
// aren't met.
type RoutableAuditEventMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m RoutableAuditEventMultiError) Error() string {
msgs := make([]string, 0, len(m))
for _, err := range m {
msgs = append(msgs, err.Error())
}
return strings.Join(msgs, "; ")
}
// AllErrors returns a list of validation violation errors.
func (m RoutableAuditEventMultiError) AllErrors() []error { return m }
// RoutableAuditEventValidationError is the validation error returned by
// RoutableAuditEvent.Validate if the designated constraints aren't met.
type RoutableAuditEventValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e RoutableAuditEventValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e RoutableAuditEventValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e RoutableAuditEventValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e RoutableAuditEventValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e RoutableAuditEventValidationError) ErrorName() string {
return "RoutableAuditEventValidationError"
}
// Error satisfies the builtin error interface
func (e RoutableAuditEventValidationError) Error() string {
cause := ""
if e.cause != nil {
cause = fmt.Sprintf(" | caused by: %v", e.cause)
}
key := ""
if e.key {
key = "key for "
}
return fmt.Sprintf(
"invalid %sRoutableAuditEvent.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = RoutableAuditEventValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = RoutableAuditEventValidationError{}