objects

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Docs added in v0.0.8

type Docs []Docstub

func (*Docs) Get added in v0.0.8

func (d *Docs) Get(element string) (gondulapi.Report, error)

type Docstub added in v0.0.8

type Docstub struct {
	Family           *string
	Shortname        *string
	Name             *string
	Sequence         *int
	Content          *string
	*auth.ReadPublic `column:"-"`
}

func (*Docstub) Get added in v0.0.8

func (ds *Docstub) Get(element string) (gondulapi.Report, error)

func (Docstub) Post added in v0.0.8

func (ds Docstub) Post() (gondulapi.Report, error)

func (Docstub) Put added in v0.0.8

func (ds Docstub) Put(element string) (gondulapi.Report, error)

type Oplog added in v0.0.8

type Oplog struct {
	Id       *int
	Time     *time.Time
	Systems  *string
	Username *string
	Log      *string
}

Oplog is a single oplog entry. It can be created with POST, or updated with PUT referencing the id.

func (Oplog) Delete added in v0.0.8

func (o Oplog) Delete(element string) (gondulapi.Report, error)

Delete the switch

func (*Oplog) Get added in v0.0.8

func (o *Oplog) Get(element string) (gondulapi.Report, error)

func (Oplog) Post added in v0.0.8

func (o Oplog) Post() (gondulapi.Report, error)

func (Oplog) Put added in v0.0.8

func (o Oplog) Put(element string) (gondulapi.Report, error)

type Oplogs added in v0.0.8

type Oplogs []Oplog

Oplogs is an array of oplog entries, and can only be fetched (with Get).

func (*Oplogs) Get added in v0.0.8

func (os *Oplogs) Get(element string) (gondulapi.Report, error)

Get multiple switches. Relies on s being a pointer to an array of structs (which it is).

type StationTests added in v0.0.8

type StationTests []Test

StationTests is an array of tests associated with a single station (and track). It is used for reading all status entries for a single station. In the future, it might support Delete() to clear all status for a station.

func (*StationTests) Get added in v0.0.8

func (st *StationTests) Get(element string) (gondulapi.Report, error)

Get an array of tests associated with a station, uses the url path /test/track/$TRACKID/station/$STATIONID for readability.

type Switch added in v0.0.8

type Switch struct {
	Sysname       *string
	MgmtIP4       *types.IP  `column:"mgmt_v4_addr"`
	MgmtIP6       *types.IP  `column:"mgmt_v6_addr"`
	LastUpdated   *time.Time `column:"last_updated"`
	PollFrequency *string    `column:"poll_frequency"`
	Locked        *bool
	Deleted       *bool
	DistroName    *string `column:"distro_name"`
	DistroPhyPort *string `column:"distro_phy_port"`
	Tags          *types.Jsonb
	Community     *string
	TrafficVlan   *int `column:"traffic_vlan"`
	MgmtVlan      *int `column:"mgmt_vlan"`
	Placement     *types.Box
}

Switch represents a single switch, or box. It can be updated in bulk or singular.

func (Switch) Delete added in v0.0.8

func (s Switch) Delete(element string) (gondulapi.Report, error)

Delete the switch

func (*Switch) Get added in v0.0.8

func (s *Switch) Get(element string) (gondulapi.Report, error)

Get a single switch from the database and return it. db.Get is a convenience that returns 404 if it doesn't exist and 400 if element is blank.

func (Switch) Post added in v0.0.8

func (s Switch) Post() (gondulapi.Report, error)

Post will either update or insert a switch entirely contained in the provided object. For switches, it's the same as Put without an element.

func (Switch) Put added in v0.0.8

func (s Switch) Put(element string) (gondulapi.Report, error)

Put will update or add a provided switch. If the name on the url and the one contained in the data doesn't match, the switch will be renamed from what's on the url to what's in the data.

type Switches added in v0.0.8

type Switches []Switch

Switches is the slice-variant of Switch, allowing us to return and parse an array of switches.

func (*Switches) Get added in v0.0.8

func (s *Switches) Get(element string) (gondulapi.Report, error)

Get multiple switches. Relies on s being a pointer to an array of structs (which it is).

func (Switches) Post added in v0.0.8

func (s Switches) Post() (gondulapi.Report, error)

Post all the provided switches in bulk.

type Test added in v0.0.8

type Test struct {
	Track            *string
	Station          *int
	Hash             *string      // Hash is a unique identifier for a single test, defined by the poster. Typically a sha-sum of the title. The key for a single test is, thus, track/station/hash
	Title            *string      // Short title
	Time             *time.Time   // Update time. Can be left empty on PUT/POST (updated by triggers)
	Description      *string      // Longer description for the test
	Status           *string      // Actual status-result. Should probably be OK / WARN/ FAIL or something (to be defined)
	Participant      *string      // Participant ID... somewhat legacy. Might be removed.
	Seq              *int         // Sorting ID
	*auth.ReadPublic `column:"-"` // Authentication enforced for writes, not reads.
	// contains filtered or unexported fields
}

Test is a single test(result), with all relevant descriptions. It is used mainly for writes, but can be Get() from as well - because why not.

func (Test) Delete added in v0.0.8

func (t Test) Delete(element string) (gondulapi.Report, error)

Delete all tests that match the url (which SHOULD be just one)

func (*Test) Get added in v0.0.8

func (t *Test) Get(element string) (gondulapi.Report, error)

Get a single test

func (Test) Post added in v0.0.8

func (t Test) Post() (gondulapi.Report, error)

Post a single test - Also uses upsert, but ignores the URL and requires all fields to be present in the data instead.

func (Test) Put added in v0.0.8

func (t Test) Put(element string) (gondulapi.Report, error)

Put a single test - uses upsert: if it exists, it is updated, if it doesn't it is added.

Jump to

Keyboard shortcuts

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