executable

package
v1.1.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	WildcardNamespace = "*"
	WildcardWorkspace = "*"
)
View Source
const (
	ExecutionGroupID = "execute"
	RetrievalGroupID = "retrieve"
	ViewGroupID      = "view"
	ConfigGroupID    = "config"
	UpdateGroupID    = "update"
)
View Source
const FlowFileExt = ".flow"
View Source
const FlowFileTemplateExt = ".flow.tmpl"
View Source
const (
	ReservedEnvVarPrefix = "FLOW_"
)
View Source
const TimeoutOverrideEnv = "FLOW_DEFAULT_TIMEOUT"
View Source
const (
	TmpDirLabel = "f:tmp"
)

Variables

View Source
var (
	DefaultVerbAliasGroup = map[Verb]string{
		VerbExec:    ExecutionGroupID,
		VerbRun:     ExecutionGroupID,
		VerbExecute: ExecutionGroupID,

		VerbRetrieve: RetrievalGroupID,
		VerbFetch:    RetrievalGroupID,
		VerbGet:      RetrievalGroupID,

		VerbView: ViewGroupID,
		VerbShow: ViewGroupID,
		VerbList: ViewGroupID,

		VerbSetup:     ConfigGroupID,
		VerbConfigure: ConfigGroupID,

		VerbUpdate:  UpdateGroupID,
		VerbUpgrade: UpdateGroupID,
	}
)
View Source
var FlowFileExtRegex = regexp.MustCompile(fmt.Sprintf(`%s(\.yaml|\.yml)?$`, regexp.QuoteMeta(FlowFileExt)))
View Source
var FlowFileTemplateExtRegex = regexp.MustCompile(fmt.Sprintf(`%s(\.yaml|\.yml)?$`, regexp.QuoteMeta(FlowFileTemplateExt)))

Functions

func HasFlowFileExt

func HasFlowFileExt(file string) bool

func HasFlowFileTemplateExt

func HasFlowFileTemplateExt(file string) bool

func MustParseExecutableID

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

func NewExecutableID

func NewExecutableID(workspace, namespace, name string) string

func SortedValidVerbs

func SortedValidVerbs() []string

Types

type Argument

type Argument struct {
	// The default value to use if the argument is not provided.
	// If the argument is required and no default is provided, the executable will
	// fail.
	//
	Default string `json:"default,omitempty" yaml:"default,omitempty" mapstructure:"default,omitempty"`

	// The name of the environment variable that will be assigned the value.
	EnvKey string `json:"envKey,omitempty" yaml:"envKey,omitempty" mapstructure:"envKey,omitempty"`

	// The flag to use when setting the argument from the command line.
	// Either `flag` or `pos` must be set, but not both.
	//
	Flag string `json:"flag,omitempty" yaml:"flag,omitempty" mapstructure:"flag,omitempty"`

	// A path where the argument value will be temporarily written to disk.
	// The file will be created before execution and cleaned up afterwards.
	//
	OutputFile string `json:"outputFile,omitempty" yaml:"outputFile,omitempty" mapstructure:"outputFile,omitempty"`

	// The position of the argument in the command line ArgumentList. Values start at
	// 1.
	// Either `flag` or `pos` must be set, but not both.
	//
	Pos *int `json:"pos,omitempty" yaml:"pos,omitempty" mapstructure:"pos,omitempty"`

	// If the argument is required, the executable will fail if the argument is not
	// provided.
	// If the argument is not required, the default value will be used if the argument
	// is not provided.
	//
	Required bool `json:"required,omitempty" yaml:"required,omitempty" mapstructure:"required,omitempty"`

	// The type of the argument. This is used to determine how to parse the value of
	// the argument.
	Type ArgumentType `json:"type,omitempty" yaml:"type,omitempty" mapstructure:"type,omitempty"`
	// contains filtered or unexported fields
}

func (*Argument) Set

func (a *Argument) Set(value string)

func (*Argument) Validate

func (a *Argument) Validate() error

func (*Argument) ValidateValue

func (a *Argument) ValidateValue() error

func (*Argument) Value

func (a *Argument) Value() string

type ArgumentList

type ArgumentList []Argument

func (*ArgumentList) Flags added in v1.0.3

func (al *ArgumentList) Flags() []string

func (*ArgumentList) Validate

func (al *ArgumentList) Validate() error

func (*ArgumentList) ValidateValues

func (al *ArgumentList) ValidateValues() error

type ArgumentType

type ArgumentType string
const ArgumentTypeBool ArgumentType = "bool"
const ArgumentTypeFloat ArgumentType = "float"
const ArgumentTypeInt ArgumentType = "int"
const ArgumentTypeString ArgumentType = "string"

type Artifact

