store

package
v2.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Certificate

type Certificate struct {
	Serial     string         `json:"serial"`
	Subject    RequestSubject `json:"subject"`
	CommonName string         `json:"commonName"`
	IsCA       bool           `json:"isCA"`
	Usage      []string       `json:"usage"`
	Revoked    bool           `json:"revoked"`
	Issued     time.Time      `json:"issued"`
	Expires    time.Time      `json:"expires"`

	Fingerprints map[string]string `json:"fingerprints"`
}

type Connections

type Connections map[string]*models.Connection

type Nodes

type Nodes map[string]*models.Node

type Request

type Request struct {
	Identity   string         `json:"identity"`
	Subject    RequestSubject `json:"subject"`
	Connection string         `json:"connection"`
	Type       string         `json:"type"`
	Version    string         `json:"version"`

	Approved chan bool `json:"-"`
}

type RequestSubject

type RequestSubject struct {
	CommonName         string        `json:"common_name,omitempty"`
	SerialNumber       string        `json:"serial_number,omitempty"`
	Country            []string      `json:"country,omitempty"`
	Organization       []string      `json:"organization,omitempty"`
	OrganizationalUnit []string      `json:"organizational_unit,omitempty"`
	Locality           []string      `json:"locality,omitempty"`
	Province           []string      `json:"province,omitempty"`
	StreetAddress      []string      `json:"street_address,omitempty"`
	PostalCode         []string      `json:"postal_code,omitempty"`
	Names              []interface{} `json:"names,omitempty"`
}

type Store

type Store struct {
	Nodes        Nodes
	SavedState   *logic.SavedStateStore
	Logic        *logic.Logic
	Scheduler    *logic.Scheduler
	Devices      *devices.List
	Connections  Connections
	Certificates []Certificate
	Requests     []Request
	Server       map[string]map[string]devices.State
	Persons      persons.List

	Destinations *notification.Destinations
	Senders      *notification.Senders

	sync.RWMutex
	// contains filtered or unexported fields
}

func New

func (*Store) AcceptRequest

func (store *Store) AcceptRequest(c string)

func (*Store) AddOrUpdateConnection

func (store *Store) AddOrUpdateConnection(id string, c *models.Connection)

func (*Store) AddOrUpdateDestination

func (store *Store) AddOrUpdateDestination(dest *notification.Destination)

func (*Store) AddOrUpdateDevice

func (store *Store) AddOrUpdateDevice(dev *devices.Device)

func (*Store) AddOrUpdateNode

func (store *Store) AddOrUpdateNode(node *models.Node)

func (*Store) AddOrUpdatePerson

func (store *Store) AddOrUpdatePerson(p persons.PersonWithPasswords) error

func (*Store) AddOrUpdatePersons

func (store *Store) AddOrUpdatePersons(persons map[string]persons.PersonWithPasswords) error

func (*Store) AddOrUpdateRules

func (store *Store) AddOrUpdateRules(rules logic.Rules)

func (*Store) AddOrUpdateSavedStates

func (store *Store) AddOrUpdateSavedStates(s logic.SavedStates)

func (*Store) AddOrUpdateScheduledTasks

func (store *Store) AddOrUpdateScheduledTasks(tasks logic.Tasks)

func (*Store) AddOrUpdateSender

func (store *Store) AddOrUpdateSender(sender notification.Sender)

func (*Store) AddOrUpdateServer

func (s *Store) AddOrUpdateServer(area, item string, state devices.State)

func (*Store) AddRequest

func (store *Store) AddRequest(r Request)

func (*Store) Connection

func (store *Store) Connection(id string) *models.Connection

func (*Store) ConnectionChanged

func (store *Store) ConnectionChanged()

func (*Store) CountAdmins

func (store *Store) CountAdmins() int

func (*Store) GetCertificates

func (store *Store) GetCertificates() []Certificate

func (*Store) GetConnections

func (store *Store) GetConnections() Connections

func (*Store) GetDestinations

func (store *Store) GetDestinations() map[string]*notification.Destination

func (*Store) GetDevices

func (store *Store) GetDevices() *devices.List

func (*Store) GetNode

func (store *Store) GetNode(uuid string) *models.Node

func (*Store) GetNodes

func (store *Store) GetNodes() Nodes

func (*Store) GetPerson

func (store *Store) GetPerson(uuid string) *persons.Person

func (*Store) GetPersons

func (store *Store) GetPersons() persons.PersonMap

func (*Store) GetRequests

func (store *Store) GetRequests() []Request

func (*Store) GetRules

func (store *Store) GetRules() logic.Rules

func (*Store) GetSavedStates

func (store *Store) GetSavedStates() logic.SavedStates

func (*Store) GetScheduledTasks

func (store *Store) GetScheduledTasks() logic.Tasks

func (*Store) GetSenderDestinations

func (store *Store) GetSenderDestinations(id string) (map[string]string, error)

func (*Store) GetSenders

func (store *Store) GetSenders() map[string]notification.Sender

func (*Store) GetServerStateAsJson

func (store *Store) GetServerStateAsJson() json.RawMessage

func (*Store) Load

func (store *Store) Load() error

Load loads all stuff from disk.

func (*Store) LoadNodes

func (store *Store) LoadNodes() error

func (*Store) OnUpdate

func (store *Store) OnUpdate(callback UpdateCallback)

func (*Store) OnUserDemote

func (store *Store) OnUserDemote(callback UserDemoteCallback)

func (*Store) ReleaseDestination

func (store *Store) ReleaseDestination(dest string, body string) error

func (*Store) RemoveConnection

func (store *Store) RemoveConnection(id string)

func (*Store) RemoveRequest

func (store *Store) RemoveRequest(c string, approved bool)

func (*Store) SaveNode

func (store *Store) SaveNode(node *models.Node) error

func (*Store) SaveNodes

func (store *Store) SaveNodes() error

func (*Store) TriggerDestination

func (store *Store) TriggerDestination(dest string, body string) error

func (*Store) UpdateCertificates

func (store *Store) UpdateCertificates(certs []Certificate)

func (*Store) ValidateLogin

func (store *Store) ValidateLogin(username, password string) (*persons.Person, error)

type UpdateCallback

type UpdateCallback func(string, *Store) error

type UserDemoteCallback

type UserDemoteCallback func(string) error

Jump to

Keyboard shortcuts

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