keystone

package
v0.0.0-...-c7ce807 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CannotMapNil = errors.New("cannot map nil")
View Source
var CannotMapPrimitives = errors.New("cannot map primitive type")
View Source
var CannotMarshalNil = errors.New("cannot marshal nil")
View Source
var CannotMarshalPrimitives = errors.New("cannot marshal primitive type")
View Source
var CannotMarshalValueError = errors.New("cannot marshal value")
View Source
var ErrCommentedMutations = errors.New("you must provide a mutation comment")
View Source
var ErrEntityIDMissing = errors.New("entity ID missing")
View Source
var ErrMustBeMapOrSlice = errors.New("you must unmarshal onto a map or slice")
View Source
var ErrMustMapStringStruct = errors.New("you must pass a map[string]Struct")
View Source
var ErrMustPassPointer = errors.New("you must pass a pointer")
View Source
var ErrMustPointerSlice = errors.New("you must pass a pointer to a []Struct")
View Source
var ErrNilMapGiven = errors.New("you must pass a non-nil map")

Functions

func AsSlice

func AsSlice[T any](entities ...*proto.EntityResponse) ([]T, error)

func Changes

func Changes(a, b interface{}) (map[Property]*proto.Value, error)

func ChangesFromDefault

func ChangesFromDefault(v interface{}) (map[Property]*proto.Value, error)

func MapProperties

func MapProperties(v interface{}) (map[Property]proto.PropertyDefinition, error)

func MapPropertiesWithPrefix

func MapPropertiesWithPrefix(v interface{}, prefix string) (map[Property]proto.PropertyDefinition, error)

func Marshal

func Marshal(v interface{}) (map[Property]*proto.Value, error)

func MarshalValue

func MarshalValue(v interface{}) (*proto.Value, error)

func MockConnection

func MockConnection() (*Connection, *MockServer, *bufconn.Listener, *grpc.Server)

func New

func New[T any](entity *proto.EntityResponse) (T, error)

func NewDynamicProperties

func NewDynamicProperties(props map[string]interface{}) []*proto.EntityProperty

func NewDynamicProperty

func NewDynamicProperty(key string, value interface{}) *proto.EntityProperty

func Type

func Type(input interface{}) string

func Unmarshal

func Unmarshal(from *proto.EntityResponse, v interface{}) error

func UnmarshalGeneric

func UnmarshalGeneric(resp *proto.EntityResponse, dst GenericResult) error

func UnmarshalProperties

func UnmarshalProperties(data map[Property]*proto.Value, v interface{}) error

func UnmarshalToMap

func UnmarshalToMap(dst any, entities ...*proto.EntityResponse) error

func UnmarshalToSlice

func UnmarshalToSlice(dstPtr any, entities ...*proto.EntityResponse) error

Types

type Actor

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

Actor is a struct that represents an actor making requests to keystone

func (*Actor) AppID

func (a *Actor) AppID() string

func (*Actor) Authorization

func (a *Actor) Authorization() *proto.Authorization

func (*Actor) Client

func (a *Actor) Client() string

func (*Actor) Connection

func (a *Actor) Connection() *Connection

func (*Actor) Find

func (a *Actor) Find(ctx context.Context, entityType string, retrieve RetrieveOption, options ...FindOption) ([]*proto.EntityResponse, error)

Find returns a list of entities matching the given entityType and retrieveProperties

func (*Actor) Get

func (a *Actor) Get(ctx context.Context, retrieveBy RetrieveBy, dst interface{}, retrieve ...RetrieveOption) error

Get retrieves an entity by the given retrieveBy, storing the result in dst

func (*Actor) GetByID

func (a *Actor) GetByID(ctx context.Context, entityID string, dst interface{}, retrieve ...RetrieveOption) error

func (*Actor) GetByUniqueProperty

func (a *Actor) GetByUniqueProperty(ctx context.Context, uniqueId, propertyName string, dst interface{}, retrieve ...RetrieveOption) error

func (*Actor) GetDynamicProperties

func (a *Actor) GetDynamicProperties(ctx context.Context, entityID string, properties ...string) (PropertyValueList, error)

func (*Actor) GetSharedByID

func (a *Actor) GetSharedByID(ctx context.Context, owner *proto.VendorApp, entityID string, dst interface{}, retrieve ...RetrieveOption) error

GetSharedByID retrieves an entity by the given retrieveBy, storing the result in dst

func (*Actor) GroupCount

func (a *Actor) GroupCount(ctx context.Context, entityType string, groupBy []string, options ...FindOption) ([]*proto.GroupCountResponse_Result, error)

GroupCount returns a list of entities within an active set

func (*Actor) List

func (a *Actor) List(ctx context.Context, entityType string, retrieveProperties []string, options ...FindOption) ([]*proto.EntityResponse, error)

List returns a list of entities within an active set

func (*Actor) Mutate

func (a *Actor) Mutate(ctx context.Context, src interface{}, options ...MutateOption) error

Mutate is a function that can mutate an entity

func (*Actor) MutateWithDefaultWatcher