type Artifact struct {
	// If true, the artifact will be copied as a template file. The file will be
	// rendered using Go templating from
	// the form data. [Expr language
	// functions](https://expr-lang.org/docs/language-definition) are available for
	// use in the template.
	//
	AsTemplate bool `json:"asTemplate,omitempty" yaml:"asTemplate,omitempty" mapstructure:"asTemplate,omitempty"`

	// The directory to copy the file to. If not set, the file will be copied to the
	// root of the flow file directory.
	// The directory will be created if it does not exist.
	//
	DstDir string `json:"dstDir,omitempty" yaml:"dstDir,omitempty" mapstructure:"dstDir,omitempty"`

	// The name of the file to copy to. If not set, the file will be copied with the
	// same name.
	DstName string `json:"dstName,omitempty" yaml:"dstName,omitempty" mapstructure:"dstName,omitempty"`

	// An expression that determines whether the the artifact should be copied, using
	// the Expr language syntax.
	// The expression is evaluated at runtime and must resolve to a boolean value. If
	// the condition is not met,
	// the artifact will not be copied.
	//
	// The expression has access to OS/architecture information (os, arch),
	// environment variables (env), form input
	// (form), and context information (name, workspace, directory, etc.).
	//
	// See the [flow documentation](https://flowexec.io/guide/templating) for more
	// information.
	//
	If string `json:"if,omitempty" yaml:"if,omitempty" mapstructure:"if,omitempty"`

	// The directory to copy the file from.
	// If not set, the file will be copied from the directory of the template file.
	//
	SrcDir string `json:"srcDir,omitempty" yaml:"srcDir,omitempty" mapstructure:"srcDir,omitempty"`

	// The name of the file to copy.
	SrcName string `json:"srcName" yaml:"srcName" mapstructure:"srcName"`
}

File source and destination configuration. Go templating from form data is supported in all fields.

type Directory

type Directory string

The directory to execute the command in. If unset, the directory of the flow file 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.

func (Directory) ExpandDirectory

func (e Directory) ExpandDirectory(
	wsPath, execPath, processTmpDir string,
	env map[string]string,
) (dir string, isTmpDir bool, err error)

type ExecExecutableType

type ExecExecutableType struct {
	// Args corresponds to the JSON schema field "args".
	Args ArgumentList `json:"args,omitempty" yaml:"args,omitempty" mapstructure:"args,omitempty"`

	// The command to execute.
	// Only one of `cmd` or `file` must be set.
	//
	Cmd string `json:"cmd,omitempty" yaml:"cmd,omitempty" mapstructure:"cmd,omitempty"`

	// Dir corresponds to the JSON schema field "dir".
	Dir Directory `json:"dir,omitempty" yaml:"dir,omitempty" mapstructure:"dir,omitempty"`

	// The file to execute.
	// Only one of `cmd` or `file` must be set.
	//
	File string `json:"file,omitempty" yaml:"file,omitempty" mapstructure:"file,omitempty"`

	// The log mode to use when running the executable.
	// This can either be `hidden`, `json`, `logfmt` or `text`
	//
	LogMode io.LogMode `json:"logMode,omitempty" yaml:"logMode,omitempty" mapstructure:"logMode,omitempty"`

	// Params corresponds to the JSON schema field "params".
	Params ParameterList `json:"params,omitempty" yaml:"params,omitempty" mapstructure:"params,omitempty"`
	// contains filtered or unexported fields
}

Standard executable type. Runs a command/file in a subprocess.

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 {
	// Aliases corresponds to the JSON schema field "aliases".
	Aliases ExecutableAliases `json:"aliases,omitempty" yaml:"aliases,omitempty" mapstructure:"aliases,omitempty"`

	// A description of the executable.
	// This description is rendered as markdown in the interactive UI.
	//
	Description string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description,omitempty"`

	// Exec corresponds to the JSON schema field "exec".
	Exec *ExecExecutableType `json:"exec,omitempty" yaml:"exec,omitempty" mapstructure:"exec,omitempty"`

	// Launch corresponds to the JSON schema field "launch".
	Launch *LaunchExecutableType `json:"launch,omitempty" yaml:"launch,omitempty" mapstructure:"launch,omitempty"`

	// An optional name for the executable.
	//
	// Name is used to reference the executable in the CLI using the format
	// `workspace/namespace:name`.
	// [Verb group + Name] must be unique within the namespace of the workspace.
	//
	Name string `json:"name,omitempty" yaml:"name,omitempty" mapstructure:"name,omitempty"`

	// Parallel corresponds to the JSON schema field "parallel".
	Parallel *ParallelExecutableType `json:"parallel,omitempty" yaml:"parallel,omitempty" mapstructure:"parallel,omitempty"`

	// Render corresponds to the JSON schema field "render".
	Render *RenderExecutableType `json:"render,omitempty" yaml:"render,omitempty" mapstructure:"render,omitempty"`

	// Request corresponds to the JSON schema field "request".
	Request *RequestExecutableType `json:"request,omitempty" yaml:"request,omitempty" mapstructure:"request,omitempty"`

	// Serial corresponds to the JSON schema field "serial".
	Serial *SerialExecutableType `json:"serial,omitempty" yaml:"serial,omitempty" mapstructure:"serial,omitempty"`

	// Tags corresponds to the JSON schema field "tags".
	Tags ExecutableTags `json:"tags,omitempty" yaml:"tags,omitempty" mapstructure:"tags,omitempty"`

	// The maximum amount of time the executable is allowed to run before being
	// terminated.
	// The timeout is specified in Go duration format (e.g. 30s, 5m, 1h).
	//
	Timeout *time.Duration `json:"timeout,omitempty" yaml:"timeout,omitempty" mapstructure:"timeout,omitempty"`

	// Verb corresponds to the JSON schema field "verb".
	Verb Verb `json:"verb" yaml:"verb" mapstructure:"verb"`

	// A list of aliases for the verb. This allows the executable to be referenced
	// with multiple verbs.
	VerbAliases []Verb `json:"verbAliases,omitempty" yaml:"verbAliases,omitempty" mapstructure:"verbAliases,omitempty"`

	// Visibility corresponds to the JSON schema field "visibility".
	Visibility *ExecutableVisibility `json:"visibility,omitempty" yaml:"visibility,omitempty" mapstructure:"visibility,omitempty"`
	// contains filtered or unexported fields
}

