Documentation ¶
Overview ¶
Package toscalib implements the TOSCA syntax in its YAML version as described in http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.0/csd03/TOSCA-Simple-Profile-YAML-v1.0-csd03.html
Index ¶
- Constants
- Variables
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func MustAsset(name string) []byte
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- type ActivityDefinition
- type ArtifactDefinition
- type ArtifactType
- type Assignment
- type AttributeAssignment
- type AttributeDefinition
- type CapabilityAssignment
- type CapabilityDefinition
- type CapabilityType
- type ConstraintClause
- type Constraints
- type CredentialDefinition
- type DataType
- type EventFilterDefinition
- type Filter
- type Frequency
- type GroupDefinition
- type GroupType
- type ImportDefinition
- type InterfaceDefinition
- type InterfaceType
- type Metadata
- type NodeFilter
- type NodeTemplate
- type NodeType
- type OperationDefinition
- type ParserHooks
- type PolicyDefinition
- type PolicyType
- type PreconditionDefinition
- type PropertyAssignment
- type PropertyDefinition
- type Regex
- type RelationshipTemplate
- type RelationshipType
- type RepositoryDefinition
- type RequirementAssignment
- type RequirementDefinition
- type RequirementRelationship
- type RequirementRelationshipType
- type Resolver
- type Scalar
- type ServiceTemplateDefinition
- func (s *ServiceTemplateDefinition) Clone() ServiceTemplateDefinition
- func (s *ServiceTemplateDefinition) GetAttribute(node, attr string) *AttributeAssignment
- func (s *ServiceTemplateDefinition) GetInputValue(prop string, raw bool) interface{}
- func (s *ServiceTemplateDefinition) GetNodeTemplate(nodeName string) *NodeTemplate
- func (s *ServiceTemplateDefinition) GetProperty(node, prop string) *PropertyAssignment
- func (s *ServiceTemplateDefinition) GetRelationshipSource(relationshipName string) *NodeTemplate
- func (s *ServiceTemplateDefinition) GetRelationshipTarget(relationshipName string) *NodeTemplate
- func (s *ServiceTemplateDefinition) Merge(u ServiceTemplateDefinition) ServiceTemplateDefinition
- func (t *ServiceTemplateDefinition) Parse(r io.Reader) error
- func (t *ServiceTemplateDefinition) ParseCsar(zipfile string) error
- func (t *ServiceTemplateDefinition) ParseReader(r io.Reader, resolver Resolver, hooks ParserHooks) error
- func (t *ServiceTemplateDefinition) ParseSource(source string, resolver Resolver, hooks ParserHooks) error
- func (s *ServiceTemplateDefinition) SetAttribute(node, attr string, value interface{})
- func (s *ServiceTemplateDefinition) SetInputValue(prop string, value interface{})
- type Size
- type Status
- type StepDefinition
- type TimeInterval
- type TopologyTemplateType
- type ToscaInterfacesNodeLifecycleStandarder
- type ToscaList
- type ToscaMap
- type ToscaRange
- type TriggerCondition
- type TriggerDefinition
- type Version
- type WorkflowDefinition
Constants ¶
const ( // Self is ref for a TOSCA orchestrator will interpret this keyword as the Node or Relationship Template // instance that contains the function at the time the function is evaluated Self = "SELF" // Source is a ref a TOSCA orchestrator will interpret this keyword as the Node Template instance // that is at the source end of the relationship that contains the referencing function. Source = "SOURCE" // Target is a ref a TOSCA orchestrator will interpret this keyword as the Node Template instance // that is at the source end of the relationship that contains the referencing function. Target = "TARGET" // Host is a ref a TOSCA orchestrator will interpret this keyword to refer to the all nodes // that “host” the node using this reference (i.e., as identified by its HostedOn relationship). Host = "HOST" // LocalFile will indicate the orchestrator is responsible for providing a path as the result of the // get_artifact call where the artifact file can be accessed. The orchestrator will also remove (by default) // the artifact from this location at the end of the operation. LocalFile = "LOCAL_FILE" )
const ( ConcatFunc = "concat" TokenFunc = "token" GetInputFunc = "get_input" GetPropFunc = "get_property" GetAttrFunc = "get_attribute" GetOpOutputFunc = "get_operation_output" GetNodesOfTypeFunc = "get_nodes_of_type" GetArtifactFunc = "get_artifact" )
Defines Tosca Function Names
const ( StateInitial = iota // Node is not yet created. Node only exists as a template definition StateCreating = iota // Node is transitioning from initial state to created state. StateCreated = iota // Node software has been installed. StateConfiguring = iota // Node is transitioning from created state to configured state. StateConfigured = iota // Node has been configured prior to being started StateStarting = iota // Node is transitioning from configured state to started state. StateStarted = iota // Node is started. StateStopping = iota // Node is transitioning from its current state to a configured state. StateDeleting = iota // Node is transitioning from its current state to one where it is deleted and its state is =iota // longer tracked by the instance model. StateError = iota // Node is in an error state )
This implements the type defined in Appendix A 3 of the definition file
const ( // NetworkPrivate is an alias used to reference the first private network within a property or attribute // of a Node or Capability which would be assigned to them by the underlying platform at runtime. NetworkPrivate = "PRIVATE" // NetworkPublic is an alias used to reference the first public network within a property or attribute // of a Node or Capability which would be assigned to them by the underlying platform at runtime. NetworkPublic = "PUBLIC" )
const UNBOUNDED uint64 = 9223372036854775807
UNBOUNDED A.2.3 TOCSA range type
Variables ¶
var Functions = []string{ ConcatFunc, TokenFunc, GetInputFunc, GetPropFunc, GetAttrFunc, GetOpOutputFunc, GetNodesOfTypeFunc, GetArtifactFunc, }
Functions is the list of Tosca Functions
var Operators = []string{
"equal",
"greater_than",
"greater_or_equal",
"less_than",
"less_or_equal",
"in_range",
"valid_values",
"length",
"min_length",
"max_length",
"pattern",
}
Operators is a list of supported constraint operators
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
Types ¶
type ActivityDefinition ¶
type ActivityDefinition struct { SetState string `yaml:"set_state,omitempty" json:"set_state,omitempty"` CallOperation string `yaml:"call_operation,omitempty" json:"call_operation,omitempty"` Inline string `yaml:"inline,omitempty" json:"inline,omitempty"` Delegate string `yaml:"delegate,omitempty" json:"delegate,omitempty"` }
ActivityDefinition structure to handle workflow step activity
type ArtifactDefinition ¶
type ArtifactDefinition struct { Type string `yaml:"type" json:"type"` // the required artifact type the artifact definition is based upon File string `yaml:"file" json:"file"` // equired URI string (relative or absolute) which can be used to locate the artifact’s file Repository string `yaml:"repository" json:"repository"` // optional name of the repository definition to use to retrieve the associated artifact (file) from Description string `yaml:"description,omitempty" json:"description,omitempty"` // optional description for the artifact DeployPath string `yaml:"deploy_path,omitempty" json:"deploy_path,omitempty"` // optional path the artifact_file_URI would be copied into within the target node’s container }
ArtifactDefinition defines a named, typed file that can be associated with Node Type or Node Template and used by orchestration engine to facilitate deployment and implementation of interface operations.
func (*ArtifactDefinition) UnmarshalYAML ¶
func (d *ArtifactDefinition) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML converts YAML text to a type
type ArtifactType ¶
type ArtifactType struct { DerivedFrom string `yaml:"derived_from,omitempty" json:"derived_from"` // optional name of the Artifact Type this Artifact Type definition derives from Version Version `yaml:"version,omitempty" json:"version"` Description string `yaml:"description,omitempty" json:"description"` Metadata Metadata `yaml:"metadata,omitempty" json:"metadata"` MimeType string `yaml:"mime_type,omitempty" json:"mime_type"` // optional Multipurpose Internet Mail Extensions (MIME) standard string value that describes the file contents for this type of Artifact Type FileExt []string `yaml:"file_ext,omitempty" json:"file_ext"` // optional list of one or more recognized file extensions for this type of artifact type Properties map[string]PropertyDefinition `yaml:"properties,omitempty" json:"properties,omitempty"` // optional list of property definitions for the artifact type }
ArtifactType is a reusable entity that defines the type of one or more files that are used to define implementation or deployment artifacts that are referenced by nodes or relationships on their operations.
type Assignment ¶
type Assignment struct { Value interface{} Function string Args []interface{} Expression ConstraintClause }
Assignment supports Value evaluation
func (*Assignment) Evaluate ¶
func (p *Assignment) Evaluate(std *ServiceTemplateDefinition, ctx string) interface{}
Evaluate gets the value of an Assignment, including the evaluation of expression or function
func (*Assignment) UnmarshalYAML ¶
func (p *Assignment) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML converts YAML text to a type
type AttributeAssignment ¶
type AttributeAssignment struct {
Assignment
}
AttributeAssignment supports Value evaluation
type AttributeDefinition ¶
type AttributeDefinition struct { Type string `yaml:"type" json:"type"` // The required data type for the attribute. Description string `yaml:"description,omitempty" json:"description,omitempty"` // The optional description for the attribute. Default interface{} `yaml:"default,omitempty" json:"default,omitempty"` // An optional key that may provide a value to be used as a default if not provided by another means. Status Status `yaml:"status,omitempty" json:"status,omitempty"` // The optional status of the attribute relative to the specification or implementation. EntrySchema interface{} `yaml:"entry_schema,omitempty" json:"-"` // The optional key that is used to declare the name of the Datatype definition for entries of set types such as the TOSCA list or map. }
AttributeDefinition is a structure describing the property assignmenet in the node template This notion is described in appendix 5.9 of the document
type CapabilityAssignment ¶
type CapabilityAssignment struct { Properties map[string]PropertyAssignment `yaml:"properties,omitempty" json:"properties"` Attributes map[string]AttributeAssignment `yaml:"attributes,omitempty" json:"attributes,omitempty"` }
CapabilityAssignment allows node template authors to assign values to properties and attributes for a named capability definition that is part of a Node Template’s type definition.
type CapabilityDefinition ¶
type CapabilityDefinition struct { Type string `yaml:"type" json:"type"` // The required name of the Capability Type the capability definition is based upon. Description string `yaml:"description,omitempty" jsson:"description,omitempty"` // The optional description of the Capability definition. Properties map[string]PropertyDefinition `yaml:"properties,omitempty" json:"properties,omitempty"` // An optional list of property definitions for the Capability definition. Attributes map[string]AttributeDefinition `yaml:"attributes" json:"attributes"` // An optional list of attribute definitions for the Capability definition. ValidSourceTypes []string `yaml:"valid_source_types" json:"valid_source_types"` // A`n optional list of one or more valid names of Node Types that are supported as valid sources of any relationship established to the declared Capability Type. Occurrences []string `yaml:"occurrences" json:"occurrences"` }
CapabilityDefinition Appendix 6.1
func (*CapabilityDefinition) IsValidSourceType ¶
func (c *CapabilityDefinition) IsValidSourceType(srcType string) bool
IsValidSourceType checks if a specific node type is valid for the specific Capability
func (*CapabilityDefinition) UnmarshalYAML ¶
func (c *CapabilityDefinition) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML is used to match both Simple Notation Example and Full Notation Example
type CapabilityType ¶
type CapabilityType struct { DerivedFrom string `yaml:"derived_from,omitempty" json:"derived_from"` // An optional parent Node Type name this new Node Type derives from Version Version `yaml:"version,omitempty" json:"version"` Description string `yaml:"description,omitempty" json:"description"` // An optional description for the Node Type Properties map[string]PropertyDefinition `yaml:"properties,omitempty" json:"properties"` Attributes map[string]AttributeDefinition `yaml:"attributes,omitempty" json:"attributes,omitempty"` // An optional list of attribute definitions for the Node Type. ValidSources []string `yaml:"valid_source_types,omitempty" json:"valid_source_types"` }
CapabilityType as described in appendix 6.6 A Capability Type is a reusable entity that describes a kind of capability that a Node Type can declare to expose. Requirements (implicit or explicit) that are declared as part of one node can be matched to (i.e., fulfilled by) the Capabilities declared by another node.
type ConstraintClause ¶
type ConstraintClause struct { Operator string Values interface{} }
ConstraintClause definition as described in Appendix 5.2. This is a map where the index is a string that may have a value in {"equal","greater_than", ...} (see Appendix 5.2) a,s value is an interface for the definition. Example: ConstraintClause may be [ "greater_than": 3 ]
func (*ConstraintClause) Evaluate ¶
func (constraint *ConstraintClause) Evaluate(interface{}) bool
Evaluate the constraint and return a boolean
func (*ConstraintClause) UnmarshalYAML ¶
func (constraint *ConstraintClause) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML handles simple and complex format when converting from YAML to types
type Constraints ¶
type Constraints []ConstraintClause
Constraints is an array of ConstraintClause
func (*Constraints) IsValid ¶
func (c *Constraints) IsValid(v interface{}) (bool, error)
IsValid returns true if the value is valid against the Constraints
type CredentialDefinition ¶
type CredentialDefinition interface{}
CredentialDefinition as described in appendix C 2.1 The Credential type is a complex TOSCA data Type used when describing authorization credentials used to access network accessible resources.
type DataType ¶
type DataType struct { DerivedFrom string `yaml:"derived_from,omitempty" json:"derived_from,omitempty"` // The optional key used when a datatype is derived from an existing TOSCA Data Type. Description string `yaml:"description,omitempty" json:"description,omitempty"` // The optional description for the Data Type. Constraints Constraints `yaml:"constraints" json:"constraints"` // The optional list of sequenced constraint clauses for the Data Type. Properties map[string]PropertyDefinition `yaml:"properties" json:"properties"` // The optional list property definitions that comprise the schema for a complex Data Type in TOSCA. }
DataType as described in Appendix 6.5 A Data Type definition defines the schema for new named datatypes in TOSCA.
type EventFilterDefinition ¶
type EventFilterDefinition struct { Node string `yaml:"node" json:"node"` Requirement string `yaml:"requirement" json:"requirement"` Capability string `yaml:"capability" json:"capability"` }
EventFilterDefinition provides structure for event_filter of a Trigger
type GroupDefinition ¶
type GroupDefinition struct { Type string `yaml:"type" json:"type"` Metadata Metadata `yaml:"metadata,omitempty" json:"metadata"` Description string `yaml:"description,omitempty" json:"description"` Properties map[string]PropertyAssignment `yaml:"properties,omitempty" json:"properties"` Interfaces map[string]InterfaceDefinition `yaml:"interfaces,omitempty" json:"interfaces"` Members []string `yaml:"members,omitempty" json:"members,omitempty"` }
GroupDefinition defines a logical grouping of node templates, typically for management purposes, but is separate from the application’s topology template.
type GroupType ¶
type GroupType struct { DerivedFrom string `yaml:"derived_from,omitempty" json:"derived_from"` Version Version `yaml:"version,omitempty" json:"version"` Metadata Metadata `yaml:"metadata,omitempty" json:"metadata"` Description string `yaml:"description,omitempty" json:"description"` Attributes map[string]AttributeDefinition `yaml:"attributes,omitempty" json:"attributes"` Properties map[string]PropertyDefinition `yaml:"properties,omitempty" json:"properties"` Requirements []map[string]RequirementDefinition `yaml:"requirements,omitempty" json:"requirements,omitempty"` // An optional sequenced list of requirement definitions for the Node Type Capabilities map[string]CapabilityDefinition `yaml:"capabilities,omitempty" json:"capabilities,omitempty"` // An optional list of capability definitions for the Node Type Interfaces map[string]InterfaceDefinition `yaml:"interfaces,omitempty" json:"interfaces"` Members []string `yaml:"members,omitempty" json:"members,omitempty"` }
GroupType defines logical grouping types for nodes, typically for different management purposes. Groups can effectively be viewed as logical nodes that are not part of the physical deployment topology of an application, yet can have capabilities and the ability to attach policies and interfaces that can be applied (depending on the group type) to its member nodes.
type ImportDefinition ¶
type ImportDefinition struct { File string `yaml:"file" json:"file"` Repository string `yaml:"repository,omitempty" json:"repository,omitempty"` NamespaceURI string `yaml:"namespace_uri,omitempty" json:"namespace_uri,omitempty"` NamespacePrefix string `yaml:"namespace_prefix,omitempty" json:"namespace_prefix,omitempty"` }
ImportDefinition is used within a TOSCA Service Template to locate and uniquely name another TOSCA Service Template file which has type and template definitions to be imported (included) and referenced within another Service Template.
func (*ImportDefinition) UnmarshalYAML ¶
func (i *ImportDefinition) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML is used to match both Simple Notation Example and Full Notation Example
type InterfaceDefinition ¶
type InterfaceDefinition struct { Type string `yaml:"type" json:"type"` Inputs map[string]PropertyAssignment `yaml:"inputs,omitempty"` Operations map[string]OperationDefinition `yaml:"operations,inline"` }
InterfaceDefinition is related to a node type
type InterfaceType ¶
type InterfaceType struct { DerivedFrom string `yaml:"derived_from,omitempty" json:"derived_from"` Version Version `yaml:"version,omitempty"` Metadata Metadata `yaml:"metadata,omitempty" json:"metadata"` Description string `yaml:"description,omitempty"` Inputs map[string]PropertyDefinition `yaml:"inputs,omitempty" json:"inputs"` // The optional list of input parameter definitions. Operations map[string]OperationDefinition `yaml:"operations,inline"` }
InterfaceType as described in Appendix A 6.4 An Interface Type is a reusable entity that describes a set of operations that can be used to interact with or manage a node or relationship in a TOSCA topology.
type Metadata ¶
Metadata is provides support for attaching provider specific attributes to different structures.
type NodeFilter ¶
type NodeFilter interface{}
NodeFilter Appendix 5.4 TODO: Implement NodeFilter struct A node filter definition defines criteria for selection of a TOSCA Node Template based upon the template’s property values, capabilities and capability properties.
type NodeTemplate ¶
type NodeTemplate struct { Name string Type string `yaml:"type" json:"type"` // The required name of the Node Type the Node Template is based upon. Description string `yaml:"description,omitempty" json:"description,omitempty"` // An optional description for the Node Template. Metadata Metadata `yaml:"metadata,omitempty" json:"metadata"` Directives []string `yaml:"directives,omitempty" json:"-" json:"directives,omitempty"` // An optional list of directive values to provide processing instructions to orchestrators and tooling. Properties map[string]PropertyAssignment `yaml:"properties,omitempty" json:"-" json:"properties,omitempty"` // An optional list of property value assignments for the Node Template. Attributes map[string]AttributeAssignment `yaml:"attributes,omitempty" json:"-" json:"attributes,omitempty"` // An optional list of attribute value assignments for the Node Template. Requirements []map[string]RequirementAssignment `yaml:"requirements,omitempty" json:"-" json:"requirements,omitempty"` // An optional sequenced list of requirement assignments for the Node Template. Capabilities map[string]CapabilityAssignment `yaml:"capabilities,omitempty" json:"-" json:"capabilities,omitempty"` // An optional list of capability assignments for the Node Template. Interfaces map[string]InterfaceDefinition `yaml:"interfaces,omitempty" json:"-" json:"interfaces,omitempty"` // An optional list of named interface definitions for the Node Template. Artifacts map[string]ArtifactDefinition `yaml:"artifacts,omitempty" json:"-" json:"artifacts,omitempty"` // An optional list of named artifact definitions for the Node Template. NodeFilter map[string]NodeFilter `yaml:"node_filter,omitempty" json:"-" json:"node_filter,omitempty"` // The optional filter definition that TOSCA orchestrators would use to select the correct target node. This keyname is only valid if the directive has the value of “selectable” set. Copy string `yaml:"copy,omitempty" json:"copy,omitempty"` // The optional (symbolic) name of another node template to copy into (all keynames and values) and use as a basis for this node template. Refs struct { Type NodeType `yaml:"-" json:"-"` } `yaml:"-" json:"-"` }
NodeTemplate as described in Appendix 7.3 A Node Template specifies the occurrence of a manageable software component as part of an application’s topology model which is defined in a TOSCA Service Template. A Node template is an instance of a specified Node Type and can provide customized properties, constraints or operations which override the defaults provided by its Node Type and its implementations.
func (*NodeTemplate) GetRelationshipSource ¶
func (n *NodeTemplate) GetRelationshipSource(relationshipName string) string
GetRelationshipSource retrieves the source Node Template name if the node has a requirement that is linked to a specific relationship template.
func (*NodeTemplate) GetRelationshipTarget ¶
func (n *NodeTemplate) GetRelationshipTarget(relationshipName string) string
GetRelationshipTarget retrieves the target Node Template name if the node has a requirement that is linked to a specific relationship template.
func (*NodeTemplate) GetRequirement ¶
func (n *NodeTemplate) GetRequirement(name string) *RequirementAssignment
GetRequirement returns the Requirement with the specified name.
type NodeType ¶
type NodeType struct { DerivedFrom string `yaml:"derived_from,omitempty" json:"derived_from"` // An optional parent Node Type name this new Node Type derives from Version Version `yaml:"version,omitempty" json:"version"` Description string `yaml:"description,omitempty" json:"description"` // An optional description for the Node Type Metadata Metadata `yaml:"metadata,omitempty" json:"metadata"` Properties map[string]PropertyDefinition `yaml:"properties,omitempty" json:"properties,omitempty"` // An optional list of property definitions for the Node Type. Attributes map[string]AttributeDefinition `yaml:"attributes,omitempty" json:"attributes,omitempty"` // An optional list of attribute definitions for the Node Type. Requirements []map[string]RequirementDefinition `yaml:"requirements,omitempty" json:"requirements,omitempty"` // An optional sequenced list of requirement definitions for the Node Type Capabilities map[string]CapabilityDefinition `yaml:"capabilities,omitempty" json:"capabilities,omitempty"` // An optional list of capability definitions for the Node Type Interfaces map[string]InterfaceDefinition `yaml:"interfaces,omitempty" json:"interfaces,omitempty"` // An optional list of interface definitions supported by the Node Type Artifacts map[string]ArtifactDefinition `yaml:"artifacts,omitempty" json:"artifacts,omitempty"` // An optional list of named artifact definitions for the Node Type }
NodeType as described is Appendix 6.8. A Node Type is a reusable entity that defines the type of one or more Node Templates. As such, a Node Type defines the structure of observable properties via a Properties Definition, the Requirements and Capabilities of the node as well as its supported interfaces.
type OperationDefinition ¶
type OperationDefinition struct { Inputs map[string]PropertyAssignment `yaml:"inputs,omitempty"` Description string `yaml:"description,omitempty"` Implementation string `yaml:"implementation,omitempty"` }
OperationDefinition defines a named function or procedure that can be bound to an implementation artifact (e.g., a script).
func (*OperationDefinition) UnmarshalYAML ¶
func (i *OperationDefinition) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML converts YAML text to a type
type ParserHooks ¶
type ParserHooks struct {
ParsedSTD func(source string, std *ServiceTemplateDefinition) error
}
ParserHooks provide callback functions for handling custom logic at key points within the overall parsing logic.
type PolicyDefinition ¶
type PolicyDefinition struct { Type string `yaml:"type" json:"type"` Metadata Metadata `yaml:"metadata,omitempty" json:"metadata"` Description string `yaml:"description,omitempty" json:"description"` Properties map[string]PropertyAssignment `yaml:"properties,omitempty" json:"properties"` Targets []string `yaml:"targets" json:"targets"` Triggers map[string]TriggerDefinition `yaml:"triggers" json:"triggers"` }
PolicyDefinition provides the structure for an instance of a Policy based on a PolicyType
func (*PolicyDefinition) IsValidTarget ¶
func (pd *PolicyDefinition) IsValidTarget(name string) bool
IsValidTarget checks if a specified target is valid for the Policy
type PolicyType ¶
type PolicyType struct { DerivedFrom string `yaml:"derived_from,omitempty" json:"derived_from"` Version Version `yaml:"version,omitempty" json:"version"` Metadata Metadata `yaml:"metadata,omitempty" json:"metadata"` Description string `yaml:"description,omitempty" json:"description"` Properties map[string]PropertyDefinition `yaml:"properties,omitempty" json:"properties"` Targets []string `yaml:"targets" json:"targets"` Triggers map[string]TriggerDefinition `yaml:"triggers" json:"triggers"` }
PolicyType provides the base structure for defining what a Policy is
type PreconditionDefinition ¶
type PreconditionDefinition struct { Target string `yaml:"target,omitempty" json:"target,omitempty"` Condition Filter `yaml:"condition,omitempty" json:"condition,omitempty"` }
PreconditionDefinition structure to handle a condition that is checked before a step
type PropertyAssignment ¶
type PropertyAssignment struct {
Assignment
}
PropertyAssignment supports Value evaluation
type PropertyDefinition ¶
type PropertyDefinition struct { // Value is not part of PropertyDefinition but an extension to represent both // PropertyDefinition and ParameterDefinition within a single type. Value PropertyAssignment `yaml:"value,omitempty"` Type string `yaml:"type" json:"type"` // The required data type for the property Description string `yaml:"description,omitempty" json:"description,omitempty"` // The optional description for the property. Required bool `yaml:"required,omitempty" json:"required,omitempty"` // An optional key that declares a property as required ( true) or not ( false) Default: true Default string `yaml:"default,omitempty" json:"default,omitempty"` Status Status `yaml:"status,omitempty" json:"status,omitempty"` Constraints Constraints `yaml:"constraints,omitempty,flow" json:"constraints,omitempty"` EntrySchema interface{} `yaml:"entry_schema,omitempty" json:"entry_schema,omitempty"` }
PropertyDefinition as described in Appendix 5.7: A property definition defines a named, typed value and related data that can be associated with an entity defined in this specification (e.g., Node Types, Relation ship Types, Capability Types, etc.). Properties are used by template authors to provide input values to TOSCA entities which indicate their “desired state” when they are instantiated. The value of a property can be retrieved using the get_property function within TOSCA Service Templates
func (*PropertyDefinition) UnmarshalYAML ¶
func (p *PropertyDefinition) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML converts YAML text to a type
type RelationshipTemplate ¶
type RelationshipTemplate struct { Type string `yaml:"type" json:"type"` Metadata Metadata `yaml:"metadata,omitempty" json:"metadata"` Description string `yaml:"description,omitempty" json:"description"` Attributes map[string]AttributeAssignment `yaml:"attributes,omitempty" json:"-" json:"attributes,omitempty"` // An optional list of attribute value assignments for the Node Template. Properties map[string]PropertyAssignment `yaml:"properties,omitempty" json:"properties"` Interfaces map[string]InterfaceDefinition `yaml:"interfaces,omitempty" json:"interfaces"` Copy string `yaml:"copy,omitempty" json:"copy,omitempty"` }
RelationshipTemplate specifies the occurrence of a manageable relationship between node templates as part of an application’s topology model that is defined in a TOSCA Service Template. A Relationship template is an instance of a specified Relationship Type and can provide customized properties, constraints or operations which override the defaults provided by its Relationship Type and its implementations.
type RelationshipType ¶
type RelationshipType struct { DerivedFrom string `yaml:"derived_from,omitempty" json:"derived_from"` Version Version `yaml:"version,omitempty" json:"version"` Metadata Metadata `yaml:"metadata,omitempty" json:"metadata"` Description string `yaml:"description,omitempty" json:"description"` Attributes map[string]AttributeDefinition `yaml:"attributes,omitempty" json:"attributes"` Properties map[string]PropertyDefinition `yaml:"properties,omitempty" json:"properties"` Interfaces map[string]InterfaceDefinition `yaml:"interfaces,omitempty" json:"interfaces"` ValidTarget []string `yaml:"valid_target_types,omitempty" json:"valid_target_types"` }
RelationshipType as described in appendix 6.9 A Relationship Type is a reusable entity that defines the type of one or more relationships between Node Types or Node Templates.
func (*RelationshipType) IsValidTarget ¶
func (r *RelationshipType) IsValidTarget(typeName string) bool
IsValidTarget checks to see if a specified type is in the list of valid targets and returns true/false. If there are no defined valid targets then it will always be true.
type RepositoryDefinition ¶
type RepositoryDefinition struct { Description string `yaml:"description,omitempty" json:"description,omitempty"` // The optional description for the repository. URL string `yaml:"url" json:"url"` // The required URL or network address used to access the repository. Credential CredentialDefinition `yaml:"credential" json:"credential"` // The optional Credential used to authorize access to the repository. }
RepositoryDefinition as desribed in Appendix 5.6 A repository definition defines a named external repository which contains deployment and implementation artifacts that are referenced within the TOSCA Service Template.
func (*RepositoryDefinition) UnmarshalYAML ¶
func (r *RepositoryDefinition) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML is used to match both Simple Notation Example and Full Notation Example
type RequirementAssignment ¶
type RequirementAssignment struct { Capability string `yaml:"capability,omitempty" json:"capability,omitempty"` /* The optional reserved keyname used to provide the name of either a: - Capability definition within a target node template that can fulfill the requirement. - Capability Type that the provider will use to select a type-compatible target node template to fulfill the requirement at runtime. */ Node string `yaml:"node,omitempty" json:"node,omitempty"` /* The optional reserved keyname used to identify the target node of a relationship. specifically, it is used to provide either a: - Node Template name that can fulfil the target node requirement. - Node Type name that the provider will use to select a type-compatible node template to fulfil the requirement at runtime. */ Nodefilter NodeFilter `yaml:"node_filter,omitempty" json:"node_filter,omitempty"` // The optional filter definition that TOSCA orchestrators or providers would use to select a type-compatible target node that can fulfill the associated abstract requirement at runtime.o /* The following is the list of recognized keynames for a TOSCA requirement assignment’s relationship keyname which is used when Property assignments need to be provided to inputs of declared interfaces or their operations:*/ Relationship RequirementRelationship `yaml:"relationship,omitempty" json:"relationship,omitempty"` }
RequirementAssignment as described in Appendix 7.2
func (*RequirementAssignment) UnmarshalYAML ¶
func (r *RequirementAssignment) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML is used to match both Simple Notation Example and Full Notation Example
type RequirementDefinition ¶
type RequirementDefinition struct { Capability string `yaml:"capability" json:"capability"` // The required reserved keyname used that can be used to provide the name of a valid Capability Type that can fulfil the requirement Node string `yaml:"node,omitempty" json:"node,omitempty"` // The optional reserved keyname used to provide the name of a valid Node Type that contains the capability definition that can be used to fulfil the requirement Relationship RequirementRelationshipType `yaml:"relationship" json:"relationship,omitempty"` Occurrences ToscaRange `yaml:"occurrences,omitempty" json:"occurrences,omitempty"` // The optional minimum and maximum occurrences for the requirement. Note: the keyword UNBOUNDED is also supported to represent any positive integer }
RequirementDefinition as described in Appendix 6.2
func (*RequirementDefinition) UnmarshalYAML ¶
func (r *RequirementDefinition) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML is used to match both Simple Notation Example and Full Notation Example
type RequirementRelationship ¶
type RequirementRelationship struct { Type string `yaml:"type" json:"type"` // The optional reserved keyname used to provide the name of the Relationship Type for the requirement assignment’s relationship keyname. Interfaces map[string]InterfaceDefinition `yaml:"interfaces,omitempty" json:"interfaces,omitempty"` // The optional reserved keyname used to reference declared (named) interface definitions of the corresponding Relationship Type in order to provide Property assignments for these interfaces or operations of these interfaces. Properties map[string]PropertyAssignment `yaml:"properties" json:"properties"` // The optional list property definitions that comprise the schema for a complex Data Type in TOSCA. }
RequirementRelationship is the list of recognized keynames for a TOSCA requirement assignment’s relationship keyname which is used when Property assignments need to be provided to inputs of declared interfaces or their operations:
func (*RequirementRelationship) UnmarshalYAML ¶
func (r *RequirementRelationship) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML is used to match both Simple Notation Example and Full Notation Example
type RequirementRelationshipType ¶
type RequirementRelationshipType struct { Type string `yaml:"type" json:"type"` Interfaces map[string]InterfaceDefinition `yaml:"interfaces,omitempty" json:"interfaces"` }
RequirementRelationshipType defines the Relationship type of a Requirement Definition
func (*RequirementRelationshipType) UnmarshalYAML ¶
func (r *RequirementRelationshipType) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML is used to match both Simple Notation Example and Full Notation Example
type Resolver ¶
Resolver defines a function spec that the Parser will use to resolve remote Imports.
type Scalar ¶
Scalar type as defined in Appendis 2.6. The scalar unit type can be used to define scalar values along with a unit from the list of recognized units Scalar type may be time.Duration, Size or Frequency
func (*Scalar) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface Unmarshals a string of the form "scalar unit" into a Scalar, validating that scalar and unit are valid
type ServiceTemplateDefinition ¶
type ServiceTemplateDefinition struct { DefinitionsVersion string `yaml:"tosca_definitions_version" json:"tosca_definitions_version"` // A.9.3.1 tosca_definitions_version Metadata Metadata `yaml:"metadata,omitempty" json:"metadata"` Description string `yaml:"description,omitempty" json:"description,omitempty"` DslDefinitions interface{} `yaml:"dsl_definitions,omitempty" json:"dsl_definitions,omitempty"` // Declares optional DSL-specific definitions and conventions. For example, in YAML, this allows defining reusable YAML macros (i.e., YAML alias anchors) for use throughout the TOSCA Service Template. Repositories map[string]RepositoryDefinition `yaml:"repositories,omitempty" json:"repositories,omitempty"` // Declares the list of external repositories which contain artifacts that are referenced in the service template along with their addresses and necessary credential information used to connect to them in order to retrieve the artifacts. Imports []ImportDefinition `yaml:"imports,omitempty" json:"imports,omitempty"` // Declares import statements external TOSCA Definitions documents. For example, these may be file location or URIs relative to the service template file within the same TOSCA CSAR file. ArtifactTypes map[string]ArtifactType `yaml:"artifact_types,omitempty" json:"artifact_types,omitempty"` // This section contains an optional list of artifact type definitions for use in service templates DataTypes map[string]DataType `yaml:"data_types,omitempty" json:"data_types,omitempty"` // Declares a list of optional TOSCA Data Type definitions. CapabilityTypes map[string]CapabilityType `yaml:"capability_types,omitempty" json:"capability_types,omitempty"` // This section contains an optional list of capability type definitions for use in service templates. InterfaceTypes map[string]InterfaceType `yaml:"interface_types,omitempty" json:"interface_types,omitempty"` // This section contains an optional list of interface type definitions for use in service templates. RelationshipTypes map[string]RelationshipType `yaml:"relationship_types,omitempty" json:"relationship_types,omitempty"` // This section contains a set of relationship type definitions for use in service templates. NodeTypes map[string]NodeType `yaml:"node_types,omitempty" json:"node_types,omitempty"` // This section contains a set of node type definitions for use in service templates. GroupTypes map[string]GroupType `yaml:"group_types,omitempty" json:"group_types,omitempty"` PolicyTypes map[string]PolicyType `yaml:"policy_types" json:"policy_types"` TopologyTemplate TopologyTemplateType `yaml:"topology_template" json:"topology_template"` // Defines the topology template of an application or service, consisting of node templates that represent the application’s or service’s components, as well as relationship templates representing relations between the components. }
ServiceTemplateDefinition is the meta structure containing an entire tosca document as described in http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.0/csd03/TOSCA-Simple-Profile-YAML-v1.0-csd03.html
func (*ServiceTemplateDefinition) Clone ¶
func (s *ServiceTemplateDefinition) Clone() ServiceTemplateDefinition
Clone creates a deep copy of a Service Template Definition
func (*ServiceTemplateDefinition) GetAttribute ¶
func (s *ServiceTemplateDefinition) GetAttribute(node, attr string) *AttributeAssignment
GetAttribute returns the attribute of a Node
func (*ServiceTemplateDefinition) GetInputValue ¶
func (s *ServiceTemplateDefinition) GetInputValue(prop string, raw bool) interface{}
GetInputValue retrieves an input value from Service Template Definition in the raw form (function evaluation not performed), or actual value after all function evaluation has completed.
func (*ServiceTemplateDefinition) GetNodeTemplate ¶
func (s *ServiceTemplateDefinition) GetNodeTemplate(nodeName string) *NodeTemplate
GetNodeTemplate returns a pointer to a node template given its name its returns nil if not found
func (*ServiceTemplateDefinition) GetProperty ¶
func (s *ServiceTemplateDefinition) GetProperty(node, prop string) *PropertyAssignment
GetProperty returns the property "prop"'s value for node named node
func (*ServiceTemplateDefinition) GetRelationshipSource ¶
func (s *ServiceTemplateDefinition) GetRelationshipSource(relationshipName string) *NodeTemplate
GetRelationshipSource verifies the RelationshipTemplate exists and then searches the NodeTemplates to determine which one has a requirement for a specific RelationshipTemplate.
func (*ServiceTemplateDefinition) GetRelationshipTarget ¶
func (s *ServiceTemplateDefinition) GetRelationshipTarget(relationshipName string) *NodeTemplate
GetRelationshipTarget verifies the RelationshipTemplate exists and then searches the NodeTemplates to determine which one has a requirement for a specific RelationshipTemplate with target node specified.
func (*ServiceTemplateDefinition) Merge ¶
func (s *ServiceTemplateDefinition) Merge(u ServiceTemplateDefinition) ServiceTemplateDefinition
Merge applies the data from one ServiceTemplate to the current ServiceTemplate
func (*ServiceTemplateDefinition) Parse ¶
func (t *ServiceTemplateDefinition) Parse(r io.Reader) error
Parse a TOSCA document and fill in the structure
func (*ServiceTemplateDefinition) ParseCsar ¶
func (t *ServiceTemplateDefinition) ParseCsar(zipfile string) error
ParseCsar handles open and parse the CSAR file
func (*ServiceTemplateDefinition) ParseReader ¶
func (t *ServiceTemplateDefinition) ParseReader(r io.Reader, resolver Resolver, hooks ParserHooks) error
ParseReader retrieves and parses a TOSCA document and loads into the structure using specified Resolver function to retrieve remote imports.
func (*ServiceTemplateDefinition) ParseSource ¶
func (t *ServiceTemplateDefinition) ParseSource(source string, resolver Resolver, hooks ParserHooks) error
ParseSource retrieves and parses a TOSCA document and loads into the structure using specified Resolver function to retrieve remote source or imports.
func (*ServiceTemplateDefinition) SetAttribute ¶
func (s *ServiceTemplateDefinition) SetAttribute(node, attr string, value interface{})
SetAttribute provides the ability to set a value to a named attribute
func (*ServiceTemplateDefinition) SetInputValue ¶
func (s *ServiceTemplateDefinition) SetInputValue(prop string, value interface{})
SetInputValue sets an input value on a Service Template Definition
type StepDefinition ¶
type StepDefinition struct { Target string `yaml:"target,omitempty" json:"target,omitempty"` OnSuccess []string `yaml:"on_success,omitempty" json:"on_success,omitempty"` Activities []ActivityDefinition `yaml:"activities,omitempty" json:"activities,omitempty"` Filter Filter `yaml:"filter,omitempty" json:"filter,omitempty"` }
StepDefinition structure to handle workflow steps
type TimeInterval ¶
type TimeInterval struct { StartTime string `yaml:"start_time" json:"start_time"` EndTime string `yaml:"end_time" json:"end_time"` }
TimeInterval Datatype defined in Spec v1.2 section 5.3.3 The TimeInterval type is a complex TOSCA data Type used when describing a period of time using the YAML ISO 8601 format to declare the start and end times.
type TopologyTemplateType ¶
type TopologyTemplateType struct { Description string `yaml:"description,omitempty" json:"description,omitempty"` Inputs map[string]PropertyDefinition `yaml:"inputs,omitempty" json:"inputs,omitempty"` NodeTemplates map[string]NodeTemplate `yaml:"node_templates" json:"node_templates"` RelationshipTemplates map[string]RelationshipTemplate `yaml:"relationship_templates,omitempty" json:"relationship_templates,omitempty"` Groups map[string]GroupDefinition `yaml:"groups" json:"groups"` Policies []map[string]PolicyDefinition `yaml:"policies" json:"policies"` Workflows map[string]WorkflowDefinition `yaml:"workflows,omitempty" json:"workflows,omitempty"` Outputs map[string]PropertyDefinition `yaml:"outputs,omitempty" json:"outputs,omitempty"` }
TopologyTemplateType as described in appendix A 8 This section defines the topology template of a cloud application. The main ingredients of the topology template are node templates representing components of the application and relationship templates representing links between the components. These elements are defined in the nested node_templates section and the nested relationship_templates sections, respectively. Furthermore, a topology template allows for defining input parameters, output parameters as well as grouping of node templates.
type ToscaInterfacesNodeLifecycleStandarder ¶
type ToscaInterfacesNodeLifecycleStandarder interface { Create() error // description: Standard lifecycle create operation. Configure() error // description: Standard lifecycle configure operation. Start() error // description: Standard lifecycle start operation. Stop() error // description: Standard lifecycle stop operation. Delete() error //description: Standard lifecycle delete operation. }
ToscaInterfacesNodeLifecycleStandarder is a go interface for the standard normative lifecycle
type ToscaList ¶
type ToscaList []interface{}
ToscaList is defined is Appendix 2.4. The list type allows for specifying multiple values for a parameter of property. For example, if an application allows for being configured to listen on multiple ports, a list of ports could be configured using the list data type. Note that entries in a list for one property or parameter must be of the same type. The type (for simple entries) or schema (for complex entries) is defined by the entry_schema attribute of the respective property definition, attribute definitions, or input or output parameter definitions.
type ToscaMap ¶
type ToscaMap map[interface{}]interface{}
ToscaMap type as described in appendix A.2.5 The map type allows for specifying multiple values for a param eter of property as a map. In contrast to the list type, where each entry can only be addressed by its index in the list, entries in a map are named elements that can be addressed by their keys.i Note that entries in a map for one property or parameter must be of the same type. The type (for simple entries) or schema (for complex entries) is defined by the entry_schema attribute of the respective property definition, attribute definition, or input or output parameter definition
type ToscaRange ¶
type ToscaRange interface{}
ToscaRange is defined in Appendix 2.3 The range type can be used to define numeric ranges with a lower and upper boundary. For example, this allows for specifying a range of ports to be opened in a firewall
type TriggerCondition ¶
type TriggerCondition struct { Constraint ConstraintClause `yaml:"constraint,omitempty" json:"constraint"` Period Scalar `yaml:"period,omitempty" json:"period"` Evaluations int `yaml:"evaluations,omitempty" json:"evaluations"` Method string `yaml:"method,omitempty" json:"method"` }
TriggerCondition provides structure for condition of a Trigger
func (*TriggerCondition) UnmarshalYAML ¶
func (t *TriggerCondition) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML handles simple and complex format when converting from YAML to types
type TriggerDefinition ¶
type TriggerDefinition struct { Description string `yaml:"description,omitempty" json:"description"` EventType string `yaml:"event_type" json:"event_type"` Schedule TimeInterval `yaml:"schedule,omitempty" json:"schedule"` TargetFilter EventFilterDefinition `yaml:"target_filter,omitempty" json:"target_filter"` Condition TriggerCondition `yaml:"condition,omitempty" json:"condition"` Action map[string]OperationDefinition `yaml:"action" json:"action"` }
TriggerDefinition provides the base structure for defining a Trigger for a Policy
type Version ¶
Version - The version have the following grammar: MajorVersion.MinorVersion[.FixVersion[.Qualifier[-BuildVersion]]]
MajorVersion is a required integer value greater than or equ al to 0 (zero) MinorVersion is a required integer value greater than or equal to 0 (zero). FixVersion is a optional integer value greater than or equal to 0 (zero) Qualifier is an optional string that indicates a named, pre-release version of the associated code that has been derived from the version of the code identified by the combination major_version, minor_version and fix_version numbers BuildVersion is an optional integer value greater than or equal to 0 (zero) that can be used to further qualify different build versions of the code that has the same qualifer_string
func (*Version) GetBuildVersion ¶
GetBuildVersion returns an integer value greater than or equal to 0 (zero) that can be used to further qualify different build versions of the code that has the same qualifer_string
func (*Version) GetFixVersion ¶
GetFixVersion returns the fix_version integer value
func (*Version) GetQualifier ¶
GetQualifier returns the named, pre-release version of the associated code that has been derived from the version of the code identified by the combination major_version, minor_version and fix_version numbers
func (*Version) UnmarshalYAML ¶
UnmarshalYAML is used to convert string to Version
type WorkflowDefinition ¶
type WorkflowDefinition struct { Description string `yaml:"description,omitempty" json:"description,omitempty"` Inputs map[string]PropertyDefinition `yaml:"inputs,omitempty" json:"inputs,omitempty"` Preconditions []PreconditionDefinition `yaml:"preconditions,omitempty" json:"preconditions,omitempty"` Steps map[string]StepDefinition `yaml:"steps,omitempty" json:"steps,omitempty"` }
WorkflowDefinition structure to handle workflows as per tosca spec 1.2
Source Files ¶
- assignment.go
- attributes.go
- capabilities.go
- constraints.go
- flattener.go
- groups.go
- interfaces.go
- lifecycle.go
- node_template.go
- node_type.go
- normative_definitions.go
- parser.go
- policies.go
- properties.go
- reflector.go
- relationships.go
- requirements.go
- resolver.go
- service_template.go
- status.go
- topology.go
- tosca_data_types.go
- tosca_functions.go
- tosca_namespace_alias.go
- tosca_normative_values.go
- tosca_reusable_modeling_definitions.go
- utils.go
- workflow.go