safe

package
v0.6.0-next.7 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2021 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Form

type Form struct {
	Inputs []Input `json:"inputs"`
}

Form is the form that is used for plugins to specify their options.

type Input

type Input struct {
	Name        string    `json:"name"`
	Type        InputType `json:"type"`
	Default     string    `json:"default,omitempty"`
	Label       string    `json:"label"`
	Options     []string  `json:"options,omitempty"`
	Required    bool      `json:"required"`
	Description string    `json:"description,omitempty"`
}

Input is a Form input. The response is tested by go-playground/validate to ensure the input is valid.

type InputType

type InputType int
const (
	// Text is a text input.
	Text InputType = iota

	// Number is a integer input.
	Number

	// List is a single select input.
	List

	// Multiple is a multi-select input.
	Multiple

	// Boolean is a checkbox input.
	Boolean
)

type Task

type Task struct {
	Plugin  string            `json:"plugin" gorm:"<-:create;notnull"`
	Node    string            `json:"node" gorm:"<-:create;notnull"`
	Details map[string]string `json:"details" gorm:"<-:create;"`
}

Task is a safe version of models.Task.

type TaskPluginInterface

type TaskPluginInterface interface {
	// GetCommand returns the command to run the server.
	GetCommand(Task) (string, error)

	// GetInputs returns the inputs that the plugin takes.
	// GetInputs([]byte) ([]byte, error) TODO: add support for customizing inputs based on metadata
	GetInputs() Form
}

TaskPluginInterface defines the interface used by task plugins.

Jump to

Keyboard shortcuts

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