normal

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

README

Normal

These structs together a "normalized" TOSCA-compatible topology, which is a flat, serializable data structure.

They are meant to be generic and independent of TOSCA grammar, especially any specific version of the TOSCA grammar.

Though they are usually created by a TOSCA parser as its final result, it's entirely possible to write code that uses a different approach, for example by translating from a non-TOSCA topology descriptor.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

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

	Description       string         `json:"description" yaml:"description"`
	Types             Types          `json:"types" yaml:"types"`
	Properties        Constrainables `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        Constrainable  `json:"credential" yaml:"credential"`
}

type Artifacts

type Artifacts map[string]*Artifact

type AttributeMapping

type AttributeMapping struct {
	NodeTemplate  *NodeTemplate
	AttributeName string
}

func (*AttributeMapping) MarshalJSON

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

json.Marshaler interface

func (*AttributeMapping) MarshalYAML

func (self *AttributeMapping) MarshalYAML() (interface{}, error)

yaml.Marshaler interface

func (*AttributeMapping) Marshalable

func (self *AttributeMapping) Marshalable() interface{}

type AttributeMappings

type AttributeMappings map[string]*AttributeMapping

type Capabilities

type Capabilities map[string]*Capability

type Capability

type Capability struct {
	NodeTemplate *NodeTemplate
	Name         string

	Description          string
	Types                Types
	Properties           Constrainables
	Attributes           Constrainables
	MinRelationshipCount uint64
	MaxRelationshipCount uint64
}

func (*Capability) MarshalJSON

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

json.Marshaler interface

func (*Capability) MarshalYAML

func (self *Capability) MarshalYAML() (interface{}, error)

yaml.Marshaler interface

func (*Capability) Marshalable

func (self *Capability) Marshalable() interface{}

type Constrainable

type Constrainable interface {
	SetKey(Constrainable)
	SetInformation(*Information)
	AddConstraint(*tosca.FunctionCall)
}

type ConstrainableList

type ConstrainableList []Constrainable

func (ConstrainableList) AppendWithKey

func (self ConstrainableList) AppendWithKey(key interface{}, value Constrainable) ConstrainableList

type Constrainables

type Constrainables map[interface{}]Constrainable

type FunctionCall

type FunctionCall struct {
	Key         Constrainable `json:"$key,omitempty" yaml:"$key,omitempty"`
	Information *Information  `json:"$information,omitempty" yaml:"$information,omitempty"`
	Constraints FunctionCalls `json:"$constraints,omitempty" yaml:"$constraints,omitempty"`

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

func NewFunctionCall

func NewFunctionCall(functionCall *tosca.FunctionCall) *FunctionCall

func (*FunctionCall) AddConstraint

func (self *FunctionCall) AddConstraint(constraint *tosca.FunctionCall)

Constrainable interface

func (*FunctionCall) SetInformation added in v0.15.0

func (self *FunctionCall) SetInformation(information *Information)

Constrainable interface

func (*FunctionCall) SetKey

func (self *FunctionCall) SetKey(key Constrainable)

Constrainable 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       Types             `json:"types" yaml:"types"`
	Properties  Constrainables    `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 Information added in v0.15.0

type Information struct {
	Description string           `json:"description,omitempty" yaml:"description,omitempty"`
	Definition  *TypeInformation `json:"definition,omitempty" yaml:"definition,omitempty"`
	Type        *TypeInformation `json:"type,omitempty" yaml:"type,omitempty"`
	Entry       *TypeInformation `json:"entry,omitempty" yaml:"entry,omitempty"`
	Key         *TypeInformation `json:"key,omitempty" yaml:"key,omitempty"`
	Value       *TypeInformation `json:"value,omitempty" yaml:"value,omitempty"`
	Properties  InformationMap   `json:"properties,omitempty" yaml:"properties,omitempty"`
}

func CopyInformation added in v0.15.0

func CopyInformation(information *Information) *Information

func NewInformation added in v0.15.0

func NewInformation() *Information

func (*Information) Empty added in v0.15.0

func (self *Information) Empty() bool

func (*Information) Prune added in v0.15.0

func (self *Information) Prune()

type InformationMap added in v0.15.0

type InformationMap map[string]*Information

func CopyInformationMap added in v0.15.0

func CopyInformationMap(informationMap InformationMap) InformationMap

func (InformationMap) Empty added in v0.15.0

func (self InformationMap) Empty() bool

func (InformationMap) Prune added in v0.15.0

