Add generated go files to git

This commit is contained in:
Christian Schaible 2024-07-15 11:13:35 +02:00
parent 4437c7b510
commit a509aae2a6
13 changed files with 19493 additions and 1 deletions

3
.gitignore vendored
View file

@ -172,4 +172,5 @@ fabric.properties
.idea/httpRequests
# Buf
gen
gen/java
gen/python

View file

@ -0,0 +1,654 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.34.1
// protoc (unknown)
// source: audit/v1/audit_event.proto
package auditV1
import (
_ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
structpb "google.golang.org/protobuf/types/known/structpb"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type EventTrigger int32
const (
EventTrigger_EVENT_TRIGGER_UNSPECIFIED EventTrigger = 0
// Event from messaging system
EventTrigger_EVENT_TRIGGER_EVENT EventTrigger = 1
// Time based scheduler
EventTrigger_EVENT_TRIGGER_SCHEDULER EventTrigger = 2
// Network request (REST, gRPC, etc.)
EventTrigger_EVENT_TRIGGER_REQUEST EventTrigger = 3
)
// Enum value maps for EventTrigger.
var (
EventTrigger_name = map[int32]string{
0: "EVENT_TRIGGER_UNSPECIFIED",
1: "EVENT_TRIGGER_EVENT",
2: "EVENT_TRIGGER_SCHEDULER",
3: "EVENT_TRIGGER_REQUEST",
}
EventTrigger_value = map[string]int32{
"EVENT_TRIGGER_UNSPECIFIED": 0,
"EVENT_TRIGGER_EVENT": 1,
"EVENT_TRIGGER_SCHEDULER": 2,
"EVENT_TRIGGER_REQUEST": 3,
}
)
func (x EventTrigger) Enum() *EventTrigger {
p := new(EventTrigger)
*p = x
return p
}
func (x EventTrigger) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (EventTrigger) Descriptor() protoreflect.EnumDescriptor {
return file_audit_v1_audit_event_proto_enumTypes[0].Descriptor()
}
func (EventTrigger) Type() protoreflect.EnumType {
return &file_audit_v1_audit_event_proto_enumTypes[0]
}
func (x EventTrigger) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use EventTrigger.Descriptor instead.
func (EventTrigger) EnumDescriptor() ([]byte, []int) {
return file_audit_v1_audit_event_proto_rawDescGZIP(), []int{0}
}
type Principal struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// A UUID or another kind of identifier
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Email *string `protobuf:"bytes,2,opt,name=email,proto3,oneof" json:"email,omitempty"`
}
func (x *Principal) Reset() {
*x = Principal{}
if protoimpl.UnsafeEnabled {
mi := &file_audit_v1_audit_event_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Principal) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Principal) ProtoMessage() {}
func (x *Principal) ProtoReflect() protoreflect.Message {
mi := &file_audit_v1_audit_event_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Principal.ProtoReflect.Descriptor instead.
func (*Principal) Descriptor() ([]byte, []int) {
return file_audit_v1_audit_event_proto_rawDescGZIP(), []int{0}
}
func (x *Principal) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *Principal) GetEmail() string {
if x != nil && x.Email != nil {
return *x.Email
}
return ""
}
type RequestDetails struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Endpoint string `protobuf:"bytes,1,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
// Accepts ipv4 and ipv6
SourceIpAddress string `protobuf:"bytes,2,opt,name=source_ip_address,json=sourceIpAddress,proto3" json:"source_ip_address,omitempty"`
UserAgent *string `protobuf:"bytes,3,opt,name=user_agent,json=userAgent,proto3,oneof" json:"user_agent,omitempty"`
Parameters *structpb.Struct `protobuf:"bytes,4,opt,name=parameters,proto3,oneof" json:"parameters,omitempty"`
Body *structpb.Struct `protobuf:"bytes,5,opt,name=body,proto3,oneof" json:"body,omitempty"`
Headers []*RequestHeader `protobuf:"bytes,6,rep,name=headers,proto3" json:"headers,omitempty"`
}
func (x *RequestDetails) Reset() {
*x = RequestDetails{}
if protoimpl.UnsafeEnabled {
mi := &file_audit_v1_audit_event_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RequestDetails) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RequestDetails) ProtoMessage() {}
func (x *RequestDetails) ProtoReflect() protoreflect.Message {
mi := &file_audit_v1_audit_event_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use RequestDetails.ProtoReflect.Descriptor instead.
func (*RequestDetails) Descriptor() ([]byte, []int) {
return file_audit_v1_audit_event_proto_rawDescGZIP(), []int{1}
}
func (x *RequestDetails) GetEndpoint() string {
if x != nil {
return x.Endpoint
}
return ""
}
func (x *RequestDetails) GetSourceIpAddress() string {
if x != nil {
return x.SourceIpAddress
}
return ""
}
func (x *RequestDetails) GetUserAgent() string {
if x != nil && x.UserAgent != nil {
return *x.UserAgent
}
return ""
}
func (x *RequestDetails) GetParameters() *structpb.Struct {
if x != nil {
return x.Parameters
}
return nil
}
func (x *RequestDetails) GetBody() *structpb.Struct {
if x != nil {
return x.Body
}
return nil
}
func (x *RequestDetails) GetHeaders() []*RequestHeader {
if x != nil {
return x.Headers
}
return nil
}
// Key-value pair for request headers. Key and value are mandatory.
type RequestHeader struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
}
func (x *RequestHeader) Reset() {
*x = RequestHeader{}
if protoimpl.UnsafeEnabled {
mi := &file_audit_v1_audit_event_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RequestHeader) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RequestHeader) ProtoMessage() {}
func (x *RequestHeader) ProtoReflect() protoreflect.Message {
mi := &file_audit_v1_audit_event_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use RequestHeader.ProtoReflect.Descriptor instead.
func (*RequestHeader) Descriptor() ([]byte, []int) {
return file_audit_v1_audit_event_proto_rawDescGZIP(), []int{2}
}
func (x *RequestHeader) GetKey() string {
if x != nil {
return x.Key
}
return ""
}
func (x *RequestHeader) GetValue() string {
if x != nil {
return x.Value
}
return ""
}
type AuditEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Functional event name with pattern <TYPE>_<ACTION>, e.g. ORGANIZATION_CREATED
// Important for filtering and translation / verbalization of event types
// in the UI or data sinks.
EventName string `protobuf:"bytes,1,opt,name=event_name,json=eventName,proto3" json:"event_name,omitempty"`
// The time when the event happened. Must not be a value in the future.
EventTimeStamp *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=event_time_stamp,json=eventTimeStamp,proto3" json:"event_time_stamp,omitempty"`
EventTrigger EventTrigger `protobuf:"varint,3,opt,name=event_trigger,json=eventTrigger,proto3,enum=audit.v1.EventTrigger" json:"event_trigger,omitempty"`
// Request details - mandatory if event_trigger is set to "EVENT_REQUEST"
Request *RequestDetails `protobuf:"bytes,4,opt,name=request,proto3,oneof" json:"request,omitempty"`
Initiator *Principal `protobuf:"bytes,5,opt,name=initiator,proto3" json:"initiator,omitempty"`
// List of service account delegation principals.
// -> Chain from service account to the actual user who initiated the action.
Principals []*Principal `protobuf:"bytes,6,rep,name=principals,proto3" json:"principals,omitempty"`
ResourceId *string `protobuf:"bytes,7,opt,name=resource_id,json=resourceId,proto3,oneof" json:"resource_id,omitempty"`
ResourceName *string `protobuf:"bytes,8,opt,name=resource_name,json=resourceName,proto3,oneof" json:"resource_name,omitempty"`
CorrelationId *string `protobuf:"bytes,9,opt,name=correlation_id,json=correlationId,proto3,oneof" json:"correlation_id,omitempty"`
// Result of the operation to publish with the event
Result *structpb.Struct `protobuf:"bytes,10,opt,name=result,proto3,oneof" json:"result,omitempty"`
// Additional information to publish with the event
Details *structpb.Struct `protobuf:"bytes,11,opt,name=details,proto3,oneof" json:"details,omitempty"`
}
func (x *AuditEvent) Reset() {
*x = AuditEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_audit_v1_audit_event_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *AuditEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AuditEvent) ProtoMessage() {}
func (x *AuditEvent) ProtoReflect() protoreflect.Message {
mi := &file_audit_v1_audit_event_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use AuditEvent.ProtoReflect.Descriptor instead.
func (*AuditEvent) Descriptor() ([]byte, []int) {
return file_audit_v1_audit_event_proto_rawDescGZIP(), []int{3}
}
func (x *AuditEvent) GetEventName() string {
if x != nil {
return x.EventName
}
return ""
}
func (x *AuditEvent) GetEventTimeStamp() *timestamppb.Timestamp {
if x != nil {
return x.EventTimeStamp
}
return nil
}
func (x *AuditEvent) GetEventTrigger() EventTrigger {
if x != nil {
return x.EventTrigger
}
return EventTrigger_EVENT_TRIGGER_UNSPECIFIED
}
func (x *AuditEvent) GetRequest() *RequestDetails {
if x != nil {
return x.Request
}
return nil
}
func (x *AuditEvent) GetInitiator() *Principal {
if x != nil {
return x.Initiator
}
return nil
}
func (x *AuditEvent) GetPrincipals() []*Principal {
if x != nil {
return x.Principals
}
return nil
}
func (x *AuditEvent) GetResourceId() string {
if x != nil && x.ResourceId != nil {
return *x.ResourceId
}
return ""
}
func (x *AuditEvent) GetResourceName() string {
if x != nil && x.ResourceName != nil {
return *x.ResourceName
}
return ""
}
func (x *AuditEvent) GetCorrelationId() string {
if x != nil && x.CorrelationId != nil {
return *x.CorrelationId
}
return ""
}
func (x *AuditEvent) GetResult() *structpb.Struct {
if x != nil {
return x.Result
}
return nil
}
func (x *AuditEvent) GetDetails() *structpb.Struct {
if x != nil {
return x.Details
}
return nil
}
var File_audit_v1_audit_event_proto protoreflect.FileDescriptor
var file_audit_v1_audit_event_proto_rawDesc = []byte{
0x0a, 0x1a, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x64, 0x69, 0x74,
0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x61, 0x75,
0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69,
0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x22, 0x54, 0x0a, 0x09, 0x50, 0x72, 0x69, 0x6e, 0x63, 0x69, 0x70, 0x61, 0x6c, 0x12,
0x16, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x06, 0xba, 0x48, 0x03,
0xc8, 0x01, 0x01, 0x52, 0x02, 0x69, 0x64, 0x12, 0x25, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xba, 0x48, 0x07, 0x72, 0x05, 0x18, 0xff, 0x01,
0x60, 0x01, 0x48, 0x00, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x88, 0x01, 0x01, 0x42, 0x08,
0x0a, 0x06, 0x5f, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x22, 0xf0, 0x02, 0x0a, 0x0e, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x12, 0x29, 0x0a, 0x08, 0x65,
0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0d, 0xba,
0x48, 0x0a, 0xc8, 0x01, 0x01, 0x72, 0x05, 0x10, 0x01, 0x18, 0xff, 0x01, 0x52, 0x08, 0x65, 0x6e,
0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x36, 0x0a, 0x11, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x5f, 0x69, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x42, 0x0a, 0xba, 0x48, 0x07, 0xc8, 0x01, 0x01, 0x72, 0x02, 0x70, 0x01, 0x52, 0x0f, 0x73,
0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x70, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x31,
0x0a, 0x0a, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x42, 0x0d, 0xba, 0x48, 0x0a, 0xc8, 0x01, 0x01, 0x72, 0x05, 0x10, 0x01, 0x18, 0xff,
0x01, 0x48, 0x00, 0x52, 0x09, 0x75, 0x73, 0x65, 0x72, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x88, 0x01,
0x01, 0x12, 0x3c, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18,
0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x48, 0x01,
0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x88, 0x01, 0x01, 0x12,
0x30, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e,
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x48, 0x02, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x88, 0x01,
0x01, 0x12, 0x31, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x06, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x17, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x07, 0x68, 0x65, 0x61,
0x64, 0x65, 0x72, 0x73, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x61, 0x67,
0x65, 0x6e, 0x74, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65,
0x72, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x22, 0x4f, 0x0a, 0x0d, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x03,
0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xba, 0x48, 0x07, 0xc8, 0x01,
0x01, 0x72, 0x02, 0x10, 0x01, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x20, 0x0a, 0x05, 0x76, 0x61,
0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xba, 0x48, 0x07, 0xc8, 0x01,
0x01, 0x72, 0x02, 0x10, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xf0, 0x06, 0x0a,
0x0a, 0x41, 0x75, 0x64, 0x69, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x38, 0x0a, 0x0a, 0x65,
0x76, 0x65, 0x6e, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42,
0x19, 0xba, 0x48, 0x16, 0xc8, 0x01, 0x01, 0x72, 0x11, 0x32, 0x0f, 0x5e, 0x5b, 0x41, 0x2d, 0x5a,
0x5d, 0x2b, 0x5f, 0x5b, 0x41, 0x2d, 0x5a, 0x5d, 0x2b, 0x24, 0x52, 0x09, 0x65, 0x76, 0x65, 0x6e,
0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x51, 0x0a, 0x10, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x74,
0x69, 0x6d, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x0b, 0xba, 0x48, 0x08,
0xc8, 0x01, 0x01, 0xb2, 0x01, 0x02, 0x38, 0x01, 0x52, 0x0e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x54,
0x69, 0x6d, 0x65, 0x53, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x48, 0x0a, 0x0d, 0x65, 0x76, 0x65, 0x6e,
0x74, 0x5f, 0x74, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32,
0x16, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74,
0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x42, 0x0b, 0xba, 0x48, 0x08, 0xc8, 0x01, 0x01, 0x82,
0x01, 0x02, 0x10, 0x01, 0x52, 0x0c, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x72, 0x69, 0x67, 0x67,
0x65, 0x72, 0x12, 0x37, 0x0a, 0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x04, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x48, 0x00, 0x52,
0x07, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x88, 0x01, 0x01, 0x12, 0x39, 0x0a, 0x09, 0x69,
0x6e, 0x69, 0x74, 0x69, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13,
0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x69, 0x6e, 0x63, 0x69,
0x70, 0x61, 0x6c, 0x42, 0x06, 0xba, 0x48, 0x03, 0xc8, 0x01, 0x01, 0x52, 0x09, 0x69, 0x6e, 0x69,
0x74, 0x69, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x33, 0x0a, 0x0a, 0x70, 0x72, 0x69, 0x6e, 0x63, 0x69,
0x70, 0x61, 0x6c, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x61, 0x75, 0x64,
0x69, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x69, 0x6e, 0x63, 0x69, 0x70, 0x61, 0x6c, 0x52,
0x0a, 0x70, 0x72, 0x69, 0x6e, 0x63, 0x69, 0x70, 0x61, 0x6c, 0x73, 0x12, 0x30, 0x0a, 0x0b, 0x72,
0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09,
0x42, 0x0a, 0xba, 0x48, 0x07, 0x72, 0x05, 0x10, 0x01, 0x18, 0xff, 0x01, 0x48, 0x01, 0x52, 0x0a,
0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x34, 0x0a,
0x0d, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08,
0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xba, 0x48, 0x07, 0x72, 0x05, 0x10, 0x01, 0x18, 0xff, 0x01,
0x48, 0x02, 0x52, 0x0c, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65,
0x88, 0x01, 0x01, 0x12, 0x36, 0x0a, 0x0e, 0x63, 0x6f, 0x72, 0x72, 0x65, 0x6c, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xba, 0x48, 0x07,
0x72, 0x05, 0x10, 0x01, 0x18, 0xff, 0x01, 0x48, 0x03, 0x52, 0x0d, 0x63, 0x6f, 0x72, 0x72, 0x65,
0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x88, 0x01, 0x01, 0x12, 0x34, 0x0a, 0x06, 0x72,
0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f,
0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74,
0x72, 0x75, 0x63, 0x74, 0x48, 0x04, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x88, 0x01,
0x01, 0x12, 0x36, 0x0a, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x18, 0x0b, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x48, 0x05, 0x52, 0x07, 0x64,
0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x88, 0x01, 0x01, 0x3a, 0x7c, 0xba, 0x48, 0x79, 0x1a, 0x77,
0x0a, 0x0f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c,
0x73, 0x12, 0x1b, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x20, 0x64, 0x65, 0x74, 0x61, 0x69,
0x6c, 0x73, 0x20, 0x6d, 0x75, 0x73, 0x74, 0x20, 0x62, 0x65, 0x20, 0x73, 0x65, 0x74, 0x1a, 0x47,
0x74, 0x68, 0x69, 0x73, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x72, 0x69, 0x67, 0x67,
0x65, 0x72, 0x20, 0x3d, 0x3d, 0x20, 0x33, 0x20, 0x26, 0x26, 0x20, 0x68, 0x61, 0x73, 0x28, 0x74,
0x68, 0x69, 0x73, 0x2e, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x29, 0x20, 0x7c, 0x7c, 0x20,
0x74, 0x68, 0x69, 0x73, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x74, 0x72, 0x69, 0x67, 0x67,
0x65, 0x72, 0x20, 0x21, 0x3d, 0x20, 0x33, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x72, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x5f, 0x69, 0x64, 0x42, 0x10, 0x0a, 0x0e, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x11, 0x0a, 0x0f, 0x5f, 0x63, 0x6f, 0x72, 0x72, 0x65, 0x6c,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x72, 0x65, 0x73,
0x75, 0x6c, 0x74, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x2a,
0x7e, 0x0a, 0x0c, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x12,
0x1d, 0x0a, 0x19, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x52, 0x49, 0x47, 0x47, 0x45, 0x52,
0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x17,
0x0a, 0x13, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x52, 0x49, 0x47, 0x47, 0x45, 0x52, 0x5f,
0x45, 0x56, 0x45, 0x4e, 0x54, 0x10, 0x01, 0x12, 0x1b, 0x0a, 0x17, 0x45, 0x56, 0x45, 0x4e, 0x54,
0x5f, 0x54, 0x52, 0x49, 0x47, 0x47, 0x45, 0x52, 0x5f, 0x53, 0x43, 0x48, 0x45, 0x44, 0x55, 0x4c,
0x45, 0x52, 0x10, 0x02, 0x12, 0x19, 0x0a, 0x15, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x54, 0x52,
0x49, 0x47, 0x47, 0x45, 0x52, 0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x03, 0x42,
0x81, 0x01, 0x0a, 0x1c, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x63, 0x68, 0x77, 0x61, 0x72, 0x7a, 0x2e,
0x73, 0x74, 0x61, 0x63, 0x6b, 0x69, 0x74, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31,
0x42, 0x0f, 0x41, 0x75, 0x64, 0x69, 0x74, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74,
0x6f, 0x50, 0x01, 0x5a, 0x0f, 0x2e, 0x2f, 0x61, 0x75, 0x64, 0x69, 0x74, 0x3b, 0x61, 0x75, 0x64,
0x69, 0x74, 0x56, 0x31, 0xa2, 0x02, 0x03, 0x41, 0x58, 0x58, 0xaa, 0x02, 0x08, 0x41, 0x75, 0x64,
0x69, 0x74, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x08, 0x41, 0x75, 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31,
0xe2, 0x02, 0x14, 0x41, 0x75, 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d,
0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x09, 0x41, 0x75, 0x64, 0x69, 0x74, 0x3a,
0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_audit_v1_audit_event_proto_rawDescOnce sync.Once
file_audit_v1_audit_event_proto_rawDescData = file_audit_v1_audit_event_proto_rawDesc
)
func file_audit_v1_audit_event_proto_rawDescGZIP() []byte {
file_audit_v1_audit_event_proto_rawDescOnce.Do(func() {
file_audit_v1_audit_event_proto_rawDescData = protoimpl.X.CompressGZIP(file_audit_v1_audit_event_proto_rawDescData)
})
return file_audit_v1_audit_event_proto_rawDescData
}
var file_audit_v1_audit_event_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_audit_v1_audit_event_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_audit_v1_audit_event_proto_goTypes = []interface{}{
(EventTrigger)(0), // 0: audit.v1.EventTrigger
(*Principal)(nil), // 1: audit.v1.Principal
(*RequestDetails)(nil), // 2: audit.v1.RequestDetails
(*RequestHeader)(nil), // 3: audit.v1.RequestHeader
(*AuditEvent)(nil), // 4: audit.v1.AuditEvent
(*structpb.Struct)(nil), // 5: google.protobuf.Struct
(*timestamppb.Timestamp)(nil), // 6: google.protobuf.Timestamp
}
var file_audit_v1_audit_event_proto_depIdxs = []int32{
5, // 0: audit.v1.RequestDetails.parameters:type_name -> google.protobuf.Struct
5, // 1: audit.v1.RequestDetails.body:type_name -> google.protobuf.Struct
3, // 2: audit.v1.RequestDetails.headers:type_name -> audit.v1.RequestHeader
6, // 3: audit.v1.AuditEvent.event_time_stamp:type_name -> google.protobuf.Timestamp
0, // 4: audit.v1.AuditEvent.event_trigger:type_name -> audit.v1.EventTrigger
2, // 5: audit.v1.AuditEvent.request:type_name -> audit.v1.RequestDetails
1, // 6: audit.v1.AuditEvent.initiator:type_name -> audit.v1.Principal
1, // 7: audit.v1.AuditEvent.principals:type_name -> audit.v1.Principal
5, // 8: audit.v1.AuditEvent.result:type_name -> google.protobuf.Struct
5, // 9: audit.v1.AuditEvent.details:type_name -> google.protobuf.Struct
10, // [10:10] is the sub-list for method output_type
10, // [10:10] is the sub-list for method input_type
10, // [10:10] is the sub-list for extension type_name
10, // [10:10] is the sub-list for extension extendee
0, // [0:10] is the sub-list for field type_name
}
func init() { file_audit_v1_audit_event_proto_init() }
func file_audit_v1_audit_event_proto_init() {
if File_audit_v1_audit_event_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_audit_v1_audit_event_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Principal); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_audit_v1_audit_event_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RequestDetails); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_audit_v1_audit_event_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RequestHeader); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_audit_v1_audit_event_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*AuditEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_audit_v1_audit_event_proto_msgTypes[0].OneofWrappers = []interface{}{}
file_audit_v1_audit_event_proto_msgTypes[1].OneofWrappers = []interface{}{}
file_audit_v1_audit_event_proto_msgTypes[3].OneofWrappers = []interface{}{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_audit_v1_audit_event_proto_rawDesc,
NumEnums: 1,
NumMessages: 4,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_audit_v1_audit_event_proto_goTypes,
DependencyIndexes: file_audit_v1_audit_event_proto_depIdxs,
EnumInfos: file_audit_v1_audit_event_proto_enumTypes,
MessageInfos: file_audit_v1_audit_event_proto_msgTypes,
}.Build()
File_audit_v1_audit_event_proto = out.File
file_audit_v1_audit_event_proto_rawDesc = nil
file_audit_v1_audit_event_proto_goTypes = nil
file_audit_v1_audit_event_proto_depIdxs = nil
}

