auditv1

package
v1.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 2, 2024 License: Apache-2.0 Imports: 20 Imported by: 4

Documentation

Overview

Package auditv1 sends events to the Audit API.

Index

Constants

This section is empty.

Variables

View Source
var Target_Kind_name = map[int32]string{
	0: "INPUT",
	1: "OUTPUT",
}
View Source
var Target_Kind_value = map[string]int32{
	"INPUT":  0,
	"OUTPUT": 1,
}

Functions

func Init added in v0.0.9

func Init(dsn string)

Init configures the DefaultClient for the provided dsn. Errors will be logged..

func RegisterAuditAPIServer

func RegisterAuditAPIServer(s *grpc.Server, srv AuditAPIServer)

func SetupClient added in v0.0.9

func SetupClient(l *zap.Logger, t *Target) (err error)

SetupClient configures the DefaultClient for t.

func Write added in v0.0.9

func Write(event *Event)

Write event asynchronously to DefaultClient. Errors are logged including event.

func WriteEvents added in v0.0.9

func WriteEvents(ctx context.Context, events []*Event) (err error)

WriteEvents to DefaultClient. Failures contained in err will contain event.

Types

type AuditAPIClient

type AuditAPIClient interface {
	// Write a new Event to a Target.
	Write(ctx context.Context, in *WriteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// WriteEvent a new Event into Indent.
	//
	// Deprecated: Use Write.
	WriteEvent(ctx context.Context, in *WriteEventRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// WriteBatch writes multiple Events into Indent.
	//
	// Deprecated: Use Write.
	WriteBatch(ctx context.Context, in *WriteBatchRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}

AuditAPIClient is the client API for AuditAPI service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewAuditAPIClient

func NewAuditAPIClient(cc grpc.ClientConnInterface) AuditAPIClient

type AuditAPIServer

type AuditAPIServer interface {
	// Write a new Event to a Target.
	Write(context.Context, *WriteRequest) (*emptypb.Empty, error)
	// WriteEvent a new Event into Indent.
	//
	// Deprecated: Use Write.
	WriteEvent(context.Context, *WriteEventRequest) (*emptypb.Empty, error)
	// WriteBatch writes multiple Events into Indent.
	//
	// Deprecated: Use Write.
	WriteBatch(context.Context, *WriteBatchRequest) (*emptypb.Empty, error)
}

AuditAPIServer is the server API for AuditAPI service.

type Client added in v0.0.9

type Client struct {
	// Target to send Events to.
	Target *Target

	// Audit communicates with the AuditAPI.
	Audit AuditAPIClient

	// Log prints informational messages.
	Log *zap.Logger

	// DebugEvents are events written with WriteDebug for validation in testing.
	DebugEvents []*Event

	// Debug determines if all Write method calls are marked for debugging. Disables sending to Audit API.
	Debug bool
}

Client sends events to the Audit API.

var (
	// DefaultClient for sending Events.
	DefaultClient *Client
)

func NewClient added in v0.0.9

func NewClient(logger *zap.Logger, target *Target) (*Client, error)

NewClient returns a client that sends to input.

func NewClientFromDSN added in v0.0.9

func NewClientFromDSN(logger *zap.Logger, dsn string) (*Client, error)

NewClientFromDSN returns a client that sends to input by DSN.

func (*Client) Write added in v0.0.9

func (c *Client) Write(event *Event)

Write event asynchronously to Audit API. Errors are logged including event.

func (*Client) WriteEvents added in v0.0.9

func (c *Client) WriteEvents(ctx context.Context, events []*Event) (err error)

WriteEvents to Audit API. Failures contained in err will contain event.

type Error added in v0.0.9

type Error struct {
	// Message relating to failure.
	Message string

	// Events that failed to be written.
	Events []*Event
}

Error encountered when writing an Event. Contains original Event for posterity.

func (*Error) Error added in v0.0.9

func (e *Error) Error() string

Error returns the reason for the failure as well as the original Event.

type Event

type Event struct {
	Event                string                 `protobuf:"bytes,1,opt,name=event,proto3" json:"event,omitempty"`
	Meta                 *Meta                  `protobuf:"bytes,2,opt,name=meta,proto3" json:"meta,omitempty"`
	Reason               string                 `protobuf:"bytes,3,opt,name=reason,proto3" json:"reason,omitempty"`
	Timestamp            *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	Id                   string                 `protobuf:"bytes,9,opt,name=id,proto3" json:"id,omitempty"`
	ExternalId           string                 `protobuf:"bytes,13,opt,name=external_id,json=externalId,proto3" json:"external_id,omitempty"`
	SessionId            string                 `protobuf:"bytes,20,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
	Actor                *Resource              `protobuf:"bytes,27,opt,name=actor,proto3" json:"actor,omitempty"`
	Resources            []*Resource            `protobuf:"bytes,30,rep,name=resources,proto3" json:"resources,omitempty"`
	XOriginal            []byte                 `protobuf:"bytes,35,opt,name=_original,json=Original,proto3" json:"_original,omitempty"`
	XXX_NoUnkeyedLiteral struct{}               `json:"-"`
	XXX_unrecognized     []byte                 `json:"-"`
	XXX_sizecache        int32                  `json:"-"`
}

Event contains information captured at a specific moment of time, typically relating to an authorization decision or instance of access.

func (*Event) Descriptor

func (*Event) Descriptor() ([]byte, []int)

func (*Event) GetActor

func (m *Event) GetActor() *Resource

func (*Event) GetEvent

func (m *Event) GetEvent() string

func (*Event) GetExternalId

func (m *Event) GetExternalId() string

func (*Event) GetId

func (m *Event) GetId() string

func (*Event) GetMeta added in v0.0.9

func (m *Event) GetMeta() *Meta

func (*Event) GetReason added in v0.0.9

func (m *Event) GetReason() string

func (*Event) GetResources

func (m *Event) GetResources() []*Resource

func (*Event) GetSessionId

func (m *Event) GetSessionId() string

func (*Event) GetTimestamp

func (m *Event) GetTimestamp() *timestamppb.Timestamp

func (*Event) GetXOriginal

func (m *Event) GetXOriginal() []byte

func (*Event) MarshalLogObject added in v0.0.9

func (m *Event) MarshalLogObject(oe zapcore.ObjectEncoder) error

func (*Event) ProtoMessage

func (*Event) ProtoMessage()

func (*Event) Reset

func (m *Event) Reset()

func (*Event) String

func (m *Event) String() string

func (*Event) XXX_DiscardUnknown

func (m *Event) XXX_DiscardUnknown()

func (*Event) XXX_Marshal

func (m *Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Event) XXX_Merge

func (m *Event) XXX_Merge(src proto.Message)

func (*Event) XXX_Size

func (m *Event) XXX_Size() int

func (*Event) XXX_Unmarshal

func (m *Event) XXX_Unmarshal(b []byte) error

type Meta added in v0.0.9

type Meta struct {
	Name                 string                 `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Space                string                 `protobuf:"bytes,2,opt,name=space,proto3" json:"space,omitempty"`
	DisplayName          string                 `protobuf:"bytes,5,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
	Labels               map[string]string      `` /* 154-byte string literal not displayed */
	CreateTime           *timestamppb.Timestamp `protobuf:"bytes,30,opt,name=create_time,json=createTime,proto3" json:"create_time,omitempty"`
	UpdateTime           *timestamppb.Timestamp `protobuf:"bytes,31,opt,name=update_time,json=updateTime,proto3" json:"update_time,omitempty"`
	DeleteTime           *timestamppb.Timestamp `protobuf:"bytes,32,opt,name=delete_time,json=deleteTime,proto3" json:"delete_time,omitempty"`
	ExpireTime           *timestamppb.Timestamp `protobuf:"bytes,35,opt,name=expire_time,json=expireTime,proto3" json:"expire_time,omitempty"`
	StartTime            *timestamppb.Timestamp `protobuf:"bytes,40,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"`
	EndTime              *timestamppb.Timestamp `protobuf:"bytes,45,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"`
	XXX_NoUnkeyedLiteral struct{}               `json:"-"`
	XXX_unrecognized     []byte                 `json:"-"`
	XXX_sizecache        int32                  `json:"-"`
}

Meta contains metadata about an Event.

func (*Meta) Descriptor added in v0.0.9

func (*Meta) Descriptor() ([]byte, []int)

func (*Meta) GetCreateTime added in v0.0.9

func (m *Meta) GetCreateTime() *timestamppb.Timestamp

func (*Meta) GetDeleteTime added in v0.0.9

func (m *Meta) GetDeleteTime() *timestamppb.Timestamp

func (*Meta) GetDisplayName added in v0.0.9

func (m *Meta) GetDisplayName() string

func (*Meta) GetEndTime added in v0.0.9

func (m *Meta) GetEndTime() *timestamppb.Timestamp

func (*Meta) GetExpireTime added in v0.0.9

func (m *Meta) GetExpireTime() *timestamppb.Timestamp

func (*Meta) GetLabels added in v0.0.9

func (m *Meta) GetLabels() map[string]string

func (*Meta) GetName added in v0.0.9

func (m *Meta) GetName() string

func (*Meta) GetSpace added in v1.0.4

func (m *Meta) GetSpace() string

func (*Meta) GetStartTime added in v0.0.9

func (m *Meta) GetStartTime() *timestamppb.Timestamp

func (*Meta) GetUpdateTime added in v0.0.9

func (m *Meta) GetUpdateTime() *timestamppb.Timestamp

func (*Meta) ProtoMessage added in v0.0.9

func (*Meta) ProtoMessage()

func (*Meta) Reset added in v0.0.9

func (m *Meta) Reset()

func (*Meta) String added in v0.0.9

func (m *Meta) String() string

func (*Meta) XXX_DiscardUnknown added in v0.0.9

func (m *Meta) XXX_DiscardUnknown()

func (*Meta) XXX_Marshal added in v0.0.9

func (m *Meta) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Meta) XXX_Merge added in v0.0.9

func (m *Meta) XXX_Merge(src proto.Message)

func (*Meta) XXX_Size added in v0.0.9

func (m *Meta) XXX_Size() int

func (*Meta) XXX_Unmarshal added in v0.0.9

func (m *Meta) XXX_Unmarshal(b []byte) error

type Resource

type Resource struct {
	Id          string   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	DisplayName string   `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
	AltIds      []string `protobuf:"bytes,3,rep,name=alt_ids,json=altIds,proto3" json:"alt_ids,omitempty"`
	Kind        string   `protobuf:"bytes,4,opt,name=kind,proto3" json:"kind,omitempty"`
	Email       string   `protobuf:"bytes,5,opt,name=email,proto3" json:"email,omitempty"`
	// Arbitrary string-addressable labels
	Labels               map[string]string `` /* 154-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

Resource related to the Event.

func (*Resource) Descriptor

func (*Resource) Descriptor() ([]byte, []int)

func (*Resource) GetAltIds

func (m *Resource) GetAltIds() []string

func (*Resource) GetDisplayName

func (m *Resource) GetDisplayName() string

func (*Resource) GetEmail added in v0.0.9

func (m *Resource) GetEmail() string

func (*Resource) GetId

func (m *Resource) GetId() string

func (*Resource) GetKind

func (m *Resource) GetKind() string

func (*Resource) GetLabels added in v0.0.9

func (m *Resource) GetLabels() map[string]string

func (*Resource) MarshalLogObject added in v0.0.9

func (m *Resource) MarshalLogObject(oe zapcore.ObjectEncoder) error

func (*Resource) ProtoMessage

func (*Resource) ProtoMessage()

func (*Resource) Reset

func (m *Resource) Reset()

func (*Resource) String

func (m *Resource) String() string

func (*Resource) XXX_DiscardUnknown

func (m *Resource) XXX_DiscardUnknown()

func (*Resource) XXX_Marshal

func (m *Resource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Resource) XXX_Merge

func (m *Resource) XXX_Merge(src proto.Message)

func (*Resource) XXX_Size

func (m *Resource) XXX_Size() int

func (*Resource) XXX_Unmarshal

func (m *Resource) XXX_Unmarshal(b []byte) error

type Target

type Target struct {
	Name                 string      `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Kind                 Target_Kind `protobuf:"varint,2,opt,name=kind,proto3,enum=indent.audit.v1.Target_Kind" json:"kind,omitempty"`
	XXX_NoUnkeyedLiteral struct{}    `json:"-"`
	XXX_unrecognized     []byte      `json:"-"`
	XXX_sizecache        int32       `json:"-"`
}

Target is the intended recipient of the contained Events.

func (*Target) Descriptor

func (*Target) Descriptor() ([]byte, []int)

func (*Target) GetKind

func (m *Target) GetKind() Target_Kind

func (*Target) GetName

func (m *Target) GetName() string

func (*Target) ProtoMessage

func (*Target) ProtoMessage()

func (*Target) Reset

func (m *Target) Reset()

func (*Target) String

func (m *Target) String() string

func (*Target) XXX_DiscardUnknown

func (m *Target) XXX_DiscardUnknown()

func (*Target) XXX_Marshal

func (m *Target) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Target) XXX_Merge

func (m *Target) XXX_Merge(src proto.Message)

func (*Target) XXX_Size

func (m *Target) XXX_Size() int

func (*Target) XXX_Unmarshal

func (m *Target) XXX_Unmarshal(b []byte) error

type Target_Kind

type Target_Kind int32

Kind of Target the Event is being written to.

const (
	Target_INPUT  Target_Kind = 0
	Target_OUTPUT Target_Kind = 1
)

func (Target_Kind) EnumDescriptor

func (Target_Kind) EnumDescriptor() ([]byte, []int)

func (Target_Kind) String

func (x Target_Kind) String() string

type UnimplementedAuditAPIServer added in v0.0.9

type UnimplementedAuditAPIServer struct {
}

UnimplementedAuditAPIServer can be embedded to have forward compatible implementations.

func (*UnimplementedAuditAPIServer) Write added in v0.0.9

func (*UnimplementedAuditAPIServer) WriteBatch added in v0.0.9

func (*UnimplementedAuditAPIServer) WriteEvent added in v0.0.9

type WriteBatchRequest

type WriteBatchRequest struct {
	// Name of space containing provider.
	SpaceName string `protobuf:"bytes,1,opt,name=space_name,json=spaceName,proto3" json:"space_name,omitempty"`
	// Name of provider containing Input.
	ProviderName string `protobuf:"bytes,2,opt,name=provider_name,json=providerName,proto3" json:"provider_name,omitempty"`
	// Name of Input the event is written to.
	InputName string `protobuf:"bytes,3,opt,name=input_name,json=inputName,proto3" json:"input_name,omitempty"`
	// Async returns immediately and doesn't wait for events to be written.
	Async bool `protobuf:"varint,4,opt,name=async,proto3" json:"async,omitempty"`
	// Events being written.
	Events               []*Event `protobuf:"bytes,20,rep,name=events,proto3" json:"events,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*WriteBatchRequest) Descriptor

func (*WriteBatchRequest) Descriptor() ([]byte, []int)

func (*WriteBatchRequest) GetAsync

func (m *WriteBatchRequest) GetAsync() bool

func (*WriteBatchRequest) GetEvents

func (m *WriteBatchRequest) GetEvents() []*Event

func (*WriteBatchRequest) GetInputName

func (m *WriteBatchRequest) GetInputName() string

func (*WriteBatchRequest) GetProviderName

func (m *WriteBatchRequest) GetProviderName() string

func (*WriteBatchRequest) GetSpaceName

func (m *WriteBatchRequest) GetSpaceName() string

func (*WriteBatchRequest) ProtoMessage

func (*WriteBatchRequest) ProtoMessage()

func (*WriteBatchRequest) Reset

func (m *WriteBatchRequest) Reset()

func (*WriteBatchRequest) String

func (m *WriteBatchRequest) String() string

func (*WriteBatchRequest) XXX_DiscardUnknown

func (m *WriteBatchRequest) XXX_DiscardUnknown()

func (*WriteBatchRequest) XXX_Marshal

func (m *WriteBatchRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*WriteBatchRequest) XXX_Merge

func (m *WriteBatchRequest) XXX_Merge(src proto.Message)

func (*WriteBatchRequest) XXX_Size

func (m *WriteBatchRequest) XXX_Size() int

func (*WriteBatchRequest) XXX_Unmarshal

func (m *WriteBatchRequest) XXX_Unmarshal(b []byte) error

type WriteEventRequest

type WriteEventRequest struct {
	// Name of space containing provider.
	SpaceName string `protobuf:"bytes,1,opt,name=space_name,json=spaceName,proto3" json:"space_name,omitempty"`
	// Name of provider containing Input.
	ProviderName string `protobuf:"bytes,2,opt,name=provider_name,json=providerName,proto3" json:"provider_name,omitempty"`
	// Name of Input the event is written to.
	InputName string `protobuf:"bytes,3,opt,name=input_name,json=inputName,proto3" json:"input_name,omitempty"`
	// Event being written.
	Event                *Event   `protobuf:"bytes,4,opt,name=event,proto3" json:"event,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*WriteEventRequest) Descriptor

func (*WriteEventRequest) Descriptor() ([]byte, []int)

func (*WriteEventRequest) GetEvent

func (m *WriteEventRequest) GetEvent() *Event

func (*WriteEventRequest) GetInputName

func (m *WriteEventRequest) GetInputName() string

func (*WriteEventRequest) GetProviderName

func (m *WriteEventRequest) GetProviderName() string

func (*WriteEventRequest) GetSpaceName

func (m *WriteEventRequest) GetSpaceName() string

func (*WriteEventRequest) ProtoMessage

func (*WriteEventRequest) ProtoMessage()

func (*WriteEventRequest) Reset

func (m *WriteEventRequest) Reset()

func (*WriteEventRequest) String

func (m *WriteEventRequest) String() string

func (*WriteEventRequest) XXX_DiscardUnknown

func (m *WriteEventRequest) XXX_DiscardUnknown()

func (*WriteEventRequest) XXX_Marshal

func (m *WriteEventRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*WriteEventRequest) XXX_Merge

func (m *WriteEventRequest) XXX_Merge(src proto.Message)

func (*WriteEventRequest) XXX_Size

func (m *WriteEventRequest) XXX_Size() int

func (*WriteEventRequest) XXX_Unmarshal

func (m *WriteEventRequest) XXX_Unmarshal(b []byte) error

type WriteRequest

type WriteRequest struct {
	// Target being written to.
	Target *Target `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"`
	// Async returns immediately and doesn't wait for events to be written.
	Async bool `protobuf:"varint,5,opt,name=async,proto3" json:"async,omitempty"`
	// Events being written.
	Events               []*Event `protobuf:"bytes,20,rep,name=events,proto3" json:"events,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*WriteRequest) Descriptor

func (*WriteRequest) Descriptor() ([]byte, []int)

func (*WriteRequest) GetAsync

func (m *WriteRequest) GetAsync() bool

func (*WriteRequest) GetEvents

func (m *WriteRequest) GetEvents() []*Event

func (*WriteRequest) GetTarget

func (m *WriteRequest) GetTarget() *Target

func (*WriteRequest) ProtoMessage

func (*WriteRequest) ProtoMessage()

func (*WriteRequest) Reset

func (m *WriteRequest) Reset()

func (*WriteRequest) String

func (m *WriteRequest) String() string

func (*WriteRequest) XXX_DiscardUnknown

func (m *WriteRequest) XXX_DiscardUnknown()

func (*WriteRequest) XXX_Marshal

func (m *WriteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*WriteRequest) XXX_Merge

func (m *WriteRequest) XXX_Merge(src proto.Message)

func (*WriteRequest) XXX_Size

func (m *WriteRequest) XXX_Size() int

func (*WriteRequest) XXX_Unmarshal

func (m *WriteRequest) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL