dwdparse

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildArgsMap

func BuildArgsMap(dwd string) (map[string]string, error)

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

func IsUnsupportedCommand(err error) bool

IsUnsupportedCommand returns true if the error indicates that the command is unsupported

func NewUnsupportedCommandErr

func NewUnsupportedCommandErr(command string) error

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.

Jump to

Keyboard shortcuts

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