The executable schema defines the structure of an executable in the Flow CLI. Executables are the building blocks of workflows and are used to define the actions that can be performed in a workspace.

func (*Executable) AliasesIDs

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

func (*Executable) Env

func (*Executable) FlowFilePath

func (e *Executable) FlowFilePath() string

func (*Executable) ID

func (e *Executable) ID() string

func (*Executable) IsExecutableFromWorkspace

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

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

func (*Executable) IsVisibleFromWorkspace

func (e *Executable) IsVisibleFromWorkspace(workspaceFilter string, visibilityFilter common.Visibility) bool

IsVisibleFromWorkspace returns true if the executable should be shown in the UI for the given workspace and visibility filter.

func (*Executable) JSON

func (e *Executable) JSON() (string, error)

func (*Executable) Markdown

func (e *Executable) Markdown() string

func (*Executable) MarshalJSON

func (e *Executable) MarshalJSON() ([]byte, error)

MarshalJSON is used to handle the custom marshaling of the Executable type. It enriches the Executable with additional fields for YAML and JSON output, and also handles the timeout field as a string for better readability in the output.

func (*Executable) MergeTags

func (e *Executable) MergeTags(tags common.Tags)

func (*Executable) NameEquals

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

func (*Executable) Namespace

func (e *Executable) Namespace() string

func (*Executable) Ref

func (e *Executable) Ref() Ref

func (*Executable) SetContext

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

func (*Executable) SetDefaults

func (e *Executable) SetDefaults()

func (*Executable) SetInheritedFields

func (e *Executable) SetInheritedFields(flowFile *FlowFile)

func (*Executable) UnmarshalJSON

func (e *Executable) UnmarshalJSON(data []byte) error

UnmarshalJSON is used to handle the custom unmarshaling of the Executable type. It parses the timeout field from a string to a time.Duration, allowing for more flexible input formats in JSON.

func (*Executable) Validate

func (e *Executable) Validate() error

func (*Executable) Workspace

func (e *Executable) Workspace() string

func (*Executable) WorkspacePath

func (e *Executable) WorkspacePath() string

func (*Executable) YAML

func (e *Executable) YAML() (string, error)

type ExecutableAliases

type ExecutableAliases common.Aliases

type ExecutableEnvironment

type ExecutableEnvironment struct {
	Params ParameterList `json:"params" yaml:"params"`
	Args   ArgumentList  `json:"args"   yaml:"args"`
}

type ExecutableList

type ExecutableList []*Executable

func (ExecutableList) FilterByNamespace

func (l ExecutableList) FilterByNamespace(ns string) ExecutableList

func (ExecutableList) FilterBySubstring

func (l ExecutableList) FilterBySubstring(str string) ExecutableList

func (ExecutableList) FilterByTags

func (l ExecutableList) FilterByTags(tags common.Tags) ExecutableList

func (ExecutableList) FilterByVerb

func (l ExecutableList) FilterByVerb(verb Verb) ExecutableList

func (ExecutableList) FilterByWorkspace

func (l ExecutableList) FilterByWorkspace(ws string) ExecutableList

func (ExecutableList) FilterByWorkspaceWithVisibility added in v1.1.1

func (l ExecutableList) FilterByWorkspaceWithVisibility(ws string, vis common.Visibility) ExecutableList

func (ExecutableList) FindByVerbAndID

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

func (ExecutableList) Items

func (l ExecutableList) Items() []*types.EntityInfo

func (ExecutableList) JSON

func (l ExecutableList) JSON() (string, error)

func (ExecutableList) Plural

func (l ExecutableList) Plural() string

func (ExecutableList) Singular

func (l ExecutableList) Singular() string

func (ExecutableList) YAML

func (l ExecutableList) YAML() (string, error)

type ExecutableTags

type ExecutableTags common.Tags

type ExecutableVisibility

type ExecutableVisibility common.Visibility

type Field

type Field struct {
	// The default value to use if a value is not set.
	Default string `json:"default,omitempty" yaml:"default,omitempty" mapstructure:"default,omitempty"`

	// A description of the field.
	Description string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description,omitempty"`

	// The group to display the field in. Fields with the same group will be displayed
	// together.
	Group int `json:"group,omitempty" yaml:"group,omitempty" mapstructure:"group,omitempty"`

	// The key to associate the data with. This is used as the key in the template
	// data map.
	Key string `json:"key" yaml:"key" mapstructure:"key"`

	// A prompt to be displayed to the user when collecting an input value.
	Prompt string `json:"prompt" yaml:"prompt" mapstructure:"prompt"`

	// If true, a value must be set. If false, the default value will be used if a
	// value is not set.
	Required bool `json:"required,omitempty" yaml:"required,omitempty" mapstructure:"required,omitempty"`

	// The type of input field to display.
	Type FieldType `json:"type,omitempty" yaml:"type,omitempty" mapstructure:"type,omitempty"`

	// A regular expression to validate the input value against.
	Validate string `json:"validate,omitempty" yaml:"validate,omitempty" mapstructure:"validate,omitempty"`
	// contains filtered or unexported fields
}

A field to be displayed to the user when generating a flow file from a template.

func (*Field) Set

func (f *Field) Set(value string)

func (*Field) ValidateConfig

func (f *Field) ValidateConfig() error

