normal

package
v0.22.4 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2024 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const VERSION = "1.0"

Variables

This section is empty.

Functions

func NewNodeTemplatePointerEdge

func NewNodeTemplatePointerEdge(type_ string, name string, pointer *Pointer, substitutionVertex *cloutpkg.Vertex, nodeTemplates map[string]*cloutpkg.Vertex)

func SetMetadata

func SetMetadata(entity cloutpkg.Entity, kind string)

Types

type Artifact

type Artifact struct {
	NodeTemplate *NodeTemplate `json:"-" yaml:"-"`
	Name         string        `json:"-" yaml:"-"`

	Description       string      `json:"description" yaml:"description"`
	Types             EntityTypes `json:"types" yaml:"types"`
	Properties        Values      `json:"properties" yaml:"properties"`
	Filename          string      `json:"filename" yaml:"filename"`
	SourcePath        string      `json:"sourcePath" yaml:"sourcePath"`
	TargetPath        string      `json:"targetPath" yaml:"targetPath"`
	Version           string      `json:"version" yaml:"version"`
	ChecksumAlgorithm string      `json:"checksumAlgorithm" yaml:"checksumAlgorithm"`
	Checksum          string      `json:"checksum" yaml:"checksum"`
	Credential        Value       `json:"credential" yaml:"credential"`
}

type Artifacts

type Artifacts map[string]*Artifact

type CallOperation

type CallOperation struct {
	Activity  *WorkflowActivity `json:"-" yaml:"-"`
	Operation *Operation        `json:"operation" yaml:"operation"`
	Inputs    Values            `json:"inputs" yaml:"inputs"`
}

type Capabilities

type Capabilities map[string]*Capability

type Capability

type Capability struct {
	NodeTemplate *NodeTemplate
	Name         string

	Description          string
	Types                EntityTypes
	Properties           Values
	Attributes           Values
	MinRelationshipCount uint64
	MaxRelationshipCount uint64
	Location             *Location
}

func (*Capability) MarshalCBOR

func (self *Capability) MarshalCBOR() ([]byte, error)

(cbor.Marshaler interface)

func (*Capability) MarshalJSON

func (self *Capability) MarshalJSON() ([]byte, error)

(json.Marshaler interface)

func (*Capability) MarshalMsgpack

func (self *Capability) MarshalMsgpack() ([]byte, error)

([msgpack.Marshaler] interface)

func (*Capability) MarshalYAML

func (self *Capability) MarshalYAML() (any, error)

([yaml.Marshaler] interface)

func (*Capability) Marshalable

func (self *Capability) Marshalable() any

func (*Capability) ToARD

func (self *Capability) ToARD(reflector *ard.Reflector) (any, error)

(ard.ToARD interface)

type EntityType

type EntityType struct {
	Name string `json:"-" yaml:"-"`

	Description string            `json:"description,omitempty" yaml:"description,omitempty"`
	Metadata    map[string]string `json:"metadata,omitempty" yaml:"metadata,omitempty"`
	Parent      string            `json:"parent,omitempty" yaml:"parent,omitempty"`
}

func NewEntityType

func NewEntityType(name string) *EntityType

type EntityTypes

type EntityTypes map[string]*EntityType

func GetEntityTypes

func GetEntityTypes(hierarchy *parsing.Hierarchy, entityPtr parsing.EntityPtr) (EntityTypes, bool)

func GetHierarchyEntityTypes

func GetHierarchyEntityTypes(hierarchy *parsing.Hierarchy) EntityTypes

func NewEntityTypes

func NewEntityTypes(names ...string) EntityTypes

type FunctionCall

type FunctionCall struct {
	Key       Value      `json:"$key,omitempty" yaml:"$key,omitempty"`
	ValueMeta *ValueMeta `json:"$meta,omitempty" yaml:"$meta,omitempty"`

	FunctionCall *parsing.FunctionCall `json:"$functionCall" yaml:"$functionCall"`
}

func NewFunctionCall

func NewFunctionCall(functionCall *parsing.FunctionCall) *FunctionCall

func (*FunctionCall) SetKey

func (self *FunctionCall) SetKey(key Value)

Value interface

func (*FunctionCall) SetMeta

func (self *FunctionCall) SetMeta(valueMeta *ValueMeta)