View file

@ -0,0 +1,759 @@
// 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
// 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{}

166
gen/go/audit/v1/event.pb.go Normal file
View file

@ -0,0 +1,166 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.34.1
// protoc (unknown)
// source: audit/v1/event.proto
package auditV1
import (
_ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type ProtobufMessage struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Serialized event
Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
// Name of the protobuf type
ProtobufType string `protobuf:"bytes,2,opt,name=protobuf_type,json=protobufType,proto3" json:"protobuf_type,omitempty"`
}
func (x *ProtobufMessage) Reset() {
*x = ProtobufMessage{}
if protoimpl.UnsafeEnabled {
mi := &file_audit_v1_event_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ProtobufMessage) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ProtobufMessage) ProtoMessage() {}
func (x *ProtobufMessage) ProtoReflect() protoreflect.Message {
mi := &file_audit_v1_event_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ProtobufMessage.ProtoReflect.Descriptor instead.
func (*ProtobufMessage) Descriptor() ([]byte, []int) {
return file_audit_v1_event_proto_rawDescGZIP(), []int{0}
}
func (x *ProtobufMessage) GetValue() []byte {
if x != nil {
return x.Value
}
return nil
}
func (x *ProtobufMessage) GetProtobufType() string {
if x != nil {
return x.ProtobufType
}
return ""
}
var File_audit_v1_event_proto protoreflect.FileDescriptor
var file_audit_v1_event_proto_rawDesc = []byte{
0x0a, 0x14, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31,
0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76,
0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x64, 0x0a,
0x0f, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
0x12, 0x20, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42,
0x0a, 0xba, 0x48, 0x07, 0xc8, 0x01, 0x01, 0x7a, 0x02, 0x10, 0x01, 0x52, 0x05, 0x76, 0x61, 0x6c,
0x75, 0x65, 0x12, 0x2f, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x5f, 0x74,
0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xba, 0x48, 0x07, 0xc8, 0x01,
0x01, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x54,
0x79, 0x70, 0x65, 0x42, 0x7c, 0x0a, 0x1c, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x63, 0x68, 0x77, 0x61,
0x72, 0x7a, 0x2e, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x69, 0x74, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74,
0x2e, 0x76, 0x31, 0x42, 0x0a, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50,
0x01, 0x5a, 0x0f, 0x2e, 0x2f, 0x61, 0x75, 0x64, 0x69, 0x74, 0x3b, 0x61, 0x75, 0x64, 0x69, 0x74,
0x56, 0x31, 0xa2, 0x02, 0x03, 0x41, 0x58, 0x58, 0xaa, 0x02, 0x08, 0x41, 0x75, 0x64, 0x69, 0x74,
0x2e, 0x56, 0x31, 0xca, 0x02, 0x08, 0x41, 0x75, 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0xe2, 0x02,
0x14, 0x41, 0x75, 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74,
0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x09, 0x41, 0x75, 0x64, 0x69, 0x74, 0x3a, 0x3a, 0x56,
0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_audit_v1_event_proto_rawDescOnce sync.Once
file_audit_v1_event_proto_rawDescData = file_audit_v1_event_proto_rawDesc
)
func file_audit_v1_event_proto_rawDescGZIP() []byte {
file_audit_v1_event_proto_rawDescOnce.Do(func() {
file_audit_v1_event_proto_rawDescData = protoimpl.X.CompressGZIP(file_audit_v1_event_proto_rawDescData)
})
return file_audit_v1_event_proto_rawDescData
}
var file_audit_v1_event_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_audit_v1_event_proto_goTypes = []interface{}{
(*ProtobufMessage)(nil), // 0: audit.v1.ProtobufMessage
}
var file_audit_v1_event_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_audit_v1_event_proto_init() }
func file_audit_v1_event_proto_init() {
if File_audit_v1_event_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_audit_v1_event_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ProtobufMessage); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_audit_v1_event_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_audit_v1_event_proto_goTypes,
DependencyIndexes: file_audit_v1_event_proto_depIdxs,
MessageInfos: file_audit_v1_event_proto_msgTypes,
}.Build()
File_audit_v1_event_proto = out.File
file_audit_v1_event_proto_rawDesc = nil
file_audit_v1_event_proto_goTypes = nil
file_audit_v1_event_proto_depIdxs = nil
}

