payloads

package
v0.0.0-...-6c6ab93 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionOp

type ActionOp int
const (
	// Reboot the NUC
	OpReboot ActionOp = iota
	// Fetch a file from an internet source
	OpFetch
	// Verify the checksum of a file
	OpVerify
	// Extract a tar archive
	OpExtract
	// Delete files or directories from disk
	OpDelete
	// Execute a command on the NUC
	OpExec
	// Put a file to an internet destination
	OpPut
	// Perform an Update
	OpUpdate
)

type Asset

type Asset struct {
	ID       uint   `gorm:"primaryKey" json:"id"`
	FileName string `json:"file_name"`
	FileType string `json:"file_type"`
	Size     uint   `json:"size"`
	Dst      string `json:"dst"`

	CreatedAt time.Time `json:"created_at"`
}

func (*Asset) Process

func (a *Asset) Process(c *http.Client) error

type DeleteData

type DeleteData struct {
	Path string `json:"path"`
}

type ExecData

type ExecData struct {
	Path string   `json:"path"`
	Args []string `json:"args"`
}

type ExtractData

type ExtractData struct {
	Src string `json:"src"`
	Dst string `json:"dst"`
}

type FetchData

type FetchData struct {
	URL  string `json:"url"`
	Path string `json:"path"`
}

type Ping

type Ping struct {
	MACAddress string      `json:"mac_addr"`
	Version    VersionInfo `json:"version_info"`
	HasErrors  bool        `json:"has_errors"`
}

type PingResponse

type PingResponse struct {
	Actions []ResponseAction `json:"actions,omitempty"`
}

type PutData

type PutData struct {
	URL  string `json:"url"`
	Path string `json:"path"`
}

type ResponseAction

type ResponseAction struct {
	Op ActionOp `json:"op"`
	// This is why we don't just submodule the payloads package
	Data json.RawMessage `json:"data,omitempty"`
}

type UpdateData

type UpdateData struct {
	Version Version `json:"version"`
}

type VerifyData

type VerifyData struct {
	Path     string `json:"path"`
	Checksum []byte `json:"checksum"`
}

type Version

type Version struct {
	ID      uint      `gorm:"primaryKey"`
	Version string    `json:"version"`
	Date    time.Time `json:"date"`
	Assets  []Asset   `json:"assets"`
}

type VersionInfo

type VersionInfo struct {
	Version string    `json:"version"`
	Date    time.Time `json:"date"`
}

Jump to

Keyboard shortcuts

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