Value interface

type FunctionCallMap

type FunctionCallMap map[string]FunctionCalls

type FunctionCallMapMap

type FunctionCallMapMap map[string]FunctionCallMap

type FunctionCalls

type FunctionCalls []*FunctionCall

type Group

type Group struct {
	ServiceTemplate *ServiceTemplate `json:"-" yaml:"-"`
	Name            string           `json:"-" yaml:"-"`

	Metadata    map[string]string `json:"metadata" yaml:"metadata"`
	Description string            `json:"description" yaml:"description"`
	Types       EntityTypes       `json:"types" yaml:"types"`
	Properties  Values            `json:"properties" yaml:"properties"`
	Interfaces  Interfaces        `json:"interfaces" yaml:"interfaces"`

	Members []*NodeTemplate `json:"-" yaml:"-"`
}

func (*Group) NewInterface

func (self *Group) NewInterface(name string) *Interface

type Groups

type Groups map[string]*Group

type Interface

type Interface struct {
	NodeTemplate *NodeTemplate `json:"-" yaml:"-"`
	Group        *Group        `json:"-" yaml:"-"`
	Relationship *Relationship `json:"-" yaml:"-"`
	Name         string        `json:"-" yaml:"-"`

	Description   string        `json:"description" yaml:"description"`
	Types         EntityTypes   `json:"types" yaml:"types"`
	Inputs        Values        `json:"inputs" yaml:"inputs"`
	Operations    Operations    `json:"operations" yaml:"operations"`
	Notifications Notifications `json:"notifications" yaml:"notifications"`
}

func (*Interface) NewNotification

func (self *Interface) NewNotification(name string) *Notification

func (*Interface) NewOperation

func (self *Interface) NewOperation(name string) *Operation

type Interfaces

type Interfaces map[string]*Interface

type List

type List struct {
	Key       Value      `json:"$key,omitempty" yaml:"$key,omitempty"`
	ValueMeta *ValueMeta `json:"$meta,omitempty" yaml:"$meta,omitempty"`

	Entries ValueList `json:"$list" yaml:"$list"`
}

func NewList

func NewList(length int) *List

func (*List) Set

func (self *List) Set(index int, value Value)

func (*List) SetKey

func (self *List) SetKey(key Value)

Value interface

func (*List) SetMeta

func (self *List) SetMeta(valueMeta *ValueMeta)

Value interface

type Location

type Location struct {
	Path   string `json:"path" yaml:"path"`
	Row    int    `json:"row" yaml:"row"`
	Column int    `json:"column" yaml:"column"`
}

func NewLocation

func NewLocation(path string, row int, column int) *Location

func NewLocationForContext

func NewLocationForContext(context *parsing.Context) *Location

type Map

type Map struct {
	Key       Value      `json:"$key,omitempty" yaml:"$key,omitempty"`
	ValueMeta *ValueMeta `json:"$meta,omitempty" yaml:"$meta,omitempty"`

	Entries ValueList `json:"$map" yaml:"$map"`
}

func NewMap

func NewMap() *Map

func (*Map) Put

func (self *Map) Put(key any, value Value)

func (*Map) SetKey

func (self *Map) SetKey(key Value)

Value interface

func (*Map) SetMeta

func (self *Map) SetMeta(valueMeta *ValueMeta)

Value interface

type MarshalableCapability

type MarshalableCapability struct {
	Description          string      `json:"description" yaml:"description"`
	Types                EntityTypes `json:"types" yaml:"types"`
	Properties           Values      `json:"properties" yaml:"properties"`
	Attributes           Values      `json:"attributes" yaml:"attributes"`
	MinRelationshipCount int64       `json:"minRelationshipCount" yaml:"minRelationshipCount"`
	MaxRelationshipCount int64       `json:"maxRelationshipCount" yaml:"maxRelationshipCount"`
	Location             *Location   `json:"location" yaml:"location"`
}

type MarshalablePointer

type MarshalablePointer struct {
	NodeTemplateName string `json:"nodeTemplateName,omitempty" yaml:"nodeTemplateName,omitempty"`
	Target           string `json:"target,omitempty" yaml:"target,omitempty"`
}

type MarshalableRequirement