View file

@ -0,0 +1,140 @@
// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: audit/v1/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 ProtobufMessage 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 *ProtobufMessage) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ProtobufMessage 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
// ProtobufMessageMultiError, or nil if none found.
func (m *ProtobufMessage) ValidateAll() error {
return m.validate(true)
}
func (m *ProtobufMessage) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for Value
// no validation rules for ProtobufType
if len(errors) > 0 {
return ProtobufMessageMultiError(errors)
}
return nil
}
// ProtobufMessageMultiError is an error wrapping multiple validation errors
// returned by ProtobufMessage.ValidateAll() if the designated constraints
// aren't met.
type ProtobufMessageMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ProtobufMessageMultiError) 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 ProtobufMessageMultiError) AllErrors() []error { return m }
// ProtobufMessageValidationError is the validation error returned by
// ProtobufMessage.Validate if the designated constraints aren't met.
type ProtobufMessageValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ProtobufMessageValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ProtobufMessageValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ProtobufMessageValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ProtobufMessageValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ProtobufMessageValidationError) ErrorName() string { return "ProtobufMessageValidationError" }
// Error satisfies the builtin error interface
func (e ProtobufMessageValidationError) 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 %sProtobufMessage.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ProtobufMessageValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ProtobufMessageValidationError{}

