Documentation ¶
Index ¶
- Constants
- Variables
- func LeafName(name string) string
- func ToError(r interface{}) error
- type APIBuilder
- type Action
- type ActionBuilder
- type Builder
- type CRD
- type CRUD
- type Call
- type CallBuilder
- type ChildBuilder
- type Condition
- type ErrorConstant
- type IterationStyle
- type Iterator
- type IteratorBuilder
- type Operation
- type Resource
- type ResourceBuilder
- type State
- type StateConverter
- type StateHandler
- type StateHandlerBuilder
- type Step
- type Workflow
- type WorkflowBuilder
Examples ¶
Constants ¶
View Source
const ( ActionExecutionError = `WF_ACTION_EXECUTION_ERROR` BadParameter = `WF_BAD_PARAMETER` ConditionSyntaxError = `WF_CONDITION_SYNTAX_ERROR` ConditionMissingRp = `WF_CONDITION_MISSING_RP` ConditionInvalidName = `WF_CONDITION_INVALID_NAME` ConditionUnexpectedEnd = `WF_CONDITION_UNEXPECTED_END` ElementNotParameter = `WF_ELEMENT_NOT_PARAMETER` FieldTypeMismatch = `WF_FIELD_TYPE_MISMATCH` IllegalIterationStyle = `WF_ILLEGAL_ITERATION_STYLE` IllegalOperation = `WF_ILLEGAL_OPERATION` InvalidFunction = `WF_INVALID_FUNCTION` InvalidTypeName = `WF_INVALID_TYPE_NAME` IteratorNotOneStep = `WF_ITERATOR_NOT_ONE_STEP` MissingRequiredField = `WF_MISSING_REQUIRED_FIELD` MissingRequiredFunction = `WF_MISSING_REQUIRED_FUNCTION` NoDefinition = `WF_NO_DEFINITION` NoServerBuilderInContext = `WF_NO_SERVER_BUILDER_IN_CONTEXT` NotStep = `WF_NOT_STEP` NotStepDefinition = `WF_NOT_STEP_DEFINITION` StepBuildError = `WF_STEP_BUILD_ERROR` StepNoName = `WF_STEP_NO_NAME` StateCreationError = `WF_STATE_CREATION_ERROR` )
View Source
const Always = boolean(true)
View Source
const IterationStyleEach = 1
View Source
const IterationStyleEachPair = 2
View Source
const IterationStyleRange = 3
View Source
const IterationStyleTimes = 4
View Source
const Never = boolean(false)
View Source
const NotFound = ErrorConstant(`not found`)
Error returned by Read, Delete, and Update when the requested state isn't found
Variables ¶
View Source
var CrdType px.Type
View Source
var CrudType px.Type
View Source
var DoType px.Type
Functions ¶
Types ¶
type APIBuilder ¶
type APIBuilder interface { Builder API(interface{}) }
type ActionBuilder ¶
type ActionBuilder interface { Builder Doer(interface{}) }
type Builder ¶
type Builder interface { Context() px.Context Build() Step Name(string) When(string) Parameters(...serviceapi.Parameter) Returns(...serviceapi.Parameter) QualifyName(childName string) string GetParameters() []serviceapi.Parameter GetName() string Parameter(name, typeName string) serviceapi.Parameter }
type CRD ¶
type CRD interface { // Create creates the desired state and returns a possibly amended version of that state // together with the externalId by which the state can henceforth be identified. Create(state px.OrderedMap) (px.OrderedMap, string, error) // Read reads and returns the current state identified by the given externalId. The error NotFound // is returned when no state can be found. Read(externalId string) (px.OrderedMap, error) // Delete deletes the state identified by the given externalId. The error NotFound is returned when // no state can be found. Delete(externalId string) error }
type CRUD ¶
type CRUD interface { CRD // Update updates the state identified by the given externalId to a new state and returns a possibly // amended version of that state. The error NotFound is returned when no state can be found. Update(externalId string, state px.OrderedMap) (px.OrderedMap, error) }
type CallBuilder ¶
type ChildBuilder ¶
type ChildBuilder interface { Builder StateHandler(func(StateHandlerBuilder)) Resource(func(ResourceBuilder)) Workflow(func(WorkflowBuilder)) Action(func(ActionBuilder)) Call(func(CallBuilder)) AddChild(Builder) Iterator(func(IteratorBuilder)) }
type Condition ¶
type Condition interface { fmt.Stringer // Precedence returns the operator precedence for this Condition Precedence() int // IsTrue returns true if the given parameters satisfies the condition, false otherwise IsTrue(parameters px.OrderedMap) bool // Returns all names in use by this condition and its nested conditions. The returned // slice is guaranteed to be unique and sorted alphabetically Names() []string }
A Condition evaluates to true or false depending on its given parameters
func Or ¶
Or returns a Condition that yields true when at least one of the given conditions yield true
func Parse ¶
Example ¶
pcore.Do(func(px.Context) { c := Parse("hello") fmt.Println(c) })
Output: hello
Example (And) ¶
pcore.Do(func(px.Context) { c := Parse("hello and goodbye") fmt.Println(c) })
Output: hello and goodbye
Example (Not) ¶
pcore.Do(func(px.Context) { c := Parse("!(hello and goodbye)") fmt.Println(c) })
Output: !(hello and goodbye)
Example (Or) ¶
pcore.Do(func(px.Context) { c := Parse("greeting and (hello or goodbye)") fmt.Println(c) })
Output: greeting and (hello or goodbye)
type ErrorConstant ¶
type ErrorConstant string
func (ErrorConstant) Error ¶
func (e ErrorConstant) Error() string
type IterationStyle ¶
type IterationStyle int
func NewIterationStyle ¶
func NewIterationStyle(style string) IterationStyle
func (IterationStyle) String ¶
func (is IterationStyle) String() string
type Iterator ¶
type Iterator interface { Step // IterationStyle returns the style of iterator, times, range, each, or eachPair. IterationStyle() IterationStyle // Producer returns the Step that will be invoked once for each iteration Producer() Step // Over returns what this iterator will iterate over. Over() px.Value // Variables returns the variables that this iterator will produce for each iteration. These // variables will be removed from the declared parameters set when the final requirements // for the step are computed. Variables() []serviceapi.Parameter // Into names the returns from the iteration Into() string }
func MakeIterator ¶
func MakeIterator(name string, origin issue.Location, when Condition, parameters, returns []serviceapi.Parameter, style IterationStyle, producer Step, over px.Value, variables []serviceapi.Parameter, into string) Iterator
func NewIterator ¶
func NewIterator(ctx px.Context, bf func(IteratorBuilder)) Iterator
type IteratorBuilder ¶
type IteratorBuilder interface { ChildBuilder Style(IterationStyle) Over(px.Value) Variables(...serviceapi.Parameter) Into(into string) }
type Operation ¶
type Operation int
const Delete Operation = 2
const Read Operation = 1
const Upsert Operation = 3
func NewOperation ¶
type Resource ¶
func MakeResource ¶
func NewResource ¶
func NewResource(ctx px.Context, bf func(ResourceBuilder)) Resource
type ResourceBuilder ¶
type State ¶
type State interface { Type() px.ObjectType State() interface{} }
type StateConverter ¶
type StateConverter func(ctx px.Context, state State, parameters px.OrderedMap) px.PuppetObject
type StateHandler ¶
type StateHandler interface { Step Interface() interface{} }
func MakeStateHandler ¶
func MakeStateHandler(name string, origin issue.Location, when Condition, parameters, returns []serviceapi.Parameter, api interface{}) StateHandler
func NewStateHandler ¶
func NewStateHandler(ctx px.Context, bf func(StateHandlerBuilder)) StateHandler
type StateHandlerBuilder ¶
type StateHandlerBuilder interface { Builder API(interface{}) }
type Step ¶
type Step interface { issue.Labeled Origin() issue.Location // When returns an optional Condition that controls whether or not this step participates // in the workflow. When() Condition // Name returns the fully qualified name of the Step Name() string // Parameters returns the parameters requirements for the Step Parameters() []serviceapi.Parameter // Returns returns the definition of that this Step will produce Returns() []serviceapi.Parameter }
An Step of a Workflow. The workflow is an Step in itself and can be used in another Workflow.
type Workflow ¶
func MakeWorkflow ¶
func NewWorkflow ¶
func NewWorkflow(ctx px.Context, bf func(WorkflowBuilder)) Workflow
type WorkflowBuilder ¶
type WorkflowBuilder interface { ChildBuilder }
Click to show internal directories.
Click to hide internal directories.