executable

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TmpDirLabel    = "f:tmp"
	DefaultTimeout = 30 * time.Minute
)
View Source
const (
	ActivateGroupID     = "activate"
	DeactivateGroupID   = "deactivate"
	ExecutionGroupID    = "execute"
	TerminationGroupID  = "terminate"
	MonitoringGroupID   = "monitor"
	RestartGroupID      = "restart"
	InstallGroupID      = "install"
	BuildGroupID        = "build"
	UninstallGroupID    = "uninstall"
	PublishGroupID      = "publish"
	DistributionGroupID = "distribute"
	TestGroupID         = "test"
	AnalyzeGroupID      = "analyze"
	LaunchGroupID       = "launch"
	CreationGroupID     = "create"
	SetGroupID          = "set"
	DestructionGroupID  = "destroy"
	UnsetGroupID        = "unset"
	CleanupGroupID      = "cleanup"
	RetrievalGroupID    = "retrieve"
)
View Source
const FlowFileExt = ".flow"
View Source
const FlowFileTemplateExt = ".flow.tmpl"
View Source
const (
	ReservedEnvVarPrefix = "FLOW_"
)
View Source
const TimeoutOverrideEnv = "FLOW_DEFAULT_TIMEOUT"

Variables

View Source
var (
	ValidVerbToGroupID = map[Verb]string{

		VerbActivate: ActivateGroupID,
		VerbEnable:   ActivateGroupID,
		VerbStart:    ActivateGroupID,
		VerbTrigger:  ActivateGroupID,

		VerbExec:    ExecutionGroupID,
		VerbRun:     ExecutionGroupID,
		VerbExecute: ExecutionGroupID,

		VerbDeactivate: DeactivateGroupID,
		VerbDisable:    DeactivateGroupID,
		VerbStop:       DeactivateGroupID,
		VerbPause:      DeactivateGroupID,

		VerbKill:      TerminationGroupID,
		VerbTerminate: TerminationGroupID,
		VerbAbort:     TerminationGroupID,

		VerbWatch:   MonitoringGroupID,
		VerbMonitor: MonitoringGroupID,
		VerbTrack:   MonitoringGroupID,

		VerbRestart: RestartGroupID,
		VerbReboot:  RestartGroupID,
		VerbReload:  RestartGroupID,
		VerbRefresh: RestartGroupID,

		VerbInstall: InstallGroupID,
		VerbSetup:   InstallGroupID,
		VerbDeploy:  InstallGroupID,

		VerbBuild:   BuildGroupID,
		VerbPackage: BuildGroupID,
		VerbBundle:  BuildGroupID,
		VerbCompile: BuildGroupID,

		VerbUninstall: UninstallGroupID,
		VerbTeardown:  UninstallGroupID,
		VerbUndeploy:  UninstallGroupID,

		VerbPublish: PublishGroupID,
		VerbRelease: PublishGroupID,

		VerbPush:  DistributionGroupID,
		VerbSend:  DistributionGroupID,
		VerbApply: DistributionGroupID,

		VerbTest:     TestGroupID,
		VerbValidate: TestGroupID,
		VerbCheck:    TestGroupID,
		VerbVerify:   TestGroupID,

		VerbAnalyze: AnalyzeGroupID,
		VerbScan:    AnalyzeGroupID,
		VerbLint:    AnalyzeGroupID,
		VerbInspect: AnalyzeGroupID,

		VerbOpen:   LaunchGroupID,
		VerbLaunch: LaunchGroupID,
		VerbShow:   LaunchGroupID,
		VerbView:   LaunchGroupID,

		VerbCreate:   CreationGroupID,
		VerbGenerate: CreationGroupID,
		VerbAdd:      CreationGroupID,
		VerbNew:      CreationGroupID,
		VerbInit:     CreationGroupID,

		VerbSet: SetGroupID,

		VerbRemove:  DestructionGroupID,
		VerbDelete:  DestructionGroupID,
		VerbDestroy: DestructionGroupID,
		VerbErase:   DestructionGroupID,

		VerbUnset: UnsetGroupID,
		VerbReset: UnsetGroupID,

		VerbClean: CleanupGroupID,
		VerbClear: CleanupGroupID,
		VerbPurge: CleanupGroupID,
		VerbTidy:  CleanupGroupID,

		VerbRetrieve: RetrievalGroupID,
		VerbFetch:    RetrievalGroupID,
		VerbGet:      RetrievalGroupID,
		VerbRequest:  RetrievalGroupID,
	}
)