View file

@ -0,0 +1,722 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.34.1
// protoc (unknown)
// source: audit/v1/routable_event.proto
package auditV1
import (
_ "buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go/buf/validate"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type Visibility int32
const (
Visibility_VISIBILITY_UNSPECIFIED Visibility = 0
// Will be routed to customer data sinks
Visibility_VISIBILITY_PUBLIC Visibility = 1
// Will NOT be routed to customer data sinks
Visibility_VISIBILITY_PRIVATE Visibility = 2
)
// Enum value maps for Visibility.
var (
Visibility_name = map[int32]string{
0: "VISIBILITY_UNSPECIFIED",
1: "VISIBILITY_PUBLIC",
2: "VISIBILITY_PRIVATE",
}
Visibility_value = map[string]int32{
"VISIBILITY_UNSPECIFIED": 0,
"VISIBILITY_PUBLIC": 1,
"VISIBILITY_PRIVATE": 2,
}
)
func (x Visibility) Enum() *Visibility {
p := new(Visibility)
*p = x
return p
}
func (x Visibility) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (Visibility) Descriptor() protoreflect.EnumDescriptor {
return file_audit_v1_routable_event_proto_enumTypes[0].Descriptor()
}
func (Visibility) Type() protoreflect.EnumType {
return &file_audit_v1_routable_event_proto_enumTypes[0]
}
func (x Visibility) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use Visibility.Descriptor instead.
func (Visibility) EnumDescriptor() ([]byte, []int) {
return file_audit_v1_routable_event_proto_rawDescGZIP(), []int{0}
}
type ObjectName int32
const (
ObjectName_OBJECT_NAME_UNSPECIFIED ObjectName = 0
// If the action happens on system level and doesn't relate to a known ObjectType.
ObjectName_OBJECT_NAME_SYSTEM ObjectName = 1
)
// Enum value maps for ObjectName.
var (
ObjectName_name = map[int32]string{
0: "OBJECT_NAME_UNSPECIFIED",
1: "OBJECT_NAME_SYSTEM",
}
ObjectName_value = map[string]int32{
"OBJECT_NAME_UNSPECIFIED": 0,
"OBJECT_NAME_SYSTEM": 1,
}
)
func (x ObjectName) Enum() *ObjectName {
p := new(ObjectName)
*p = x
return p
}
func (x ObjectName) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (ObjectName) Descriptor() protoreflect.EnumDescriptor {
return file_audit_v1_routable_event_proto_enumTypes[1].Descriptor()
}
func (ObjectName) Type() protoreflect.EnumType {
return &file_audit_v1_routable_event_proto_enumTypes[1]
}
func (x ObjectName) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use ObjectName.Descriptor instead.
func (ObjectName) EnumDescriptor() ([]byte, []int) {
return file_audit_v1_routable_event_proto_rawDescGZIP(), []int{1}
}
// The type of the object the audit event refers to.
// Relevant for type-detection and lookups in the routing.
type ObjectType int32
const (
ObjectType_OBJECT_TYPE_UNSPECIFIED ObjectType = 0
ObjectType_OBJECT_TYPE_ORGANIZATION ObjectType = 1
ObjectType_OBJECT_TYPE_FOLDER ObjectType = 2
ObjectType_OBJECT_TYPE_PROJECT ObjectType = 3
)
// Enum value maps for ObjectType.
var (
ObjectType_name = map[int32]string{
0: "OBJECT_TYPE_UNSPECIFIED",
1: "OBJECT_TYPE_ORGANIZATION",
2: "OBJECT_TYPE_FOLDER",
3: "OBJECT_TYPE_PROJECT",
}
ObjectType_value = map[string]int32{
"OBJECT_TYPE_UNSPECIFIED": 0,
"OBJECT_TYPE_ORGANIZATION": 1,
"OBJECT_TYPE_FOLDER": 2,
"OBJECT_TYPE_PROJECT": 3,
}
)
func (x ObjectType) Enum() *ObjectType {
p := new(ObjectType)
*p = x
return p
}
func (x ObjectType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (ObjectType) Descriptor() protoreflect.EnumDescriptor {
return file_audit_v1_routable_event_proto_enumTypes[2].Descriptor()
}
func (ObjectType) Type() protoreflect.EnumType {
return &file_audit_v1_routable_event_proto_enumTypes[2]
}
func (x ObjectType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use ObjectType.Descriptor instead.
func (ObjectType) EnumDescriptor() ([]byte, []int) {
return file_audit_v1_routable_event_proto_rawDescGZIP(), []int{2}
}
type ObjectIdentifier struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Identifier of the respective entity (e.g. Identifier of an organization)
Identifier string `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"`
// Type of the respective entity relevant for routing
Type ObjectType `protobuf:"varint,2,opt,name=type,proto3,enum=audit.v1.ObjectType" json:"type,omitempty"`
}
func (x *ObjectIdentifier) Reset() {
*x = ObjectIdentifier{}
if protoimpl.UnsafeEnabled {
mi := &file_audit_v1_routable_event_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ObjectIdentifier) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ObjectIdentifier) ProtoMessage() {}
func (x *ObjectIdentifier) ProtoReflect() protoreflect.Message {
mi := &file_audit_v1_routable_event_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ObjectIdentifier.ProtoReflect.Descriptor instead.
func (*ObjectIdentifier) Descriptor() ([]byte, []int) {
return file_audit_v1_routable_event_proto_rawDescGZIP(), []int{0}
}
func (x *ObjectIdentifier) GetIdentifier() string {
if x != nil {
return x.Identifier
}
return ""
}
func (x *ObjectIdentifier) GetType() ObjectType {
if x != nil {
return x.Type
}
return ObjectType_OBJECT_TYPE_UNSPECIFIED
}
type EncryptedData struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Encrypted serialized protobuf content (the actual audit event)
Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
// Name of the protobuf type
ProtobufType string `protobuf:"bytes,2,opt,name=protobuf_type,json=protobufType,proto3" json:"protobuf_type,omitempty"`
// The password taken to derive the encryption key from
EncryptedPassword string `protobuf:"bytes,3,opt,name=encrypted_password,json=encryptedPassword,proto3" json:"encrypted_password,omitempty"`
// Version of the encrypted key
KeyVersion int32 `protobuf:"varint,4,opt,name=key_version,json=keyVersion,proto3" json:"key_version,omitempty"`
}
func (x *EncryptedData) Reset() {
*x = EncryptedData{}
if protoimpl.UnsafeEnabled {
mi := &file_audit_v1_routable_event_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *EncryptedData) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*EncryptedData) ProtoMessage() {}
func (x *EncryptedData) ProtoReflect() protoreflect.Message {
mi := &file_audit_v1_routable_event_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use EncryptedData.ProtoReflect.Descriptor instead.
func (*EncryptedData) Descriptor() ([]byte, []int) {
return file_audit_v1_routable_event_proto_rawDescGZIP(), []int{1}
}
func (x *EncryptedData) GetData() []byte {
if x != nil {
return x.Data
}
return nil
}
func (x *EncryptedData) GetProtobufType() string {
if x != nil {
return x.ProtobufType
}
return ""
}
func (x *EncryptedData) GetEncryptedPassword() string {
if x != nil {
return x.EncryptedPassword
}
return ""
}
func (x *EncryptedData) GetKeyVersion() int32 {
if x != nil {
return x.KeyVersion
}
return 0
}
type UnencryptedData struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Unencrypted serialized protobuf content (the actual audit event)
Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
// Name of the protobuf type
ProtobufType string `protobuf:"bytes,2,opt,name=protobuf_type,json=protobufType,proto3" json:"protobuf_type,omitempty"`
}
func (x *UnencryptedData) Reset() {
*x = UnencryptedData{}
if protoimpl.UnsafeEnabled {
mi := &file_audit_v1_routable_event_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UnencryptedData) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UnencryptedData) ProtoMessage() {}
func (x *UnencryptedData) ProtoReflect() protoreflect.Message {
mi := &file_audit_v1_routable_event_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UnencryptedData.ProtoReflect.Descriptor instead.
func (*UnencryptedData) Descriptor() ([]byte, []int) {
return file_audit_v1_routable_event_proto_rawDescGZIP(), []int{2}
}
func (x *UnencryptedData) GetData() []byte {
if x != nil {
return x.Data
}
return nil
}
func (x *UnencryptedData) GetProtobufType() string {
if x != nil {
return x.ProtobufType
}
return ""
}
type RoutableAuditEvent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Functional event name with pattern <TYPE>_<ACTION>, e.g. ORGANIZATION_CREATED
// Will be copied over by the SDK from the AuditEvent
EventName string `protobuf:"bytes,1,opt,name=event_name,json=eventName,proto3" json:"event_name,omitempty"`
// Visibility relevant for differentiating between internal and public events
Visibility Visibility `protobuf:"varint,2,opt,name=visibility,proto3,enum=audit.v1.Visibility" json:"visibility,omitempty"`
// Identifier the audit log event refers to
//
// Types that are assignable to ResourceReference:
//
// *RoutableAuditEvent_ObjectName
// *RoutableAuditEvent_ObjectIdentifier
ResourceReference isRoutableAuditEvent_ResourceReference `protobuf_oneof:"resource_reference"`
// The actual audit event is transferred in one of the attributes below
//
// Types that are assignable to Data:
//
// *RoutableAuditEvent_UnencryptedData
// *RoutableAuditEvent_EncryptedData
Data isRoutableAuditEvent_Data `protobuf_oneof:"data"`
}
func (x *RoutableAuditEvent) Reset() {
*x = RoutableAuditEvent{}
if protoimpl.UnsafeEnabled {
mi := &file_audit_v1_routable_event_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RoutableAuditEvent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RoutableAuditEvent) ProtoMessage() {}
func (x *RoutableAuditEvent) ProtoReflect() protoreflect.Message {
mi := &file_audit_v1_routable_event_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use RoutableAuditEvent.ProtoReflect.Descriptor instead.
func (*RoutableAuditEvent) Descriptor() ([]byte, []int) {
return file_audit_v1_routable_event_proto_rawDescGZIP(), []int{3}
}
func (x *RoutableAuditEvent) GetEventName() string {
if x != nil {
return x.EventName
}
return ""
}
func (x *RoutableAuditEvent) GetVisibility() Visibility {
if x != nil {
return x.Visibility
}
return Visibility_VISIBILITY_UNSPECIFIED
}
func (m *RoutableAuditEvent) GetResourceReference() isRoutableAuditEvent_ResourceReference {
if m != nil {
return m.ResourceReference
}
return nil
}
func (x *RoutableAuditEvent) GetObjectName() ObjectName {
if x, ok := x.GetResourceReference().(*RoutableAuditEvent_ObjectName); ok {
return x.ObjectName
}
return ObjectName_OBJECT_NAME_UNSPECIFIED
}
func (x *RoutableAuditEvent) GetObjectIdentifier() *ObjectIdentifier {
if x, ok := x.GetResourceReference().(*RoutableAuditEvent_ObjectIdentifier); ok {
return x.ObjectIdentifier
}
return nil
}
func (m *RoutableAuditEvent) GetData() isRoutableAuditEvent_Data {
if m != nil {
return m.Data
}
return nil
}
func (x *RoutableAuditEvent) GetUnencryptedData() *UnencryptedData {
if x, ok := x.GetData().(*RoutableAuditEvent_UnencryptedData); ok {
return x.UnencryptedData
}
return nil
}
func (x *RoutableAuditEvent) GetEncryptedData() *EncryptedData {
if x, ok := x.GetData().(*RoutableAuditEvent_EncryptedData); ok {
return x.EncryptedData
}
return nil
}
type isRoutableAuditEvent_ResourceReference interface {
isRoutableAuditEvent_ResourceReference()
}
type RoutableAuditEvent_ObjectName struct {
// If it is a technical event not related to an organization, folder or project
// Will NOT be routed to the end-user, only for internal analysis ->
// Clarify what do in the router
ObjectName ObjectName `protobuf:"varint,3,opt,name=object_name,json=objectName,proto3,enum=audit.v1.ObjectName,oneof"`
}
type RoutableAuditEvent_ObjectIdentifier struct {
ObjectIdentifier *ObjectIdentifier `protobuf:"bytes,4,opt,name=object_identifier,json=objectIdentifier,proto3,oneof"`
}
func (*RoutableAuditEvent_ObjectName) isRoutableAuditEvent_ResourceReference() {}
func (*RoutableAuditEvent_ObjectIdentifier) isRoutableAuditEvent_ResourceReference() {}
type isRoutableAuditEvent_Data interface {
isRoutableAuditEvent_Data()
}
type RoutableAuditEvent_UnencryptedData struct {
UnencryptedData *UnencryptedData `protobuf:"bytes,5,opt,name=unencrypted_data,json=unencryptedData,proto3,oneof"`
}
type RoutableAuditEvent_EncryptedData struct {
EncryptedData *EncryptedData `protobuf:"bytes,6,opt,name=encrypted_data,json=encryptedData,proto3,oneof"`
}
func (*RoutableAuditEvent_UnencryptedData) isRoutableAuditEvent_Data() {}
func (*RoutableAuditEvent_EncryptedData) isRoutableAuditEvent_Data() {}
var File_audit_v1_routable_event_proto protoreflect.FileDescriptor
var file_audit_v1_routable_event_proto_rawDesc = []byte{
0x0a, 0x1d, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x61,
0x62, 0x6c, 0x65, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
0x08, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x1a, 0x1b, 0x62, 0x75, 0x66, 0x2f, 0x76,
0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x76, 0x0a, 0x10, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74,
0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x2b, 0x0a, 0x0a, 0x69, 0x64,
0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0b,
0xba, 0x48, 0x08, 0xc8, 0x01, 0x01, 0x72, 0x03, 0xb0, 0x01, 0x01, 0x52, 0x0a, 0x69, 0x64, 0x65,
0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x35, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31,
0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x42, 0x0b, 0xba, 0x48, 0x08,
0xc8, 0x01, 0x01, 0x82, 0x01, 0x02, 0x10, 0x01, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0xc5,
0x01, 0x0a, 0x0d, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x44, 0x61, 0x74, 0x61,
0x12, 0x1e, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x0a,
0xba, 0x48, 0x07, 0xc8, 0x01, 0x01, 0x7a, 0x02, 0x10, 0x01, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61,
0x12, 0x2f, 0x0a, 0x0d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x5f, 0x74, 0x79, 0x70,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xba, 0x48, 0x07, 0xc8, 0x01, 0x01, 0x72,
0x02, 0x10, 0x01, 0x52, 0x0c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x54, 0x79, 0x70,
0x65, 0x12, 0x39, 0x0a, 0x12, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x5f, 0x70,
0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0a, 0xba,
0x48, 0x07, 0xc8, 0x01, 0x01, 0x72, 0x02, 0x10, 0x01, 0x52, 0x11, 0x65, 0x6e, 0x63, 0x72, 0x79,
0x70, 0x74, 0x65, 0x64, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x28, 0x0a, 0x0b,
0x6b, 0x65, 0x79, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28,
0x05, 0x42, 0x07, 0xba, 0x48, 0x04, 0x1a, 0x02, 0x28, 0x01, 0x52, 0x0a, 0x6b, 0x65, 0x79, 0x56,
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x62, 0x0a, 0x0f, 0x55, 0x6e, 0x65, 0x6e, 0x63, 0x72,
0x79, 0x70, 0x74, 0x65, 0x64, 0x44, 0x61, 0x74, 0x61, 0x12, 0x1e, 0x0a, 0x04, 0x64, 0x61, 0x74,
0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x0a, 0xba, 0x48, 0x07, 0xc8, 0x01, 0x01, 0x7a,
0x02, 0x10, 0x01, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2f, 0x0a, 0x0d, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x75, 0x66, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x42, 0x0a, 0xba, 0x48, 0x07, 0xc8, 0x01, 0x01, 0x72, 0x02, 0x10, 0x01, 0x52, 0x0c, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x54, 0x79, 0x70, 0x65, 0x22, 0xcb, 0x03, 0x0a, 0x12, 0x52,
0x6f, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x75, 0x64, 0x69, 0x74, 0x45, 0x76, 0x65, 0x6e,
0x74, 0x12, 0x38, 0x0a, 0x0a, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x19, 0xba, 0x48, 0x16, 0xc8, 0x01, 0x01, 0x72, 0x11, 0x32,
0x0f, 0x5e, 0x5b, 0x41, 0x2d, 0x5a, 0x5d, 0x2b, 0x5f, 0x5b, 0x41, 0x2d, 0x5a, 0x5d, 0x2b, 0x24,
0x52, 0x09, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x41, 0x0a, 0x0a, 0x76,
0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32,
0x14, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62,
0x69, 0x6c, 0x69, 0x74, 0x79, 0x42, 0x0b, 0xba, 0x48, 0x08, 0xc8, 0x01, 0x01, 0x82, 0x01, 0x02,
0x10, 0x01, 0x52, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x37,
0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20,
0x01, 0x28, 0x0e, 0x32, 0x14, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x4f,
0x62, 0x6a, 0x65, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x48, 0x00, 0x52, 0x0a, 0x6f, 0x62, 0x6a,
0x65, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x49, 0x0a, 0x11, 0x6f, 0x62, 0x6a, 0x65, 0x63,
0x74, 0x5f, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x62,
0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x48, 0x00,
0x52, 0x10, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69,
0x65, 0x72, 0x12, 0x46, 0x0a, 0x10, 0x75, 0x6e, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65,
0x64, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x61,
0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x6e, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70,
0x74, 0x65, 0x64, 0x44, 0x61, 0x74, 0x61, 0x48, 0x01, 0x52, 0x0f, 0x75, 0x6e, 0x65, 0x6e, 0x63,
0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x44, 0x61, 0x74, 0x61, 0x12, 0x40, 0x0a, 0x0e, 0x65, 0x6e,
0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x06, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x17, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e,
0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x44, 0x61, 0x74, 0x61, 0x48, 0x01, 0x52, 0x0d, 0x65,
0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x44, 0x61, 0x74, 0x61, 0x42, 0x1b, 0x0a, 0x12,
0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x5f, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e,
0x63, 0x65, 0x12, 0x05, 0xba, 0x48, 0x02, 0x08, 0x01, 0x42, 0x0d, 0x0a, 0x04, 0x64, 0x61, 0x74,
0x61, 0x12, 0x05, 0xba, 0x48, 0x02, 0x08, 0x01, 0x2a, 0x57, 0x0a, 0x0a, 0x56, 0x69, 0x73, 0x69,
0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x1a, 0x0a, 0x16, 0x56, 0x49, 0x53, 0x49, 0x42, 0x49,
0x4c, 0x49, 0x54, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44,
0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x56, 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59,
0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x56, 0x49, 0x53,
0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x10,
0x02, 0x2a, 0x41, 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12,
0x1b, 0x0a, 0x17, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4e, 0x41, 0x4d, 0x45, 0x5f, 0x55,
0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12,
0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x4e, 0x41, 0x4d, 0x45, 0x5f, 0x53, 0x59, 0x53, 0x54,
0x45, 0x4d, 0x10, 0x01, 0x2a, 0x78, 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79,
0x70, 0x65, 0x12, 0x1b, 0x0a, 0x17, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x54, 0x59, 0x50,
0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12,
0x1c, 0x0a, 0x18, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4f,
0x52, 0x47, 0x41, 0x4e, 0x49, 0x5a, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x01, 0x12, 0x16, 0x0a,
0x12, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x4f, 0x4c,
0x44, 0x45, 0x52, 0x10, 0x02, 0x12, 0x17, 0x0a, 0x13, 0x4f, 0x42, 0x4a, 0x45, 0x43, 0x54, 0x5f,
0x54, 0x59, 0x50, 0x45, 0x5f, 0x50, 0x52, 0x4f, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x03, 0x42, 0x84,
0x01, 0x0a, 0x1c, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x63, 0x68, 0x77, 0x61, 0x72, 0x7a, 0x2e, 0x73,
0x74, 0x61, 0x63, 0x6b, 0x69, 0x74, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x74, 0x2e, 0x76, 0x31, 0x42,
0x12, 0x52, 0x6f, 0x75, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x50, 0x72,
0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x0f, 0x2e, 0x2f, 0x61, 0x75, 0x64, 0x69, 0x74, 0x3b, 0x61,
0x75, 0x64, 0x69, 0x74, 0x56, 0x31, 0xa2, 0x02, 0x03, 0x41, 0x58, 0x58, 0xaa, 0x02, 0x08, 0x41,
0x75, 0x64, 0x69, 0x74, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x08, 0x41, 0x75, 0x64, 0x69, 0x74, 0x5c,
0x56, 0x31, 0xe2, 0x02, 0x14, 0x41, 0x75, 0x64, 0x69, 0x74, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50,
0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x09, 0x41, 0x75, 0x64, 0x69,
0x74, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_audit_v1_routable_event_proto_rawDescOnce sync.Once
file_audit_v1_routable_event_proto_rawDescData = file_audit_v1_routable_event_proto_rawDesc
)
func file_audit_v1_routable_event_proto_rawDescGZIP() []byte {
file_audit_v1_routable_event_proto_rawDescOnce.Do(func() {
file_audit_v1_routable_event_proto_rawDescData = protoimpl.X.CompressGZIP(file_audit_v1_routable_event_proto_rawDescData)
})
return file_audit_v1_routable_event_proto_rawDescData
}
var file_audit_v1_routable_event_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
var file_audit_v1_routable_event_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_audit_v1_routable_event_proto_goTypes = []interface{}{
(Visibility)(0), // 0: audit.v1.Visibility
(ObjectName)(0), // 1: audit.v1.ObjectName
(ObjectType)(0), // 2: audit.v1.ObjectType
(*ObjectIdentifier)(nil), // 3: audit.v1.ObjectIdentifier
(*EncryptedData)(nil), // 4: audit.v1.EncryptedData
(*UnencryptedData)(nil), // 5: audit.v1.UnencryptedData
(*RoutableAuditEvent)(nil), // 6: audit.v1.RoutableAuditEvent
}
var file_audit_v1_routable_event_proto_depIdxs = []int32{
2, // 0: audit.v1.ObjectIdentifier.type:type_name -> audit.v1.ObjectType
0, // 1: audit.v1.RoutableAuditEvent.visibility:type_name -> audit.v1.Visibility
1, // 2: audit.v1.RoutableAuditEvent.object_name:type_name -> audit.v1.ObjectName
3, // 3: audit.v1.RoutableAuditEvent.object_identifier:type_name -> audit.v1.ObjectIdentifier
5, // 4: audit.v1.RoutableAuditEvent.unencrypted_data:type_name -> audit.v1.UnencryptedData
4, // 5: audit.v1.RoutableAuditEvent.encrypted_data:type_name -> audit.v1.EncryptedData
6, // [6:6] is the sub-list for method output_type
6, // [6:6] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name
6, // [6:6] is the sub-list for extension extendee
0, // [0:6] is the sub-list for field type_name
}
func init() { file_audit_v1_routable_event_proto_init() }
func file_audit_v1_routable_event_proto_init() {
if File_audit_v1_routable_event_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_audit_v1_routable_event_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ObjectIdentifier); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_audit_v1_routable_event_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*EncryptedData); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_audit_v1_routable_event_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UnencryptedData); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_audit_v1_routable_event_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RoutableAuditEvent); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_audit_v1_routable_event_proto_msgTypes[3].OneofWrappers = []interface{}{
(*RoutableAuditEvent_ObjectName)(nil),
(*RoutableAuditEvent_ObjectIdentifier)(nil),
(*RoutableAuditEvent_UnencryptedData)(nil),
(*RoutableAuditEvent_EncryptedData)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_audit_v1_routable_event_proto_rawDesc,
NumEnums: 3,
NumMessages: 4,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_audit_v1_routable_event_proto_goTypes,
DependencyIndexes: file_audit_v1_routable_event_proto_depIdxs,
EnumInfos: file_audit_v1_routable_event_proto_enumTypes,
MessageInfos: file_audit_v1_routable_event_proto_msgTypes,
}.Build()
File_audit_v1_routable_event_proto = out.File
file_audit_v1_routable_event_proto_rawDesc = nil
file_audit_v1_routable_event_proto_goTypes = nil
file_audit_v1_routable_event_proto_depIdxs = nil
}

