Documentation ¶
Index ¶
- Constants
- Variables
- func NewExecutableID(workspace, namespace, name string) string
- func ParseExecutableID(id string) (workspace, namespace, name string)
- func SortedValidVerbs() []string
- func ValidVerbs() []string
- type Aliases
- type Collection
- type CollectionItem
- type DirectoryScopedExecutable
- type Entity
- type ExecExecutableType
- type Executable
- func (e *Executable) AliasesIDs() []string
- func (e *Executable) DefinitionPath() string
- func (e *Executable) ID() string
- func (e *Executable) IsExecutableFromWorkspace(workspace string) bool
- func (e *Executable) IsVisibleFromWorkspace(workspaceFilter string) bool
- func (e *Executable) JSON(pretty bool) (string, error)
- func (e *Executable) Markdown() string
- func (e *Executable) MergeTags(tags Tags)
- func (e *Executable) MergeVisibility(visibility VisibilityType)
- func (e *Executable) NameEquals(name string) bool
- func (e *Executable) Ref() Ref
- func (e *Executable) SetContext(workspaceName, workspacePath, namespace, definitionPath string)
- func (e *Executable) SetDefaults()
- func (e *Executable) Validate() error
- func (e *Executable) WorkspacePath() string
- func (e *Executable) YAML() (string, error)
- type ExecutableDefinition
- type ExecutableDefinitionList
- type ExecutableList
- func (l ExecutableList) FilterByNamespace(ns string) ExecutableList
- func (l ExecutableList) FilterByTags(tags Tags) ExecutableList
- func (l ExecutableList) FilterByVerb(verb Verb) ExecutableList
- func (l ExecutableList) FilterByWorkspace(ws string) ExecutableList
- func (l ExecutableList) FindByVerbAndID(verb Verb, id string) (*Executable, error)
- func (l ExecutableList) Items() []CollectionItem
- func (l ExecutableList) JSON(pretty bool) (string, error)
- func (l ExecutableList) Plural() string
- func (l ExecutableList) Singular() string
- func (l ExecutableList) YAML() (string, error)
- type ExecutableLocationConfig
- type ExecutableTypeSpec
- type GitConfig
- type InteractiveConfig
- type LaunchExecutableType
- type LogMode
- type OutputFormat
- type ParallelExecutableType
- type Parameter
- type ParameterList
- type ParameterizedExecutable
- type Ref
- type RenderExecutableType
- type RequestExecutableType
- type RequestResponseFile
- type SerialExecutableType
- type Tags
- type UserConfig
- type Verb
- type VisibilityType
- type WorkspaceConfig
- func (c *WorkspaceConfig) AssignedName() string
- func (c *WorkspaceConfig) JSON(pretty bool) (string, error)
- func (c *WorkspaceConfig) Location() string
- func (c *WorkspaceConfig) Markdown() string
- func (c *WorkspaceConfig) SetContext(name, location string)
- func (c *WorkspaceConfig) YAML() (string, error)
- type WorkspaceConfigList
Constants ¶
const ( ActivateGroupID = "activate" DeactivateGroupID = "deactivate" LaunchGroupID = "launch" )
const DefaultTimeout = 30 * time.Minute
const (
ReservedEnvVarPrefix = "FLOW_"
)
Variables ¶
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, "edit": LaunchGroupID, "show": LaunchGroupID, "view": LaunchGroupID, "render": LaunchGroupID, "process": LaunchGroupID, "transform": LaunchGroupID, "generate": LaunchGroupID, } )
Functions ¶
func NewExecutableID ¶
func ParseExecutableID ¶
func SortedValidVerbs ¶ added in v0.1.0
func SortedValidVerbs() []string
func ValidVerbs ¶
func ValidVerbs() []string
Types ¶
type Collection ¶ added in v0.1.0
type CollectionItem ¶ added in v0.1.0
type DirectoryScopedExecutable ¶
type DirectoryScopedExecutable struct { // +docsgen:dir // The directory to execute the command in. // If unset, the directory of the executable definition will be used. // If set to `f:tmp`, a temporary directory will be created for the process. // If prefixed with `./`, the path will be relative to the current working directory. // If prefixed with `//`, the path will be relative to the workspace root. // Environment variables in the path will be expended at runtime. Directory string `yaml:"dir"` }
func (*DirectoryScopedExecutable) ExpandDirectory ¶
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"` // +docsgen:type // The type of executable. Only one type can be set. 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) Markdown ¶ added in v0.1.0
func (e *Executable) Markdown() string
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
func (*Executable) YAML ¶ added in v0.1.0
func (e *Executable) YAML() (string, error)
type ExecutableDefinition ¶
type ExecutableDefinition struct { // +docsgen:namespace // The namespace of the executable definition. This is used to group executables together. // If not set, the executables in the definition will be grouped into the root (*) namespace. // Namespaces can be reused across multiple definitions. Namespace string `yaml:"namespace"` Tags Tags `yaml:"tags"` // +docsgen:visibility // The visibility of the executables to Flow. // If not set, the visibility will default to `public`. // // `public` executables can be executed and listed from anywhere. // `private` executables can be executed and listed only within their own workspace. // `internal` executables can be executed within their own workspace but are not listed. // `hidden` executables cannot be executed or listed. Visibility VisibilityType `yaml:"visibility"` // +docsgen:executables // A list of executables to be defined in the executable definition. 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 ¶
func (l *ExecutableDefinitionList) FilterByTag(tag string) ExecutableDefinitionList
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)
func (ExecutableList) Items ¶ added in v0.1.0
func (l ExecutableList) Items() []CollectionItem
func (ExecutableList) JSON ¶ added in v0.1.0
func (l ExecutableList) JSON(pretty bool) (string, error)
func (ExecutableList) Plural ¶ added in v0.1.0
func (l ExecutableList) Plural() string
func (ExecutableList) Singular ¶ added in v0.1.0
func (l ExecutableList) Singular() string
func (ExecutableList) YAML ¶ added in v0.1.0
func (l ExecutableList) YAML() (string, error)
type ExecutableLocationConfig ¶ added in v0.1.0
type ExecutableLocationConfig struct { // +docsgen:included // A list of directories to include in the executable search. Included []string `json:"included,omitempty" yaml:"included,omitempty"` // +docsgen:excluded // A list of directories to exclude from the executable search. Excluded []string `json:"excluded,omitempty" yaml:"excluded,omitempty"` }
type ExecutableTypeSpec ¶
type ExecutableTypeSpec struct { // +docsgen:exec // Standard executable type. Runs a command/file in a subprocess. Exec *ExecExecutableType `yaml:"exec,omitempty"` // +docsgen:launch // Launches an application or opens a URI. Launch *LaunchExecutableType `yaml:"launch,omitempty"` // +docsgen:request // Makes an HTTP request. Request *RequestExecutableType `yaml:"request,omitempty"` // +docsgen:render // Renders a Markdown template with provided data. Requires the Interactive UI. Render *RenderExecutableType `yaml:"render,omitempty"` // +docsgen:serial // Runs a list of executables in serial. Serial *SerialExecutableType `yaml:"serial,omitempty"` // +docsgen:parallel // Runs a list of executables in parallel. Parallel *ParallelExecutableType `yaml:"parallel,omitempty"` }
type InteractiveConfig ¶ added in v0.1.0
type InteractiveConfig struct { Enabled bool `json:"enabled" yaml:"enabled"` // +docsgen:notify // Whether to send a desktop notification when a command completes. NotifyOnCompletion bool `json:"notify" yaml:"notify"` // +docsgen:sound // Whether to play a sound when a command completes. SoundOnCompletion bool `json:"sound" yaml:"sound"` }
type LaunchExecutableType ¶
type LaunchExecutableType struct { ParameterizedExecutable `yaml:",inline"` App string `yaml:"app"` URI string `yaml:"uri"` Wait bool `yaml:"wait"` }
type OutputFormat ¶ added in v0.1.0
type OutputFormat string
const ( JSON OutputFormat = "json" FormattedJSON OutputFormat = "jsonp" YAML OutputFormat = "yaml" UNSET OutputFormat = "" )
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 { // +docsgen:text // A static value to be passed to the executable. Text string `yaml:"text"` // +docsgen:secretRef // A reference to a secret to be passed to the executable. Prompt string `yaml:"prompt"` // +docsgen:prompt // A prompt to be displayed to the user to collect a value to be passed to the executable. SecretRef string `yaml:"secretRef"` // +docsgen:envKey // The name of the environment variable that will be set with the value of the parameter. EnvKey string `yaml:"envKey"` }
+docsgen:param A parameter is a value that can be passed to an executable and all of its sub-executables. Only one of `text`, `secretRef`, or `prompt` must be set. Specifying more than one will result in an error.
type ParameterList ¶
type ParameterList []Parameter
type ParameterizedExecutable ¶
type ParameterizedExecutable struct { // +docsgen:params // List of parameters to pass to the executable. Parameters ParameterList `yaml:"params"` }
type Ref ¶
type Ref string
+docsgen:ref A reference to an executable. The format is `<verb> <workspace>/<namespace>:<executable name>`. For example, `exec ws/ns:my-flow`.
The workspace and namespace are optional. If the workspace is not specified, the current workspace will be used. If the namespace is not specified, the current namespace will be used.
type RenderExecutableType ¶ added in v0.1.0
type RenderExecutableType struct { DirectoryScopedExecutable `yaml:",inline"` ParameterizedExecutable `yaml:",inline"` TemplateFile string `yaml:"templateFile"` TemplateDataFile string `yaml:"templateDataFile"` }
type RequestExecutableType ¶ added in v0.1.0
type RequestExecutableType struct { ParameterizedExecutable `yaml:",inline"` Method string `yaml:"method"` URL string `yaml:"url"` Body string `yaml:"body"` Headers map[string]string `yaml:"headers"` Timeout time.Duration `yaml:"timeout"` ResponseFile *RequestResponseFile `yaml:"responseFile"` TransformResponse string `yaml:"transformResponse"` LogResponse bool `yaml:"logResponse"` ValidStatusCodes []int `yaml:"validStatusCodes"` }
type RequestResponseFile ¶ added in v0.1.0
type RequestResponseFile struct { DirectoryScopedExecutable `yaml:",inline"` Filename string `yaml:"filename"` SaveAs OutputFormat `yaml:"saveAs"` }
type SerialExecutableType ¶
type SerialExecutableType struct { ParameterizedExecutable `yaml:",inline"` // +docsgen:refs // List of executables references ExecutableRefs []Ref `yaml:"refs"` FailFast bool `yaml:"failFast"` }
type Tags ¶
type Tags []string
+docsgen:tags A list of tags. Tags can be used with list commands to filter returned data.
func (Tags) ContextString ¶ added in v0.1.0
func (Tags) PreviewString ¶ added in v0.1.0
type UserConfig ¶
type UserConfig struct { // +docsgen:workspaces // Map of workspace names to their paths. Workspaces map[string]string `json:"workspaces" yaml:"workspaces"` // +docsgen:currentWorkspace // The name of the current workspace. This should match a key in the `workspaces` map. CurrentWorkspace string `json:"currentWorkspace" yaml:"currentWorkspace"` // +docsgen:currentNamespace // The name of the current namespace. This is not required to be set. CurrentNamespace string `json:"currentNamespace" yaml:"currentNamespace"` // +docsgen:interactive // Configurations for the interactive UI. Interactive *InteractiveConfig `json:"interactive" yaml:"interactive"` }
func (*UserConfig) Markdown ¶ added in v0.1.0
func (c *UserConfig) Markdown() string
func (*UserConfig) Validate ¶
func (c *UserConfig) Validate() error
func (*UserConfig) YAML ¶ added in v0.1.0
func (c *UserConfig) YAML() (string, error)
type Verb ¶
type Verb string
+docsgen:verb Keywords that describe the action an executable performs. While executables are configured with a single verb, the verb can be aliased to related verbs. For example, the `exec` verb can replaced with "run" or "start" when referencing an executable. This allows users to use the verb that best describes the action they are performing.
**Activation verbs**: `exec`, `run`, `start`, `install`, `setup` **Deactivation verbs**: `delete`, `remove`, `uninstall`, `teardown`, `destroy` **Launch verbs**: `open`, `launch`, `edit`, `show`, `view`, `render`, `process`, `transform`, `generate`
func RelatedVerbs ¶
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
func (VisibilityType) String ¶ added in v0.1.0
func (v VisibilityType) String() string
type WorkspaceConfig ¶
type WorkspaceConfig struct { // +docsgen:displayName // The display name of the workspace. This is used in the interactive UI. 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 *ExecutableLocationConfig `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) JSON ¶ added in v0.1.0
func (c *WorkspaceConfig) JSON(pretty bool) (string, error)
func (*WorkspaceConfig) Location ¶
func (c *WorkspaceConfig) Location() string
func (*WorkspaceConfig) Markdown ¶ added in v0.1.0
func (c *WorkspaceConfig) Markdown() string
func (*WorkspaceConfig) SetContext ¶
func (c *WorkspaceConfig) SetContext(name, location string)
func (*WorkspaceConfig) YAML ¶ added in v0.1.0
func (c *WorkspaceConfig) YAML() (string, error)
type WorkspaceConfigList ¶ added in v0.1.0
type WorkspaceConfigList []WorkspaceConfig
func (WorkspaceConfigList) Items ¶ added in v0.1.0
func (l WorkspaceConfigList) Items() []CollectionItem
func (WorkspaceConfigList) JSON ¶ added in v0.1.0
func (l WorkspaceConfigList) JSON(pretty bool) (string, error)
func (WorkspaceConfigList) Plural ¶ added in v0.1.0
func (l WorkspaceConfigList) Plural() string
func (WorkspaceConfigList) Singular ¶ added in v0.1.0
func (l WorkspaceConfigList) Singular() string
func (WorkspaceConfigList) YAML ¶ added in v0.1.0
func (l WorkspaceConfigList) YAML() (string, error)