dbconf

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2020 License: Apache-2.0 Imports: 20 Imported by: 4

Documentation

Overview

Package dbconf manages everything related to the SQL database. This database will be used to store and retrieve configurations.

The convention is to have:

* one type per DB object;
* a bunch of functions that returns one (list of) object(s) type to get objects;
* a bunch of receiver functions that interact with the database (Save(), Delete()...)

The "list" functions need 2 parameters: pageSize and pageOffset. Setting pageSize to 0
means "return all results". The pageOffset is just an offset, independently of the size.
The different combinations of pageSize and pageOffset are:

| `pageSize` | `pageOffset` | SQL                  | Results             |
| ---------- | ------------ | -------------------- | ------------------- |
| 0          | 0            |                      | 0..∞ (_N_ results)  |
| 1          | 0            | `LIMIT 1`            | 0..0 (1 result)     |
| 0          | 10           | `LIMIT -1 OFFSET 10` | 10..∞ (_M_ results) |
| 1          | 10           | `LIMIT 1 OFFSET 10`  | 10..10 (1 result)   |

Index

Constants

View Source
const SQLiteMinimumVersion = 3026000

SQLiteMinimumVersion is the SQLite library version required Note: the version used is the one embedded in the library, not in the system see github.com/mattn/go-sqlite3

Variables

This section is empty.

Functions

func Downgrade added in v0.3.0

func Downgrade(db ConfigurationDB) (err error)

Downgrade reverts one migrations on the DB

func GetVersion

func GetVersion(db ConfigurationDB) (version int64, err error)

GetVersion returns the migration version of a DB

func IsVersion

func IsVersion(db ConfigurationDB, version int64) (b bool, err error)

IsVersion checks if the DB Conf version matches the parameter

func Migrate

func Migrate(db ConfigurationDB) (err error)

Migrate applies all the available migrations on the DB

func MigrateTo

func MigrateTo(db ConfigurationDB, version int64) (err error)

MigrateTo applies all the available migrations up to a specific version on the DB

func RequiredVersion

func RequiredVersion() (version int64)

RequiredVersion returns the version of the DB expected by Panto

Types

type Agent

type Agent struct {
	ID               int
	UUID             uuid.UUID
	OrganizationUUID uuid.UUID
	DisplayName      string
	TsConfiguration  time.Time
	TsCreated        time.Time
	TsUpdated        time.Time
	TsDeleted        time.Time
}

An Agent is the representation of an agent in the DB

type Alert

type Alert struct {
	ID               int
	UUID             uuid.UUID
	OrganizationUUID uuid.UUID
	ChannelUUID      uuid.UUID
	Type             string
	Configuration    map[string]interface{}
	TsCreated        time.Time
	TsUpdated        time.Time
	TsDeleted        time.Time
}

An Alert is the representation of an alert in the DB

type Channel

type Channel struct {
	ID               int
	UUID             uuid.UUID
	OrganizationUUID uuid.UUID
	Type             string
	DisplayName      string
	Configuration    map[string]interface{}
	TsCreated        time.Time
	TsUpdated        time.Time
	TsDeleted        time.Time
}

Channel is the representation of a channel in the DB

type ChannelType

type ChannelType struct {
	Label                 string
	ConfigurationTemplate []util.Parameter
}

ChannelType is the representation of a channel_type in the DB

type ConfigurationDB