func (*Field) Value

func (f *Field) Value() string

type FieldType

type FieldType string
const FieldTypeConfirm FieldType = "confirm"
const FieldTypeMasked FieldType = "masked"
const FieldTypeMultiline FieldType = "multiline"
const FieldTypeText FieldType = "text"

type FlowFile

type FlowFile struct {

	// A description of the executables defined within the flow file. This description
	// will used as a shared description
	// for all executables in the flow file.
	//
	Description string `json:"description,omitempty" yaml:"description,omitempty" mapstructure:"description,omitempty"`

	// A path to a markdown file that contains the description of the executables
	// defined within the flow file.
	DescriptionFile string `json:"descriptionFile,omitempty" yaml:"descriptionFile,omitempty" mapstructure:"descriptionFile,omitempty"`

	// Executables corresponds to the JSON schema field "executables".
	Executables ExecutableList `json:"executables,omitempty" yaml:"executables,omitempty" mapstructure:"executables,omitempty"`

	// DEPRECATED: Use `imports` instead
	FromFile FromFile `json:"fromFile,omitempty" yaml:"fromFile,omitempty" mapstructure:"fromFile,omitempty"`

	// Imports corresponds to the JSON schema field "imports".
	Imports FromFile `json:"imports,omitempty" yaml:"imports,omitempty" mapstructure:"imports,omitempty"`

	// The namespace to be given to all executables in the flow file.
	// If not set, the executables in the file will be grouped into the root (*)
	// namespace.
	// Namespaces can be reused across multiple flow files.
	//
	// Namespaces are used to reference executables in the CLI using the format
	// `workspace:namespace/name`.
	//
	Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty" mapstructure:"namespace,omitempty"`

	// Tags to be applied to all executables defined within the flow file.
	Tags []string `json:"tags,omitempty" yaml:"tags,omitempty" mapstructure:"tags,omitempty"`

	// Visibility corresponds to the JSON schema field "visibility".
	Visibility *FlowFileVisibility `json:"visibility,omitempty" yaml:"visibility,omitempty" mapstructure:"visibility,omitempty"`
	// contains filtered or unexported fields
}

Configuration for a group of Flow CLI executables. The file must have the extension `.flow`, `.flow.yaml`, or `.flow.yml` in order to be discovered by the CLI. It's configuration is used to define a group of executables with shared metadata (namespace, tags, etc). A workspace can have multiple flow files located anywhere in the workspace directory

func (*FlowFile) ConfigPath

func (f *FlowFile) ConfigPath() string

func (*FlowFile) SetContext

func (f *FlowFile) SetContext(workspaceName, workspacePath, configPath string)

func (*FlowFile) SetDefaults

func (f *FlowFile) SetDefaults()

func (*FlowFile) WorkspacePath

func (f *FlowFile) WorkspacePath() string

func (*FlowFile) YAML

func (f *FlowFile) YAML() (string, error)

type FlowFileList

type FlowFileList []*FlowFile

func (*FlowFileList) FilterByNamespace

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

func (*FlowFileList) FilterByTag

func (l *FlowFileList) FilterByTag(tag string) FlowFileList

type FlowFileVisibility

type FlowFileVisibility common.Visibility

type FormFields

type FormFields []*Field

func (FormFields) Set

func (f FormFields) Set(key, value string)

func (FormFields) Validate

func (f FormFields) Validate() error

func (FormFields) ValueMap

func (f FormFields) ValueMap() map[string]string

type FromFile

type FromFile []string

A list of `.sh` files to convert into generated executables in the file's executable group.

type LaunchExecutableType

type LaunchExecutableType struct {
	// The application to launch the URI with.
	App string `json:"app,omitempty" yaml:"app,omitempty" mapstructure:"app,omitempty"`

	// Args corresponds to the JSON schema field "args".
	Args ArgumentList `json:"args,omitempty" yaml:"args,omitempty" mapstructure:"args,omitempty"`

	// Params corresponds to the JSON schema field "params".
	Params ParameterList `json:"params,omitempty" yaml:"params,omitempty" mapstructure:"params,omitempty"`

	// The URI to launch. This can be a file path or a web URL.
	URI string `json:"uri" yaml:"uri" mapstructure:"uri"`
}

Launches an application or opens a URI.

type ParallelExecutableType

type ParallelExecutableType struct {
	// Args corresponds to the JSON schema field "args".
	Args ArgumentList `json:"args,omitempty" yaml:"args,omitempty" mapstructure:"args,omitempty"`

	// Dir corresponds to the JSON schema field "dir".
	Dir Directory `json:"dir,omitempty" yaml:"dir,omitempty" mapstructure:"dir,omitempty"`

	// A list of executables to run in parallel.
	// Each executable can be a command or a reference to another executable.
	//
	Execs ParallelRefConfigList `json:"execs" yaml:"execs" mapstructure:"execs"`

	// End the parallel execution as soon as an exec exits with a non-zero status.
	// This is the default behavior.
	// When set to false, all execs will be run regardless of the exit status of
	// parallel execs.
	//
	//
	FailFast *bool `json:"failFast,omitempty" yaml:"failFast,omitempty" mapstructure:"failFast,omitempty"`

	// The maximum number of threads to use when executing the parallel executables.
	MaxThreads int `json:"maxThreads,omitempty" yaml:"maxThreads,omitempty" mapstructure:"maxThreads,omitempty"`

	// Params corresponds to the JSON schema field "params".
	Params ParameterList `json:"params,omitempty" yaml:"params,omitempty" mapstructure:"params,omitempty"`
}

