config

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActivateGroupID   = "activate"
	DeactivateGroupID = "deactivate"
	LaunchGroupID     = "launch"
)
View Source
const DefaultTimeout = 30 * time.Minute
View Source
const (
	ReservedEnvVarPrefix = "FLOW_"
)

Variables

View Source
var (
	ValidVerbToGroupID = map[string]string{
		"exec":      ActivateGroupID,
		"run":       ActivateGroupID,
		"start":     ActivateGroupID,
		"install":   ActivateGroupID,
		"setup":     ActivateGroupID,
		"delete":    DeactivateGroupID,
		"remove":    DeactivateGroupID,
		"uninstall": DeactivateGroupID,
		"teardown":  DeactivateGroupID,
		"destroy":   DeactivateGroupID,
		"open":      LaunchGroupID,
		"launch":    LaunchGroupID,
	}

	ValidVerbs = lo.Keys(ValidVerbToGroupID)
)

Functions

func NewExecutableID

func NewExecutableID(workspace, namespace, name string) string

func ParseExecutableID

func ParseExecutableID(id string) (workspace, namespace, name string)

Types

type Aliases

type Aliases []string

func (Aliases) HasAlias

func (a Aliases) HasAlias(alias string) bool

type DirectoryScopedExecutable

type DirectoryScopedExecutable struct {
	Directory string `yaml:"dir"`
	// contains filtered or unexported fields
}

func (*DirectoryScopedExecutable) ExpandDirectory

func (e *DirectoryScopedExecutable) ExpandDirectory(wsPath, execPath string, env map[string]string) (string, error)

func (*DirectoryScopedExecutable) Finalize

func (e *DirectoryScopedExecutable) Finalize()

type ExecExecutableType

type ExecExecutableType struct {
	DirectoryScopedExecutable `yaml:",inline"`
	ParameterizedExecutable   `yaml:",inline"`

	Command string  `yaml:"cmd"`
	File    string  `yaml:"file"`
	LogMode LogMode `yaml:"logMode"`
	// contains filtered or unexported fields
}

func (*ExecExecutableType) GetLogFields

func (e *ExecExecutableType) GetLogFields() map[string]interface{}

func (*ExecExecutableType) SetLogFields

func (e *ExecExecutableType) SetLogFields(fields map[string]interface{})

type Executable

type Executable struct {
	Verb        Verb                `yaml:"verb"`
	Name        string              `yaml:"name"`
	Aliases     []string            `yaml:"aliases"`
	Tags        Tags                `yaml:"tags"`
	Description string              `yaml:"description"`
	Visibility  VisibilityType      `yaml:"visibility"`
	Timeout     time.Duration       `yaml:"timeout"`
	Type        *ExecutableTypeSpec `yaml:"type"`
	// contains filtered or unexported fields
}

func (*Executable) AliasesIDs

func (e *Executable) AliasesIDs() []string

func (*Executable) DefinitionPath

func (e *Executable) DefinitionPath() string

func (*Executable) ID

func (e *Executable) ID() string

func (*Executable) IsExecutableFromWorkspace

func (e *Executable) IsExecutableFromWorkspace(workspace string) bool

IsExecutableFromWorkspace returns true if the executable can be executed from the given workspace.

func (*Executable) IsVisibleFromWorkspace

func (e *Executable) IsVisibleFromWorkspace(workspaceFilter string) bool

IsVisibleFromWorkspace returns true if the executable should be shown in terminal output for the given workspace.

func (*Executable) MergeTags

func (e *Executable) MergeTags(tags Tags)

func (*Executable) MergeVisibility

func (e *Executable) MergeVisibility(visibility VisibilityType)

func (*Executable) NameEquals

func (e *Executable) NameEquals(name string) bool

func (*Executable) Ref

func (e *Executable) Ref() Ref

func (*Executable) SetContext

func (e *Executable) SetContext(workspaceName, workspacePath, namespace, definitionPath string)

func (*Executable) SetDefaults

func (e *Executable) SetDefaults()

func (*Executable) Validate

func (e *Executable) Validate() error

func (*Executable) WorkspacePath

func (e *Executable) WorkspacePath() string

type ExecutableContext

type ExecutableContext struct {
	Workspace          string
	Namespace          string
	WorkspacePath      string
	DefinitionFilePath string
}

type ExecutableDefinition

type ExecutableDefinition struct {
	Namespace   string         `yaml:"namespace"`
	Tags        Tags           `yaml:"tags"`
	Visibility  VisibilityType `yaml:"visibility"`
	Executables ExecutableList `yaml:"executables"`
	// contains filtered or unexported fields
}

func (*ExecutableDefinition) DefinitionPath

func (d *ExecutableDefinition) DefinitionPath() string

func (*ExecutableDefinition) SetContext

func (d *ExecutableDefinition) SetContext(workspaceName, workspacePath, definitionPath string)

func (*ExecutableDefinition) SetDefaults

func (d *ExecutableDefinition) SetDefaults()

func (*ExecutableDefinition) WorkspacePath

func (d *ExecutableDefinition) WorkspacePath() string

type ExecutableDefinitionList

type ExecutableDefinitionList []*ExecutableDefinition

func (*ExecutableDefinitionList) FilterByNamespace

func (l *ExecutableDefinitionList) FilterByNamespace(namespace string) ExecutableDefinitionList

func (*ExecutableDefinitionList) FilterByTag

type ExecutableList

type ExecutableList []*Executable

func (ExecutableList) FilterByNamespace

func (l ExecutableList) FilterByNamespace(ns string) ExecutableList

func (ExecutableList) FilterByTags

func (l ExecutableList) FilterByTags(tags Tags) ExecutableList

func (ExecutableList) FilterByVerb