type ConfigurationDB interface {
	ListOrganizations(count int32, offset uint64) ([]*Organization, error)
	GetOrganization(organizationUUID uuid.UUID) (*Organization, error)
	UpdateOrganization(organization *Organization) (*Organization, error)
	CreateOrganization(organization *Organization) (*Organization, error)

	ListAgents(organizationUUID uuid.UUID, count int32, offset uint64) ([]*Agent, error)
	GetAgent(organizationUUID, agentUUID uuid.UUID) (*Agent, error)
	CreateAgent(agent *Agent) (*Agent, error)
	UpdateAgent(agent *Agent) (*Agent, error)
	DeleteAgent(organizationUUID, agentUUID uuid.UUID) error

	ListTargets(organizationUUID uuid.UUID, count int32, offset uint64) ([]*Target, error)
	GetTarget(organizationUUID, targetUUID uuid.UUID) (*Target, error)
	CreateTarget(target *Target) (*Target, error)
	UpdateTarget(target *Target) (*Target, error)
	DeleteTarget(organizationUUID, targetUUID uuid.UUID) error

	ListTargetProbes(organizationUUID uuid.UUID, targetUUIDs, probeUUIDs []uuid.UUID, count int32, offset uint64) ([]*TargetProbe, error)
	GetTargetProbe(organizationUUID, targetProbeUUID uuid.UUID) (*TargetProbe, error)
	CreateTargetProbe(targetProbe *TargetProbe) (*TargetProbe, error)
	UpdateTargetProbe(targetProbe *TargetProbe) (*TargetProbe, error)
	DeleteTargetProbe(organizationUUID, targetProbeUUID uuid.UUID) error

	ListTargetProbesByAlert(organizationUUID, alertUUID uuid.UUID, count int32, offset uint64) (targetProbes []*TargetProbe, err error)
	ListAlertsByTargetProbe(organizationUUID, targetProbeUUID uuid.UUID, count int32, offset uint64) ([]*Alert, error)
	LinkTargetProbesToAlert(force bool, organizationUUID, alertUUID uuid.UUID, targetProbes ...uuid.UUID) error

	ListTargetProbeAgents(organizationUUID, agentUUID uuid.UUID, count int32, offset uint64) ([]*TargetProbeAgent, error)
	ListTargetProbeAgentsForOrganization(organizationUUID uuid.UUID, checkUUIDs []uuid.UUID, pageSize int32, pageOffset uint64) ([]*TargetProbeAgent, error)
	ListTargetProbeAgentsAll(count int32, offset uint64) ([]*TargetProbeAgent, error)
	GetTargetProbeAgent(organizationUUID, agentUUID, targetProbeAgentUUID uuid.UUID) (*TargetProbeAgent, error)
	CreateTargetProbeAgent(targetProbeAgent *TargetProbeAgent) (*TargetProbeAgent, error)
	UpdateTargetProbeAgent(targetProbeAgent *TargetProbeAgent) (*TargetProbeAgent, error)
	DeleteTargetProbeAgent(organizationUUID, agentUUID, targetProbeAgentUUID uuid.UUID) error

	ListChannels(organizationUUID uuid.UUID, count int32, offset uint64) ([]*Channel, error)
	GetChannel(organizationUUID, channelUUID uuid.UUID) (*Channel, error)
	CreateChannel(channel *Channel) (*Channel, error)
	UpdateChannel(channel *Channel) (*Channel, error)
	DeleteChannel(organizationUUID, channelUUID uuid.UUID) error

	ListAlerts(organizationUUID uuid.UUID, count int32, offset uint64) ([]*Alert, error)
	GetAlert(organizationUUID, alertUUID uuid.UUID) (*Alert, error)
	CreateAlert(alert *Alert) (*Alert, error)
	UpdateAlert(alert *Alert) (*Alert, error)
	DeleteAlert(organizationUUID, alertUUID uuid.UUID) error

	GetUserByEmail(email string) (*User, error)
	CreateUser(user *User) (*User, error)
	UpdateUser(user *User) (*User, error)
	DeleteUser(organizationUUID, userUUID uuid.UUID) error

	ListAlertsByChannel(organizationUUID, channelUUID uuid.UUID, count int32, offset uint64) ([]*Alert, error)

	ListTags(organizationUUID uuid.UUID, count int32, offset uint64) ([]*Tag, error)
	GetTag(organizationUUID uuid.UUID, slug string) (*Tag, error)
	CreateTag(tag *Tag) (*Tag, error)
	UpdateTag(tag *Tag) (*Tag, error)
	DeleteTag(organizationUUID uuid.UUID, slug string) error

	ListTagsByTarget(organizationUUID, targetUUID uuid.UUID, pageSize int32, pageOffset uint64) ([]*Tag, error)
	ListTargetsByTag(organizationUUID uuid.UUID, tagName string, pageSize int32, pageOffset uint64) ([]*Target, error)
	LinkTagsToTarget(force bool, organizationUUID, targetUUID uuid.UUID, tagSlugs ...string) error
	UnlinkTagsFromTarget(organizationUUID, targetUUID uuid.UUID, tagSlugs ...string) error

	ListChannelTypes(count int32, offset uint64) ([]*ChannelType, error)
	GetChannelType(label string) (*ChannelType, error)

	ListProbes(count int32, offset uint64) ([]*Probe, error)
	GetProbe(probeUUID uuid.UUID) (*Probe, error)

	// Close DB connection
	Close() error
	// contains filtered or unexported methods
}