type ParallelRefConfig

type ParallelRefConfig struct {
	// Arguments to pass to the executable.
	Args []string `json:"args,omitempty" yaml:"args,omitempty" mapstructure:"args,omitempty"`

	// The command to execute.
	// One of `cmd` or `ref` must be set.
	//
	Cmd string `json:"cmd,omitempty" yaml:"cmd,omitempty" mapstructure:"cmd,omitempty"`

	// An expression that determines whether the executable should run, using the Expr
	// language syntax.
	// The expression is evaluated at runtime and must resolve to a boolean value.
	//
	// The expression has access to OS/architecture information (os, arch),
	// environment variables (env), stored data
	// (store), and context information (ctx) like workspace and paths.
	//
	// For example, `os == "darwin"` will only run on macOS, `len(store["feature"]) >
	// 0` will run if a value exists
	// in the store, and `env["CI"] == "true"` will run in CI environments.
	// See the [Expr documentation](https://expr-lang.org/docs/language-definition)
	// for more information.
	//
	If string `json:"if,omitempty" yaml:"if,omitempty" mapstructure:"if,omitempty"`

	// A reference to another executable to run in serial.
	// One of `cmd` or `ref` must be set.
	//
	Ref Ref `json:"ref,omitempty" yaml:"ref,omitempty" mapstructure:"ref,omitempty"`

	// The number of times to retry the executable if it fails.
	Retries int `json:"retries,omitempty" yaml:"retries,omitempty" mapstructure:"retries,omitempty"`
}

Configuration for a parallel executable.

type ParallelRefConfigList

type ParallelRefConfigList []ParallelRefConfig

A list of executables to run in parallel. The executables can be defined by it's exec `cmd` or `ref`.

type Parameter

type Parameter struct {
	// A path to a file containing environment variables to be passed to the
	// executable.
	// The file should contain one variable per line in the format `KEY=VALUE`.
	//
	EnvFile string `json:"envFile,omitempty" yaml:"envFile,omitempty" mapstructure:"envFile,omitempty"`

	// The name of the environment variable that will be assigned the value.
	//
	// When specified with `envFile`, only the environment variable with this name
	// will be set.
	//
	EnvKey string `json:"envKey,omitempty" yaml:"envKey,omitempty" mapstructure:"envKey,omitempty"`

	// A path where the parameter value will be temporarily written to disk.
	// The file will be created before execution and cleaned up afterwards.
	//
	OutputFile string `json:"outputFile,omitempty" yaml:"outputFile,omitempty" mapstructure:"outputFile,omitempty"`

	// A prompt to be displayed to the user when collecting an input value.
	Prompt string `json:"prompt,omitempty" yaml:"prompt,omitempty" mapstructure:"prompt,omitempty"`

	// A reference to a secret to be passed to the executable.
	SecretRef string `json:"secretRef,omitempty" yaml:"secretRef,omitempty" mapstructure:"secretRef,omitempty"`

	// A static value to be passed to the executable.
	Text string `json:"text,omitempty" yaml:"text,omitempty" mapstructure:"text,omitempty"`
}

A parameter is a value that can be passed to an executable and all of its sub-executables. Only one of `text`, `secretRef`, `prompt`, or `file` must be set. Specifying more than one will result in an error.

func (*Parameter) Validate

func (p *Parameter) Validate() error

type ParameterList

type ParameterList []Parameter

type Ref

type Ref string

A reference to an executable. The format is `<verb> <workspace>/<namespace>:<executable name>`. For example, `exec ws/ns:my-workflow`.

- If the workspace is not specified, the current workspace will be used. - If the namespace is not specified, the current namespace will be used. - Excluding the name will reference the executable with a matching verb but an unspecified name and namespace (e.g. `exec ws` or simply `exec`).

func NewRef

func NewRef(id string, verb Verb) Ref

func (Ref) Equals

func (r Ref) Equals(other Ref) bool

func (Ref) ID

func (r Ref) ID() string

func (Ref) Namespace

func (r Ref) Namespace() string

func (Ref) String

func (r Ref) String() string

func (Ref) Verb

func (r Ref) Verb() Verb

func (Ref) Workspace

func (r Ref) Workspace() string

type RefList

type RefList []Ref

type RenderExecutableType

type RenderExecutableType struct {
	// Args corresponds to the JSON schema field "args".
	Args ArgumentList `json:"args,omitempty" yaml:"args,omitempty" mapstructure:"args,omitempty"`

	// Dir corresponds to the JSON schema field "dir".
	Dir Directory `json:"dir,omitempty" yaml:"dir,omitempty" mapstructure:"dir,omitempty"`

	// Params corresponds to the JSON schema field "params".
	Params ParameterList `json:"params,omitempty" yaml:"params,omitempty" mapstructure:"params,omitempty"`

	// The path to the JSON or YAML file containing the template data.
	TemplateDataFile string `json:"templateDataFile,omitempty" yaml:"templateDataFile,omitempty" mapstructure:"templateDataFile,omitempty"`

	// The path to the markdown template file to render.
	TemplateFile string `json:"templateFile" yaml:"templateFile" mapstructure:"templateFile"`
}

Renders a markdown template file with data.

type RequestExecutableType