func (a *Actor) MutateWithDefaultWatcher(ctx context.Context, src interface{}, options ...MutateOption) error

func (*Actor) MutateWithWatcher

func (a *Actor) MutateWithWatcher(ctx context.Context, src interface{}, w *Watcher, options ...MutateOption) error

func (*Actor) NewRateLimit

func (a *Actor) NewRateLimit(key string, hardLimit, limitMinutes int32) *RateLimit

func (*Actor) NewTrackedRateLimit

func (a *Actor) NewTrackedRateLimit(key string, hardLimit, limitMinutes int32) *RateLimit

func (*Actor) RemoteIp

func (a *Actor) RemoteIp() string

func (*Actor) RemoteMutate

func (a *Actor) RemoteMutate(ctx context.Context, src interface{}) error

func (*Actor) ReplaceConnection

func (a *Actor) ReplaceConnection(c *Connection)

func (*Actor) ReportTimeSeries

func (a *Actor) ReportTimeSeries(ctx context.Context, src interface{}) error

ReportTimeSeries writes point in time data

func (*Actor) SetClientName

func (a *Actor) SetClientName(client string)

SetClientName sets the client name for the actor

func (*Actor) SetDynamicProperties

func (a *Actor) SetDynamicProperties(ctx context.Context, entityID string, setProperties []*proto.EntityProperty, removeProperties []string, comment string) error

func (*Actor) SetTraceID

func (a *Actor) SetTraceID(id string)

func (*Actor) ShareView

func (a *Actor) ShareView(ctx context.Context, with *proto.VendorApp, def *SharedView) (*proto.SharedViewResponse, error)

func (*Actor) SharedViews

func (a *Actor) SharedViews(ctx context.Context, with *proto.VendorApp, entityID, entityType string, anyWorkspace bool) (*proto.SharedViewsResponse, error)

func (*Actor) TraceID

func (a *Actor) TraceID() string

func (*Actor) User

func (a *Actor) User() *proto.User

func (*Actor) UserAgent

func (a *Actor) UserAgent() string

func (*Actor) UserId

func (a *Actor) UserId() string

func (*Actor) VendorApp

func (a *Actor) VendorApp() *proto.VendorApp

func (*Actor) VendorID

func (a *Actor) VendorID() string

func (*Actor) WorkspaceID

func (a *Actor) WorkspaceID() string

type Amount

type Amount struct {
	Currency string `json:"currency"`
	Units    int64  `json:"units"`
}

Amount represents money

func NewAmount

func NewAmount(currency string, units int64) Amount

NewAmount creates a new Amount

func (*Amount) MarshalValue

func (a *Amount) MarshalValue() (*proto.Value, error)

func (*Amount) PropertyDefinition

func (a *Amount) PropertyDefinition() proto.PropertyDefinition

func (*Amount) UnmarshalValue

func (a *Amount) UnmarshalValue(value *proto.Value) error

type BaseChildEntity

type BaseChildEntity struct {
	BaseEntity
	// contains filtered or unexported fields
}

BaseChildEntity is a full entity, but keyed under a parent entity

func (*BaseChildEntity) GetKeystoneChildID

func (e *BaseChildEntity) GetKeystoneChildID() string

func (*BaseChildEntity) GetKeystoneParentID

func (e *BaseChildEntity) GetKeystoneParentID() string

func (*BaseChildEntity) SetKeystoneChildID

func (e *BaseChildEntity) SetKeystoneChildID(id string)

func (*BaseChildEntity) SetKeystoneID

func (e *BaseChildEntity) SetKeystoneID(id string)

func (*BaseChildEntity) SetKeystoneParentID

func (e *BaseChildEntity) SetKeystoneParentID(id string)

type ChildEntity

type ChildEntity interface {
	GetKeystoneParentID() string
	GetKeystoneChildID() string
	SetKeystoneParentID(id string)
	SetKeystoneChildID(id string)
}

type Connection

type Connection struct {
	proto.KeystoneClient
	// contains filtered or unexported fields
}

Connection is a connection to a keystone server

func DefaultConnection

func DefaultConnection(host, port, vendorID, appID, accessToken string) *Connection

func NewConnection

func NewConnection(client proto.KeystoneClient, vendorID, appID, accessToken string) *Connection

NewConnection creates a new connection to a keystone server

func (*Connection) Actor

func (c *Connection) Actor(workspaceID, remoteIP, userID, userAgent string) Actor

Actor returns an actor for the given workspace, remote IP, user ID, and user agent

func (*Connection) ChartTimeSeries

func (*Connection) DailyEntities

func (*Connection) Define

func (c *Connection) Define(ctx context.Context, in *proto.SchemaRequest, opts ...grpc.CallOption) (*proto.Schema, error)

func (*Connection) DirectClient

func (c *Connection) DirectClient() proto.KeystoneClient

DirectClient avoid using the direct client in case of changes

func (*Connection) Events

func (*Connection) Find

func (*Connection) GroupCount

func (*Connection) List

func (*Connection) Log

func (*Connection) Logs

func (*Connection) Mutate

func (*Connection) RateLimit

func (*Connection) RegisterTypes