ConfigurationDB represents an abstract SQL database.

func NewSQLiteDB

func NewSQLiteDB(path string) (ConfigurationDB, error)

NewSQLiteDB creates a new connection to an Sqlite DB The `path` argument is the path to the database file.

type Graphs

type Graphs struct {
	Graphs []struct {
		Title   string // name of the graph
		Type    string // type of graph (lines, stacked-lines)
		Format  string // unit formatter for the metrics
		Metrics []struct {
			Name  string // the name of the metric to graph
			Color string // the color to draw the metric representation
		}
		Tags []string // list of tags to group the metrics on (and to duplicate graphs)
	}
}

Graphs describes the graphs to render a Probe Stored in the DB as a JSON:

{
    "graphs": [
        {
            "title": "title of the graph",
            "type": "stacked-lines",
            "format": "bignumber",
            "metrics": [
                {
						"name": "metric-to-graph",
						"color": "#000000"
				   },
                {
						"name": "other-metric-to-graph",
						"color": "#000000"
				   }
            ],
            "tags": [
                "tag-to-filter"
            ]
        }
    ]
}

type MetricOptions added in v0.8.0

type MetricOptions struct {
	Accumulator bool
}

MetricOptions describes a special field of a Probe Metric (see below)

type Metrics

type Metrics struct {
	Metrics []struct {
		Name        string
		Type        string
		Description string
		Options     MetricOptions
	}
	Tags []struct {
		Name        string
		Description string
	}
}

Metrics describes the fields and tags of a Probe's results Stored in the DB as a JSON:

{
    "metrics": [
        {
            "name": "metric-name",
            "type": "int64",
            "description": "this is a metric that does that"
            "options": {
					"accumulator": "boolean"
				}
        }
    ],
		"tags": [
			{
				"name": "tag-name",
				"description": "this is the description of the tag"
			}
		]
}

type Migration added in v0.3.0

type Migration struct {
	Version int64
	Name    string
}

Migration is the representation of a migration script

func ListLastMigration added in v0.3.0

func ListLastMigration(to int64) (list []Migration, err error)

ListLastMigration returns the last migrations for a given version

func ListPendingMigrations

func ListPendingMigrations(from, to int64) (list []Migration, err error)

ListPendingMigrations returns the list of all migrations available between 2 version

type NullBytes

type NullBytes struct {
	Bytes []byte
	Valid bool
}

NullBytes is useful to get value from DB that might be null

func (*NullBytes) Scan

func (nb *NullBytes) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullBytes) Value

func (nb NullBytes) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type NullTime

type NullTime struct {
	Time  time.Time
	Valid bool // Valid is true if Time is not NULL
}

NullTime is useful to get value from DB that might be null

func (*NullTime) Scan

func (nt *NullTime) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullTime) Value

func (nt NullTime) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Organization

type Organization struct {
	ID        int
	UUID      uuid.UUID
	Name      string
	TsCreated time.Time
	TsUpdated time.Time
	TsDeleted time.Time
}

An Organization is the representation of an organization in the DB

type Probe

type Probe struct {
	ID                    int
	UUID                  uuid.UUID
	Label                 string
	DisplayName           string
	Description           string
	ConfigurationTemplate []util.Parameter
	Metrics               Metrics
	Graphs                Graphs
	TsCreated             time.Time
	TsUpdated             time.Time
	TsDeleted             time.Time
}

Probe is the representation of a probe in the DB

type SQLiteDB

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