View file

@ -0,0 +1,602 @@
// 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 {
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 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 {
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 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 {
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 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 EventName
// no validation rules for Visibility
switch v := m.ResourceReference.(type) {
case *RoutableAuditEvent_ObjectName:
if v == nil {
err := RoutableAuditEventValidationError{
field: "ResourceReference",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
// no validation rules for ObjectName
case *RoutableAuditEvent_ObjectIdentifier:
if v == nil {
err := RoutableAuditEventValidationError{
field: "ResourceReference",
reason: "oneof value cannot be a typed-nil",
}
if !all {
return err
}
errors = append(errors, err)
}
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,
}
}
}
default:
_ = v // ensures v is used
}
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 {
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 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{}

View file

@ -0,0 +1,397 @@
// Copyright 2023 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.34.1
// protoc (unknown)
// source: buf/validate/expression.proto
package validate
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// `Constraint` represents a validation rule written in the Common Expression
// Language (CEL) syntax. Each Constraint includes a unique identifier, an
// optional error message, and the CEL expression to evaluate. For more
// information on CEL, [see our documentation](https://github.com/bufbuild/protovalidate/blob/main/docs/cel.md).
//
// ```proto
//
// message Foo {
// option (buf.validate.message).cel = {
// id: "foo.bar"
// message: "bar must be greater than 0"
// expression: "this.bar > 0"
// };
// int32 bar = 1;
// }
//
// ```
type Constraint struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// `id` is a string that serves as a machine-readable name for this Constraint.
// It should be unique within its scope, which could be either a message or a field.
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
// `message` is an optional field that provides a human-readable error message
// for this Constraint when the CEL expression evaluates to false. If a
// non-empty message is provided, any strings resulting from the CEL
// expression evaluation are ignored.
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
// `expression` is the actual CEL expression that will be evaluated for
// validation. This string must resolve to either a boolean or a string
// value. If the expression evaluates to false or a non-empty string, the
// validation is considered failed, and the message is rejected.
Expression string `protobuf:"bytes,3,opt,name=expression,proto3" json:"expression,omitempty"`
}
func (x *Constraint) Reset() {
*x = Constraint{}
if protoimpl.UnsafeEnabled {
mi := &file_buf_validate_expression_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Constraint) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Constraint) ProtoMessage() {}
func (x *Constraint) ProtoReflect() protoreflect.Message {
mi := &file_buf_validate_expression_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Constraint.ProtoReflect.Descriptor instead.
func (*Constraint) Descriptor() ([]byte, []int) {
return file_buf_validate_expression_proto_rawDescGZIP(), []int{0}
}
func (x *Constraint) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *Constraint) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
func (x *Constraint) GetExpression() string {
if x != nil {
return x.Expression
}
return ""
}
// `Violations` is a collection of `Violation` messages. This message type is returned by
// protovalidate when a proto message fails to meet the requirements set by the `Constraint` validation rules.
// Each individual violation is represented by a `Violation` message.
type Violations struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// `violations` is a repeated field that contains all the `Violation` messages corresponding to the violations detected.
Violations []*Violation `protobuf:"bytes,1,rep,name=violations,proto3" json:"violations,omitempty"`
}
func (x *Violations) Reset() {
*x = Violations{}
if protoimpl.UnsafeEnabled {
mi := &file_buf_validate_expression_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Violations) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Violations) ProtoMessage() {}
func (x *Violations) ProtoReflect() protoreflect.Message {
mi := &file_buf_validate_expression_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Violations.ProtoReflect.Descriptor instead.
func (*Violations) Descriptor() ([]byte, []int) {
return file_buf_validate_expression_proto_rawDescGZIP(), []int{1}
}
func (x *Violations) GetViolations() []*Violation {
if x != nil {
return x.Violations
}
return nil
}
// `Violation` represents a single instance where a validation rule, expressed
// as a `Constraint`, was not met. It provides information about the field that
// caused the violation, the specific constraint that wasn't fulfilled, and a
// human-readable error message.
//
// ```json
//
// {
// "fieldPath": "bar",
// "constraintId": "foo.bar",
// "message": "bar must be greater than 0"
// }
//
// ```
type Violation struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// `field_path` is a machine-readable identifier that points to the specific field that failed the validation.
// This could be a nested field, in which case the path will include all the parent fields leading to the actual field that caused the violation.
FieldPath string `protobuf:"bytes,1,opt,name=field_path,json=fieldPath,proto3" json:"field_path,omitempty"`
// `constraint_id` is the unique identifier of the `Constraint` that was not fulfilled.
// This is the same `id` that was specified in the `Constraint` message, allowing easy tracing of which rule was violated.
ConstraintId string `protobuf:"bytes,2,opt,name=constraint_id,json=constraintId,proto3" json:"constraint_id,omitempty"`
// `message` is a human-readable error message that describes the nature of the violation.
// This can be the default error message from the violated `Constraint`, or it can be a custom message that gives more context about the violation.
Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
// `for_key` indicates whether the violation was caused by a map key, rather than a value.
ForKey bool `protobuf:"varint,4,opt,name=for_key,json=forKey,proto3" json:"for_key,omitempty"`
}
func (x *Violation) Reset() {
*x = Violation{}
if protoimpl.UnsafeEnabled {
mi := &file_buf_validate_expression_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Violation) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Violation) ProtoMessage() {}
func (x *Violation) ProtoReflect() protoreflect.Message {
mi := &file_buf_validate_expression_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Violation.ProtoReflect.Descriptor instead.
func (*Violation) Descriptor() ([]byte, []int) {
return file_buf_validate_expression_proto_rawDescGZIP(), []int{2}
}
func (x *Violation) GetFieldPath() string {
if x != nil {
return x.FieldPath
}
return ""
}
func (x *Violation) GetConstraintId() string {
if x != nil {
return x.ConstraintId
}
return ""
}
func (x *Violation) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
func (x *Violation) GetForKey() bool {
if x != nil {
return x.ForKey
}
return false
}
var File_buf_validate_expression_proto protoreflect.FileDescriptor
var file_buf_validate_expression_proto_rawDesc = []byte{
0x0a, 0x1d, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x65,
0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
0x0c, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x22, 0x56, 0x0a,
0x0a, 0x43, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6d,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65,
0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73,
0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65,
0x73, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x45, 0x0a, 0x0a, 0x56, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x12, 0x37, 0x0a, 0x0a, 0x76, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61,
0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x56, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x52, 0x0a, 0x76, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x82, 0x01, 0x0a,
0x09, 0x56, 0x69, 0x6f, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x69,
0x65, 0x6c, 0x64, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
0x66, 0x69, 0x65, 0x6c, 0x64, 0x50, 0x61, 0x74, 0x68, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x6f, 0x6e,
0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x18,
0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x6f, 0x72, 0x5f,
0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x66, 0x6f, 0x72, 0x4b, 0x65,
0x79, 0x42, 0xbf, 0x01, 0x0a, 0x12, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2e, 0x62, 0x75, 0x66, 0x2e,
0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x42, 0x0f, 0x45, 0x78, 0x70, 0x72, 0x65, 0x73,
0x73, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x47, 0x62, 0x75, 0x66,
0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x62, 0x75,
0x66, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x76, 0x61, 0x6c, 0x69,
0x64, 0x61, 0x74, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x62, 0x75, 0x66,
0x66, 0x65, 0x72, 0x73, 0x2f, 0x67, 0x6f, 0x2f, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69,
0x64, 0x61, 0x74, 0x65, 0xa2, 0x02, 0x03, 0x42, 0x56, 0x58, 0xaa, 0x02, 0x0c, 0x42, 0x75, 0x66,
0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0xca, 0x02, 0x0c, 0x42, 0x75, 0x66, 0x5c,
0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0xe2, 0x02, 0x18, 0x42, 0x75, 0x66, 0x5c, 0x56,
0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64,
0x61, 0x74, 0x61, 0xea, 0x02, 0x0d, 0x42, 0x75, 0x66, 0x3a, 0x3a, 0x56, 0x61, 0x6c, 0x69, 0x64,
0x61, 0x74, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_buf_validate_expression_proto_rawDescOnce sync.Once
file_buf_validate_expression_proto_rawDescData = file_buf_validate_expression_proto_rawDesc
)
func file_buf_validate_expression_proto_rawDescGZIP() []byte {
file_buf_validate_expression_proto_rawDescOnce.Do(func() {
file_buf_validate_expression_proto_rawDescData = protoimpl.X.CompressGZIP(file_buf_validate_expression_proto_rawDescData)
})
return file_buf_validate_expression_proto_rawDescData
}
var file_buf_validate_expression_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_buf_validate_expression_proto_goTypes = []interface{}{
(*Constraint)(nil), // 0: buf.validate.Constraint
(*Violations)(nil), // 1: buf.validate.Violations
(*Violation)(nil), // 2: buf.validate.Violation
}
var file_buf_validate_expression_proto_depIdxs = []int32{
2, // 0: buf.validate.Violations.violations:type_name -> buf.validate.Violation
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_buf_validate_expression_proto_init() }
func file_buf_validate_expression_proto_init() {
if File_buf_validate_expression_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_buf_validate_expression_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Constraint); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_buf_validate_expression_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Violations); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_buf_validate_expression_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Violation); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_buf_validate_expression_proto_rawDesc,
NumEnums: 0,
NumMessages: 3,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_buf_validate_expression_proto_goTypes,
DependencyIndexes: file_buf_validate_expression_proto_depIdxs,
MessageInfos: file_buf_validate_expression_proto_msgTypes,
}.Build()
File_buf_validate_expression_proto = out.File
file_buf_validate_expression_proto_rawDesc = nil
file_buf_validate_expression_proto_goTypes = nil
file_buf_validate_expression_proto_depIdxs = nil
}