Functions

func NewExecutableID

func NewExecutableID(workspace, namespace, name string) string

func ParseExecutableID

func ParseExecutableID(id string) (workspace, namespace, name 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" yaml:"envKey" mapstructure:"envKey"`

	// 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"`

	// 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) SetValues

func (al *ArgumentList) SetValues(flagArgs map[string]string, posArgs []string) error

func (*ArgumentList) ToEnvMap

func (al *ArgumentList) ToEnvMap() map[string]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 added in v0.6.0

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. [Sprig functions](https://masterminds.github.io/sprig/) 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"`

	// A condition to determine if the artifact should be copied. The condition is
	// evaluated using Go templating
	// from the form data. If the condition is not met, the artifact will not be
	// copied.
	// [Sprig functions](https://masterminds.github.io/sprig/) are available for use
	// in the condition.
	//
	// For example, to copy the artifact only if the `name` field is set:
	// “`
	// {{ if .name }}true{{ end }}
	// “`
	//
	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(
	logger io.Logger,
	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"`

	// The name of 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" yaml:"name" mapstructure:"name"`

	// 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"`

	// 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) bool

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

func (*Executable) JSON

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

func (*Executable) Markdown

func (e *Executable) Markdown() string

func (*Executable) MergeTags

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

func (*Executable) NameEquals

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

func (*Executable) Namespace added in v0.5.0

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 added in v0.4.0

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

func (*Executable) Validate

func (e *Executable) Validate() error

func (*Executable) Workspace added in v0.5.0

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) 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 added in v0.6.0

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 added in v0.6.0

func (f *Field) Set(value string)

func (*Field) ValidateConfig added in v0.6.0

func (f *Field) ValidateConfig() error

func (*Field) Value added in v0.6.0

func (f *Field) Value() string

type FieldType added in v0.6.2

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"`

	// FromFile corresponds to the JSON schema field "fromFile".
	FromFile FromFile `json:"fromFile,omitempty" yaml:"fromFile,omitempty" mapstructure:"fromFile,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` 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 added in v0.6.0

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 added in v0.6.0

type FormFields []*Field

func (FormFields) Set added in v0.6.0

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

func (FormFields) Validate added in v0.6.0

func (f FormFields) Validate() error

func (FormFields) ValueMap added in v0.6.0

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"`

	// If set to true, the executable will wait for the launched application to exit
	// before continuing.
	Wait bool `json:"wait,omitempty" yaml:"wait,omitempty" mapstructure:"wait,omitempty"`
}

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"`

	// 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"`

	// If set to true, the parallel executable will fail if any of the sub-executables
	// fail.
	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 added in v0.5.0

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"`

	// 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 added in v0.5.0

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 {
	// The name of the environment variable that will be assigned the value.
	EnvKey string `json:"envKey" yaml:"envKey" mapstructure:"envKey"`

	// 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`, or `prompt` 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`.

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.

func NewRef

func NewRef(id string, verb Verb) Ref

func (Ref) Equals

func (r Ref) Equals(other Ref) bool

func (Ref) ID added in v0.6.0

func (r Ref) ID() string

func (Ref) Namespace added in v0.6.0

func (r Ref) Namespace() string

func (Ref) String

func (r Ref) String() string

func (Ref) Validate

func (r Ref) Validate() error

func (Ref) Verb added in v0.6.0

func (r Ref) Verb() Verb

func (Ref) Workspace added in v0.6.0

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"`

	// JQ query to transform the response before saving it to a file or outputting it.
	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.

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"`

	// 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"`

	// If set to true, the serial executable will fail if any of the sub-executables
	// fail.
	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 added in v0.5.0

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"`

	// 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 added in v0.5.0

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 added in v0.6.0

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 added in v0.6.0

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

func (*Template) Location added in v0.6.0

func (t *Template) Location() string

func (*Template) Markdown added in v0.6.0

func (t *Template) Markdown() string

func (*Template) Name added in v0.6.0

func (t *Template) Name() string

func (*Template) SetContext added in v0.6.0

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

func (*Template) Validate added in v0.6.0

func (t *Template) Validate() error

func (*Template) YAML added in v0.6.0

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

type TemplateList added in v0.6.0

type TemplateList []*Template

func (TemplateList) Find added in v0.6.0

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

func (TemplateList) Items added in v0.6.0

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

func (TemplateList) JSON added in v0.6.0

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

func (TemplateList) Plural added in v0.6.0

func (t TemplateList) Plural() string

func (TemplateList) Singular added in v0.6.0

func (t TemplateList) Singular() string

func (TemplateList) YAML added in v0.6.0

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

type TemplateRefConfig added in v0.6.2

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"`

	// A condition to determine if the executable should be run. The condition is
	// evaluated using Go templating
	// from the form data. If the condition is not met, the executable run will be
	// skipped.
	// [Sprig functions](https://masterminds.github.io/sprig/) are available for use
	// in the condition.
	//
	// For example, to run a command only if the `name` field is set:
	// “`
	// {{ if .name }}true{{ end }}
	// “`
	//
	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 added in v0.6.2

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 VerbBuild Verb = "build"
const VerbBundle Verb = "bundle"
const VerbCheck Verb = "check"
const VerbClean Verb = "clean"
const VerbClear Verb = "clear"
const VerbCompile Verb = "compile"
const VerbConfigure Verb = "configure"
const VerbCreate Verb = "create"
const VerbDeactivate Verb = "deactivate"
const VerbDelete Verb = "delete"
const VerbDeploy Verb = "deploy"
const VerbDestroy Verb = "destroy"
const VerbDisable Verb = "disable"
const VerbEdit Verb = "edit"
const VerbEnable Verb = "enable"
const VerbErase Verb = "erase"
const VerbExec Verb = "exec"
const VerbExecute Verb = "execute"
const VerbFetch Verb = "fetch"
const VerbGenerate Verb = "generate"
const VerbGet Verb = "get"
const VerbInit Verb = "init"
const VerbInspect Verb = "inspect"
const VerbInstall Verb = "install"
const VerbKill Verb = "kill"
const VerbLaunch Verb = "launch"
const VerbLint Verb = "lint"
const VerbManage Verb = "manage"
const VerbModify Verb = "modify"
const VerbMonitor Verb = "monitor"
const VerbNew Verb = "new"
const VerbOpen Verb = "open"
const VerbPackage Verb = "package"
const VerbPatch Verb = "patch"
const VerbPause Verb = "pause"
const VerbPublish Verb = "publish"
const VerbPurge Verb = "purge"
const VerbPush Verb = "push"
const VerbReboot Verb = "reboot"
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 VerbRetrieve Verb = "retrieve"
const VerbRun Verb = "run"
const VerbScan Verb = "scan"
const VerbSend Verb = "send"
const VerbSet Verb = "set"
const VerbSetup Verb = "setup"
const VerbShow Verb = "show"
const VerbStart Verb = "start"
const VerbStop Verb = "stop"
const VerbTeardown Verb = "teardown"
const VerbTerminate Verb = "terminate"
const VerbTest Verb = "test"
const VerbTidy Verb = "tidy"
const VerbTrack Verb = "track"
const VerbTransform Verb = "transform"
const VerbTrigger Verb = "trigger"
const VerbUndeploy Verb = "undeploy"
const VerbUninstall Verb = "uninstall"
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