func (c *Connection) RegisterTypes(types ...interface{}) int

RegisterTypes registers the given types with the connection, returning the number of new types registered

func (*Connection) ReportTimeSeries

func (c *Connection) ReportTimeSeries(ctx context.Context, in *proto.ReportTimeSeriesRequest, opts ...grpc.CallOption) (*proto.MutateResponse, error)

func (*Connection) Retrieve

func (*Connection) SchemaStatistics

func (*Connection) ShareView

func (*Connection) SharedViews

func (*Connection) SyncSchema

func (c *Connection) SyncSchema() *sync.WaitGroup

SyncSchema syncs the schema with the server

type Country

type Country String

func (*Country) PropertyDefinition

func (s *Country) PropertyDefinition() proto.PropertyDefinition

type Email

type Email String

func (*Email) PropertyDefinition

func (s *Email) PropertyDefinition() proto.PropertyDefinition

type EmbeddedChild

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

func (*EmbeddedChild) AggregateValue

func (e *EmbeddedChild) AggregateValue() int64

func (*EmbeddedChild) ChildID

func (e *EmbeddedChild) ChildID() string

func (*EmbeddedChild) SetAggregateValue

func (e *EmbeddedChild) SetAggregateValue(val int64)

func (*EmbeddedChild) SetChildID

func (e *EmbeddedChild) SetChildID(id string)

type EmbeddedDetails

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

func (*EmbeddedDetails) DateCreated

func (e *EmbeddedDetails) DateCreated() time.Time

func (*EmbeddedDetails) KeystoneState

func (e *EmbeddedDetails) KeystoneState() proto.EntityState

func (*EmbeddedDetails) LastUpdated

func (e *EmbeddedDetails) LastUpdated() time.Time

func (*EmbeddedDetails) SetEntityDetail

func (e *EmbeddedDetails) SetEntityDetail(entity *proto.Entity)

type EmbeddedEntity

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

func (*EmbeddedEntity) GetKeystoneID

func (e *EmbeddedEntity) GetKeystoneID() string

func (*EmbeddedEntity) MutationSuccess

func (e *EmbeddedEntity) MutationSuccess(resp *proto.MutateResponse)

func (*EmbeddedEntity) SetKeystoneID

func (e *EmbeddedEntity) SetKeystoneID(id string)

type EmbeddedEvents

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

EmbeddedEvents is a struct that implements EventProvider

func (*EmbeddedEvents) AddEvent

func (e *EmbeddedEvents) AddEvent(eventType string, properties map[string]string)

AddEvent adds an event

func (*EmbeddedEvents) ClearEvents

func (e *EmbeddedEvents) ClearEvents() error

ClearEvents clears the events

func (*EmbeddedEvents) GetEvents

func (e *EmbeddedEvents) GetEvents() []*proto.EntityEvent

GetEvents returns the events

type EmbeddedLabels

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

EmbeddedLabels is a struct that implements LabelProvider

func (*EmbeddedLabels) AddLabel

func (e *EmbeddedLabels) AddLabel(name, value string)

AddLabel adds a label

func (*EmbeddedLabels) ClearLabels

func (e *EmbeddedLabels) ClearLabels() error

ClearLabels clears the labels

func (*EmbeddedLabels) GetLabels

func (e *EmbeddedLabels) GetLabels() []*proto.EntityLabel

GetLabels returns the labels

type EmbeddedLock

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

func (*EmbeddedLock) AcquiredLock

func (e *EmbeddedLock) AcquiredLock() bool

func (*EmbeddedLock) LockData

func (e *EmbeddedLock) LockData() *LockInfo

func (*EmbeddedLock) SetLockResult

func (e *EmbeddedLock) SetLockResult(lockInfo *LockInfo)

type EmbeddedLogs

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

EmbeddedLogs is a struct that implements LogProvider

func (*EmbeddedLogs) ClearLogs

func (e *EmbeddedLogs) ClearLogs() error

ClearLogs clears the logs

func (*EmbeddedLogs) GetLogs

func (e *EmbeddedLogs) GetLogs() []*proto.EntityLog

GetLogs returns the logs

func (*EmbeddedLogs) Log

func (e *EmbeddedLogs) Log(level proto.LogLevel, message, reference, actor, traceID string, logTime time.Time, data map[string]string)

Log logs a message

func (*EmbeddedLogs) LogAlert

func (e *EmbeddedLogs) LogAlert(message, reference, actor, traceID string, data map[string]string)

LogAlert logs an alert message

func (*EmbeddedLogs) LogCritical

func (e *EmbeddedLogs) LogCritical(message, reference, actor, traceID string, data map[string]string)

LogCritical logs a critical message

func (*EmbeddedLogs) LogDebug

func (e *EmbeddedLogs) LogDebug(message, reference, actor, traceID string, data map[string]string)

LogDebug logs a debug message

func (*EmbeddedLogs) LogError

func (e *EmbeddedLogs) LogError(message, reference, actor, traceID string, data map[string]string)

LogError logs an error message

func (*EmbeddedLogs) LogFatal

