backend

package
v0.0.0-...-a03849a Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultAuth = Auth{
	TTL: time.Second * 10,
}

Default auth provider.

Functions

func ConfigEnvOrDefault

func ConfigEnvOrDefault(name, defaultValue string) string

func ConnectDB

func ConnectDB(databasePath string) *gorm.DB

func MustGatherExec

func MustGatherExec(gathering *Gathering, db *gorm.DB, archiveFilename string)

func PeriodicalCleanup

func PeriodicalCleanup(maxAgeOption string, db *gorm.DB, runOnceNow bool)

Types

type Auth

type Auth struct {
	// k8s API writer.
	Writer client.Writer
	// Cached token TTL.
	TTL time.Duration
	// contains filtered or unexported fields
}

Authorized by k8s bearer token SAR. Token must have "*" on the cluster, like cluster-admin

func (*Auth) Permit

func (r *Auth) Permit(ctx *gin.Context)

Authenticate token.

type Gathering

type Gathering struct {
	ID          uint      `gorm:"primarykey" json:"id"`
	CreatedAt   time.Time `json:"created-at"`
	UpdatedAt   time.Time `json:"updated-at"`
	AuthToken   string    `json:"-"` // Maybe use hash function to not store the real token
	CustomName  string    `gorm:"index" form:"custom-name" json:"custom-name"`
	Status      string    `json:"status"` // Expected values: new, inprogress, completed, error
	Image       string    `form:"image" json:"image"`
	ImageStream string    `form:"image-stream" json:"image-stream"`
	NodeName    string    `form:"node-name" json:"node-name"`
	Command     string    `form:"command" json:"command"`
	SourceDir   string    `form:"source-dir" json:"source-dir"`
	Timeout     string    `form:"timeout" json:"timeout"`
	Server      string    `form:"server" json:"server"`
	ArchivePath string    `json:"-"` // Not exposed via JSON API
	ArchiveSize uint      `json:"archive-size"`
	ArchiveName string    `json:"archive-name"`
	ExecOutput  string    `json:"exec-output"` // Fields without form:"<name>" cannot be set via API by bind
}

Jump to

Keyboard shortcuts

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