SQLiteDB is a concrete implementation of `sql.DB` that uses Sqlite as a SQL database.

func (*SQLiteDB) Close

func (db *SQLiteDB) Close() error

Close closes the database connection

func (*SQLiteDB) CreateAgent

func (db *SQLiteDB) CreateAgent(agent *Agent) (*Agent, error)

CreateAgent creates a new Agent in the DB

func (*SQLiteDB) CreateAlert

func (db *SQLiteDB) CreateAlert(alert *Alert) (*Alert, error)

CreateAlert creates a new Alert in the DB

func (*SQLiteDB) CreateChannel

func (db *SQLiteDB) CreateChannel(channel *Channel) (*Channel, error)

CreateChannel creates a new Channel in the DB

func (*SQLiteDB) CreateOrganization

func (db *SQLiteDB) CreateOrganization(organization *Organization) (*Organization, error)

CreateOrganization creates a new Organization in the DB

func (*SQLiteDB) CreateTag

func (db *SQLiteDB) CreateTag(tag *Tag) (*Tag, error)

CreateTag creates a new Tag in the DB

func (*SQLiteDB) CreateTarget

func (db *SQLiteDB) CreateTarget(target *Target) (*Target, error)

CreateTarget creates a new Target in the DB

func (*SQLiteDB) CreateTargetProbe

func (db *SQLiteDB) CreateTargetProbe(tp *TargetProbe) (*TargetProbe, error)

CreateTargetProbe creates a new TargetProbe in the DB

func (*SQLiteDB) CreateTargetProbeAgent

func (db *SQLiteDB) CreateTargetProbeAgent(targetProbeAgent *TargetProbeAgent) (*TargetProbeAgent, error)

CreateTargetProbeAgent inserts a new TargetProbeAgent into the DB

func (*SQLiteDB) CreateUser added in v0.9.0

func (db *SQLiteDB) CreateUser(user *User) (*User, error)

CreateUser creates a new User in the DB

func (*SQLiteDB) DeleteAgent

func (db *SQLiteDB) DeleteAgent(organizationUUID, agentUUID uuid.UUID) error

DeleteAgent deletes an Agent and all linked entities (TargetProbeAgent) from the DB

func (*SQLiteDB) DeleteAlert

func (db *SQLiteDB) DeleteAlert(organizationUUID, alertUUID uuid.UUID) error

DeleteAlert deletes an Alert and all linked entities (TargetProbeAlert) from the DB

func (*SQLiteDB) DeleteChannel

func (db *SQLiteDB) DeleteChannel(organizationUUID, channelUUID uuid.UUID) error

DeleteChannel deletes a Channel and all linked entities (TargetProbeChannel) from the DB

func (*SQLiteDB) DeleteTag

func (db *SQLiteDB) DeleteTag(organizationUUID uuid.UUID, slug string) error

DeleteTag deletes a Tag from the DB

func (*SQLiteDB) DeleteTarget

func (db *SQLiteDB) DeleteTarget(organizationUUID, targetUUID uuid.UUID) error

DeleteTarget deletes a Target and all linked entities (TargetProbe, TargetProbeAgent) from the DB

func (*SQLiteDB) DeleteTargetProbe

func (db *SQLiteDB) DeleteTargetProbe(organizationUUID, targetprobeUUID uuid.UUID) error

DeleteTargetProbe deletes a TargetProbe and all linked entities (TargetProbeAgent) from the DB

func (*SQLiteDB) DeleteTargetProbeAgent

func (db *SQLiteDB) DeleteTargetProbeAgent(organizationUUID, agentUUID, targetProbeAgentUUID uuid.UUID) error

DeleteTargetProbeAgent removes a TargetProbeAgent from the DB

func (*SQLiteDB) DeleteUser added in v0.9.0

func (db *SQLiteDB) DeleteUser(organizationUUID, userUUID uuid.UUID) error

DeleteUser deletes a User from the DB

func (*SQLiteDB) GetAgent

func (db *SQLiteDB) GetAgent(organizationUUID, agentUUID uuid.UUID) (*Agent, error)

GetAgent returns an Agent in the DB based on its UUID and its parent organization's UUID