func (e *EmbeddedLogs) LogFatal(message, reference, actor, traceID string, data map[string]string)

LogFatal logs a fatal message

func (*EmbeddedLogs) LogInfo

func (e *EmbeddedLogs) LogInfo(message, reference, actor, traceID string, data map[string]string)

LogInfo logs an info message

func (*EmbeddedLogs) LogNotice

func (e *EmbeddedLogs) LogNotice(message, reference, actor, traceID string, data map[string]string)

LogNotice logs a notice message

func (*EmbeddedLogs) LogWarn

func (e *EmbeddedLogs) LogWarn(message, reference, actor, traceID string, data map[string]string)

LogWarn logs a warning message

type EmbeddedRelationships

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

EmbeddedRelationships is a struct that implements RelationshipProvider

func (*EmbeddedRelationships) AddRelationship

func (e *EmbeddedRelationships) AddRelationship(relationshipType, target string, meta map[string]string, since time.Time)

AddRelationship adds a relationship

func (*EmbeddedRelationships) ClearRelationships

func (e *EmbeddedRelationships) ClearRelationships() error

ClearRelationships clears the relationships

func (*EmbeddedRelationships) GetRelationships

func (e *EmbeddedRelationships) GetRelationships() []*proto.EntityRelationship

GetRelationships returns the relationships

func (*EmbeddedRelationships) SetRelationships

func (e *EmbeddedRelationships) SetRelationships(links []*proto.EntityRelationship)

SetRelationships sets the relationships

type EmbeddedSensors

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

EmbeddedSensors is a struct that implements SensorProvider

func (*EmbeddedSensors) AddSensorMeasurement

func (e *EmbeddedSensors) AddSensorMeasurement(sensor string, value float64)

AddSensorMeasurement adds a Sensor measurement

func (*EmbeddedSensors) AddSensorMeasurementWithData

func (e *EmbeddedSensors) AddSensorMeasurementWithData(sensor string, value float64, data map[string]string)

AddSensorMeasurementWithData adds a Sensor measurement

func (*EmbeddedSensors) ClearSensorMeasurements

func (e *EmbeddedSensors) ClearSensorMeasurements() error

ClearSensorMeasurements clears the Sensors

func (*EmbeddedSensors) GetSensorMeasurements

func (e *EmbeddedSensors) GetSensorMeasurements() []*proto.EntitySensorMeasurement

GetSensorMeasurements returns the Sensors measurements

type EmbeddedWatcher

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

func (*EmbeddedWatcher) HasWatcher

func (e *EmbeddedWatcher) HasWatcher() bool

func (*EmbeddedWatcher) SetWatcher

func (e *EmbeddedWatcher) SetWatcher(watcher *Watcher)

func (*EmbeddedWatcher) Watcher

func (e *EmbeddedWatcher) Watcher() *Watcher

type Entity

type Entity interface {
	GetKeystoneID() string
	SetKeystoneID(id string)
}

type EntityDefinition

type EntityDefinition interface {
	GetKeystoneDefinition() TypeDefinition
}

EntityDefinition is an interface that defines the keystone entity

type EntityDetail

type EntityDetail interface {
	SetEntityDetail(entity *proto.Entity)
}

type EventProvider

type EventProvider interface {
	ClearEvents() error
	GetEvents() []*proto.EntityEvent
}

EventProvider is an interface for entities that can have events

type FindOption

type FindOption interface {
	Apply(config *filterRequest)
}

FindOption is an interface for options to be applied to a find request

func ChildOf

func ChildOf(entityID string) FindOption

func Limit

func Limit(perPage, pageNumber int32) FindOption

func RelationOf

func RelationOf(entityID, relationshipType, relVendor, relApp string) FindOption

func RelationOfSibling

func RelationOfSibling(entityID, relationshipType string) FindOption

func RelationTo

func RelationTo(entityID, relationshipType, relVendor, relApp string) FindOption

func RelationToSibling

func RelationToSibling(entityID, relationshipType string) FindOption

func SortBy

func SortBy(property string, descending bool) FindOption

func WhereBetween

func WhereBetween(key string, value1, value2 any) FindOption

WhereBetween is a find option that filters entities by a property being between two values

func WhereContains

func WhereContains(key string, value any) FindOption

WhereContains is a find option that filters entities by a property containing a value

func WhereEndsWith

func WhereEndsWith(key string, value string) FindOption

WhereEndsWith is a find option that filters entities by a property ending with a value

func WhereEquals

func WhereEquals(key string, value any) FindOption

WhereEquals is a find option that filters entities by a property equaling a value

func WhereGreaterThan

func WhereGreaterThan(key string, value any) FindOption

WhereGreaterThan is a find option that filters entities by a property being greater than a value

func WhereGreaterThanOrEquals

func WhereGreaterThanOrEquals(key string, value any) FindOption

WhereGreaterThanOrEquals is a find option that filters entities by a property being greater than or equal to a value

func WhereIn

func WhereIn(key string, value ...any) FindOption

WhereIn is a find option that filters entities by a property being in a list of values

func WhereLessThan

func WhereLessThan(key string, value any) FindOption