type RequestExecutableType struct {
	// Args corresponds to the JSON schema field "args".
	Args ArgumentList `json:"args,omitempty" yaml:"args,omitempty" mapstructure:"args,omitempty"`

	// The body of the request.
	Body string `json:"body,omitempty" yaml:"body,omitempty" mapstructure:"body,omitempty"`

	// A map of headers to include in the request.
	Headers RequestExecutableTypeHeaders `json:"headers,omitempty" yaml:"headers,omitempty" mapstructure:"headers,omitempty"`

	// If set to true, the response will be logged as program output.
	LogResponse bool `json:"logResponse,omitempty" yaml:"logResponse,omitempty" mapstructure:"logResponse,omitempty"`

	// The HTTP method to use when making the request.
	Method RequestExecutableTypeMethod `json:"method,omitempty" yaml:"method,omitempty" mapstructure:"method,omitempty"`

	// Params corresponds to the JSON schema field "params".
	Params ParameterList `json:"params,omitempty" yaml:"params,omitempty" mapstructure:"params,omitempty"`

	// ResponseFile corresponds to the JSON schema field "responseFile".
	ResponseFile *RequestResponseFile `json:"responseFile,omitempty" yaml:"responseFile,omitempty" mapstructure:"responseFile,omitempty"`

	// The timeout for the request in Go duration format (e.g. 30s, 5m, 1h).
	Timeout time.Duration `json:"timeout,omitempty" yaml:"timeout,omitempty" mapstructure:"timeout,omitempty"`

	// [Expr](https://expr-lang.org/docs/language-definition) expression used to
	// transform the response before
	// saving it to a file or outputting it.
	//
	// The following variables are available in the expression:
	//   - `status`: The response status string.
	//   - `code`: The response status code.
	//   - `body`: The response body.
	//   - `headers`: The response headers.
	//
	// For example, to capitalize a JSON body field's value, you can use
	// `upper(fromJSON(body)["field"])`.
	//
	TransformResponse string `json:"transformResponse,omitempty" yaml:"transformResponse,omitempty" mapstructure:"transformResponse,omitempty"`

	// The URL to make the request to.
	URL string `json:"url" yaml:"url" mapstructure:"url"`

	// A list of valid status codes. If the response status code is not in this list,
	// the executable will fail.
	// If not set, the response status code will not be checked.
	//
	ValidStatusCodes []int `json:"validStatusCodes,omitempty" yaml:"validStatusCodes,omitempty" mapstructure:"validStatusCodes,omitempty"`
}

Makes an HTTP request.

func (*RequestExecutableType) MarshalJSON

func (r *RequestExecutableType) MarshalJSON() ([]byte, error)

func (*RequestExecutableType) UnmarshalJSON

func (r *RequestExecutableType) UnmarshalJSON(data []byte) error

type RequestExecutableTypeHeaders

type RequestExecutableTypeHeaders map[string]string

A map of headers to include in the request.

type RequestExecutableTypeMethod

type RequestExecutableTypeMethod string
const RequestExecutableTypeMethodDELETE RequestExecutableTypeMethod = "DELETE"
const RequestExecutableTypeMethodGET RequestExecutableTypeMethod = "GET"
const RequestExecutableTypeMethodPATCH RequestExecutableTypeMethod = "PATCH"
const RequestExecutableTypeMethodPOST RequestExecutableTypeMethod = "POST"
const RequestExecutableTypeMethodPUT RequestExecutableTypeMethod = "PUT"

type RequestResponseFile

type RequestResponseFile struct {
	// Dir corresponds to the JSON schema field "dir".
	Dir Directory `json:"dir,omitempty" yaml:"dir,omitempty" mapstructure:"dir,omitempty"`

	// The name of the file to save the response to.
	Filename string `json:"filename" yaml:"filename" mapstructure:"filename"`

	// The format to save the response as.
	SaveAs RequestResponseFileSaveAs `json:"saveAs,omitempty" yaml:"saveAs,omitempty" mapstructure:"saveAs,omitempty"`
}

Configuration for saving the response of a request to a file.

type RequestResponseFileSaveAs

type RequestResponseFileSaveAs string
const RequestResponseFileSaveAsIndentedJson RequestResponseFileSaveAs = "indented-json"
const RequestResponseFileSaveAsJson RequestResponseFileSaveAs = "json"
const RequestResponseFileSaveAsRaw RequestResponseFileSaveAs = "raw"
const RequestResponseFileSaveAsYaml RequestResponseFileSaveAs = "yaml"
const RequestResponseFileSaveAsYml RequestResponseFileSaveAs = "yml"

type SerialExecutableType

type SerialExecutableType struct {
	// Args corresponds to the JSON schema field "args".
	Args ArgumentList `json:"args,omitempty" yaml:"args,omitempty" mapstructure:"args,omitempty"`

	// Dir corresponds to the JSON schema field "dir".
	Dir Directory `json:"dir,omitempty" yaml:"dir,omitempty" mapstructure:"dir,omitempty"`

	// A list of executables to run in serial.
	// Each executable can be a command or a reference to another executable.
	//
	Execs SerialRefConfigList `json:"execs" yaml:"execs" mapstructure:"execs"`

	// End the serial execution as soon as an exec exits with a non-zero status. This
	// is the default behavior.
	// When set to false, all execs will be run regardless of the exit status of the
	// previous exec.
	//
	//
	FailFast *bool `json:"failFast,omitempty" yaml:"failFast,omitempty" mapstructure:"failFast,omitempty"`

	// Params corresponds to the JSON schema field "params".
	Params ParameterList `json:"params,omitempty" yaml:"params,omitempty" mapstructure:"params,omitempty"`
}

