// Code generated by protoc-gen-validate. DO NOT EDIT. // source: audit/v1/audit_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 Principal 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 *Principal) Validate() error { return m.validate(false) } // ValidateAll checks the field values on Principal 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 PrincipalMultiError, or nil // if none found. func (m *Principal) ValidateAll() error { return m.validate(true) } func (m *Principal) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for Id if m.Email != nil { // no validation rules for Email } if len(errors) > 0 { return PrincipalMultiError(errors) } return nil } // PrincipalMultiError is an error wrapping multiple validation errors returned // by Principal.ValidateAll() if the designated constraints aren't met. type PrincipalMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m PrincipalMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m PrincipalMultiError) AllErrors() []error { return m } // PrincipalValidationError is the validation error returned by // Principal.Validate if the designated constraints aren't met. type PrincipalValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e PrincipalValidationError) Field() string { return e.field } // Reason function returns reason value. func (e PrincipalValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e PrincipalValidationError) Cause() error { return e.cause } // Key function returns key value. func (e PrincipalValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e PrincipalValidationError) ErrorName() string { return "PrincipalValidationError" } // Error satisfies the builtin error interface func (e PrincipalValidationError) 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 %sPrincipal.%s: %s%s", key, e.field, e.reason, cause) } var _ error = PrincipalValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = PrincipalValidationError{} // Validate checks the field values on RequestDetails 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 *RequestDetails) Validate() error { return m.validate(false) } // ValidateAll checks the field values on RequestDetails 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 RequestDetailsMultiError, // or nil if none found. func (m *RequestDetails) ValidateAll() error { return m.validate(true) } func (m *RequestDetails) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for Endpoint // no validation rules for SourceIpAddress for idx, item := range m.GetHeaders() { _, _ = idx, item if all { switch v := interface{}(item).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, RequestDetailsValidationError{ field: fmt.Sprintf("Headers[%v]", idx), reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, RequestDetailsValidationError{ field: fmt.Sprintf("Headers[%v]", idx), reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RequestDetailsValidationError{ field: fmt.Sprintf("Headers[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } if m.UserAgent != nil { // no validation rules for UserAgent } if m.Parameters != nil { if all { switch v := interface{}(m.GetParameters()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, RequestDetailsValidationError{ field: "Parameters", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, RequestDetailsValidationError{ field: "Parameters", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetParameters()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RequestDetailsValidationError{ field: "Parameters", reason: "embedded message failed validation", cause: err, } } } } if m.Body != nil { if all { switch v := interface{}(m.GetBody()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, RequestDetailsValidationError{ field: "Body", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, RequestDetailsValidationError{ field: "Body", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetBody()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return RequestDetailsValidationError{ field: "Body", reason: "embedded message failed validation", cause: err, } } } } if len(errors) > 0 { return RequestDetailsMultiError(errors) } return nil } // RequestDetailsMultiError is an error wrapping multiple validation errors // returned by RequestDetails.ValidateAll() if the designated constraints // aren't met. type RequestDetailsMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m RequestDetailsMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m RequestDetailsMultiError) AllErrors() []error { return m } // RequestDetailsValidationError is the validation error returned by // RequestDetails.Validate if the designated constraints aren't met. type RequestDetailsValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e RequestDetailsValidationError) Field() string { return e.field } // Reason function returns reason value. func (e RequestDetailsValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e RequestDetailsValidationError) Cause() error { return e.cause } // Key function returns key value. func (e RequestDetailsValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e RequestDetailsValidationError) ErrorName() string { return "RequestDetailsValidationError" } // Error satisfies the builtin error interface func (e RequestDetailsValidationError) 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 %sRequestDetails.%s: %s%s", key, e.field, e.reason, cause) } var _ error = RequestDetailsValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = RequestDetailsValidationError{} // Validate checks the field values on RequestHeader 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 *RequestHeader) Validate() error { return m.validate(false) } // ValidateAll checks the field values on RequestHeader 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 RequestHeaderMultiError, or // nil if none found. func (m *RequestHeader) ValidateAll() error { return m.validate(true) } func (m *RequestHeader) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for Key // no validation rules for Value if len(errors) > 0 { return RequestHeaderMultiError(errors) } return nil } // RequestHeaderMultiError is an error wrapping multiple validation errors // returned by RequestHeader.ValidateAll() if the designated constraints // aren't met. type RequestHeaderMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m RequestHeaderMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m RequestHeaderMultiError) AllErrors() []error { return m } // RequestHeaderValidationError is the validation error returned by // RequestHeader.Validate if the designated constraints aren't met. type RequestHeaderValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e RequestHeaderValidationError) Field() string { return e.field } // Reason function returns reason value. func (e RequestHeaderValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e RequestHeaderValidationError) Cause() error { return e.cause } // Key function returns key value. func (e RequestHeaderValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e RequestHeaderValidationError) ErrorName() string { return "RequestHeaderValidationError" } // Error satisfies the builtin error interface func (e RequestHeaderValidationError) 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 %sRequestHeader.%s: %s%s", key, e.field, e.reason, cause) } var _ error = RequestHeaderValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = RequestHeaderValidationError{} // Validate checks the field values on AuditEvent 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 *AuditEvent) Validate() error { return m.validate(false) } // ValidateAll checks the field values on AuditEvent 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 AuditEventMultiError, or // nil if none found. func (m *AuditEvent) ValidateAll() error { return m.validate(true) } func (m *AuditEvent) validate(all bool) error { if m == nil { return nil } var errors []error if all { switch v := interface{}(m.GetSequenceNumber()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AuditEventValidationError{ field: "SequenceNumber", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AuditEventValidationError{ field: "SequenceNumber", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetSequenceNumber()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AuditEventValidationError{ field: "SequenceNumber", reason: "embedded message failed validation", cause: err, } } } // no validation rules for EventName if all { switch v := interface{}(m.GetEventTimeStamp()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AuditEventValidationError{ field: "EventTimeStamp", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AuditEventValidationError{ field: "EventTimeStamp", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetEventTimeStamp()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AuditEventValidationError{ field: "EventTimeStamp", reason: "embedded message failed validation", cause: err, } } } // no validation rules for EventTrigger if all { switch v := interface{}(m.GetInitiator()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AuditEventValidationError{ field: "Initiator", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AuditEventValidationError{ field: "Initiator", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetInitiator()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AuditEventValidationError{ field: "Initiator", reason: "embedded message failed validation", cause: err, } } } for idx, item := range m.GetPrincipals() { _, _ = idx, item if all { switch v := interface{}(item).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AuditEventValidationError{ field: fmt.Sprintf("Principals[%v]", idx), reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AuditEventValidationError{ field: fmt.Sprintf("Principals[%v]", idx), reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(item).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AuditEventValidationError{ field: fmt.Sprintf("Principals[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } if m.Request != nil { if all { switch v := interface{}(m.GetRequest()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AuditEventValidationError{ field: "Request", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AuditEventValidationError{ field: "Request", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetRequest()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AuditEventValidationError{ field: "Request", reason: "embedded message failed validation", cause: err, } } } } if m.ResourceId != nil { // no validation rules for ResourceId } if m.ResourceName != nil { // no validation rules for ResourceName } if m.CorrelationId != nil { // no validation rules for CorrelationId } if m.Result != nil { if all { switch v := interface{}(m.GetResult()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AuditEventValidationError{ field: "Result", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AuditEventValidationError{ field: "Result", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetResult()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AuditEventValidationError{ field: "Result", reason: "embedded message failed validation", cause: err, } } } } if m.Details != nil { if all { switch v := interface{}(m.GetDetails()).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, AuditEventValidationError{ field: "Details", reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, AuditEventValidationError{ field: "Details", reason: "embedded message failed validation", cause: err, }) } } } else if v, ok := interface{}(m.GetDetails()).(interface{ Validate() error }); ok { if err := v.Validate(); err != nil { return AuditEventValidationError{ field: "Details", reason: "embedded message failed validation", cause: err, } } } } if len(errors) > 0 { return AuditEventMultiError(errors) } return nil } // AuditEventMultiError is an error wrapping multiple validation errors // returned by AuditEvent.ValidateAll() if the designated constraints aren't met. type AuditEventMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m AuditEventMultiError) Error() string { var msgs []string for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m AuditEventMultiError) AllErrors() []error { return m } // AuditEventValidationError is the validation error returned by // AuditEvent.Validate if the designated constraints aren't met. type AuditEventValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e AuditEventValidationError) Field() string { return e.field } // Reason function returns reason value. func (e AuditEventValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e AuditEventValidationError) Cause() error { return e.cause } // Key function returns key value. func (e AuditEventValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e AuditEventValidationError) ErrorName() string { return "AuditEventValidationError" } // Error satisfies the builtin error interface func (e AuditEventValidationError) 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 %sAuditEvent.%s: %s%s", key, e.field, e.reason, cause) } var _ error = AuditEventValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = AuditEventValidationError{}