auditv1

package
v1.0.7 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: 18 Imported by: 0

Documentation

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 EndpointFromDSN added in v0.0.5

func EndpointFromDSN(dsn string) (string, error)

func Init

func Init(dsn string)

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

func RegisterAuditAPIServer added in v0.0.2

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

func SetupClient

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

SetupClient configures the DefaultClient for t.

func Write

func Write(event *Event)

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

func WriteEvents

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

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

Types

type AuditAPIClient added in v0.0.2

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 added in v0.0.2

func NewAuditAPIClient(cc grpc.ClientConnInterface) AuditAPIClient

type AuditAPIServer added in v0.0.2

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

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

	// Audit communicates with the AuditAPI.
	Audit AuditAPIClient

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

Client sends events to the Audit API.

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

func NewClient

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

NewClient returns a client that sends to input.

func NewClientFromDSN added in v0.0.5

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

NewClientFromDSN returns a client that sends to input by DSN.

func (*Client) Write

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

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

func (*Client) WriteEvents

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

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

type Error

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

func (e *Error) Error() string

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

type Event added in v0.0.2

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 added in v0.0.2

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

func (*Event) GetActor added in v0.0.2

func (m *Event) GetActor() *Resource

func (*Event) GetEvent added in v0.0.2

func (m *Event) GetEvent() string

func (*Event) GetExternalId added in v0.0.2

func (m *Event) GetExternalId() string

func (*Event) GetId added in v0.0.2

func (m *Event) GetId() string

func (*Event) GetMeta added in v0.0.4

func (m *Event) GetMeta() *Meta

func (*Event) GetReason added in v0.0.3

func (m *Event) GetReason() string

func (*Event) GetResources added in v0.0.2

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

func (*Event) GetSessionId added in v0.0.2

func (m *Event) GetSessionId() string

func (*Event) GetTimestamp added in v0.0.2

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

func (*Event) GetXOriginal added in v0.0.2

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

func (*Event) ProtoMessage added in v0.0.2

func (*Event) ProtoMessage()

func (*Event) Reset added in v0.0.2

func (m *Event) Reset()

func (*Event) String added in v0.0.2

func (m *Event) String() string

func (*Event) XXX_DiscardUnknown added in v0.0.2

func (m *Event) XXX_DiscardUnknown()

func (*Event) XXX_Marshal added in v0.0.2

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

func (*Event) XXX_Merge added in v0.0.2

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

func (*Event) XXX_Size added in v0.0.2

func (m *Event) XXX_Size() int

func (*Event) XXX_Unmarshal added in v0.0.2

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

type Meta added in v0.0.4