func (*SQLiteDB) GetAlert

func (db *SQLiteDB) GetAlert(organizationUUID, alertUUID uuid.UUID) (*Alert, error)

GetAlert returns an Alert in the DB based on its UUID and its parent organization's UUID

func (*SQLiteDB) GetChannel

func (db *SQLiteDB) GetChannel(organizationUUID, channelUUID uuid.UUID) (*Channel, error)

GetChannel returns a Channel in the DB based on its UUID and its parent organization's UUID

func (*SQLiteDB) GetChannelType

func (db *SQLiteDB) GetChannelType(label string) (*ChannelType, error)

GetChannelType returns a ChannelType in the DB based on its label

func (*SQLiteDB) GetOrganization

func (db *SQLiteDB) GetOrganization(organizationUUID uuid.UUID) (*Organization, error)

GetOrganization returns an Organization in the DB based on its UUID

func (*SQLiteDB) GetProbe

func (db *SQLiteDB) GetProbe(probeUUID uuid.UUID) (*Probe, error)

GetProbe returns a Probe in the DB based on its UUID

func (*SQLiteDB) GetTag

func (db *SQLiteDB) GetTag(organizationUUID uuid.UUID, slug string) (*Tag, error)

GetTag returns a Tag in the DB based on its name and its parent organization's UUID

func (*SQLiteDB) GetTarget

func (db *SQLiteDB) GetTarget(organizationUUID, targetUUID uuid.UUID) (*Target, error)

GetTarget returns a Target in the DB based on its UUID and its parent organization's UUID

func (*SQLiteDB) GetTargetProbe

func (db *SQLiteDB) GetTargetProbe(organizationUUID, targetprobeUUID uuid.UUID) (*TargetProbe, error)

GetTargetProbe returns a TargetProbes in the DB based on its UUID and its parent organization's UUID

func (*SQLiteDB) GetTargetProbeAgent

func (db *SQLiteDB) GetTargetProbeAgent(organizationUUID, agentUUID, targetProbeAgentUUID uuid.UUID) (*TargetProbeAgent, error)

GetTargetProbeAgent returns a TargetProbeAgent according to its UUID and parent organization & agent

func (*SQLiteDB) GetUserByEmail added in v0.9.0

func (db *SQLiteDB) GetUserByEmail(email string) (*User, error)

GetUserByEmail returns a User from the DB based on its email

func (*SQLiteDB) LinkTagsToTarget

func (db *SQLiteDB) LinkTagsToTarget(force bool, organizationUUID, targetUUID uuid.UUID, tagSlugs ...string) error

LinkTagsToTarget connects a number of tags to a target in the DB Set force to true to also remove all pre-existing links to target

func (*SQLiteDB) LinkTargetProbesToAlert

func (db *SQLiteDB) LinkTargetProbesToAlert(force bool, organizationUUID, alertUUID uuid.UUID, targetProbes ...uuid.UUID) error

LinkTargetProbesToAlert connects a number of target_probes to an alert in the DB Set force to true to also remove all pre-existing links to alert

func (*SQLiteDB) ListAgents

func (db *SQLiteDB) ListAgents(organizationUUID uuid.UUID, pageSize int32, pageOffset uint64) (agents []*Agent, err error)

ListAgents returns all Agents from the DBConf

func (*SQLiteDB) ListAlerts

func (db *SQLiteDB) ListAlerts(organizationUUID uuid.UUID, pageSize int32, pageOffset uint64) (alerts []*Alert, err error)

ListAlerts returns all Alerts from the DBConf

func (*SQLiteDB) ListAlertsByChannel added in v0.5.0

func (db *SQLiteDB) ListAlertsByChannel(organizationUUID, channelUUID uuid.UUID, pageSize int32, pageOffset uint64) ([]*Alert, error)

ListAlertsByChannel returns all alerts in an Organization using a given Channel

func (*SQLiteDB) ListAlertsByTargetProbe

func (db *SQLiteDB) ListAlertsByTargetProbe(organizationUUID, targetProbeUUID uuid.UUID, pageSize int32, pageOffset uint64) ([]*Alert, error)