View file

@ -0,0 +1,381 @@
// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: buf/validate/expression.proto
package validate
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 Constraint 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 *Constraint) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on Constraint 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 ConstraintMultiError, or
// nil if none found.
func (m *Constraint) ValidateAll() error {
return m.validate(true)
}
func (m *Constraint) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for Id
// no validation rules for Message
// no validation rules for Expression
if len(errors) > 0 {
return ConstraintMultiError(errors)
}
return nil
}
// ConstraintMultiError is an error wrapping multiple validation errors
// returned by Constraint.ValidateAll() if the designated constraints aren't met.
type ConstraintMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ConstraintMultiError) 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 ConstraintMultiError) AllErrors() []error { return m }
// ConstraintValidationError is the validation error returned by
// Constraint.Validate if the designated constraints aren't met.
type ConstraintValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ConstraintValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ConstraintValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ConstraintValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ConstraintValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ConstraintValidationError) ErrorName() string { return "ConstraintValidationError" }
// Error satisfies the builtin error interface
func (e ConstraintValidationError) 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 %sConstraint.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ConstraintValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ConstraintValidationError{}
// Validate checks the field values on Violations 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 *Violations) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on Violations 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 ViolationsMultiError, or
// nil if none found.
func (m *Violations) ValidateAll() error {
return m.validate(true)
}
func (m *Violations) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
for idx, item := range m.GetViolations() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, ViolationsValidationError{
field: fmt.Sprintf("Violations[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, ViolationsValidationError{
field: fmt.Sprintf("Violations[%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 ViolationsValidationError{
field: fmt.Sprintf("Violations[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(errors) > 0 {
return ViolationsMultiError(errors)
}
return nil
}
// ViolationsMultiError is an error wrapping multiple validation errors
// returned by Violations.ValidateAll() if the designated constraints aren't met.
type ViolationsMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ViolationsMultiError) 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 ViolationsMultiError) AllErrors() []error { return m }
// ViolationsValidationError is the validation error returned by
// Violations.Validate if the designated constraints aren't met.
type ViolationsValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ViolationsValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ViolationsValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ViolationsValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ViolationsValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ViolationsValidationError) ErrorName() string { return "ViolationsValidationError" }
// Error satisfies the builtin error interface
func (e ViolationsValidationError) 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 %sViolations.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ViolationsValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ViolationsValidationError{}
// Validate checks the field values on Violation 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 *Violation) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on Violation 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 ViolationMultiError, or nil
// if none found.
func (m *Violation) ValidateAll() error {
return m.validate(true)
}
func (m *Violation) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for FieldPath
// no validation rules for ConstraintId
// no validation rules for Message
// no validation rules for ForKey
if len(errors) > 0 {
return ViolationMultiError(errors)
}
return nil
}
// ViolationMultiError is an error wrapping multiple validation errors returned
// by Violation.ValidateAll() if the designated constraints aren't met.
type ViolationMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ViolationMultiError) 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 ViolationMultiError) AllErrors() []error { return m }
// ViolationValidationError is the validation error returned by
// Violation.Validate if the designated constraints aren't met.
type ViolationValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ViolationValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ViolationValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ViolationValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ViolationValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ViolationValidationError) ErrorName() string { return "ViolationValidationError" }
// Error satisfies the builtin error interface
func (e ViolationValidationError) 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 %sViolation.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ViolationValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ViolationValidationError{}

