Documentation
¶
Index ¶
- func BuildArgsMap(dwd string) (map[string]string, error)
- func BuildRulesMap(rule DWDirectiveRuleSpec, cmd string) (map[string]DWDirectiveRuleDef, error)
- func IsUnsupportedCommand(err error) bool
- func NewUnsupportedCommandErr(command string) error
- func ValidateArgs(args map[string]string, rule DWDirectiveRuleSpec, uniqueMap map[string]bool, ...) error
- func ValidateDWDirective(rule DWDirectiveRuleSpec, dwd string, uniqueMap map[string]bool, ...) (bool, error)
- type DWDirectiveRuleDef
- type DWDirectiveRuleSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildArgsMap ¶
BuildArgsMap builds a map of the DWDirective's arguments in the form: args["key"] = value
func BuildRulesMap ¶
func BuildRulesMap(rule DWDirectiveRuleSpec, cmd string) (map[string]DWDirectiveRuleDef, error)
BuildRulesMap builds a map of the DWDirectives argument parser rules for the specified command
func IsUnsupportedCommand ¶
IsUnsupportedCommand returns true if the error indicates that the command is unsupported
func NewUnsupportedCommandErr ¶
NewUnsupportedCommandErr returns a reference to the unsupported command type
func ValidateArgs ¶
func ValidateArgs(args map[string]string, rule DWDirectiveRuleSpec, uniqueMap map[string]bool, failUnknownCommand bool) error
ValidateArgs validates a map of arguments against the rules For cases where an unknown command may be allowed because there may be other handlers for that command
failUnknownCommand = false
func ValidateDWDirective ¶
func ValidateDWDirective(rule DWDirectiveRuleSpec, dwd string, uniqueMap map[string]bool, failUnknownCommand bool) (bool, error)
ValidateDWDirective validates a set of #DW directives against a specified rule set
Types ¶
type DWDirectiveRuleDef ¶
type DWDirectiveRuleDef struct {
Key string `json:"key"`
Type string `json:"type"`
Pattern string `json:"pattern,omitempty"`
Min int `json:"min,omitempty"`
Max int `json:"max,omitempty"`
IsRequired bool `json:"isRequired,omitempty"`
IsValueRequired bool `json:"isValueRequired,omitempty"`
UniqueWithin string `json:"uniqueWithin,omitempty"`
}
DWDirectiveRuleDef defines the DWDirective parser rules +kubebuilder:object:generate=true
func (*DWDirectiveRuleDef) DeepCopy ¶
func (in *DWDirectiveRuleDef) DeepCopy() *DWDirectiveRuleDef
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DWDirectiveRuleDef.
func (*DWDirectiveRuleDef) DeepCopyInto ¶
func (in *DWDirectiveRuleDef) DeepCopyInto(out *DWDirectiveRuleDef)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type DWDirectiveRuleSpec ¶
type DWDirectiveRuleSpec struct {
// Name of the #DW command. jobdw, stage_in, etc.
Command string `json:"command"`
// Override for the Driver ID. If left empty this defaults to the
// name of the DWDirectiveRule
DriverLabel string `json:"driverLabel,omitempty"`
// Comma separated list of states that this rule wants to register for.
// These watch states will result in an entry in the driver status array
// in the Workflow resource
WatchStates string `json:"watchStates,omitempty"`
// List of key/value pairs this #DW command is expected to have
RuleDefs []DWDirectiveRuleDef `json:"ruleDefs"`
}
DWDirectiveRuleSpec defines the desired state of DWDirective +kubebuilder:object:generate=true
func (*DWDirectiveRuleSpec) DeepCopy ¶
func (in *DWDirectiveRuleSpec) DeepCopy() *DWDirectiveRuleSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DWDirectiveRuleSpec.
func (*DWDirectiveRuleSpec) DeepCopyInto ¶
func (in *DWDirectiveRuleSpec) DeepCopyInto(out *DWDirectiveRuleSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.