type MarshalableRequirement struct {
	Name                           string             `json:"name" yaml:"name"`
	CapabilityTypeName             string             `json:"capabilityTypeName" yaml:"capabilityTypeName"`
	CapabilityName                 string             `json:"capabilityName" yaml:"capabilityName"`
	NodeTypeName                   string             `json:"nodeTypeName" yaml:"nodeTypeName"`
	NodeTemplateName               string             `json:"nodeTemplateName" yaml:"nodeTemplateName"`
	NodeTemplatePropertyValidators FunctionCallMap    `json:"nodeTemplatePropertyValidators" yaml:"nodeTemplatePropertyValidators"`
	CapabilityPropertyValidators   FunctionCallMapMap `json:"capabilityPropertyValidators" yaml:"capabilityPropertyValidators"`
	Relationship                   *Relationship      `json:"relationship" yaml:"relationship"`
	Directives                     []string           `json:"directives" yaml:"directives"`
	Optional                       bool               `json:"optional" yaml:"optional"`
	Location                       *Location          `json:"location" yaml:"location"`
}

type NodeTemplate

type NodeTemplate struct {
	ServiceTemplate *ServiceTemplate `json:"-" yaml:"-"`
	Name            string           `json:"-" yaml:"-"`

	Metadata     map[string]string `json:"metadata" yaml:"metadata"`
	Description  string            `json:"description" yaml:"description"`
	Types        EntityTypes       `json:"types" yaml:"types"`
	Directives   []string          `json:"directives" yaml:"directives"`
	Properties   Values            `json:"properties" yaml:"properties"`
	Attributes   Values            `json:"attributes" yaml:"attributes"`
	Requirements Requirements      `json:"requirements" yaml:"requirements"`
	Capabilities Capabilities      `json:"capabilities" yaml:"capabilities"`
	Interfaces   Interfaces        `json:"interfaces" yaml:"interfaces"`
	Artifacts    Artifacts         `json:"artifacts" yaml:"artifacts"`
}

func (*NodeTemplate) NewArtifact

func (self *NodeTemplate) NewArtifact(name string) *Artifact

func (*NodeTemplate) NewCapability

func (self *NodeTemplate) NewCapability(name string, location *Location) *Capability

func (*NodeTemplate) NewInterface

func (self *NodeTemplate) NewInterface(name string) *Interface

func (*NodeTemplate) NewPointer

func (self *NodeTemplate) NewPointer(target string) *Pointer

func (*NodeTemplate) NewRequirement

func (self *NodeTemplate) NewRequirement(name string, location *Location) *Requirement

type NodeTemplates

type NodeTemplates map[string]*NodeTemplate

func (NodeTemplates) Object

func (self NodeTemplates) Object(name string) map[string]any

For access in JavaScript

type Normalizable

type Normalizable interface {
	NormalizeServiceTemplate() *ServiceTemplate
}

type Notification

type Notification struct {
	Interface *Interface `json:"-" yaml:"-"`
	Name      string     `json:"-" yaml:"-"`

	Description    string   `json:"description" yaml:"description"`
	Implementation string   `json:"implementation" yaml:"implementation"`
	Dependencies   []string `json:"dependencies" yaml:"dependencies"`
	Timeout        int64    `json:"timeout" yaml:"timeout"`
	Host           string   `json:"host,omitempty" yaml:"host,omitempty"`
	Outputs        Values   `json:"outputs" yaml:"outputs"`
}

type Notifications

type Notifications map[string]*Notification

type Operation

type Operation struct {
	Interface     *Interface     `json:"-" yaml:"-"`
	PolicyTrigger *PolicyTrigger `json:"-" yaml:"-"`
	Name          string         `json:"-" yaml:"-"`

	Description    string   `json:"description" yaml:"description"`
	Implementation string   `json:"implementation" yaml:"implementation"`
	Dependencies   []string `json:"dependencies" yaml:"dependencies"`
	Inputs         Values   `json:"inputs" yaml:"inputs"`
	Outputs        Values   `json:"outputs" yaml:"outputs"`
	Timeout        int64    `json:"timeout" yaml:"timeout"`
	Host           string   `json:"host,omitempty" yaml:"host,omitempty"`
}

type Operations

type Operations map[string]*Operation

type Pointer