Executes a list of executables in serial.

type SerialRefConfig

type SerialRefConfig struct {
	// Arguments to pass to the executable.
	Args []string `json:"args,omitempty" yaml:"args,omitempty" mapstructure:"args,omitempty"`

	// The command to execute.
	// One of `cmd` or `ref` must be set.
	//
	Cmd string `json:"cmd,omitempty" yaml:"cmd,omitempty" mapstructure:"cmd,omitempty"`

	// An expression that determines whether the executable should run, using the Expr
	// language syntax.
	// The expression is evaluated at runtime and must resolve to a boolean value.
	//
	// The expression has access to OS/architecture information (os, arch),
	// environment variables (env), stored data
	// (store), and context information (ctx) like workspace and paths.
	//
	// For example, `os == "darwin"` will only run on macOS, `len(store["feature"]) >
	// 0` will run if a value exists
	// in the store, and `env["CI"] == "true"` will run in CI environments.
	// See the [Expr documentation](https://expr-lang.org/docs/language-definition)
	// for more information.
	//
	If string `json:"if,omitempty" yaml:"if,omitempty" mapstructure:"if,omitempty"`

	// A reference to another executable to run in serial.
	// One of `cmd` or `ref` must be set.
	//
	Ref Ref `json:"ref,omitempty" yaml:"ref,omitempty" mapstructure:"ref,omitempty"`

	// The number of times to retry the executable if it fails.
	Retries int `json:"retries,omitempty" yaml:"retries,omitempty" mapstructure:"retries,omitempty"`

	// If set to true, the user will be prompted to review the output of the
	// executable before continuing.
	ReviewRequired bool `json:"reviewRequired,omitempty" yaml:"reviewRequired,omitempty" mapstructure:"reviewRequired,omitempty"`
}

Configuration for a serial executable.

type SerialRefConfigList

type SerialRefConfigList []SerialRefConfig

A list of executables to run in serial. The executables can be defined by it's exec `cmd` or `ref`.

type Template

type Template struct {
	// A list of artifacts to be copied after generating the flow file.
	Artifacts []Artifact `json:"artifacts,omitempty" yaml:"artifacts,omitempty" mapstructure:"artifacts,omitempty"`

	// Form fields to be displayed to the user when generating a flow file from a
	// template.
	// The form will be rendered first, and the user's input can be used to render the
	// template.
	// For example, a form field with the key `name` can be used in the template as
	// `{{.name}}`.
	//
	Form FormFields `json:"form,omitempty" yaml:"form,omitempty" mapstructure:"form,omitempty"`

	// A list of exec executables to run after generating the flow file.
	PostRun []TemplateRefConfig `json:"postRun,omitempty" yaml:"postRun,omitempty" mapstructure:"postRun,omitempty"`

	// A list of exec executables to run before generating the flow file.
	PreRun []TemplateRefConfig `json:"preRun,omitempty" yaml:"preRun,omitempty" mapstructure:"preRun,omitempty"`

	// The flow file template to generate. The template must be a valid flow file
	// after rendering.
	Template string `json:"template" yaml:"template" mapstructure:"template"`
	// contains filtered or unexported fields
}

Configuration for a flowfile template; templates can be used to generate flow files.

func (*Template) JSON

func (t *Template) JSON() (string, error)

func (*Template) Location

func (t *Template) Location() string

func (*Template) Markdown

func (t *Template) Markdown() string

func (*Template) Name

func (t *Template) Name() string

func (*Template) SetContext

func (t *Template) SetContext(name, location string)

func (*Template) Validate

func (t *Template) Validate() error

func (*Template) YAML

func (t *Template) YAML() (string, error)

type TemplateList

type TemplateList []*Template

func (TemplateList) Find

func (t TemplateList) Find(name string) *Template

func (TemplateList) Items

func (t TemplateList) Items() []*types.EntityInfo

func (TemplateList) JSON

func (t TemplateList) JSON() (string, error)

func (TemplateList) Plural

func (t TemplateList) Plural() string

func (TemplateList) Singular

func (t TemplateList) Singular() string

func (TemplateList) YAML

func (t TemplateList) YAML() (string, error)

type TemplateRefConfig

type TemplateRefConfig struct {
	// Arguments to pass to the executable.
	Args []string `json:"args,omitempty" yaml:"args,omitempty" mapstructure:"args,omitempty"`

	// The command to execute.
	// One of `cmd` or `ref` must be set.
	//
	Cmd string `json:"cmd,omitempty" yaml:"cmd,omitempty" mapstructure:"cmd,omitempty"`

	// An expression that determines whether the executable should be run, using the
	// Expr language syntax.
	// The expression is evaluated at runtime and must resolve to a boolean value. If
	// the condition is not met,
	// the executable will be skipped.
	//
	// The expression has access to OS/architecture information (os, arch),
	// environment variables (env), form input
	// (form), and context information (name, workspace, directory, etc.).
	//
	// See the [flow documentation](https://flowexec.io/guide/templating) for more
	// information.
	//
	If string `json:"if,omitempty" yaml:"if,omitempty" mapstructure:"if,omitempty"`

	// A reference to another executable to run in serial.
	// One of `cmd` or `ref` must be set.
	//
	Ref TemplateRefConfigRef `json:"ref,omitempty" yaml:"ref,omitempty" mapstructure:"ref,omitempty"`
}

Configuration for a template executable.

