types

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: 0BSD Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAPIRouteNotFound     = errors.New("API Route not found")
	ErrAlreadyAccepted      = errors.New("this Sprout ID was already accepted")
	ErrAlreadyDenied        = errors.New("this Sprout ID was already denied")
	ErrAlreadyRejected      = errors.New("this Sprout ID was already rejected")
	ErrAlreadyUnaccepted    = errors.New("this Sprout ID was already unaccepted")
	ErrCannotParseRootCA    = errors.New("cannot load the RootCA certificate")
	ErrDependencyCycleFound = errors.New("found a dependency cycle")
	ErrSproutIDFound        = errors.New("a Sprout ID matching that system has already been recorded")
	ErrSproutIDInvalid      = errors.New("bad user input: invalid SproutID received")
	ErrSproutIDNotFound     = errors.New("a Sprout ID matching that system cannot be found")
	ErrInvalidUserInput     = errors.New("invalid user input was received")

	ErrNotImplemented           = errors.New("this feature is not yet implemented")
	ErrInvalidKeyState          = errors.New("code bug: an invalid key state was supplied")
	ErrConfirmationLengthIsZero = errors.New("code bug: confirmation options muct not be 0-length")

	ErrInvalidMethod  = errors.New("invalid method")
	ErrMissingName    = errors.New("recipe is missing a name")
	ErrMissingSource  = errors.New("recipe is missing a source")
	ErrMissingHash    = errors.New("file is missing a hash")
	ErrCacheFailure   = errors.New("file caching failed")
	ErrMissingContent = errors.New("file is missing content")

	ErrFileNotFound  = errors.New("file not found")
	ErrHashMismatch  = errors.New("file hash mismatch")
	ErrDeleteRoot    = errors.New("cannot delete root directory")
	ErrModifyRoot    = errors.New("cannot modify root directory")
	ErrMissingTarget = errors.New("target is missing")
	ErrPathNotFound  = errors.New("path not found")
)

Functions

This section is empty.

Types

type Ack added in v0.0.5

type Ack struct {
	Acknowledged bool
	JobID        string
}

type CmdCook added in v0.0.3

type CmdCook struct {
	Async   bool          `json:"async"`
	Env     string        `json:"env"`
	Recipe  RecipeName    `json:"recipe"`
	Test    bool          `json:"test"`
	Timeout time.Duration `json:"timeout"`

	Errors map[string]error `json:"errors"`
	JID    string           `json:"jid"`
}

type CmdRun

type CmdRun struct {
	Command string        `json:"command"`
	Args    []string      `json:"args"`
	Path    string        `json:"path"` // path is prepended to the command's normal path
	CWD     string        `json:"cwd"`
	RunAs   string        `json:"runas"`
	Env     EnvVar        `json:"env"`
	Timeout time.Duration `json:"timeout"`

	Stdout   string        `json:"stdout"`
	Stderr   string        `json:"stderr"`
	Duration time.Duration `json:"duration"`
	ErrCode  int           `json:"errcode"`

	Error error `json:"error"`
}

type CombinedVersion added in v0.0.3

type CombinedVersion struct {
	CLI    Version `json:"cli"`
	Farmer Version `json:"farmer"`
	Error  string  `json:"error"`
}

type CompletionStatus added in v0.0.13

type CompletionStatus int
const (
	StepNotStarted CompletionStatus = iota
	StepInProgress
	StepCompleted
	StepFailed
)

type CookSummary added in v0.0.13

type CookSummary struct {
	Succeeded int
	Failures  int
	Changed   int
	Notes     []fmt.Stringer
}

type EnvVar

type EnvVar map[string]string

type Executor added in v0.0.13

type Executor struct {
	PubKey string
}

type FilePath added in v0.0.3

type FilePath struct {
	Name string `json:"name"`
}

type FileProvider added in v0.0.5

type FileProvider interface {
	Download(context.Context) error
	Properties() (map[string]interface{}, error)
	Parse(id, source, destination, hash string, properties map[string]interface{}) (FileProvider, error)
	Protocols() []string
	Verify(context.Context) (bool, error)
}

type Function added in v0.0.3

type Function string

type Ingredient added in v0.0.3

type Ingredient string

type Inline

type Inline struct {
	Success bool  `json:"success"`
	Error   error `json:"error"`
}

type Job added in v0.0.13

type Job struct {
	JID     string   `json:"jid"`
	ID      string   `json:"id"`
	Results []Result `json:"results"`
	Sprout  string   `json:"sprout"`
	Summary Summary  `json:"summary"`
}

type KeyManager

type KeyManager struct {
	SproutID string `json:"id"`
}

type KeySet

type KeySet struct {
	Sprouts []KeyManager `json:"sprouts"`
}

type KeySubmission