type Pointer struct {
	NodeTemplate *NodeTemplate
	Target       string
}

func NewPointer

func NewPointer(target string) *Pointer

func (*Pointer) MarshalCBOR

func (self *Pointer) MarshalCBOR() ([]byte, error)

(cbor.Marshaler interface)

func (*Pointer) MarshalJSON

func (self *Pointer) MarshalJSON() ([]byte, error)

(json.Marshaler interface)

func (*Pointer) MarshalMsgpack

func (self *Pointer) MarshalMsgpack() ([]byte, error)

([msgpack.Marshaler] interface)

func (*Pointer) MarshalYAML

func (self *Pointer) MarshalYAML() (any, error)

([yaml.Marshaler] interface)

func (*Pointer) Marshalable

func (self *Pointer) Marshalable() any

func (*Pointer) ToARD

func (self *Pointer) ToARD(reflector *ard.Reflector) (any, error)

(ard.ToARD interface)

type Pointers

type Pointers map[string]*Pointer

type Policies

type Policies map[string]*Policy

type Policy

type Policy struct {
	ServiceTemplate *ServiceTemplate `json:"-" yaml:"-"`
	Name            string           `json:"-" yaml:"-"`

	Metadata    map[string]string `json:"metadata" yaml:"metadata"`
	Description string            `json:"description" yaml:"description"`
	Types       EntityTypes       `json:"types" yaml:"types"`
	Properties  Values            `json:"properties" yaml:"properties"`

	GroupTargets        []*Group         `json:"-" yaml:"-"`
	NodeTemplateTargets []*NodeTemplate  `json:"-" yaml:"-"`
	Triggers            []*PolicyTrigger `json:"-" yaml:"-"`
}

func (*Policy) NewTrigger

func (self *Policy) NewTrigger() *PolicyTrigger

type PolicyTrigger

type PolicyTrigger struct {
	Policy *Policy `json:"-" yaml:"-"`

	EventType string     `json:"eventType" yaml:"eventType"`
	Operation *Operation `json:"operation" yaml:"operation"`
	Workflow  *Workflow  `json:"workflow" yaml:"workflow"`
}

func (*PolicyTrigger) NewOperation

func (self *PolicyTrigger) NewOperation() *Operation

type Primitive

type Primitive struct {
	Key       Value      `json:"$key,omitempty" yaml:"$key,omitempty"`
	ValueMeta *ValueMeta `json:"$meta,omitempty" yaml:"$meta,omitempty"`

	Primitive ard.Value `json:"$primitive" yaml:"$primitive"`
}

func NewPrimitive

func NewPrimitive(primitive ard.Value) *Primitive

func (*Primitive) SetKey

func (self *Primitive) SetKey(key Value)

Value interface

func (*Primitive) SetMeta

func (self *Primitive) SetMeta(valueMeta *ValueMeta)

Value interface

type Relationship

type Relationship struct {
	Requirement *Requirement `json:"-" yaml:"-"`
	Name        string       `json:"-" yaml:"-"`

	Metadata    map[string]string `json:"metadata" yaml:"metadata"`
	Description string            `json:"description" yaml:"description"`
	Types       EntityTypes       `json:"types" yaml:"types"`
	Properties  Values            `json:"properties" yaml:"properties"`
	Attributes  Values            `json:"attributes" yaml:"attributes"`
	Interfaces  Interfaces        `json:"interfaces" yaml:"interfaces"`
}

func (*Relationship) NewInterface

func (self *Relationship) NewInterface(name string) *Interface

type Relationships

type Relationships []*Relationship

type Requirement

type Requirement struct {
	SourceNodeTemplate *NodeTemplate

	Name                           string
	CapabilityTypeName             *string
	CapabilityName                 *string
	NodeTypeName                   *string
	NodeTemplate                   *NodeTemplate
	NodeTemplatePropertyValidation FunctionCallMap
	CapabilityPropertyValidation   FunctionCallMapMap
	Relationship                   *Relationship
	Directives                     []string
	Optional                       bool
	Location                       *Location
}

func (*Requirement) MarshalCBOR

func (self *Requirement) MarshalCBOR() ([]byte, error)

(cbor.Marshaler interface)

func (*Requirement) MarshalJSON

func (self *Requirement) MarshalJSON() ([]byte, error)