func (self InformationMap) Prune()

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         Types          `json:"types" yaml:"types"`
	Inputs        Constrainables `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         Constrainable `json:"$key,omitempty" yaml:"$key,omitempty"`
	Information *Information  `json:"$information,omitempty" yaml:"$information,omitempty"`
	Constraints FunctionCalls `json:"$constraints,omitempty" yaml:"$constraints,omitempty"`

	EntryConstraints FunctionCalls `json:"$entryConstraints,omitempty" yaml:"$entryConstraints,omitempty"`

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

func NewList

func NewList(length int) *List

func (*List) AddConstraint

func (self *List) AddConstraint(functionCall *tosca.FunctionCall)

Constrainable interface

func (*List) AddEntryConstraint

func (self *List) AddEntryConstraint(constraint *tosca.FunctionCall)

func (*List) Set

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

func (*List) SetInformation added in v0.15.0

func (self *List) SetInformation(information *Information)

Constrainable interface

func (*List) SetKey

func (self *List) SetKey(key Constrainable)

Constrainable interface

type Map

type Map struct {
	Key         Constrainable `json:"$key,omitempty" yaml:"$key,omitempty"`
	Information *Information  `json:"$information,omitempty" yaml:"$information,omitempty"`
	Constraints FunctionCalls `json:"$constraints,omitempty" yaml:"$constraints,omitempty"`

	KeyConstraints   FunctionCalls `json:"$keyConstraints,omitempty" yaml:"$keyConstraints,omitempty"`
	ValueConstraints FunctionCalls `json:"$valueConstraints,omitempty" yaml:"$valueConstraints,omitempty"`

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

func NewMap

func NewMap() *Map

func (*Map) AddConstraint

func (self *Map) AddConstraint(constraint *tosca.FunctionCall)

Constrainable interface

func (*Map) AddKeyConstraint

func (self *Map) AddKeyConstraint(constraint *tosca.FunctionCall)

func (*Map) AddValueConstraint

func (self *Map) AddValueConstraint(constraint *tosca.FunctionCall)

func (*Map) Put

func (self *Map) Put(key interface{}, value Constrainable)

func (*Map) SetInformation added in v0.15.0

func (self *Map) SetInformation(information *Information)

Constrainable interface

func (*Map) SetKey

func (self *Map) SetKey(key Constrainable)

Constrainable interface

type MarshalableAttributeMapping

type MarshalableAttributeMapping struct {
	NodeTemplateName string `json:"nodeTemplateName" yaml:"nodeTemplateName"`
	AttributeName    string `json:"attributeName" yaml:"attributeName"`
}

type MarshalableCapability

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

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"`
	NodeTemplatePropertyConstraints FunctionCallMap    `json:"nodeTemplatePropertyConstraints" yaml:"nodeTemplatePropertyConstraints"`
	CapabilityPropertyConstraints   FunctionCallMapMap `json:"capabilityPropertyConstraints" yaml:"capabilityPropertyConstraints"`
	Relationship                    *Relationship      `json:"relationship" yaml:"relationship"`
	Path                            string             `json:"path" yaml:"path"`
}

type MarshalableSubstitution

type MarshalableSubstitution struct {
	Type                string            `json:"type" yaml:"type"`
	TypeMetadata        map[string]string `json:"typeMetadata" yaml:"typeMetadata"`
	CapabilityMappings  map[string]string `json:"capabilityMappings" yaml:"capabilityMappings"`
	RequirementMappings map[string]string `json:"requirementMappings" yaml:"requirementMappings"`
	PropertyMappings    map[string]string `json:"propertyMappings" yaml:"propertyMappings"`
	AttributeMappings   map[string]string `json:"attributeMappings" yaml:"attributeMappings"`
	InterfaceMappings   map[string]string `json:"interfaceMappings" yaml:"interfaceMappings"`
}

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        Types             `json:"types" yaml:"types"`
	Directives   []string          `json:"directives" yaml:"directives"`
	Properties   Constrainables    `json:"properties" yaml:"properties"`
	Attributes   Constrainables    `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) NewAttributeMapping

func (self *NodeTemplate) NewAttributeMapping(attributeName string) *AttributeMapping

func (*NodeTemplate) NewCapability

func (self *NodeTemplate) NewCapability(name string) *Capability

func (*NodeTemplate) NewInterface

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

func (*NodeTemplate) NewRequirement

func (self *NodeTemplate) NewRequirement(name string, path string) *Requirement

type NodeTemplates

type NodeTemplates map[string]*NodeTemplate

func (NodeTemplates) Object

func (self NodeTemplates) Object(name string) map[string]interface{}

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" yaml:"host"`
	Outputs        AttributeMappings `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         Constrainables    `json:"inputs" yaml:"inputs"`
	Outputs        AttributeMappings `json:"outputs" yaml:"outputs"`
	Timeout        int64             `json:"timeout" yaml:"timeout"`
	Host           string            `json:"host" yaml:"host"`
}

type Operations

type Operations map[string]*Operation

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       Types             `json:"types" yaml:"types"`
	Properties  Constrainables    `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 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       Types             `json:"types" yaml:"types"`
	Properties  Constrainables    `json:"properties" yaml:"properties"`
	Attributes  Constrainables    `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
	NodeTemplatePropertyConstraints FunctionCallMap
	CapabilityPropertyConstraints   FunctionCallMapMap
	Relationship                    *Relationship
	Path                            string
}

func (*Requirement) MarshalJSON

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

json.Marshaler interface

func (*Requirement) MarshalYAML

func (self *Requirement) MarshalYAML() (interface{}, error)

yaml.Marshaler interface

func (*Requirement) Marshalable

func (self *Requirement) Marshalable() interface{}

func (*Requirement) NewRelationship

func (self *Requirement) NewRelationship() *Relationship

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             Constrainables            `json:"inputs" yaml:"inputs"`
	Outputs            Constrainables            `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 *tosca.ScriptletNamespace `json:"scriptletNamespace" yaml:"scriptletNamespace"`
}