type TemplateRefConfigRef

type TemplateRefConfigRef Ref

A reference to another executable to run in serial. One of `cmd` or `ref` must be set.

type Verb

type Verb string
const VerbAbort Verb = "abort"
const VerbActivate Verb = "activate"
const VerbAdd Verb = "add"
const VerbAnalyze Verb = "analyze"
const VerbApply Verb = "apply"
const VerbArchive Verb = "archive"
const VerbAudit Verb = "audit"
const VerbBackup Verb = "backup"
const VerbBenchmark Verb = "benchmark"
const VerbBuild Verb = "build"
const VerbBundle Verb = "bundle"
const VerbCheck Verb = "check"
const VerbClean Verb = "clean"
const VerbClear Verb = "clear"
const VerbCommit Verb = "commit"
const VerbCompile Verb = "compile"
const VerbCompress Verb = "compress"
const VerbConfigure Verb = "configure"
const VerbConnect Verb = "connect"
const VerbCopy Verb = "copy"
const VerbCreate Verb = "create"
const VerbDeactivate Verb = "deactivate"
const VerbDebug Verb = "debug"
const VerbDecompress Verb = "decompress"
const VerbDecrypt Verb = "decrypt"
const VerbDelete Verb = "delete"
const VerbDeploy Verb = "deploy"
const VerbDestroy Verb = "destroy"
const VerbDisable Verb = "disable"
const VerbDisconnect Verb = "disconnect"
const VerbEdit Verb = "edit"
const VerbEnable Verb = "enable"
const VerbEncrypt Verb = "encrypt"
const VerbErase Verb = "erase"
const VerbExec Verb = "exec"
const VerbExecute Verb = "execute"
const VerbExport Verb = "export"
const VerbExpose Verb = "expose"
const VerbFetch Verb = "fetch"
const VerbFix Verb = "fix"
const VerbFlush Verb = "flush"
const VerbFormat Verb = "format"
const VerbGenerate Verb = "generate"
const VerbGet Verb = "get"
const VerbImport Verb = "import"
const VerbIndex Verb = "index"
const VerbInit Verb = "init"
const VerbInspect Verb = "inspect"
const VerbInstall Verb = "install"
const VerbJoin Verb = "join"
const VerbKill Verb = "kill"
const VerbLaunch Verb = "launch"
const VerbLint Verb = "lint"
const VerbList Verb = "list"
const VerbLoad Verb = "load"
const VerbLock Verb = "lock"
const VerbLogin Verb = "login"
const VerbLogout Verb = "logout"
const VerbManage Verb = "manage"
const VerbMerge Verb = "merge"
const VerbMigrate Verb = "migrate"
const VerbModify Verb = "modify"
const VerbMonitor Verb = "monitor"
const VerbMount Verb = "mount"
const VerbNew Verb = "new"
const VerbNotify Verb = "notify"
const VerbOpen Verb = "open"
const VerbPackage Verb = "package"
const VerbPartition Verb = "partition"
const VerbPatch Verb = "patch"
const VerbPause Verb = "pause"
const VerbPing Verb = "ping"
const VerbPrefetch Verb = "prefetch"
const VerbPreload Verb = "preload"
const VerbProfile Verb = "profile"
const VerbProvision Verb = "provision"
const VerbPublish Verb = "publish"
const VerbPurge Verb = "purge"
const VerbPush Verb = "push"
const VerbQueue Verb = "queue"
const VerbReboot Verb = "reboot"
const VerbRecover Verb = "recover"
const VerbRefresh Verb = "refresh"
const VerbRelease Verb = "release"
const VerbReload Verb = "reload"
const VerbRemove Verb = "remove"
const VerbRequest Verb = "request"
const VerbReset Verb = "reset"
const VerbRestart Verb = "restart"
const VerbRestore Verb = "restore"
const VerbRetrieve Verb = "retrieve"
const VerbRollback Verb = "rollback"
const VerbRun Verb = "run"
const VerbSave Verb = "save"
const VerbScale Verb = "scale"
const VerbScan Verb = "scan"
const VerbSchedule Verb = "schedule"
const VerbSeed Verb = "seed"
const VerbSend Verb = "send"
const VerbServe Verb = "serve"
const VerbSet Verb = "set"
const VerbSetup Verb = "setup"
const VerbShow Verb = "show"
const VerbSnapshot Verb = "snapshot"
const VerbStart Verb = "start"
const VerbStash Verb = "stash"
const VerbStop Verb = "stop"
const VerbTag Verb = "tag"
const VerbTeardown Verb = "teardown"
const VerbTerminate Verb = "terminate"
const VerbTest Verb = "test"
const VerbTidy Verb = "tidy"
const VerbTrace Verb = "trace"
const VerbTransform Verb = "transform"
const VerbTrigger Verb = "trigger"
const VerbTunnel Verb = "tunnel"
const VerbUndeploy Verb = "undeploy"
const VerbUninstall Verb = "uninstall"
const VerbUnmount Verb = "unmount"
const VerbUnset Verb = "unset"
const VerbUpdate Verb = "update"
const VerbUpgrade Verb = "upgrade"
const VerbValidate Verb = "validate"
const VerbVerify Verb = "verify"
const VerbView Verb = "view"
const VerbWatch Verb = "watch"

func RelatedVerbs

func RelatedVerbs(verb Verb) []Verb

func ValidVerbs

func ValidVerbs() []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

Jump to

Keyboard shortcuts

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