(json.Marshaler interface)

func (*Requirement) MarshalMsgpack

func (self *Requirement) MarshalMsgpack() ([]byte, error)

([msgpack.Marshaler] interface)

func (*Requirement) MarshalYAML

func (self *Requirement) MarshalYAML() (any, error)

([yaml.Marshaler] interface)

func (*Requirement) Marshalable

func (self *Requirement) Marshalable() any

func (*Requirement) NewRelationship

func (self *Requirement) NewRelationship() *Relationship

func (*Requirement) ToARD

func (self *Requirement) ToARD(reflector *ard.Reflector) (any, error)

(ard.ToARD interface)

type Requirements

type Requirements []*Requirement

type ServiceTemplate

type ServiceTemplate struct {
	Description        string                      `json:"description" yaml:"description"`
	NodeTemplates      NodeTemplates               `json:"nodeTemplates" yaml:"nodeTemplates"`
	Groups             Groups                      `json:"groups" yaml:"groups"`
	Policies           Policies                    `json:"policies" yaml:"policies"`
	Inputs             Values                      `json:"inputs" yaml:"inputs"`
	Outputs            Values                      `json:"outputs" yaml:"outputs"`
	Workflows          Workflows                   `json:"workflows" yaml:"workflows"`
	Substitution       *Substitution               `json:"substitution" yaml:"substitution"`
	Metadata           map[string]string           `json:"metadata" yaml:"metadata"`
	ScriptletNamespace *parsing.ScriptletNamespace `json:"scriptletNamespace" yaml:"scriptletNamespace"`
}

func NewServiceTemplate

func NewServiceTemplate() *ServiceTemplate

func NormalizeServiceTemplate

func NormalizeServiceTemplate(entityPtr parsing.EntityPtr) (*ServiceTemplate, bool)

From Normalizable interface

func (*ServiceTemplate) Compile

func (serviceTemplate *ServiceTemplate) Compile() (*cloutpkg.Clout, error)

func (*ServiceTemplate) NewGroup

func (self *ServiceTemplate) NewGroup(name string) *Group

func (*ServiceTemplate) NewNodeTemplate

func (self *ServiceTemplate) NewNodeTemplate(name string) *NodeTemplate

func (*ServiceTemplate) NewPolicy

func (self *ServiceTemplate) NewPolicy(name string) *Policy

func (*ServiceTemplate) NewSubstitution

func (self *ServiceTemplate) NewSubstitution() *Substitution

func (*ServiceTemplate) NewWorkflow

func (self *ServiceTemplate) NewWorkflow(name string) *Workflow

type Substitution

type Substitution struct {
	ServiceTemplate *ServiceTemplate `json:"-" yaml:"-"`

	Type               string            `json:"type" yaml:"type"`
	TypeMetadata       map[string]string `json:"typeMetadata" yaml:"typeMetadata"`
	InputPointers      Pointers          `json:"inputPointers" yaml:"inputPointers"`
	CapabilityPointers Pointers          `json:"capabilityPointers" yaml:"capabilityPointers"`
	RequirementPointer Pointers          `json:"requirementPointers" yaml:"requirementPointers"`
	PropertyPointers   Pointers          `json:"propertyPointers" yaml:"propertyPointers"`
	PropertyValues     Values            `json:"propertyValues" yaml:"propertyValues"`
	AttributePointers  Pointers          `json:"attributePointers" yaml:"attributePointers"`
	InterfacePointers  Pointers          `json:"interfacePointers" yaml:"interfacePointers"`
}

type Value

type Value interface {
	SetKey(Value)
	SetMeta(*ValueMeta)
}

type ValueList

type ValueList []Value

func (ValueList) AppendWithKey

func (self ValueList) AppendWithKey(key any, value Value) ValueList

type ValueMeta