WhereLessThan is a find option that filters entities by a property being less than a value

func WhereLessThanOrEquals

func WhereLessThanOrEquals(key string, value any) FindOption

WhereLessThanOrEquals is a find option that filters entities by a property being less than or equal to a value

func WhereNotContains

func WhereNotContains(key string, value any) FindOption

WhereNotContains is a find option that filters entities by a property not containing a value

func WhereNotEquals

func WhereNotEquals(key string, value any) FindOption

WhereNotEquals is a find option that filters entities by a property not equaling a value

func WhereNotIn

func WhereNotIn(key string, value ...any) FindOption

WhereNotIn is a find option that filters entities by a property not being in a list of values

func WhereStartsWith

func WhereStartsWith(key string, value any) FindOption

WhereStartsWith is a find option that filters entities by a property starting with a value

func WithLabel

func WithLabel(name, value string) FindOption

type GenericResult

type GenericResult map[string]interface{}

GenericResult is a map that can be used to retrieve a generic result

type IPAddress

type IPAddress String

func (*IPAddress) PropertyDefinition

func (s *IPAddress) PropertyDefinition() proto.PropertyDefinition

type IntSet

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

func NewIntSet

func NewIntSet(values ...int64) IntSet

func (*IntSet) Add

func (s *IntSet) Add(value int64)

func (*IntSet) Append

func (s *IntSet) Append(value ...int64)

func (*IntSet) Clear

func (s *IntSet) Clear()

func (*IntSet) CurrentValues

func (s *IntSet) CurrentValues() []int64

func (*IntSet) Diff

func (s *IntSet) Diff(values ...int64) []int64

func (*IntSet) Has

func (s *IntSet) Has(value int64) bool

func (*IntSet) IsEmpty

func (s *IntSet) IsEmpty() bool

func (*IntSet) MarshalValue

func (s *IntSet) MarshalValue() (*proto.Value, error)

func (*IntSet) MutationSuccess

func (s *IntSet) MutationSuccess(resp *proto.MutateResponse)

func (*IntSet) PropertyDefinition

func (s *IntSet) PropertyDefinition() proto.PropertyDefinition

func (*IntSet) Reduce

func (s *IntSet) Reduce(value ...int64)

func (*IntSet) Remove

func (s *IntSet) Remove(value int64)

func (*IntSet) ReplaceExisting

func (s *IntSet) ReplaceExisting() bool

func (*IntSet) ReplaceWith

func (s *IntSet) ReplaceWith(values ...int64)

func (*IntSet) ToAdd

func (s *IntSet) ToAdd() []int64

func (*IntSet) ToRemove

func (s *IntSet) ToRemove() []int64

func (*IntSet) UnmarshalValue

func (s *IntSet) UnmarshalValue(value *proto.Value) error

func (*IntSet) Values

func (s *IntSet) Values() []int64

type LabelProvider

type LabelProvider interface {
	ClearLabels() error
	GetLabels() []*proto.EntityLabel
}

LabelProvider is an interface for entities that can provide labels

type LockInfo

type LockInfo struct {
	ID           string
	LockedUntil  time.Time
	Message      string
	LockAcquired bool
}

type Locker

type Locker interface {
	SetLockResult(*LockInfo)
}

type LogProvider

type LogProvider interface {
	ClearLogs() error
	GetLogs() []*proto.EntityLog
}

LogProvider is an interface for entities that can have logs

type MarshaledEntity

type MarshaledEntity struct {
	Properties map[Property]*proto.Value
}

func NewMarshaledEntity

func NewMarshaledEntity() MarshaledEntity

func (*MarshaledEntity) Append

func (m *MarshaledEntity) Append(name string, val interface{}) error

type Marshaler

type Marshaler interface {
	MarshalKeystone() (map[Property]*proto.Value, error)
	UnmarshalKeystone(map[Property]*proto.Value) error
}

type MockServer

type MockServer struct {
	proto.UnimplementedKeystoneServer
	DefineFunc           func(context.Context, *proto.SchemaRequest) (*proto.Schema, error)
	MutateFunc           func(context.Context, *proto.MutateRequest) (*proto.MutateResponse, error)
	ReportTimeSeriesFunc func(context.Context, *proto.ReportTimeSeriesRequest) (*proto.MutateResponse, error)
	RetrieveFunc         func(context.Context, *proto.EntityRequest) (*proto.EntityResponse, error)
	FindFunc             func(context.Context, *proto.FindRequest) (*proto.FindResponse, error)
	ListFunc             func(context.Context, *proto.ListRequest) (*proto.ListResponse, error)
	GroupCountFunc       func(context.Context, *proto.GroupCountRequest) (*proto.GroupCountResponse, error)
	LogFunc              func(context.Context, *proto.LogRequest) (*proto.LogResponse, error)
	LogsFunc             func(context.Context, *proto.LogsRequest) (*proto.LogsResponse, error)
	EventsFunc           func(context.Context, *proto.EventRequest) (*proto.EventsResponse, error)
	DailyEntitiesFunc    func(context.Context, *proto.DailyEntityRequest) (*proto.DailyEntityResponse, error)
	SchemaStatisticsFunc func(context.Context, *proto.SchemaStatisticsRequest) (*proto.SchemaStatisticsResponse, error)
	ChartTimeSeriesFunc  func(context.Context, *proto.ChartTimeSeriesRequest) (*proto.ChartTimeSeriesResponse, error)
	ShareViewFunc        func(context.Context, *proto.ShareViewRequest) (*proto.SharedViewResponse, error)
	SharedViewsFunc      func(context.Context, *proto.SharedViewsRequest) (*proto.SharedViewsResponse, error)
	RateLimitFunc        func(context.Context, *proto.RateLimitRequest) (*proto.RateLimitResponse, error)
}