type Meta struct {
	Name                 string                 `protobuf:"bytes,1,opt,name=name,proto3" json:"name,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.4

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.4

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

func (*Meta) GetName added in v0.0.9

func (m *Meta) GetName() 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.4

func (*Meta) ProtoMessage()

func (*Meta) Reset added in v0.0.4

func (m *Meta) Reset()

func (*Meta) String added in v0.0.4

func (m *Meta) String() string

func (*Meta) XXX_DiscardUnknown added in v0.0.4

func (m *Meta) XXX_DiscardUnknown()

func (*Meta) XXX_Marshal added in v0.0.4

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

func (*Meta) XXX_Merge added in v0.0.4

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

func (*Meta) XXX_Size added in v0.0.4

func (m *Meta) XXX_Size() int

func (*Meta) XXX_Unmarshal added in v0.0.4

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

type Resource added in v0.0.2

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 added in v0.0.2

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

func (*Resource) GetAltIds added in v0.0.2

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

func (*Resource) GetDisplayName added in v0.0.2

func (m *Resource) GetDisplayName() string

func (*Resource) GetEmail added in v0.0.6

func (m *Resource) GetEmail() string

func (*Resource) GetId added in v0.0.2

func (m *Resource) GetId() string

func (*Resource) GetKind added in v0.0.2

func (m *Resource) GetKind() string

func (*Resource) GetLabels added in v0.0.3

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

func (*Resource) ProtoMessage added in v0.0.2

func (*Resource) ProtoMessage()

func (*Resource) Reset added in v0.0.2

func (m *Resource) Reset()

func (*Resource) String added in v0.0.2

func (m *Resource) String() string

func (*Resource) XXX_DiscardUnknown added in v0.0.2

func (m *Resource) XXX_DiscardUnknown()

func (*Resource) XXX_Marshal added in v0.0.2

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

func (*Resource) XXX_Merge added in v0.0.2

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

func (*Resource) XXX_Size added in v0.0.2

func (m *Resource) XXX_Size() int

func (*Resource) XXX_Unmarshal added in v0.0.2

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

type Target added in v0.0.2

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 TargetFromDSN

func TargetFromDSN(dsn string) (*Target, error)

func (*Target) Descriptor added in v0.0.2

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

func (*Target) GetKind added in v0.0.2

func (m *Target) GetKind() Target_Kind

func (*Target) GetName added in v0.0.2

func (m *Target) GetName() string

func (*Target) ProtoMessage added in v0.0.2

func (*Target) ProtoMessage()

func (*Target) Reset added in v0.0.2

func (m *Target) Reset()

func (*Target) String added in v0.0.2

func (m *Target) String() string

func (*Target) XXX_DiscardUnknown added in v0.0.2

func (m *Target) XXX_DiscardUnknown()

func (*Target) XXX_Marshal added in v0.0.2

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

func (*Target) XXX_Merge added in v0.0.2

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

func (*Target) XXX_Size added in v0.0.2

func (m *Target) XXX_Size() int

func (*Target) XXX_Unmarshal added in v0.0.2

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

type Target_Kind added in v0.0.2

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 added in v0.0.2

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

func (Target_Kind) String added in v0.0.2

func (x Target_Kind) String() string

type UnimplementedAuditAPIServer added in v0.0.4

type UnimplementedAuditAPIServer struct {
}

UnimplementedAuditAPIServer can be embedded to have forward compatible implementations.

func (*UnimplementedAuditAPIServer) Write added in v0.0.4

func (*UnimplementedAuditAPIServer) WriteBatch added in v0.0.4

func (*UnimplementedAuditAPIServer) WriteEvent added in v0.0.4

type WriteBatchRequest added in v0.0.2

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 added in v0.0.2

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

func (*WriteBatchRequest) GetAsync added in v0.0.2

func (m *WriteBatchRequest) GetAsync() bool

func (*WriteBatchRequest) GetEvents added in v0.0.2

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

func (*WriteBatchRequest) GetInputName added in v0.0.2

func (m *WriteBatchRequest) GetInputName() string

func (*WriteBatchRequest) GetProviderName added in v0.0.2

func (m *WriteBatchRequest) GetProviderName() string

func (*WriteBatchRequest) GetSpaceName added in v0.0.2

func (m *WriteBatchRequest) GetSpaceName() string

func (*WriteBatchRequest) ProtoMessage added in v0.0.2

func (*WriteBatchRequest) ProtoMessage()

func (*WriteBatchRequest) Reset added in v0.0.2

func (m *WriteBatchRequest) Reset()

func (*WriteBatchRequest) String added in v0.0.2

func (m *WriteBatchRequest) String() string

func (*WriteBatchRequest) XXX_DiscardUnknown added in v0.0.2

func (m *WriteBatchRequest) XXX_DiscardUnknown()

func (*WriteBatchRequest) XXX_Marshal added in v0.0.2

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

func (*WriteBatchRequest) XXX_Merge added in v0.0.2

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

func (*WriteBatchRequest) XXX_Size added in v0.0.2

func (m *WriteBatchRequest) XXX_Size() int

func (*WriteBatchRequest) XXX_Unmarshal added in v0.0.2

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

type WriteEventRequest added in v0.0.2

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 added in v0.0.2

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

func (*WriteEventRequest) GetEvent added in v0.0.2

func (m *WriteEventRequest) GetEvent() *Event

func (*WriteEventRequest) GetInputName added in v0.0.2

func (m *WriteEventRequest) GetInputName() string

func (*WriteEventRequest) GetProviderName added in v0.0.2

func (m *WriteEventRequest) GetProviderName() string

func (*WriteEventRequest) GetSpaceName added in v0.0.2

func (m *WriteEventRequest) GetSpaceName() string

func (*WriteEventRequest) ProtoMessage added in v0.0.2

func (*WriteEventRequest) ProtoMessage()

func (*WriteEventRequest) Reset added in v0.0.2

func (m *WriteEventRequest) Reset()

func (*WriteEventRequest) String added in v0.0.2

func (m *WriteEventRequest) String() string

func (*WriteEventRequest) XXX_DiscardUnknown added in v0.0.2

func (m *WriteEventRequest) XXX_DiscardUnknown()

func (*WriteEventRequest) XXX_Marshal added in v0.0.2

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

func (*WriteEventRequest) XXX_Merge added in v0.0.2

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

func (*WriteEventRequest) XXX_Size added in v0.0.2

func (m *WriteEventRequest) XXX_Size() int

func (*WriteEventRequest) XXX_Unmarshal added in v0.0.2

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

type WriteRequest added in v0.0.2

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 added in v0.0.2

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

func (*WriteRequest) GetAsync added in v0.0.2

func (m *WriteRequest) GetAsync() bool

func (*WriteRequest) GetEvents added in v0.0.2

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

func (*WriteRequest) GetTarget added in v0.0.2

func (m *WriteRequest) GetTarget() *Target

func (*WriteRequest) ProtoMessage added in v0.0.2

func (*WriteRequest) ProtoMessage()

func (*WriteRequest) Reset added in v0.0.2

func (m *WriteRequest) Reset()

func (*WriteRequest) String added in v0.0.2

func (m *WriteRequest) String() string

func (*WriteRequest) XXX_DiscardUnknown added in v0.0.2

func (m *WriteRequest) XXX_DiscardUnknown()

func (*WriteRequest) XXX_Marshal added in v0.0.2

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

func (*WriteRequest) XXX_Merge added in v0.0.2

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

func (*WriteRequest) XXX_Size added in v0.0.2

func (m *WriteRequest) XXX_Size() int

func (*WriteRequest) XXX_Unmarshal added in v0.0.2

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