ListAlertsByTargetProbe returns all the Alerts linked to a TargetProbe from the DBConf

func (*SQLiteDB) ListChannelTypes

func (db *SQLiteDB) ListChannelTypes(pageSize int32, pageOffset uint64) (channelTypes []*ChannelType, err error)

ListChannelTypes returns all the ChannelTypes from the DBConf

func (*SQLiteDB) ListChannels

func (db *SQLiteDB) ListChannels(organizationUUID uuid.UUID, pageSize int32, pageOffset uint64) (channels []*Channel, err error)

ListChannels returns all Channels from the DBConf

func (*SQLiteDB) ListOrganizations

func (db *SQLiteDB) ListOrganizations(pageSize int32, pageOffset uint64) (orgs []*Organization, err error)

ListOrganizations returns all Organizations from the DBConf

func (*SQLiteDB) ListProbes

func (db *SQLiteDB) ListProbes(pageSize int32, pageOffset uint64) (probes []*Probe, err error)

ListProbes returns all Probes from the DBConf

func (*SQLiteDB) ListTags

func (db *SQLiteDB) ListTags(organizationUUID uuid.UUID, pageSize int32, pageOffset uint64) (tags []*Tag, err error)

ListTags returns all Tags from the DBConf

func (*SQLiteDB) ListTagsByTarget

func (db *SQLiteDB) ListTagsByTarget(organizationUUID, targetUUID uuid.UUID, pageSize int32, pageOffset uint64) ([]*Tag, error)

ListTagsByTarget returns all Tags linked to a given target from the DB

func (*SQLiteDB) ListTargetProbeAgents

func (db *SQLiteDB) ListTargetProbeAgents(organizationUUID, agentUUID uuid.UUID, pageSize int32, pageOffset uint64) ([]*TargetProbeAgent, error)

ListTargetProbeAgents returns all TargetProbeAgents for a given organization and agent

func (*SQLiteDB) ListTargetProbeAgentsAll added in v0.4.0

func (db *SQLiteDB) ListTargetProbeAgentsAll(pageSize int32, pageOffset uint64) ([]*TargetProbeAgent, error)

ListTargetProbeAgentsAll returns all TargetProbeAgents

func (*SQLiteDB) ListTargetProbeAgentsForOrganization

func (db *SQLiteDB) ListTargetProbeAgentsForOrganization(organizationUUID uuid.UUID, checkUUIDs []uuid.UUID, pageSize int32, pageOffset uint64) ([]*TargetProbeAgent, error)

ListTargetProbeAgentsForOrganization returns all TargetProbeAgents for a given organization

func (*SQLiteDB) ListTargetProbes

func (db *SQLiteDB) ListTargetProbes(organizationUUID uuid.UUID, targetUUIDs, probeUUIDs []uuid.UUID, pageSize int32, pageOffset uint64) (targetProbes []*TargetProbe, err error)

ListTargetProbes returns all the TargetProbe from the DBConf

func (*SQLiteDB) ListTargetProbesByAlert

func (db *SQLiteDB) ListTargetProbesByAlert(organizationUUID, alertUUID uuid.UUID, pageSize int32, pageOffset uint64) (targetProbes []*TargetProbe, err error)

ListTargetProbesByAlert returns all the TargetProbe linked to an Alert from the DBConf

func (*SQLiteDB) ListTargets

func (db *SQLiteDB) ListTargets(organizationUUID uuid.UUID, pageSize int32, pageOffset uint64) (targets []*Target, err error)

ListTargets returns all Targets from the DBConf

func (*SQLiteDB) ListTargetsByTag

func (db *SQLiteDB) ListTargetsByTag(organizationUUID uuid.UUID, tagSlug string, pageSize int32, pageOffset uint64) ([]*Target, error)

ListTargetsByTag returns all Targets linked to a given tag from the DB

func (*SQLiteDB) UnlinkTagsFromTarget

func (db *SQLiteDB) UnlinkTagsFromTarget(organizationUUID, targetUUID uuid.UUID, tagSlugs ...string) error