View file

@ -0,0 +1,289 @@
// Copyright 2023 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.34.1
// protoc (unknown)
// source: buf/validate/priv/private.proto
package priv
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
descriptorpb "google.golang.org/protobuf/types/descriptorpb"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// Do not use. Internal to protovalidate library
type FieldConstraints struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Cel []*Constraint `protobuf:"bytes,1,rep,name=cel,proto3" json:"cel,omitempty"`
}
func (x *FieldConstraints) Reset() {
*x = FieldConstraints{}
if protoimpl.UnsafeEnabled {
mi := &file_buf_validate_priv_private_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *FieldConstraints) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FieldConstraints) ProtoMessage() {}
func (x *FieldConstraints) ProtoReflect() protoreflect.Message {
mi := &file_buf_validate_priv_private_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use FieldConstraints.ProtoReflect.Descriptor instead.
func (*FieldConstraints) Descriptor() ([]byte, []int) {
return file_buf_validate_priv_private_proto_rawDescGZIP(), []int{0}
}
func (x *FieldConstraints) GetCel() []*Constraint {
if x != nil {
return x.Cel
}
return nil
}
// Do not use. Internal to protovalidate library
type Constraint struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
Expression string `protobuf:"bytes,3,opt,name=expression,proto3" json:"expression,omitempty"`
}
func (x *Constraint) Reset() {
*x = Constraint{}
if protoimpl.UnsafeEnabled {
mi := &file_buf_validate_priv_private_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Constraint) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Constraint) ProtoMessage() {}
func (x *Constraint) ProtoReflect() protoreflect.Message {
mi := &file_buf_validate_priv_private_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Constraint.ProtoReflect.Descriptor instead.
func (*Constraint) Descriptor() ([]byte, []int) {
return file_buf_validate_priv_private_proto_rawDescGZIP(), []int{1}
}
func (x *Constraint) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *Constraint) GetMessage() string {
if x != nil {
return x.Message
}
return ""
}
func (x *Constraint) GetExpression() string {
if x != nil {
return x.Expression
}
return ""
}
var file_buf_validate_priv_private_proto_extTypes = []protoimpl.ExtensionInfo{
{
ExtendedType: (*descriptorpb.FieldOptions)(nil),
ExtensionType: (*FieldConstraints)(nil),
Field: 1160,
Name: "buf.validate.priv.field",
Tag: "bytes,1160,opt,name=field",
Filename: "buf/validate/priv/private.proto",
},
}
// Extension fields to descriptorpb.FieldOptions.
var (
// Do not use. Internal to protovalidate library
//
// optional buf.validate.priv.FieldConstraints field = 1160;
E_Field = &file_buf_validate_priv_private_proto_extTypes[0]
)
var File_buf_validate_priv_private_proto protoreflect.FileDescriptor
var file_buf_validate_priv_private_proto_rawDesc = []byte{
0x0a, 0x1f, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x70,
0x72, 0x69, 0x76, 0x2f, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x12, 0x11, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e,
0x70, 0x72, 0x69, 0x76, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x43, 0x0a, 0x10, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x43,
0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x12, 0x2f, 0x0a, 0x03, 0x63, 0x65,
0x6c, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61,
0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x76, 0x2e, 0x43, 0x6f, 0x6e, 0x73,
0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x52, 0x03, 0x63, 0x65, 0x6c, 0x22, 0x56, 0x0a, 0x0a, 0x43,
0x6f, 0x6e, 0x73, 0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73,
0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73,
0x61, 0x67, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f,
0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x72, 0x65, 0x73, 0x73,
0x69, 0x6f, 0x6e, 0x3a, 0x5c, 0x0a, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x12, 0x1d, 0x2e, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46,
0x69, 0x65, 0x6c, 0x64, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x88, 0x09, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x23, 0x2e, 0x62, 0x75, 0x66, 0x2e, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74,
0x65, 0x2e, 0x70, 0x72, 0x69, 0x76, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x43, 0x6f, 0x6e, 0x73,
0x74, 0x72, 0x61, 0x69, 0x6e, 0x74, 0x73, 0x52, 0x05, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x88, 0x01,
0x01, 0x42, 0xdb, 0x01, 0x0a, 0x17, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2e, 0x62, 0x75, 0x66, 0x2e,
0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x69, 0x76, 0x42, 0x0c, 0x50,
0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x4c, 0x62,
0x75, 0x66, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f,
0x62, 0x75, 0x66, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x76, 0x61,
0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x62,
0x75, 0x66, 0x66, 0x65, 0x72, 0x73, 0x2f, 0x67, 0x6f, 0x2f, 0x62, 0x75, 0x66, 0x2f, 0x76, 0x61,
0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x70, 0x72, 0x69, 0x76, 0xa2, 0x02, 0x03, 0x42, 0x56,
0x50, 0xaa, 0x02, 0x11, 0x42, 0x75, 0x66, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65,
0x2e, 0x50, 0x72, 0x69, 0x76, 0xca, 0x02, 0x11, 0x42, 0x75, 0x66, 0x5c, 0x56, 0x61, 0x6c, 0x69,
0x64, 0x61, 0x74, 0x65, 0x5c, 0x50, 0x72, 0x69, 0x76, 0xe2, 0x02, 0x1d, 0x42, 0x75, 0x66, 0x5c,
0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5c, 0x50, 0x72, 0x69, 0x76, 0x5c, 0x47, 0x50,
0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x13, 0x42, 0x75, 0x66, 0x3a,
0x3a, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x3a, 0x3a, 0x50, 0x72, 0x69, 0x76, 0x62,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_buf_validate_priv_private_proto_rawDescOnce sync.Once
file_buf_validate_priv_private_proto_rawDescData = file_buf_validate_priv_private_proto_rawDesc
)
func file_buf_validate_priv_private_proto_rawDescGZIP() []byte {
file_buf_validate_priv_private_proto_rawDescOnce.Do(func() {
file_buf_validate_priv_private_proto_rawDescData = protoimpl.X.CompressGZIP(file_buf_validate_priv_private_proto_rawDescData)
})
return file_buf_validate_priv_private_proto_rawDescData
}
var file_buf_validate_priv_private_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_buf_validate_priv_private_proto_goTypes = []interface{}{
(*FieldConstraints)(nil), // 0: buf.validate.priv.FieldConstraints
(*Constraint)(nil), // 1: buf.validate.priv.Constraint
(*descriptorpb.FieldOptions)(nil), // 2: google.protobuf.FieldOptions
}
var file_buf_validate_priv_private_proto_depIdxs = []int32{
1, // 0: buf.validate.priv.FieldConstraints.cel:type_name -> buf.validate.priv.Constraint
2, // 1: buf.validate.priv.field:extendee -> google.protobuf.FieldOptions
0, // 2: buf.validate.priv.field:type_name -> buf.validate.priv.FieldConstraints
3, // [3:3] is the sub-list for method output_type
3, // [3:3] is the sub-list for method input_type
2, // [2:3] is the sub-list for extension type_name
1, // [1:2] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_buf_validate_priv_private_proto_init() }
func file_buf_validate_priv_private_proto_init() {
if File_buf_validate_priv_private_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_buf_validate_priv_private_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*FieldConstraints); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_buf_validate_priv_private_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Constraint); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_buf_validate_priv_private_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 1,
NumServices: 0,
},
GoTypes: file_buf_validate_priv_private_proto_goTypes,
DependencyIndexes: file_buf_validate_priv_private_proto_depIdxs,
MessageInfos: file_buf_validate_priv_private_proto_msgTypes,
ExtensionInfos: file_buf_validate_priv_private_proto_extTypes,
}.Build()
File_buf_validate_priv_private_proto = out.File
file_buf_validate_priv_private_proto_rawDesc = nil
file_buf_validate_priv_private_proto_goTypes = nil
file_buf_validate_priv_private_proto_depIdxs = nil
}