type ValueMeta struct {
	Type             string            `json:"type,omitempty" yaml:"type,omitempty"`
	Element          *ValueMeta        `json:"element,omitempty" yaml:"element,omitempty"`
	Key              *ValueMeta        `json:"key,omitempty" yaml:"key,omitempty"`
	Value            *ValueMeta        `json:"value,omitempty" yaml:"value,omitempty"`
	Fields           ValueMetaMap      `json:"fields,omitempty" yaml:"fields,omitempty"`
	Validators       FunctionCalls     `json:"validators,omitempty" yaml:"validators,omitempty"`
	Converter        *FunctionCall     `json:"converter,omitempty" yaml:"converter,omitempty"`
	Description      string            `json:"description,omitempty" yaml:"description,omitempty"`
	TypeDescription  string            `json:"typeDescription,omitempty" yaml:"typeDescription,omitempty"`
	LocalDescription string            `json:"localDescription,omitempty" yaml:"localDescription,omitempty"`
	Metadata         map[string]string `json:"metadata,omitempty" yaml:"metadata,omitempty"`
	TypeMetadata     map[string]string `json:"typeMetadata,omitempty" yaml:"typeMetadata,omitempty"`
	LocalMetadata    map[string]string `json:"localMetadata,omitempty" yaml:"localMetadata,omitempty"`
}

func CopyValueMeta

func CopyValueMeta(valueMeta *ValueMeta) *ValueMeta

func NewValueMeta

func NewValueMeta() *ValueMeta

func (*ValueMeta) AddValidator

func (self *ValueMeta) AddValidator(validator *parsing.FunctionCall)

func (*ValueMeta) Empty

func (self *ValueMeta) Empty() bool

func (*ValueMeta) Prune

func (self *ValueMeta) Prune()

func (*ValueMeta) SetConverter

func (self *ValueMeta) SetConverter(converter *parsing.FunctionCall)

type ValueMetaMap

type ValueMetaMap map[string]*ValueMeta

func CopyValueMetaMap

func CopyValueMetaMap(valueMetaMap ValueMetaMap) ValueMetaMap

func (ValueMetaMap) Empty

func (self ValueMetaMap) Empty() bool

func (ValueMetaMap) Prune

func (self ValueMetaMap) Prune()

type Values

type Values map[string]Value

type Workflow

type Workflow struct {
	ServiceTemplate *ServiceTemplate `json:"-" yaml:"-"`
	Name            string           `json:"-" yaml:"-"`

	Metadata      map[string]string       `json:"metadata" yaml:"metadata"`
	Description   string                  `json:"description" yaml:"description"`
	Preconditions []*WorkflowPrecondition `json:"preconditions" yaml:"preconditions"`
	Steps         WorkflowSteps           `json:"steps" yaml:"steps"`
	Inputs        Values                  `json:"inputs" yaml:"inputs"`
}

func (*Workflow) NewStep

func (self *Workflow) NewStep(name string) *WorkflowStep

type WorkflowActivity

type WorkflowActivity struct {
	Step             *WorkflowStep  `json:"-" yaml:"-"`
	DelegateWorkflow *Workflow      `json:"-" yaml:"-"`
	InlineWorkflow   *Workflow      `json:"-" yaml:"-"`
	SetNodeState     string         `json:"setNodeState" yaml:"setNodeState"`
	CallOperation    *CallOperation `json:"callOperation" yaml:"callOperation"`
}

func (*WorkflowActivity) NewCallOperation

func (self *WorkflowActivity) NewCallOperation() *CallOperation

type WorkflowPrecondition

type WorkflowPrecondition struct {
	TargetNodeTemplate *NodeTemplate `json:"-" yaml:"-"`
	TargetGroup        *Group        `json:"-" yaml:"-"`
}

type WorkflowStep

type WorkflowStep struct {
	Workflow           *Workflow     `json:"-" yaml:"-"`
	Name               string        `json:"-" yaml:"-"`
	TargetNodeTemplate *NodeTemplate `json:"-" yaml:"-"`
	TargetGroup        *Group        `json:"-" yaml:"-"`
	// TODO: Filters
	OnSuccessSteps []*WorkflowStep     `json:"-" yaml:"-"`
	OnFailureSteps []*WorkflowStep     `json:"-" yaml:"-"`
	Activities     []*WorkflowActivity `json:"-" yaml:"-"`
	Host           string              `json:"-" yaml:"-"`
}

func (*WorkflowStep) NewActivity

func (self *WorkflowStep) NewActivity() *WorkflowActivity

type WorkflowSteps

type WorkflowSteps map[string]*WorkflowStep

type Workflows

type Workflows map[string]*Workflow

Jump to

Keyboard shortcuts

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