func (l ExecutableList) FilterByVerb(verb Verb) ExecutableList

func (ExecutableList) FilterByWorkspace

func (l ExecutableList) FilterByWorkspace(ws string) ExecutableList

func (ExecutableList) FindByVerbAndID

func (l ExecutableList) FindByVerbAndID(verb Verb, id string) (*Executable, error)

type ExecutableTypeSpec

type ExecutableTypeSpec struct {
	Exec     *ExecExecutableType     `yaml:"exec,omitempty"`
	Launch   *LaunchExecutableType   `yaml:"launch,omitempty"`
	Serial   *SerialExecutableType   `yaml:"serial,omitempty"`
	Parallel *ParallelExecutableType `yaml:"parallel,omitempty"`
}

type ExecutablesConfig

type ExecutablesConfig struct {
	Included []string `json:"included,omitempty" yaml:"included,omitempty"`
	Excluded []string `json:"excluded,omitempty" yaml:"excluded,omitempty"`
}

type GitConfig

type GitConfig struct {
	Enabled    bool `json:"enabled"              yaml:"enabled"`
	PullOnSync bool `json:"pullOnSync,omitempty" yaml:"pullOnSync,omitempty"`
}

type LaunchExecutableType

type LaunchExecutableType struct {
	ParameterizedExecutable `yaml:",inline"`

	App  string `yaml:"app"`
	URI  string `yaml:"uri"`
	Wait bool   `yaml:"wait"`
}

type LogMode

type LogMode string
const (
	NoLogMode         LogMode = "none"
	StructuredLogMode LogMode = "structured"
	RawLogMode        LogMode = "raw"
)

type ParallelExecutableType

type ParallelExecutableType struct {
	ParameterizedExecutable `yaml:",inline"`

	ExecutableRefs []Ref `yaml:"refs"`
	MaxThreads     int   `yaml:"maxThreads"`
	FailFast       bool  `yaml:"failFast"`
}

type Parameter

type Parameter struct {
	// Only one of text, secretRef, or prompt should be set.
	Text      string `yaml:"text"`
	Prompt    string `yaml:"prompt"`
	SecretRef string `yaml:"secretRef"`

	EnvKey string `yaml:"envKey"`
}

func (*Parameter) Validate

func (p *Parameter) Validate() error

type ParameterList

type ParameterList []Parameter

type ParameterizedExecutable

type ParameterizedExecutable struct {
	Parameters ParameterList `yaml:"params"`
}

type Ref

type Ref string

func NewRef

func NewRef(id string, verb Verb) Ref

func (Ref) Equals

func (r Ref) Equals(other Ref) bool

func (Ref) GetID

func (r Ref) GetID() string

func (Ref) GetVerb

func (r Ref) GetVerb() Verb

func (Ref) String

func (r Ref) String() string

func (Ref) Validate

func (r Ref) Validate() error

type SerialExecutableType

type SerialExecutableType struct {
	ParameterizedExecutable `yaml:",inline"`

	ExecutableRefs []Ref `yaml:"refs"`
	FailFast       bool  `yaml:"failFast"`
}

type Tags

type Tags []string

func (Tags) HasAnyTag

func (t Tags) HasAnyTag(tags Tags) bool

func (Tags) HasTag

func (t Tags) HasTag(tag string) bool

type UserConfig

type UserConfig struct {
	Workspaces       map[string]string `json:"workspaces"       yaml:"workspaces"`
	CurrentWorkspace string            `json:"currentWorkspace" yaml:"currentWorkspace"`
	CurrentNamespace string            `json:"currentNamespace" yaml:"currentNamespace"`
}

func (*UserConfig) Validate

func (c *UserConfig) Validate() error

type Verb

type Verb string

func RelatedVerbs

func RelatedVerbs(verb Verb) []Verb

func (Verb) Equals

func (v Verb) Equals(other Verb) bool

func (Verb) String

func (v Verb) String() string

func (Verb) Validate

func (v Verb) Validate() error

type VisibilityType

type VisibilityType string
const (
	// VisibilityPublic is executable and visible across all workspaces.
	VisibilityPublic VisibilityType = "public"
	// VisibilityPrivate is executable and visible only within it's own workspace.
	VisibilityPrivate VisibilityType = "private"
	// VisibilityInternal is not visible but can be executed within a workspace.
	VisibilityInternal VisibilityType = "internal"
	// VisibilityHidden is not executable or visible.
	VisibilityHidden VisibilityType = "hidden"
)

func (VisibilityType) IsHidden

func (v VisibilityType) IsHidden() bool

func (VisibilityType) IsInternal

func (v VisibilityType) IsInternal() bool

func (VisibilityType) IsPrivate

func (v VisibilityType) IsPrivate() bool

func (VisibilityType) IsPublic

func (v VisibilityType) IsPublic() bool

type WorkspaceConfig

type WorkspaceConfig struct {
	DisplayName string             `json:"displayName"           yaml:"displayName"`
	Description string             `json:"description,omitempty" yaml:"description,omitempty"`
	Tags        Tags               `json:"tags,omitempty"        yaml:"tags,omitempty"`
	Git         *GitConfig         `json:"git,omitempty"         yaml:"git,omitempty"`
	Executables *ExecutablesConfig `json:"executables,omitempty" yaml:"executables,omitempty"`
	// contains filtered or unexported fields
}

func DefaultWorkspaceConfig

func DefaultWorkspaceConfig(name string) *WorkspaceConfig

func (*WorkspaceConfig) AssignedName

func (c *WorkspaceConfig) AssignedName() string

func (*WorkspaceConfig) Location

func (c *WorkspaceConfig) Location() string

func (*WorkspaceConfig) SetContext

func (c *WorkspaceConfig) SetContext(name, location string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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