type KeySubmission struct {
	NKey     string `json:"nkey"`
	SproutID string `json:"id"`
}

type KeysByType

type KeysByType struct {
	Accepted   KeySet `json:"accepted,omitempty"`
	Denied     KeySet `json:"denied,omitempty"`
	Rejected   KeySet `json:"rejected,omitempty"`
	Unaccepted KeySet `json:"unaccepted,omitempty"`
}

type PingPong

type PingPong struct {
	Ping  bool  `json:"ping"`
	Pong  bool  `json:"pong"`
	Error error `json:"error"`
}

type RecipeCooker added in v0.0.3

type RecipeCooker interface {
	Apply(context.Context) (Result, error)
	Test(context.Context) (Result, error)
	Properties() (map[string]interface{}, error)
	Parse(id, method string, properties map[string]interface{}) (RecipeCooker, error)
	Methods() (string, []string)
	PropertiesForMethod(method string) (map[string]string, error)
}

type RecipeEnvelope added in v0.0.5

type RecipeEnvelope struct {
	JobID string
	Steps []Step
	Test  bool
}

type RecipeName added in v0.0.3

type RecipeName string

type ReqType added in v0.0.3

type ReqType string
const (
	OnChanges ReqType = "onchanges"
	OnFail    ReqType = "onfail"
	Require   ReqType = "require"

	OnChangesAny ReqType = "onchanges_any"
	OnFailAny    ReqType = "onfail_any"
	RequireAny   ReqType = "require_any"
)

type Requisite added in v0.0.3

type Requisite struct {
	Condition ReqType
	StepIDs   []StepID
	Steps     []*Step
}

func (Requisite) Equals added in v0.0.3

func (r Requisite) Equals(other Requisite) bool

type RequisiteSet added in v0.0.3

type RequisiteSet []Requisite

func (RequisiteSet) AllIDs added in v0.0.3

func (r RequisiteSet) AllIDs() []StepID

func (RequisiteSet) AllSteps added in v0.0.3

func (r RequisiteSet) AllSteps() []*Step

func (RequisiteSet) Equals added in v0.0.3

func (r RequisiteSet) Equals(other RequisiteSet) bool

type Result added in v0.0.3

type Result struct {
	Succeeded bool
	Failed    bool
	Changed   bool
	Notes     []fmt.Stringer
}

type ServiceProvider added in v0.0.5

type ServiceProvider interface {
	Properties() (map[string]interface{}, error)
	Parse(id, method string, properties map[string]interface{}) (ServiceProvider, error)

	Start(context.Context) error
	Stop(context.Context) error
	Status(context.Context) (string, error)

	Enable(context.Context) error
	Disable(context.Context) error
	IsEnabled(context.Context) (bool, error)

	IsRunning(context.Context) (bool, error)
	Restart(context.Context) error

	Mask(context.Context) error
	Unmask(context.Context) error
	IsMasked(context.Context) (bool, error)

	InitName() string
	IsInit() bool
}

type SimpleNote added in v0.0.5

type SimpleNote string

func Snprintf added in v0.0.5

func Snprintf(format string, a ...any) SimpleNote

func (SimpleNote) String added in v0.0.5

func (s SimpleNote) String() string

type SproutStepCompletion added in v0.0.13

type SproutStepCompletion struct {
	SproutID      string
	CompletedStep StepCompletion
}

type Startup

type Startup struct {
	Version  Version `json:"version"`
	SproutID string  `json:"id"`
}

type Step added in v0.0.3

type Step struct {
	Ingredient  Ingredient `json:"ingredient" yaml:"ingredient"`
	Method      string     `json:"method" yaml:"method"`
	ID          StepID
	Requisites  RequisiteSet
	Properties  map[string]interface{}
	IsRequisite bool
}

type StepCompletion added in v0.0.13

type StepCompletion struct {
	ID               StepID
	CompletionStatus CompletionStatus
	ChangesMade      bool
	Changes          []string
	Error            error
}

type StepID added in v0.0.3

type StepID string

type Summary added in v0.0.5

type Summary struct {
	Succeeded  int
	InProgress bool
	Failures   int
	Changes    int
	Errors     []error
}

type TargetedAction

type TargetedAction struct {
	Target []KeyManager `json:"target"`
	Action interface{}  `json:"action"`
}

type TargetedResults

type TargetedResults struct {
	Results map[string]interface{} `json:"results,omitempty"`
}

type Targets added in v0.0.3

type Targets []StepID

type TriggerMsg added in v0.0.13

type TriggerMsg struct {
	JID string `json:"jid"`
}

type Version

type Version struct {
	Arch      string `json:"arch"`
	Compiler  string `json:"compiler"`
	GitCommit string `json:"git_commit"`
	Tag       string `json:"tag"`
}

Jump to

Keyboard shortcuts

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