dgraphstore

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package dgraphstore provides store implementation with Dgraph

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplySchema

func ApplySchema(ctx context.Context, dg *dgo.Dgraph) error

func NewDgraphClient

func NewDgraphClient(grpcClient *grpc.ClientConn) *dgo.Dgraph

func NewGrpcClient

func NewGrpcClient(address string, opts []grpc.DialOption) (*grpc.ClientConn, error)

Types

type Action

type Action struct {
	UID   string   `json:"uid,omitempty"`
	DType []string `json:"dgraph.type,omitempty"`

	Namespace          string `json:"action_namespace,omitempty"`
	Name               string `json:"action_name,omitempty"`
	Selector           string `json:"action_selector,omitempty"`
	OnViolatedProcess  bool   `json:"action_on_violated_process,omitempty"`
	OnViolatedFile     bool   `json:"action_on_violated_file,omitempty"`
	OnFalcoAlert       bool   `json:"action_on_falco_alert,omitempty"`
	FalcoAlertPriority int    `json:"action_falco_alert_priority,omitempty"`
	Action             string `json:"action_action,omitempty"`
}

type Constraint

type Constraint struct {
	UID   string   `json:"uid,omitempty"`
	DType []string `json:"dgraph.type,omitempty"`

	Namespace        string `json:"constraint_namespace,omitempty"`
	Name             string `json:"constraint_name,omitempty"`
	Selector         string `json:"constraint_selector,omitempty"`
	AllowedProcesses string `json:"constraint_allowed_processes,omitempty"`
	AllowedFiles     string `json:"constraint_allowed_files,omitempty"`
}

type DgraphActionStore

type DgraphActionStore struct {
	// contains filtered or unexported fields
}

func NewDgraphActionStore

func NewDgraphActionStore(dgraphClient *dgo.Dgraph) *DgraphActionStore

func (*DgraphActionStore) Add

func (d *DgraphActionStore) Add(action *tarianpb.Action) error

func (*DgraphActionStore) FindByNamespace

func (d *DgraphActionStore) FindByNamespace(namespace string) ([]*tarianpb.Action, error)

func (*DgraphActionStore) GetAll

func (d *DgraphActionStore) GetAll() ([]*tarianpb.Action, error)

func (*DgraphActionStore) NamespaceAndNameExist

func (d *DgraphActionStore) NamespaceAndNameExist(namespace, name string) (bool, error)

func (*DgraphActionStore) RemoveByNamespaceAndName

func (d *DgraphActionStore) RemoveByNamespaceAndName(namespace, name string) error

type DgraphConfig

type DgraphConfig struct {
	Address     string `default:"localhost:9080"`
	TLSCertFile string
	TLSKeyFile  string
	TLSCAFile   string
}

type DgraphConstraintStore

type DgraphConstraintStore struct {
	// contains filtered or unexported fields
}

func NewDgraphConstraintStore

func NewDgraphConstraintStore(dgraphClient *dgo.Dgraph) *DgraphConstraintStore

func (*DgraphConstraintStore) Add

func (d *DgraphConstraintStore) Add(constraint *tarianpb.Constraint) error

func (*DgraphConstraintStore) FindByNamespace

func (d *DgraphConstraintStore) FindByNamespace(namespace string) ([]*tarianpb.Constraint, error)

func (*DgraphConstraintStore) GetAll

func (d *DgraphConstraintStore) GetAll() ([]*tarianpb.Constraint, error)

func (*DgraphConstraintStore) NamespaceAndNameExist

func (d *DgraphConstraintStore) NamespaceAndNameExist(namespace, name string) (bool, error)

func (*DgraphConstraintStore) RemoveByNamespaceAndName

func (d *DgraphConstraintStore) RemoveByNamespaceAndName(namespace, name string) error

type DgraphEventStore

type DgraphEventStore struct {
	// contains filtered or unexported fields
}

func NewDgraphEventStore

func NewDgraphEventStore(dgraphClient *dgo.Dgraph) *DgraphEventStore

func (*DgraphEventStore) Add

func (d *DgraphEventStore) Add(evt *tarianpb.Event) error

func (*DgraphEventStore) FindByNamespace

func (d *DgraphEventStore) FindByNamespace(namespace string, limit uint) ([]*tarianpb.Event, error)

func (*DgraphEventStore) FindWhereAlertNotSent

func (d *DgraphEventStore) FindWhereAlertNotSent() ([]*tarianpb.Event, error)

func (*DgraphEventStore) GetAll

func (d *DgraphEventStore) GetAll(limit uint) ([]*tarianpb.Event, error)

func (*DgraphEventStore) UpdateAlertSent

func (d *DgraphEventStore) UpdateAlertSent(uid string) error

func (*DgraphEventStore) UpsertPod

func (d *DgraphEventStore) UpsertPod(dgraphPod Pod) (Pod, error)

type Event

type Event struct {
	UID   string   `json:"uid,omitempty"`
	DType []string `json:"dgraph.type,omitempty"`

	Type            string     `json:"event_type,omitempty"`
	EventUID        string     `json:"event_uid,omitempty"`
	ClientTimestamp *time.Time `json:"event_client_timestamp,omitempty"`
	ServerTimestamp *time.Time `json:"event_server_timestamp,omitempty"`
	AlertSentAt     *time.Time `json:"event_alert_sent_at,omitempty"`
	Targets         []Target   `json:"targets,omitempty"`
}

type Pod

type Pod struct {
	UID   string   `json:"uid,omitempty"`
	DType []string `json:"dgraph.type,omitempty"`

	Namespace string `json:"pod_namespace,omitempty"`
	Name      string `json:"pod_name,omitempty"`
	PodUID    string `json:"pod_uid,omitempty"`
	Labels    string `json:"pod_labels,omitempty"`
}

type Target

type Target struct {
	UID   string   `json:"uid,omitempty"`
	DType []string `json:"dgraph.type,omitempty"`

	ViolatedProcesses string `json:"target_violated_processes,omitempty"`
	ViolatedFiles     string `json:"target_violated_files,omitempty"`
	FalcoAlert        string `json:"target_falco_alert,omitempty"`
	Pod               *Pod   `json:"pod,omitempty"`
}

Jump to

Keyboard shortcuts

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