pack

package
v0.0.0-...-3faa8e7 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PackNotFoundErr = errors.New("pack not found")

Functions

func DeletePack

func DeletePack(w http.ResponseWriter, r *http.Request)

func GetPack

func GetPack(w http.ResponseWriter, r *http.Request)

func GetPacks

func GetPacks(w http.ResponseWriter, r *http.Request)

func PostPack

func PostPack(w http.ResponseWriter, r *http.Request)

func ScheduleDailyRemovalOfDeadPacksAt

func ScheduleDailyRemovalOfDeadPacksAt(time string, packGracePeriodInSeconds int) (*gocron.Scheduler, chan bool)

* time format should be "HH:MM" i.e. "23:00"

Types

type Command

type Command struct {
	Name   string          `json:"name"`
	Events []string        `json:"events"`
	Links  []httputil.Link `json:"links,omitempty"`
}

type Event

type Event struct {
	Name  string          `json:"name"`
	Links []httputil.Link `json:"links,omitempty"`
}

type Pack

type Pack struct {
	Id       string            `json:"id" bson:"_id"`
	Name     string            `json:"name"`
	Labels   map[string]string `json:"labels,omitempty"`
	Commands []Command         `json:"commands,omitempty"`
	Events   []Event           `json:"events,omitempty"`
	LastSeen time.Time         `json:"lastSeen,omitempty" bson:"lastSeen,omitempty"`
	Links    []httputil.Link   `json:"links,omitempty"`
}

type Repository

type Repository interface {
	Add(pack Pack) error
	Remove(id string) error
	Get(id string) (*Pack, error)
	FindAll() ([]Pack, error)
	RemoveAllOlderThan(date time.Time) (packsRemoved int, err error)
}

Jump to

Keyboard shortcuts

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