func NewServiceTemplate

func NewServiceTemplate() *ServiceTemplate

func NormalizeServiceTemplate

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

From Normalizable interface

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

	Type                string
	TypeMetadata        map[string]string
	CapabilityMappings  map[*NodeTemplate]*Capability
	RequirementMappings map[*NodeTemplate]string
	PropertyMappings    map[*NodeTemplate]string
	AttributeMappings   map[*NodeTemplate]string
	InterfaceMappings   map[*NodeTemplate]string
}

func (*Substitution) MarshalJSON

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

json.Marshaler interface

func (*Substitution) MarshalYAML

func (self *Substitution) MarshalYAML() (interface{}, error)

yaml.Marshaler interface

func (*Substitution) Marshalable

func (self *Substitution) Marshalable() interface{}

type Type

type Type 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 NewType

func NewType(name string) *Type

type TypeInformation added in v0.15.0

type TypeInformation struct {
	Name              string            `json:"name,omitempty" yaml:"name,omitempty"`
	Description       string            `json:"description,omitempty" yaml:"description,omitempty"`
	SchemaDescription string            `json:"schemaDescription,omitempty" yaml:"schemaDescription,omitempty"`
	Metadata          map[string]string `json:"metadata,omitempty" yaml:"metadata,omitempty"`
}

func CopyTypeInformation added in v0.15.0

func CopyTypeInformation(information *TypeInformation) *TypeInformation

func NewTypeInformation added in v0.15.0

func NewTypeInformation() *TypeInformation

func (*TypeInformation) Empty added in v0.15.0

func (self *TypeInformation) Empty() bool

func (*TypeInformation) Prune added in v0.15.0

func (self *TypeInformation) Prune()

type Types

type Types map[string]*Type

func GetHierarchyTypes

func GetHierarchyTypes(hierarchy *tosca.Hierarchy) Types

func GetTypes

func GetTypes(hierarchy *tosca.Hierarchy, entityPtr tosca.EntityPtr) (Types, bool)

func NewTypes

func NewTypes(names ...string) Types

type Value

type Value struct {
	Key         Constrainable `json:"$key,omitempty" yaml:"$key,omitempty"`
	Information *Information  `json:"$information,omitempty" yaml:"$information,omitempty"`
	Constraints FunctionCalls `json:"$constraints,omitempty" yaml:"$constraints,omitempty"`

	Value ard.Value `json:"$value" yaml:"$value"`
}

func NewValue

func NewValue(value ard.Value) *Value

func (*Value) AddConstraint

func (self *Value) AddConstraint(constraint *tosca.FunctionCall)

Constrainable interface

func (*Value) SetInformation added in v0.15.0

func (self *Value) SetInformation(information *Information)

Constrainable interface

func (*Value) SetKey

func (self *Value) SetKey(key Constrainable)

Constrainable interface

type Workflow

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

	Description   string                  `json:"description" yaml:"description"`
	Preconditions []*WorkflowPrecondition `json:"preconditions" yaml:"preconditions"`
	Steps         WorkflowSteps           `json:"steps" yaml:"steps"`
	Inputs        Constrainables          `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    *Operation    `json:"callOperation" yaml:"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