func (*MockServer) ChartTimeSeries

func (*MockServer) DailyEntities

func (*MockServer) Define

func (m *MockServer) Define(ctx context.Context, req *proto.SchemaRequest) (*proto.Schema, error)

func (*MockServer) Events

func (*MockServer) Find

func (*MockServer) GroupCount

func (*MockServer) List

func (*MockServer) Log

func (*MockServer) Logs

func (*MockServer) Mutate

func (*MockServer) RateLimit

func (*MockServer) ReportTimeSeries

func (m *MockServer) ReportTimeSeries(ctx context.Context, req *proto.ReportTimeSeriesRequest) (*proto.MutateResponse, error)

func (*MockServer) Retrieve

func (*MockServer) SchemaStatistics

func (*MockServer) ShareView

func (*MockServer) ShareViews

type MutateOption

type MutateOption interface {
	// contains filtered or unexported methods
}

func MutateProperties

func MutateProperties(property ...string) MutateOption

MutateProperties Only mutate the specified properties

func OnConflictUseID

func OnConflictUseID(property ...string) MutateOption

OnConflictUseID should set the unique properties that can be used to identify an existing identity

func WithMutationComment

func WithMutationComment(comment string) MutateOption

type MutationObserver

type MutationObserver interface {
	MutationSuccess(response *proto.MutateResponse)
}

type MutationOptionWatcherPrepare

type MutationOptionWatcherPrepare interface {
	// contains filtered or unexported methods
}

type NestedChild

type NestedChild interface {
	ChildID() string
	SetChildID(id string)
}

NestedChild is an interface that defines a child struct - these are not standalone entities

type NestedChildAggregateValue

type NestedChildAggregateValue interface {
	AggregateValue() int64
	SetAggregateValue(val int64)
}

NestedChildAggregateValue defines the aggregate value of a child entity

type PII

type PII String

func (*PII) PropertyDefinition

func (s *PII) PropertyDefinition() proto.PropertyDefinition

type PersonName

type PersonName String

func (*PersonName) PropertyDefinition

func (s *PersonName) PropertyDefinition() proto.PropertyDefinition

type Phone

type Phone String

func (*Phone) PropertyDefinition

func (s *Phone) PropertyDefinition() proto.PropertyDefinition

type Property

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

func NewPrefixProperty

func NewPrefixProperty(prefix, name string) Property

func NewProperty

func NewProperty(name string) Property

func ReflectProperty

func ReflectProperty(f reflect.StructField, prefix string) (Property, proto.PropertyDefinition)

func (*Property) HydrateOnly

func (p *Property) HydrateOnly() bool

func (*Property) Name

func (p *Property) Name() string

func (*Property) SetPrefix

func (p *Property) SetPrefix(prefix string)

type PropertyValueList

type PropertyValueList map[string]*proto.Value

func (PropertyValueList) Get

func (p PropertyValueList) Get(key string) *proto.Value

func (PropertyValueList) GetBool

func (p PropertyValueList) GetBool(key string, defaultValue bool) bool

func (PropertyValueList) GetFloat

func (p PropertyValueList) GetFloat(key string, defaultValue float64) float64

func (PropertyValueList) GetInt

func (p PropertyValueList) GetInt(key string, defaultValue int64) int64

func (PropertyValueList) GetText

func (p PropertyValueList) GetText(key, defaultValue string) string

type RateLimit

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

func (*RateLimit) Trigger

func (r *RateLimit) Trigger(ctx context.Context, transactionId string) (RateLimitResult, error)

type RateLimitResult

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

func (RateLimitResult) CurrentCount

func (r RateLimitResult) CurrentCount() int32

func (RateLimitResult) HitLimit

func (r RateLimitResult) HitLimit() bool

func (RateLimitResult) Percent

func (r RateLimitResult) Percent() float64

type Reflector

type Reflector interface {
	ToProto(reflect.Value) (*proto.Value, error)
	SetValue(*proto.Value, reflect.Value) error
	PropertyDefinition() proto.PropertyDefinition
}

func GetReflector

func GetReflector(t reflect.Type, v reflect.Value) Reflector

type RelationshipProvider

type RelationshipProvider interface {
	ClearRelationships() error
	GetRelationships() []*proto.EntityRelationship
	SetRelationships(links []*proto.EntityRelationship)
}

RelationshipProvider is an interface for entities that can have relationships

type Remote