UnlinkTagsFromTarget disconnects a tag from a target in the DB

func (*SQLiteDB) UnlinkTargetProbesFromAlert

func (db *SQLiteDB) UnlinkTargetProbesFromAlert(organizationUUID, alertUUID uuid.UUID) error

UnlinkTargetProbesFromAlert removes all existing links to alert

func (*SQLiteDB) UpdateAgent

func (db *SQLiteDB) UpdateAgent(agent *Agent) (*Agent, error)

UpdateAgent updates an existing Agent in the DB

func (*SQLiteDB) UpdateAlert

func (db *SQLiteDB) UpdateAlert(alert *Alert) (*Alert, error)

UpdateAlert updates an existing Alert in the DB

func (*SQLiteDB) UpdateChannel

func (db *SQLiteDB) UpdateChannel(channel *Channel) (*Channel, error)

UpdateChannel updates an existing Channel in the DB

func (*SQLiteDB) UpdateOrganization

func (db *SQLiteDB) UpdateOrganization(organization *Organization) (*Organization, error)

UpdateOrganization updates an existing Organization in the DB

func (*SQLiteDB) UpdateTag

func (db *SQLiteDB) UpdateTag(tag *Tag) (*Tag, error)

UpdateTag updates an existing Tag in the DB

func (*SQLiteDB) UpdateTarget

func (db *SQLiteDB) UpdateTarget(target *Target) (*Target, error)

UpdateTarget updates an existing Target in the DB

func (*SQLiteDB) UpdateTargetProbe

func (db *SQLiteDB) UpdateTargetProbe(tp *TargetProbe) (*TargetProbe, error)

UpdateTargetProbe updates an existing TargetProbe in the DB

func (*SQLiteDB) UpdateTargetProbeAgent

func (db *SQLiteDB) UpdateTargetProbeAgent(targetProbeAgent *TargetProbeAgent) (*TargetProbeAgent, error)

UpdateTargetProbeAgent updates the writable fields of the TargetProbeAgent

func (*SQLiteDB) UpdateUser added in v0.9.0

func (db *SQLiteDB) UpdateUser(user *User) (*User, error)

UpdateUser updates an existing User in the DB

type Tag

type Tag struct {
	ID               int
	OrganizationUUID uuid.UUID
	Slug             string
	DisplayName      string
	Note             string
	Color            string
	TsCreated        time.Time
	TsUpdated        time.Time
	TsDeleted        time.Time
}

Tag is the representation of a tag in the DB

type Target

type Target struct {
	ID               int
	UUID             uuid.UUID
	OrganizationUUID uuid.UUID
	Address          string
	Note             string
	TsCreated        time.Time
	TsUpdated        time.Time
	TsDeleted        time.Time
}

A Target is the representation of a target in the DB

type TargetProbe

type TargetProbe struct {
	ID                 int
	UUID               uuid.UUID
	TargetUUID         uuid.UUID
	ProbeUUID          uuid.UUID
	OrganizationUUID   uuid.UUID
	StateType          string
	StateConfiguration map[string]interface{}
	TsCreated          time.Time
	TsUpdated          time.Time
	TsDeleted          time.Time
}

TargetProbe is the representation of the target_probe in the DB

type TargetProbeAgent

type TargetProbeAgent struct {
	UUID               uuid.UUID
	OrganizationUUID   uuid.UUID
	AgentUUID          uuid.UUID
	TargetProbeUUID    uuid.UUID
	ProbeLabel         string
	ProbeConfiguration map[string]interface{}
	Schedule           time.Duration
	TsCreated          time.Time
	TsUpdated          time.Time
	TsDeleted          time.Time
}

TargetProbeAgent is a representation of a target_probe_agent in the DB

type User added in v0.9.0

type User struct {
	ID               int
	UUID             uuid.UUID
	OrganizationUUID uuid.UUID
	Email            string
	PasswordSalt     util.Salt
	PasswordHash     util.Hash
	Details          map[string]interface{}
	TsCreated        time.Time
	TsUpdated        time.Time
	TsDeleted        time.Time
}

User is the representation of a user in the DB

Jump to

Keyboard shortcuts

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