Documentation
¶
Index ¶
- Constants
- func BoltGetAccountObjects(db *bolt.DB, accountUUID ParentID, bucketName string, t reflect.Type) (*map[string]PersistanceID, error)
- func BoltGetObject(db *bolt.DB, bucketName string, objID string, t reflect.Type) (*PersistanceID, *ParentID, error)
- func BoltGetObjects(db *bolt.DB, bucketName string, t reflect.Type) (*map[string][]PersistanceID, error)
- func BoltMap(objs interface{}) *map[string]PersistanceID
- func BoltSaveAccountObjects(db *bolt.DB, accountUUID ParentID, bucketName string, ...) error
- func BoltSaveObject(bucket *bolt.Bucket, key string, obj interface{}) error
- func BoltSingle(obj interface{}) *map[string]PersistanceID
- func LatestHeartbeatPerApiKey(db *bolt.DB, accountUUID string) (*map[string]Heartbeat, error)
- func ListAPIKeys(db *bolt.DB, accountUUID string) (*map[string]APIKey, error)
- func ListAccounts(db *bolt.DB) (*map[string]Account, error)
- func ListAlerts(db *bolt.DB, accountUUID string) (*map[string]Alert, error)
- func ListAllTokens(db *bolt.DB) (*map[string][]Token, error)
- func ListDevices(db *bolt.DB, accountUUID string) (*map[string]Device, error)
- func ListHeartbeats(db *bolt.DB, accountUUID string) (*map[string]Heartbeat, error)
- func ListNonArchivedAlerts(db *bolt.DB, accountUUID string) (*map[string]Alert, error)
- func ListRenewals(db *bolt.DB, accountUUID string) (*map[string]Renewal, error)
- func ListTokens(db *bolt.DB, accountUUID string) (*map[string]Token, error)
- func SaveDevices(db *bolt.DB, accountUUID string, devices *map[string]Device) error
- func SaveRenewals(db *bolt.DB, accountUUID string, renewals *map[string]Renewal) error
- type APIKey
- type APIKeyStatus
- type Account
- type Alert
- type AlertPriority
- type AlertStatus
- type ChildID
- type Device
- type Heartbeat
- type ParentID
- type PersistanceID
- type Renewal
- type Scope
- type Token
Constants ¶
const ( HighPriority AlertPriority = "high" NormalPriority AlertPriority = "normal" LowPriority AlertPriority = "low" NewStatus AlertStatus = "new" SeenStatus AlertStatus = "seen" ArchivedStatus AlertStatus = "archived" )
Variables ¶
This section is empty.
Functions ¶
func BoltGetAccountObjects ¶
func BoltGetAccountObjects(db *bolt.DB, accountUUID ParentID, bucketName string, t reflect.Type) (*map[string]PersistanceID, error)
TODO rename to GetChildObjects
func BoltGetObject ¶
func BoltGetObject(db *bolt.DB, bucketName string, objID string, t reflect.Type) (*PersistanceID, *ParentID, error)
BoltGetObject returns the object with the given 'objID' and the accountID it belongs to or nil if none is found
func BoltGetObjects ¶
func BoltMap ¶
func BoltMap(objs interface{}) *map[string]PersistanceID
func BoltSaveAccountObjects ¶
func BoltSaveAccountObjects(db *bolt.DB, accountUUID ParentID, bucketName string, objs *map[string]PersistanceID) error
TODO rename to SaveChildObjects
func BoltSingle ¶
func BoltSingle(obj interface{}) *map[string]PersistanceID
func ListAPIKeys ¶
ListAPIKeys returns all API keys for the given account
func ListAccounts ¶
ListAccounts returns all accounts in a map with the uuid as key
func ListAlerts ¶
ListsAlerts returns all alerts for the given account
func ListAllTokens ¶
ListAllTokens returns a map of account id to array of tokens
func ListHeartbeats ¶
func ListNonArchivedAlerts ¶
ListNonArchivedAlerts list all alerts that do not have status "archived" for the given account
func ListTokens ¶
ListTokens returns all created tokens for an account as a map with the token id as key and the token as value
func SaveDevices ¶
Types ¶
type APIKey ¶
type APIKey struct { ID string // uuid Description string // the user's description of the key Status APIKeyStatus CreatedAt time.Time }
APIKey contains information about a created API key
func (APIKey) PersistanceID ¶
PersistanceID is used by the persistance layer
type APIKeyStatus ¶
type APIKeyStatus string
APIKeyStatus shows the status of the API Key
const ( // APIKeyActive indicates that this API key is active APIKeyActive APIKeyStatus = "active" // APIKeyInactive indicates that this API key is inactive APIKeyInactive = "inactive" )
type Account ¶
func NewAccount ¶
func NewAccount() *Account
type Alert ¶
type Alert struct { ID string // uuid APIKeyID string // uuid of api key that sent this heartbeat Title string ShortDescription string LongDescription string Priority AlertPriority Status AlertStatus TriggeredAt time.Time CreatedAt time.Time UpdatedAt time.Time }
func (Alert) PersistanceID ¶
type AlertPriority ¶
type AlertPriority string
AlertPriority shows the priority of the alert, possible values HighPriority, NormalPriority and LowPriority
type Device ¶
type Device struct { ID string // uuid DeviceID string DeviceType string DeviceInfo string CreatedAt time.Time }
func (Device) PersistanceID ¶
type Heartbeat ¶
type Heartbeat struct { ID string // uuid APIKeyID string // uuid of api key that sent this heartbeat ExecutedAt time.Time CreatedAt time.Time }
func NewHeartbeat ¶
func (Heartbeat) PersistanceID ¶
type PersistanceID ¶
type PersistanceID interface {
PersistanceID() string
}
type Renewal ¶
type Renewal struct { ID string // uuid RefreshTokenID string // uuid of refresh token UsedAt *time.Time // the time at which this renewal was used to create a new access token CreatedAt time.Time // the time at which this renewal was created }
func GetRenewal ¶
GetRenewal returns the given renewal and accountID if a match is found, nil otherwise
func NewRenewal ¶
func NewRenewal() *Renewal