type Remote struct {
	EmbeddedSensors
	EmbeddedLogs
	EmbeddedRelationships
	EmbeddedLabels
	EmbeddedEvents
	// contains filtered or unexported fields
}

func RemoteEntity

func RemoteEntity(entityID string) Remote

RemoteEntity is a remote entity that is not stored in the local database

func (Remote) GetKeystoneID

func (r Remote) GetKeystoneID() string

func (Remote) SetKeystoneID

func (r Remote) SetKeystoneID(id string)

type RetrieveBy

type RetrieveBy interface {
	BaseRequest() *proto.EntityRequest
	EntityType() string
}

RetrieveBy is an interface that defines a retriever

func ByEntityID

func ByEntityID(entityType interface{}, entityID string) RetrieveBy

func ByUniqueProperty

func ByUniqueProperty(entityType interface{}, uniqueID, property string) RetrieveBy

type RetrieveEntityOption

type RetrieveEntityOption interface {
	ApplyRequest(config *proto.EntityRequest)
}

type RetrieveOption

type RetrieveOption interface {
	Apply(config *proto.EntityView)
}

RetrieveOption is an interface for options to be applied to an entity request

func RetrieveOptions

func RetrieveOptions(opts ...RetrieveOption) RetrieveOption

func WithChildSummary

func WithChildSummary() RetrieveOption

func WithChildren

func WithChildren(childType string, ids ...string) RetrieveOption

WithChildren is a retrieve option that loads Children

func WithDatum

func WithDatum() RetrieveOption

WithDatum is a retrieve option that loads datum

func WithDecryptedProperties

func WithDecryptedProperties(properties ...string) RetrieveOption

WithDecryptedProperties is a retrieve option that loads decrypted properties

func WithDescendantCount

func WithDescendantCount(entityType string) RetrieveOption

func WithLabels

func WithLabels() RetrieveOption

WithLabels is a retrieve option that loads labels

func WithLock

func WithLock(note string, ttlSeconds int32) RetrieveOption

func WithProperties

func WithProperties(properties ...string) RetrieveOption

WithProperties is a retrieve option that loads properties

func WithProperty

func WithProperty(decrypt bool, properties ...string) RetrieveOption

WithProperty is a retrieve option that loads properties

func WithRelationshipCount

func WithRelationshipCount(relationType, appId, vendorId string) RetrieveOption

func WithRelationships

func WithRelationships(keys ...string) RetrieveOption

WithRelationships is a retrieve option that loads relationships

func WithSiblingRelationshipCount

func WithSiblingRelationshipCount(relationType string) RetrieveOption

func WithSummary

func WithSummary() RetrieveOption

WithSummary is a retrieve option that loads summaries

func WithTotalRelationshipCount

func WithTotalRelationshipCount() RetrieveOption

func WithView

func WithView(name string) RetrieveOption

type SecureString

type SecureString struct {
	Masked   string `json:"masked,omitempty"`
	Original string `json:"-"`
}

SecureString is a string that represents sensitive Data

func NewSecretString

func NewSecretString(original, masked string) SecureString

NewSecretString creates a new SecureString

func (*SecureString) MarshalJSON

func (e *SecureString) MarshalJSON() ([]byte, error)

func (*SecureString) MarshalValue

func (e *SecureString) MarshalValue() (*proto.Value, error)

func (*SecureString) PropertyDefinition

func (e *SecureString) PropertyDefinition() proto.PropertyDefinition

func (*SecureString) String

func (e *SecureString) String() string

String returns the original string if it exists, otherwise the masked string

func (*SecureString) UnmarshalJSON

func (e *SecureString) UnmarshalJSON(data []byte) error

func (*SecureString) UnmarshalValue

func (e *SecureString) UnmarshalValue(value *proto.Value) error

type SensorProvider

type SensorProvider interface {
	ClearSensorMeasurements() error
	GetSensorMeasurements() []*proto.EntitySensorMeasurement
}

SensorProvider is an interface for entities that can provide Sensors

type SettableWatchedEntity

type SettableWatchedEntity interface {
	WatchedEntity
	SetWatcher(*Watcher)
}

type SharedView

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

func NewSharedView

func NewSharedView(properties ...string) *SharedView

func (*SharedView) Add

func (s *SharedView) Add(property string, allowPii, allowSecure bool) *SharedView

func (*SharedView) ForAllWorkspaces

func (s *SharedView) ForAllWorkspaces() *SharedView

func (*SharedView) ForEntity

func (s *SharedView) ForEntity(entityID string) *SharedView

func (*SharedView) ForType

func (s *SharedView) ForType(forType string) *SharedView

func (*SharedView) WithComment

func (s *SharedView) WithComment(comment string) *SharedView

type String

type String string

func (*String) MarshalValue

func (s *String) MarshalValue() (*proto.Value, error)

func (*String) PropertyDefinition

func (s *String) PropertyDefinition() proto.PropertyDefinition

func (*String) UnmarshalValue

func (s *String) UnmarshalValue(value *proto.Value) error

type StringSet

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

func NewStringSet

func NewStringSet(values ...string) StringSet

func (*StringSet) Add