View file

@ -0,0 +1,275 @@
// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: buf/validate/priv/private.proto
package priv
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 FieldConstraints 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 *FieldConstraints) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on FieldConstraints 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
// FieldConstraintsMultiError, or nil if none found.
func (m *FieldConstraints) ValidateAll() error {
return m.validate(true)
}
func (m *FieldConstraints) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
for idx, item := range m.GetCel() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, FieldConstraintsValidationError{
field: fmt.Sprintf("Cel[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, FieldConstraintsValidationError{
field: fmt.Sprintf("Cel[%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 FieldConstraintsValidationError{
field: fmt.Sprintf("Cel[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(errors) > 0 {
return FieldConstraintsMultiError(errors)
}
return nil
}
// FieldConstraintsMultiError is an error wrapping multiple validation errors
// returned by FieldConstraints.ValidateAll() if the designated constraints
// aren't met.
type FieldConstraintsMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m FieldConstraintsMultiError) 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 FieldConstraintsMultiError) AllErrors() []error { return m }
// FieldConstraintsValidationError is the validation error returned by
// FieldConstraints.Validate if the designated constraints aren't met.
type FieldConstraintsValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e FieldConstraintsValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e FieldConstraintsValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e FieldConstraintsValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e FieldConstraintsValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e FieldConstraintsValidationError) ErrorName() string { return "FieldConstraintsValidationError" }
// Error satisfies the builtin error interface
func (e FieldConstraintsValidationError) 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 %sFieldConstraints.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = FieldConstraintsValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = FieldConstraintsValidationError{}
// Validate checks the field values on Constraint 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 *Constraint) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on Constraint 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 ConstraintMultiError, or
// nil if none found.
func (m *Constraint) ValidateAll() error {
return m.validate(true)
}
func (m *Constraint) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for Id
// no validation rules for Message
// no validation rules for Expression
if len(errors) > 0 {
return ConstraintMultiError(errors)
}
return nil
}
// ConstraintMultiError is an error wrapping multiple validation errors
// returned by Constraint.ValidateAll() if the designated constraints aren't met.
type ConstraintMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ConstraintMultiError) 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 ConstraintMultiError) AllErrors() []error { return m }
// ConstraintValidationError is the validation error returned by
// Constraint.Validate if the designated constraints aren't met.
type ConstraintValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ConstraintValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ConstraintValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ConstraintValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ConstraintValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ConstraintValidationError) ErrorName() string { return "ConstraintValidationError" }
// Error satisfies the builtin error interface
func (e ConstraintValidationError) 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 %sConstraint.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ConstraintValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ConstraintValidationError{}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff