Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMismatchedExpectedType is returned when the type field of a parameter // is not the same as the actual type of the value of a parameter. ErrMismatchedExpectedType = errors.New("stated parameter type different than actual value type") // ErrUnknownParameterType is returned when the type of field parameter // is not one of the expected values. ErrUnknownParameterType = errors.New("unknown parameter type") )
var ErrInvalidComponentType = fmt.Errorf("not a valid ComponentType, try [%s]", strings.Join(_ComponentTypeNames, ", "))
var ErrInvalidParameterType = errors.New("not a valid ParameterType")
Functions ¶
func ComponentTypeNames ¶ added in v0.64.0
func ComponentTypeNames() []string
ComponentTypeNames returns a list of possible string values of ComponentType.
Types ¶
type Component ¶
type Component struct { // Description describes what the component will do. Description string `json:"description" yaml:"description"` // Name is the component name. Name string `json:"name" yaml:"name"` // Parameters is the list of parameters to be supplied to the component. Parameters []Parameter `json:"parameters" yaml:"parameters"` // Steps is the list of steps to be supplied to the component. Steps []Step `json:"steps" yaml:"steps"` // Type represents the component type. Type ComponentType `json:"type" yaml:"type"` }
Component is a binary or a script that can be used in the context of a workflow to generate some useful result.
type ComponentRef ¶
type ComponentRef struct { // Component represents the linked component. Component Component `json:"component,omitempty" yaml:"component,omitempty"` // Overrides contains first later of parameter overrides for this component. Overrides []Parameter `json:"overrides" yaml:"overrides"` }
ComponentRef represents a reference to a component along with some overrides that the user needs to declare.
type ComponentType ¶
type ComponentType string
ComponentType represents all the types of components that Smithy supports. ENUM(unknown, target, scanner, enricher, filter, reporter)
const ( // ComponentTypeUnknown is a ComponentType of type unknown. ComponentTypeUnknown ComponentType = "unknown" // ComponentTypeTarget is a ComponentType of type target. ComponentTypeTarget ComponentType = "target" // ComponentTypeScanner is a ComponentType of type scanner. ComponentTypeScanner ComponentType = "scanner" // ComponentTypeEnricher is a ComponentType of type enricher. ComponentTypeEnricher ComponentType = "enricher" // ComponentTypeFilter is a ComponentType of type filter. ComponentTypeFilter ComponentType = "filter" // ComponentTypeReporter is a ComponentType of type reporter. ComponentTypeReporter ComponentType = "reporter" )
func ComponentTypeValues ¶ added in v0.64.0
func ComponentTypeValues() []ComponentType
ComponentTypeValues returns a list of the values for ComponentType
func ParseComponentType ¶ added in v0.61.0
func ParseComponentType(name string) (ComponentType, error)
ParseComponentType attempts to convert a string to a ComponentType.
func (ComponentType) IsValid ¶ added in v0.61.0
func (x ComponentType) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (ComponentType) String ¶ added in v0.61.0
func (x ComponentType) String() string
String implements the Stringer interface.
type Parameter ¶
type Parameter struct { // Name is the name of the parameter. Name string `json:"name" yaml:"name"` // Type is the parameter type. Type ParameterType `json:"type" yaml:"type"` // Value is the JSON/Yaml encoded/decoded value of the parameter which is decoded based its Type. Value any `json:"value,omitempty" yaml:"value,omitempty"` }
Parameter is a struct whose value must be of the type as it's defined in the Type field. Due to the fact that this value is expected to be communicated to external clients via JSON, which doesn't support rich types, we need to communicate the expected value type via an enum string. Given the Golang type system, there is no way to enforce the type restrictions via an interface, so do all the type checks when marshaling/unmarshalling the JSON bytes, since this type will constantly be subject to such transformations.
func (*Parameter) MarshalJSON ¶
MarshalJSON marshals the Parameter into JSON bytes.
func (*Parameter) MarshalYAML ¶ added in v0.61.0
func (*Parameter) UnmarshalJSON ¶
UnmarshalJSON unmarshal JSON bytes into a Parameter object.
func (*Parameter) UnmarshalYAML ¶ added in v0.61.0
type ParameterType ¶
type ParameterType string
ParameterType represents the type of parameter that can be parsed by the system. ENUM(string, const_string=const:string, list_string=list:string)
const ( // ParameterTypeString is a ParameterType of type string. ParameterTypeString ParameterType = "string" // ParameterTypeConstString is a ParameterType of type const_string. ParameterTypeConstString ParameterType = "const:string" // ParameterTypeListString is a ParameterType of type list_string. ParameterTypeListString ParameterType = "list:string" )
func ParseParameterType ¶
func ParseParameterType(name string) (ParameterType, error)
ParseParameterType attempts to convert a string to a ParameterType.
func (ParameterType) IsValid ¶
func (x ParameterType) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (ParameterType) String ¶
func (x ParameterType) String() string
String implements the Stringer interface.
type Stage ¶
type Stage struct { // ComponentRefs contains the list of component references attached to this stage. ComponentRefs []ComponentRef `json:"component_refs" yaml:"component_refs"` }
Stage is a group of Components that can be executed in parallel during in the context of a Workflow Instance.
type Step ¶
type Step struct { // Args is the list of arguments supplied to a component. Args []string `json:"args" yaml:"args"` // EnvVars is the set of environment variables key:val supplied to a component. EnvVars map[string]string `json:"env_vars" yaml:"env_vars"` // Name is the step name. Name string `json:"name" yaml:"name"` // Executable is the path to the entrypoint to run the component. Executable string `json:"executable" yaml:"executable"` // Images is the docker image to be run for this component. Image string `json:"image" yaml:"image"` // Script will be deprecated after rewriting all components. Script string `json:"script" yaml:"script"` }
Step represents an executing step inside a Component.
type Workflow ¶
type Workflow struct { // Description described what the workflow is configured for. Description string `json:"description" yaml:"description"` // Name is the name of the workflow. Name string `json:"name" yaml:"name"` // Stages contains the stages to be applied by the workflow. Stages []Stage `json:"stages" yaml:"stages"` }
Workflow represents a combination of