func (s *StringSet) Add(value string)

func (*StringSet) Append

func (s *StringSet) Append(value ...string)

func (*StringSet) Clear

func (s *StringSet) Clear()

func (*StringSet) CurrentValues

func (s *StringSet) CurrentValues() []string

func (*StringSet) Diff

func (s *StringSet) Diff(values ...string) []string

func (*StringSet) Has

func (s *StringSet) Has(value string) bool

func (*StringSet) IsEmpty

func (s *StringSet) IsEmpty() bool

func (*StringSet) MarshalValue

func (s *StringSet) MarshalValue() (*proto.Value, error)

func (*StringSet) MutationSuccess

func (s *StringSet) MutationSuccess(resp *proto.MutateResponse)

func (*StringSet) PropertyDefinition

func (s *StringSet) PropertyDefinition() proto.PropertyDefinition

func (*StringSet) Reduce

func (s *StringSet) Reduce(value ...string)

func (*StringSet) Remove

func (s *StringSet) Remove(value string)

func (*StringSet) ReplaceExisting

func (s *StringSet) ReplaceExisting() bool

func (*StringSet) ReplaceWith

func (s *StringSet) ReplaceWith(values ...string)

func (*StringSet) ToAdd

func (s *StringSet) ToAdd() []string

func (*StringSet) ToRemove

func (s *StringSet) ToRemove() []string

func (*StringSet) UnmarshalValue

func (s *StringSet) UnmarshalValue(value *proto.Value) error

func (*StringSet) Values

func (s *StringSet) Values() []string

type TSEntity

type TSEntity interface {
	GetTimeSeriesInputTime() time.Time
}

type TimeSeriesEntity

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

func (*TimeSeriesEntity) GetTimeSeriesInputTime

func (e *TimeSeriesEntity) GetTimeSeriesInputTime() time.Time

func (*TimeSeriesEntity) SetTimeSeriesInputTime

func (e *TimeSeriesEntity) SetTimeSeriesInputTime(t time.Time)

type TypeDefinition

type TypeDefinition struct {
	Type         string // Unique Type Name e.g. user
	Name         string // Friendly name of the entity e.g. Library User
	Description  string // Description of the entity
	Singular     string // Name for a single one of these entities e.g. User
	Plural       string // Name for a collection of these entities e.g. Users
	Options      []proto.Schema_Option
	KeystoneType proto.Schema_Type

	Properties map[Property]proto.PropertyDefinition
	// contains filtered or unexported fields
}

TypeDefinition is a definition of a keystone type

func Define

func Define(input interface{}) TypeDefinition

func NewTypeDefinition

func NewTypeDefinition() TypeDefinition

func QuickDefine

func QuickDefine(input interface{}) TypeDefinition

func (TypeDefinition) HasOption

func (t TypeDefinition) HasOption(option proto.Schema_Option) bool

func (TypeDefinition) Schema

func (t TypeDefinition) Schema() *proto.Schema

type URL

type URL String

func (*URL) PropertyDefinition

func (s *URL) PropertyDefinition() proto.PropertyDefinition

type UserInput

type UserInput String

func (*UserInput) PropertyDefinition

func (s *UserInput) PropertyDefinition() proto.PropertyDefinition

type ValueMarshaler

type ValueMarshaler interface {
	MarshalValue() (*proto.Value, error)
	UnmarshalValue(*proto.Value) error
	PropertyDefinition() proto.PropertyDefinition
}

type VerifyString

type VerifyString struct {
	Original string `json:"original,omitempty"`
	// contains filtered or unexported fields
}

VerifyString is a string that can be verified

func NewVerifyString

func NewVerifyString(original string) VerifyString

NewVerifyString creates a new VerifyString

func (*VerifyString) MarshalValue

func (e *VerifyString) MarshalValue() (*proto.Value, error)

func (*VerifyString) PropertyDefinition

func (e *VerifyString) PropertyDefinition() proto.PropertyDefinition

func (*VerifyString) String

func (e *VerifyString) String() string

String returns the original string if it exists, otherwise the masked string

func (*VerifyString) UnmarshalValue

func (e *VerifyString) UnmarshalValue(value *proto.Value) error

type WatchedEntity

type WatchedEntity interface {
	HasWatcher() bool
	Watcher() *Watcher
}

type Watcher

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

func NewDefaultsWatcher

func NewDefaultsWatcher(v interface{}) (*Watcher, error)

NewDefaultsWatcher creates a new watcher with the default values of the given type

func NewWatcher

func NewWatcher(v interface{}) (*Watcher, error)

NewWatcher creates a new watcher with the given value

func (*Watcher) AppendKnownValues

func (w *Watcher) AppendKnownValues(vals map[Property]*proto.Value)

func (*Watcher) Changes

func (w *Watcher) Changes(v interface{}, update bool) (map[Property]*proto.Value, error)

Changes returns the changes between the current value and the previous value. If update is true, the current value will be stored as the previous value

func (*Watcher) ReplaceKnownValues

func (w *Watcher) ReplaceKnownValues(vals map[Property]*proto.Value)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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