deployments

package
v3.1.0-M1+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2018 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const DockerHubURL = "https://hub.docker.com/"

DockerHubURL is the official URL for the docker hub

View Source
const SingularityHubURL = "https://singularity-hub.org/"

SingularityHubURL is the official URL for the docker hub

Variables

View Source
var DefaultVaultClient vault.Client

DefaultVaultClient is the default Vault Client used to resolve get_secret functions it is nil by default and should be set by the one who created the client

Functions

func CreateNewNodeStackInstances

func CreateNewNodeStackInstances(kv *api.KV, deploymentID, nodeName string, instances int) (map[string]string, error)

CreateNewNodeStackInstances create the given number of new instances of the given node and all other nodes hosted on this one and all linked nodes

CreateNewNodeStackInstances returns a map of newly created instances IDs indexed by node name

func DeleteInstance

func DeleteInstance(kv *api.KV, deploymentID, nodeName, instanceName string) error

DeleteInstance deletes the given instance of the given node from the Consul store

func DeleteRelationshipInstance

func DeleteRelationshipInstance(kv *api.KV, deploymentID, nodeName, instanceName string) error

DeleteRelationshipInstance deletes the instance from relationship instances stored in consul

func DoesDeploymentExists

func DoesDeploymentExists(kv *api.KV, deploymentID string) (bool, error)

DoesDeploymentExists checks if a given deploymentId refer to an existing deployment

func DoesNodeExist

func DoesNodeExist(kv *api.KV, deploymentID, nodeName string) (bool, error)

DoesNodeExist checks if a given node exist in a deployment

func GetArtifactTypeExtensions

func GetArtifactTypeExtensions(kv *api.KV, deploymentID, artifactType string) ([]string, error)

GetArtifactTypeExtensions returns the extensions defined in this artifact type. If the artifact doesn't define any extension then a nil slice is returned

func GetArtifactsForNode

func GetArtifactsForNode(kv *api.KV, deploymentID, nodeName string) (map[string]string, error)

GetArtifactsForNode returns a map of artifact name / artifact file for the given node.

The returned artifacts paths are relative to root of the deployment archive. It will first fetch artifacts from it node type and its parents and fetch artifacts for the node template itself. This way artifacts from a parent type may be overridden by child types and artifacts from node type may be overridden by the node template

func GetArtifactsForType

func GetArtifactsForType(kv *api.KV, deploymentID, typeName string) (map[string]string, error)

GetArtifactsForType returns a map of artifact name / artifact file for the given type.

The returned artifacts paths are relative to root of the deployment archive. It traverse the 'derived_from' relations to support inheritance of artifacts. Parent artifacts are fetched first and may be overridden by child types

func GetBooleanNodeProperty

func GetBooleanNodeProperty(kv *api.KV, deploymentID, nodeName, propertyName string) (bool, error)

GetBooleanNodeProperty returns the boolean value of a property (default: false)

func GetCapabilitiesOfType

func GetCapabilitiesOfType(kv *api.KV, deploymentID, typeName, capabilityTypeName string) ([]string, error)

GetCapabilitiesOfType returns names of all capabilities in a given type hierarchy that derives from a given capability type

func GetCapabilityForRequirement

func GetCapabilityForRequirement(kv *api.KV, deploymentID, nodeName, requirementIndex string) (string, error)

GetCapabilityForRequirement returns the capability associated with a given requirementIndex for the given nodeName.

If there is no capability defined for this requirement then an empty string is returned.

func GetCapabilityProperty deprecated

func GetCapabilityProperty(kv *api.KV, deploymentID, nodeName, capabilityName, propertyName string, nestedKeys ...string) (bool, string, error)

GetCapabilityProperty retrieves the value for a given property in a given node capability

It returns true if a value is found false otherwise as first return parameter. If the property is not found in the node then the type hierarchy is explored to find a default value.

Deprecated: use GetCapabilityPropertyValue instead

will be removed in Yorc 4.0

func GetDefaultNbInstancesForNode

func GetDefaultNbInstancesForNode(kv *api.KV, deploymentID, nodeName string) (uint32, error)

GetDefaultNbInstancesForNode retrieves the default number of instances for a given node nodeName in deployment deploymentId.

If the node has a capability that is or is derived from 'tosca.capabilities.Scalable' it will look for a property 'default_instances' in this capability of this node. Otherwise it will search for any relationship derived from 'tosca.relationships.HostedOn' in node requirements and reiterate the process. If a scalable node is finally found it returns the instances number. If there is no node with the Scalable capability at the end of the hosted on chain then assume that there is only one instance

func GetDeploymentTemplateName

func GetDeploymentTemplateName(kv *api.KV, deploymentID string) (string, error)

GetDeploymentTemplateName only return the name of the template used during the deployment

func GetHostedOnNode

func GetHostedOnNode(kv *api.KV, deploymentID, nodeName string) (string, error)

GetHostedOnNode returns the node name of the node defined in the first found relationship derived from "tosca.relationships.HostedOn"

If there is no HostedOn relationship for this node then it returns an empty string

func GetHostedOnNodeInstance

func GetHostedOnNodeInstance(kv *api.KV, deploymentID, nodeName, instanceName string) (string, string, error)

GetHostedOnNodeInstance returns the node name and instance name of the instance defined in the first found relationship derived from "tosca.relationships.HostedOn"

If there is no HostedOn relationship for this node then it returns an empty string

func GetImplementationArtifactForExtension

func GetImplementationArtifactForExtension(kv *api.KV, deploymentID, extension string) (string, error)

GetImplementationArtifactForExtension returns the implementation artifact type for a given extension.

If the extension is unknown then an empty string is returned

func GetImplementationArtifactForOperation

func GetImplementationArtifactForOperation(kv *api.KV, deploymentID, nodeName, operationName string, isNodeTemplateOperation, isRelationshipOp bool, requirementIndex string) (string, error)

GetImplementationArtifactForOperation returns the implementation artifact type for a given operation. operationName, isRelationshipOp and requirementIndex are typically the result of the DecodeOperation function that should generally call prior to call this function.

func GetInputValue

func GetInputValue(kv *api.KV, deploymentID, inputName string, nestedKeys ...string) (string, error)

GetInputValue tries to retrieve the value of the given input name.

GetInputValue first checks if a non-empty field value exists for this input, if it doesn't then it checks for a non-empty field default. If none of them exists then it returns an empty string.

func GetInstanceAttribute deprecated

func GetInstanceAttribute(kv *api.KV, deploymentID, nodeName, instanceName, attributeName string, nestedKeys ...string) (bool, string, error)

GetInstanceAttribute retrieves the given attribute for a node instance

It returns true if a value is found false otherwise as first return parameter. If the attribute is not found in the node then the type hierarchy is explored to find a default value. If the attribute is still not found then it will explore the HostedOn hierarchy. If still not found then it will check node properties as the spec states "TOSCA orchestrators will automatically reflect (i.e., make available) any property defined on an entity making it available as an attribute of the entity with the same name as the property."

Deprecated: use GetInstanceAttributeValue instead

will be removed in Yorc 4.0

func GetInstanceCapabilityAttribute deprecated

func GetInstanceCapabilityAttribute(kv *api.KV, deploymentID, nodeName, instanceName, capabilityName, attributeName string, nestedKeys ...string) (bool, string, error)

GetInstanceCapabilityAttribute retrieves the value for a given attribute in a given node instance capability

It returns true if a value is found false otherwise as first return parameter. If the attribute is not found in the node then the type hierarchy is explored to find a default value. If still not found check properties as the spec states "TOSCA orchestrators will automatically reflect (i.e., make available) any property defined on an entity making it available as an attribute of the entity with the same name as the property."

Deprecated: use GetInstanceCapabilityAttributeValue instead

will be removed in Yorc 4.0

func GetInstanceState

func GetInstanceState(kv *api.KV, deploymentID, nodeName, instanceName string) (tosca.NodeState, error)

GetInstanceState retrieves the state of a given node instance

func GetKeyValuePairsNodeProperty

func GetKeyValuePairsNodeProperty(kv *api.KV, deploymentID, nodeName, propertyName string) (map[string]string, error)

GetKeyValuePairsNodeProperty returns a key/value string map value of a node property (default: false)

func GetMaxNbInstancesForNode

func GetMaxNbInstancesForNode(kv *api.KV, deploymentID, nodeName string) (uint32, error)

GetMaxNbInstancesForNode retrieves the maximum number of instances for a given node nodeName in deployment deploymentId.

If the node has a capability that is or is derived from 'tosca.capabilities.Scalable' it will look for a property 'max_instances' in this capability of this node. Otherwise it will search for any relationship derived from 'tosca.relationships.HostedOn' in node requirements and reiterate the process. If a scalable node is finally found it returns the instances number. If there is no node with the Scalable capability at the end of the hosted on chain then assume that there is only one instance$

func GetMinNbInstancesForNode

func GetMinNbInstancesForNode(kv *api.KV, deploymentID, nodeName string) (uint32, error)

GetMinNbInstancesForNode retrieves the minimum number of instances for a given node nodeName in deployment deploymentId.

If the node has a capability that is or is derived from 'tosca.capabilities.Scalable' it will look for a property 'min_instances' in this capability of this node. Otherwise it will search for any relationship derived from 'tosca.relationships.HostedOn' in node requirements and reiterate the process. If a scalable node is finally found it returns the instances number.œ If there is no node with the Scalable capability at the end of the hosted on chain then assume that there is only one instance

func GetNbInstancesForNode

func GetNbInstancesForNode(kv *api.KV, deploymentID, nodeName string) (uint32, error)

GetNbInstancesForNode retrieves the number of instances for a given node nodeName in deployment deploymentID.

func GetNbRequirementsForNode

func GetNbRequirementsForNode(kv *api.KV, deploymentID, nodeName string) (int, error)

GetNbRequirementsForNode returns the number of requirements declared for the given node

func GetNestedDataType

func GetNestedDataType(kv *api.KV, deploymentID, baseType string, nestedKeys ...string) (string, error)

GetNestedDataType return the type of a nested datatype

func GetNodeAttributes deprecated

func GetNodeAttributes(kv *api.KV, deploymentID, nodeName, attributeName string, nestedKeys ...string) (bool, map[string]string, error)

GetNodeAttributes retrieves the values for a given attribute in a given node.

As a node may have multiple instances and attributes may be instance-scoped, then returned result is a map with the instance name as key and the retrieved attributes as values.

It returns true if a value is found false otherwise as first return parameter. If the property is not found in the node then the type hierarchy is explored to find a default value. If the property is still not found then it will explore the HostedOn hierarchy.

Deprecated: use GetNodeAttributesValues instead

will be removed in Yorc 4.0

func GetNodeAttributesNames

func GetNodeAttributesNames(kv *api.KV, deploymentID, nodeName string) ([]string, error)

GetNodeAttributesNames retrieves the list of existing attributes for a given node.

func GetNodeAttributesValues

func GetNodeAttributesValues(kv *api.KV, deploymentID, nodeName, attributeName string, nestedKeys ...string) (map[string]*TOSCAValue, error)

GetNodeAttributesValues retrieves the values for a given attribute in a given node.

As a node may have multiple instances and attributes may be instance-scoped, then returned result is a map with the instance name as key and the retrieved attributes as values.

If the property is not found in the node then the type hierarchy is explored to find a default value. If the property is still not found then it will explore the HostedOn hierarchy.

func GetNodeCapabilityAttributeNames

func GetNodeCapabilityAttributeNames(kv *api.KV, deploymentID, nodeName, capabilityName string, exploreParents bool) ([]string, error)

GetNodeCapabilityAttributeNames retrieves the names for all capability attributes of a capability on a given node name

func GetNodeCapabilityType

func GetNodeCapabilityType(kv *api.KV, deploymentID, nodeName, capabilityName string) (string, error)

GetNodeCapabilityType retrieves the type of a node template capability identified by its name

This is a shorthand for GetNodeTypeCapabilityType

func GetNodeInstancesIds

func GetNodeInstancesIds(kv *api.KV, deploymentID, nodeName string) ([]string, error)

GetNodeInstancesIds returns the names of the different instances for a given node.

It may be an empty array if the given node is not HostedOn a scalable node.

func GetNodeMetadata

func GetNodeMetadata(kv *api.KV, deploymentID, nodeName, key string) (bool, string, error)

GetNodeMetadata retrieves the related node metadata key if exists

func GetNodeProperty deprecated

func GetNodeProperty(kv *api.KV, deploymentID, nodeName, propertyName string, nestedKeys ...string) (bool, string, error)

GetNodeProperty retrieves the value for a given property in a given node

It returns true if a value is found false otherwise as first return parameter. If the property is not found in the node then the type hierarchy is explored to find a default value. If the property is still not found then it will explore the HostedOn hierarchy.

Deprecated: use GetNodePropertyValue instead

will be removed in Yorc 4.0

func GetNodeType

func GetNodeType(kv *api.KV, deploymentID, nodeName string) (string, error)

GetNodeType returns the type of a given node identified by its name

func GetNodeTypeCapabilityProperty deprecated

func GetNodeTypeCapabilityProperty(kv *api.KV, deploymentID, nodeType, capabilityName, propertyName, propDataType string, nestedKeys ...string) (bool, string, error)

GetNodeTypeCapabilityProperty retrieves the property value of a node type capability identified by its name

It explores the type hierarchy (derived_from) to found the given capability.

Deprecated: use GetNodeTypeCapabilityPropertyValue instead

will be removed in Yorc 4.0

func GetNodeTypeCapabilityType

func GetNodeTypeCapabilityType(kv *api.KV, deploymentID, nodeType, capabilityName string) (string, error)

GetNodeTypeCapabilityType retrieves the type of a node type capability identified by its name

It explores the type hierarchy (derived_from) to found the given capability. It may return an empty string if the capability is not found in the type hierarchy

func GetNodeTypeImplementingAnOperation

func GetNodeTypeImplementingAnOperation(kv *api.KV, deploymentID, nodeName, operationName string) (string, error)

GetNodeTypeImplementingAnOperation returns the first (bottom-up) type in the type hierarchy of a given node that implements a given operation

This is a shortcut for retrieving the node type and calling the GetTypeImplementingAnOperation() function

func GetNodes

func GetNodes(kv *api.KV, deploymentID string) ([]string, error)

GetNodes returns the names of the different nodes for a given deployment.

func GetNodesHostedOn

func GetNodesHostedOn(kv *api.KV, deploymentID, hostNode string) ([]string, error)

GetNodesHostedOn returns the list of nodes that are hosted on a given node

func GetOperationHostFromTypeOperation

func GetOperationHostFromTypeOperation(kv *api.KV, deploymentID, typeName, interfaceName, operationName string) (string, error)

GetOperationHostFromTypeOperation return the operation_host declared for this operation if any.

The returned value may be an empty string. This function doesn't explore the type heirarchy to find the operation or declared value for operation_host.

func GetOperationHostFromTypeOperationByName

func GetOperationHostFromTypeOperationByName(kv *api.KV, deploymentID, typeName, operationName string) (string, error)

GetOperationHostFromTypeOperationByName return the operation_host declared for this operation if any.

The given operation name should be in format <interface_name>.<operation_name> The returned value may be an empty string. This function doesn't explore the type heirarchy to find the operation or declared value for operation_host.

func GetOperationImplementationFile

func GetOperationImplementationFile(kv *api.KV, deploymentID, nodeTemplateImpl, nodeTypeImpl, operationName string) (string, error)

GetOperationImplementationFile allows you when the implementation of an operation is an artifact to retrieve the file of this artifact

The returned file is the raw value. To have a file with a path relative to the root of the deployment use GetOperationImplementationFileWithRelativePath()

func GetOperationImplementationFileWithRelativePath

func GetOperationImplementationFileWithRelativePath(kv *api.KV, deploymentID, nodeTemplateImpl, nodeTypeImpl, operationName string) (string, error)

GetOperationImplementationFileWithRelativePath allows you when the implementation of an operation is an artifact to retrieve the file of this artifact

The returned file is relative to the root of the deployment. To have the raw value use GetOperationImplementationFile()

func GetOperationImplementationRepository

func GetOperationImplementationRepository(kv *api.KV, deploymentID, nodeTemplateImpl, nodeTypeImpl, operationName string) (string, error)

GetOperationImplementationRepository allows you when the implementation of an operation is an artifact to retrieve the repository of this artifact

func GetOperationImplementationType

func GetOperationImplementationType(kv *api.KV, deploymentID, nodeTemplateImpl, nodeTypeImpl, operationName string) (string, error)

GetOperationImplementationType allows you when the implementation of an operation is an artifact to retrieve the type of this artifact

func GetOperationInputs

func GetOperationInputs(kv *api.KV, deploymentID, nodeTemplateImpl, typeNameImpl, operationName string) ([]string, error)

GetOperationInputs returns the list of inputs names for a given operation

func GetOperationOutputForNode

func GetOperationOutputForNode(kv *api.KV, deploymentID, nodeName, instanceName, interfaceName, operationName, outputName string) (string, error)

GetOperationOutputForNode return a map with in index the instance number and in value the result of the output The "params" parameter is necessary to pass the path of the output

func GetOperationOutputForRelationship

func GetOperationOutputForRelationship(kv *api.KV, deploymentID, nodeName, instanceName, requirementIndex, interfaceName, operationName, outputName string) (string, error)

GetOperationOutputForRelationship retrieves an operation output for a relationship The returned value may be empty if the operation output could not be retrieved

func GetOperationPathAndPrimaryImplementation

func GetOperationPathAndPrimaryImplementation(kv *api.KV, deploymentID, nodeTemplateImpl, nodeTypeImpl, operationName string) (string, string, error)

GetOperationPathAndPrimaryImplementation traverses the type hierarchy to find an operation matching the given operationName.

First, it checks the node template if operation implementation is present Next it gets down to types hierarchy Once found it returns the path to the operation and the value of its primary implementation. If the operation is not found in the node template or in the type hierarchy then empty strings are returned.

func GetParentType

func GetParentType(kv *api.KV, deploymentID, typeName string) (string, error)

GetParentType returns the direct parent type of a given type using the 'derived_from' attributes

An empty string denotes a root type

func GetRelationshipAttributeFromRequirement deprecated

func GetRelationshipAttributeFromRequirement(kv *api.KV, deploymentID, nodeName, instanceName, requirementIndex, attributeName string, nestedKeys ...string) (bool, string, error)

GetRelationshipAttributeFromRequirement retrieves the value for a given attribute in a given node instance requirement

It returns true if a value is found false otherwise as first return parameter. If the attribute is not found in the node then the type hierarchy is explored to find a default value. If still not found check properties as the spec states "TOSCA orchestrators will automatically reflect (i.e., make available) any property defined on an entity making it available as an attribute of the entity with the same name as the property."

Deprecated: use GetRelationshipAttributeValueFromRequirement instead

will be removed in Yorc 4.0

func GetRelationshipForRequirement

func GetRelationshipForRequirement(kv *api.KV, deploymentID, nodeName, requirementIndex string) (string, error)

GetRelationshipForRequirement returns the relationship associated with a given requirementIndex for the given nodeName.

If there is no relationship defined for this requirement then an empty string is returned.

func GetRelationshipPropertyFromRequirement deprecated

func GetRelationshipPropertyFromRequirement(kv *api.KV, deploymentID, nodeName, requirementIndex, propertyName string, nestedKeys ...string) (bool, string, error)

GetRelationshipPropertyFromRequirement returns the value of a relationship's property identified by a requirement index on a node

Deprecated: use GetRelationshipPropertyValueFromRequirement instead

will be removed in Yorc 4.0

func GetRelationshipTypeImplementingAnOperation

func GetRelationshipTypeImplementingAnOperation(kv *api.KV, deploymentID, nodeName, operationName, requirementIndex string) (string, error)

GetRelationshipTypeImplementingAnOperation returns the first (bottom-up) type in the type hierarchy of a given relationship that implements a given operation

An error is returned if the operation is not found in the type hierarchy

func GetRepositoryTokenTypeFromName

func GetRepositoryTokenTypeFromName(kv *api.KV, deploymentID, repoName string) (string, error)

GetRepositoryTokenTypeFromName retrieves the token_type of credential for a given repoName

func GetRepositoryTokenUserFromName

func GetRepositoryTokenUserFromName(kv *api.KV, deploymentID, repoName string) (token string, user string, err error)

GetRepositoryTokenUserFromName This function get the credentials (user/token) for a given repoName

func GetRepositoryURLFromName

func GetRepositoryURLFromName(kv *api.KV, deploymentID, repoName string) (url string, err error)

GetRepositoryURLFromName allow you to retrieve the url of a repo from is name

func GetRequirementIndexByNameForNode

func GetRequirementIndexByNameForNode(kv *api.KV, deploymentID, nodeName, requirementName string) (string, error)

GetRequirementIndexByNameForNode returns the requirement index which name match with defined requirementName for a given node name

func GetRequirementIndexFromRequirementKey

func GetRequirementIndexFromRequirementKey(requirementKey string) string

GetRequirementIndexFromRequirementKey returns the corresponding requirement index from a given requirement key (typically returned by GetRequirementsKeysByTypeForNode)

func GetRequirementKeyByNameForNode

func GetRequirementKeyByNameForNode(kv *api.KV, deploymentID, nodeName, requirementName string) (string, error)

GetRequirementKeyByNameForNode returns path to requirement which name match with defined requirementName for a given node name

func GetRequirementsIndexes

func GetRequirementsIndexes(kv *api.KV, deploymentID, nodeName string) ([]string, error)

GetRequirementsIndexes returns the list of requirements indexes for a given node

func GetRequirementsKeysByTypeForNode

func GetRequirementsKeysByTypeForNode(kv *api.KV, deploymentID, nodeName, requirementType string) ([]string, error)

GetRequirementsKeysByTypeForNode returns paths to requirements whose name or type_requirement match the given requirementType

The returned slice may be empty if there is no matching requirements.

func GetStringArrayNodeProperty

func GetStringArrayNodeProperty(kv *api.KV, deploymentID, nodeName, propertyName string) ([]string, error)

GetStringArrayNodeProperty returns the string Array value of a node property (default: false)

func GetStringNodeProperty

func GetStringNodeProperty(kv *api.KV, deploymentID, nodeName, propertyName string, mandatory bool) (string, error)

GetStringNodeProperty returns the string value of a property. If this value is empty and the argument mandatory is true, an error is returned

func GetTargetInstanceForRequirement

func GetTargetInstanceForRequirement(kv *api.KV, deploymentID, nodeName, requirementIndex, instanceName string) (string, []string, error)

GetTargetInstanceForRequirement returns the target node and instances associated with a given requirementIndex of the given nodeName/instanceName.

func GetTargetNodeForRequirement

func GetTargetNodeForRequirement(kv *api.KV, deploymentID, nodeName, requirementIndex string) (string, error)

GetTargetNodeForRequirement returns the target node associated with a given requirementIndex for the given nodeName.

If there is no node defined for this requirement then an empty string is returned.

func GetTargetNodeForRequirementByName

func GetTargetNodeForRequirementByName(kv *api.KV, deploymentID, nodeName, requirementName string) (string, error)

GetTargetNodeForRequirementByName returns the target node associated with a given requirementName for the given nodeName.

If there is no node defined for this requirement then an empty string is returned.

func GetTopologyInputType

func GetTopologyInputType(kv *api.KV, deploymentID, inputName string) (string, error)

GetTopologyInputType retrieves the optional data type of the parameter.

As this keyname is required for a TOSCA Property definition, but is not for a TOSCA Parameter definition it may be empty. If the input type is list or map and an entry_schema is provided a semicolon and the entry_schema value are appended to the type (ie list:integer) otherwise string is assumed for then entry_schema.

func GetTopologyOutput deprecated

func GetTopologyOutput(kv *api.KV, deploymentID, outputName string, nestedKeys ...string) (bool, string, error)

GetTopologyOutput returns the value of a given topology output

Deprecated: use GetTopologyOutputValue instead

will be removed in Yorc 4.0

func GetTopologyOutputType

func GetTopologyOutputType(kv *api.KV, deploymentID, outputName string) (string, error)

GetTopologyOutputType retrieves the optional data type of the parameter.

As this keyname is required for a TOSCA Property definition, but is not for a TOSCA Parameter definition it may be empty. If the input type is list or map and an entry_schema is provided a semicolon and the entry_schema value are appended to the type (ie list:integer) otherwise string is assumed for then entry_schema.

func GetTopologyOutputsNames

func GetTopologyOutputsNames(kv *api.KV, deploymentID string) ([]string, error)

GetTopologyOutputsNames returns the list of outputs for the deployment

func GetTypeAttributeDataType

func GetTypeAttributeDataType(kv *api.KV, deploymentID, typeName, propertyName string) (string, error)

GetTypeAttributeDataType returns the type of a attribute as defined in its attribute definition

Default value is "string" if not specified. Lists and Maps types have their entry_schema value append separated by a semicolon (ex "map:string") again if there is specified entry_schema "string" is assumed.

func GetTypeAttributes

func GetTypeAttributes(kv *api.KV, deploymentID, typeName string, exploreParents bool) ([]string, error)

GetTypeAttributes returns the list of attributes defined in a given type

It lists only attributes defined in the given type not in its parent types.

func GetTypeAttributesNames

func GetTypeAttributesNames(kv *api.KV, deploymentID, typeName string) ([]string, error)

GetTypeAttributesNames returns the list of attributes names found in the type hierarchy

func GetTypeImplementingAnOperation

func GetTypeImplementingAnOperation(kv *api.KV, deploymentID, typeName, operationName string) (string, error)

GetTypeImplementingAnOperation returns the first (bottom-up) type in the type hierarchy that implements a given operation

An error is returned if the operation is not found in the type hierarchy

func GetTypeImportPath

func GetTypeImportPath(kv *api.KV, deploymentID, typeName string) (string, error)

GetTypeImportPath returns the import path relative to the root of a CSAR of a given TOSCA type.

This is particulary useful for resolving artifacts and implementation

func GetTypeProperties

func GetTypeProperties(kv *api.KV, deploymentID, typeName string, exploreParents bool) ([]string, error)

GetTypeProperties returns the list of properties defined in a given type

It lists only properties defined in the given type not in its parent types.

func GetTypePropertyDataType

func GetTypePropertyDataType(kv *api.KV, deploymentID, typeName, propertyName string) (string, error)

GetTypePropertyDataType returns the type of a property as defined in its property definition

Default value is "string" if not specified. Lists and Maps types have their entry_schema value append separated by a semicolon (ex "map:string") again if there is specified entry_schema "string" is assumed.

func GetTypes

func GetTypes(kv *api.KV, deploymentID string) ([]string, error)

GetTypes returns the names of the different types for a given deployment.

func GetWorkflows

func GetWorkflows(kv *api.KV, deploymentID string) ([]string, error)

GetWorkflows returns the list of workflows names for a given deployment

func HasScalableCapability

func HasScalableCapability(kv *api.KV, deploymentID, nodeName string) (bool, error)

HasScalableCapability check if the given nodeName in the specified deployment, has in this capabilities a Key named scalable

func IsDeploymentNotFoundError

func IsDeploymentNotFoundError(err error) bool

IsDeploymentNotFoundError checks if an error is a deployment not found error

func IsHostedOn

func IsHostedOn(kv *api.KV, deploymentID, nodeName, hostedOn string) (bool, error)

IsHostedOn checks if a given nodeName is hosted on another given node hostedOn by traversing the hostedOn hierarchy

func IsInputNotFound

func IsInputNotFound(err error) bool

IsInputNotFound checks if a given error is an error indicating that an input was not found in an operation

func IsNodeDerivedFrom

func IsNodeDerivedFrom(kv *api.KV, deploymentID, nodeName, derives string) (bool, error)

IsNodeDerivedFrom check if the node's type is derived from another type.

Basically this function is a shorthand for GetNodeType and IsNodeTypeDerivedFrom.

func IsNodeTemplateImplementingOperation

func IsNodeTemplateImplementingOperation(kv *api.KV, deploymentID, nodeName, operationName string) (bool, error)

IsNodeTemplateImplementingOperation returns true if the node implements the defined operation

func IsOperationInputAPropertyDefinition

func IsOperationInputAPropertyDefinition(kv *api.KV, deploymentID, nodeTemplateImpl, typeNameImpl, operationName, inputName string) (bool, error)

IsOperationInputAPropertyDefinition checks if a given operation input is a property definition

func IsOperationNotImplemented

func IsOperationNotImplemented(err error) bool

IsOperationNotImplemented checks if a given error is an error indicating that an operation is not implemented

func IsTypeAttributeRequired

func IsTypeAttributeRequired(kv *api.KV, deploymentID, typeName, attributeName string) (bool, error)

IsTypeAttributeRequired checks if a attribute defined in a given type is required.

As per the TOSCA specification a attribute is considered as required by default. An error is returned if the given type doesn't define the given attribute.

func IsTypeDerivedFrom

func IsTypeDerivedFrom(kv *api.KV, deploymentID, nodeType, derives string) (bool, error)

IsTypeDerivedFrom traverses 'derived_from' to check if type derives from another type

func IsTypeMissingError

func IsTypeMissingError(err error) bool

IsTypeMissingError checks if the given error is a TypeMissing error

func IsTypePropertyRequired

func IsTypePropertyRequired(kv *api.KV, deploymentID, typeName, propertyName string) (bool, error)

IsTypePropertyRequired checks if a property defined in a given type is required.

As per the TOSCA specification a property is considered as required by default. An error is returned if the given type doesn't define the given property.

func ReadWorkflow

func ReadWorkflow(kv *api.KV, deploymentID, workflowName string) (tosca.Workflow, error)

ReadWorkflow reads a workflow definition from Consul and built its TOSCA representation

func SelectNodeStackInstances

func SelectNodeStackInstances(kv *api.KV, deploymentID, nodeName string, instancesDelta int) (map[string]string, error)

SelectNodeStackInstances selects a given number of instances of the given node, all the nodes hosted on this one and all nodes linked to it.

For each node it returns a coma separated list of selected instances

func SetAttributeComplexForAllInstances

func SetAttributeComplexForAllInstances(kv *api.KV, deploymentID, nodeName, attributeName string, attributeValue interface{}) error

SetAttributeComplexForAllInstances sets the same attribute value to all instances of a given node.

It does the same thing than iterating over instances ids and calling SetInstanceAttributeComplex but use a consulutil.ConsulStore to do it in parallel. We can expect better performances with a large number of instances

func SetAttributeForAllInstances

func SetAttributeForAllInstances(kv *api.KV, deploymentID, nodeName, attributeName, attributeValue string) error

SetAttributeForAllInstances sets the same attribute value to all instances of a given node.

It does the same thing than iterating over instances ids and calling SetInstanceAttribute but use a consulutil.ConsulStore to do it in parallel. We can expect better performances with a large number of instances

func SetCapabilityAttributeComplexForAllInstances

func SetCapabilityAttributeComplexForAllInstances(kv *api.KV, deploymentID, nodeName, capabilityName, attributeName string, attributeValue interface{}) error

SetCapabilityAttributeComplexForAllInstances sets the same capability attribute value that may be a literal or a complex data type to all instances of a given node.

It does the same thing than iterating over instances ids and calling SetInstanceCapabilityAttributeComplex but use a consulutil.ConsulStore to do it in parallel. We can expect better performances with a large number of instances

func SetCapabilityAttributeForAllInstances

func SetCapabilityAttributeForAllInstances(kv *api.KV, deploymentID, nodeName, capabilityName, attributeName, attributeValue string) error

SetCapabilityAttributeForAllInstances sets the same capability attribute value to all instances of a given node.

It does the same thing than iterating over instances ids and calling SetInstanceCapabilityAttribute but use a consulutil.ConsulStore to do it in parallel. We can expect better performances with a large number of instances

func SetInstanceAttribute

func SetInstanceAttribute(deploymentID, nodeName, instanceName, attributeName, attributeValue string) error

SetInstanceAttribute sets an instance attribute

func SetInstanceAttributeComplex

func SetInstanceAttributeComplex(deploymentID, nodeName, instanceName, attributeName string, attributeValue interface{}) error

SetInstanceAttributeComplex sets an instance attribute that may be a literal or a complex data type

func SetInstanceCapabilityAttribute

func SetInstanceCapabilityAttribute(deploymentID, nodeName, instanceName, capabilityName, attributeName, value string) error

SetInstanceCapabilityAttribute sets a capability attribute for a given node instance

func SetInstanceCapabilityAttributeComplex

func SetInstanceCapabilityAttributeComplex(deploymentID, nodeName, instanceName, capabilityName, attributeName string, attributeValue interface{}) error

SetInstanceCapabilityAttributeComplex sets an instance capability attribute that may be a literal or a complex data type

func SetInstanceRelationshipAttribute

func SetInstanceRelationshipAttribute(deploymentID, nodeName, instanceName, requirementIndex, attributeName, value string) error

SetInstanceRelationshipAttribute sets a relationship attribute for a given node instance

func SetInstanceRelationshipAttributeComplex

func SetInstanceRelationshipAttributeComplex(deploymentID, nodeName, instanceName, requirementIndex, attributeName string, attributeValue interface{}) error

SetInstanceRelationshipAttributeComplex sets an instance relationship attribute that may be a literal or a complex data type

func SetInstanceState deprecated

func SetInstanceState(kv *api.KV, deploymentID, nodeName, instanceName string, state tosca.NodeState) error

SetInstanceState stores the state of a given node instance and publishes a status change event

Deprecated: use SetInstanceStateWithContextualLogs instead

will be removed in Yorc 4.0

func SetInstanceStateString deprecated

func SetInstanceStateString(kv *api.KV, deploymentID, nodeName, instanceName, state string) error

SetInstanceStateString stores the state of a given node instance and publishes a status change event

Deprecated: use SetInstanceStateStringWithContextualLogs instead

will be removed in Yorc 4.0

func SetInstanceStateStringWithContextualLogs

func SetInstanceStateStringWithContextualLogs(ctx context.Context, kv *api.KV, deploymentID, nodeName, instanceName, state string) error

SetInstanceStateStringWithContextualLogs stores the state of a given node instance and publishes a status change event context is used to carry contextual information for logging (see events package)

func SetInstanceStateWithContextualLogs

func SetInstanceStateWithContextualLogs(ctx context.Context, kv *api.KV, deploymentID, nodeName, instanceName string, state tosca.NodeState) error

SetInstanceStateWithContextualLogs stores the state of a given node instance and publishes a status change event context is used to carry contextual information for logging (see events package)

func SetNodeInstanceAttribute deprecated

func SetNodeInstanceAttribute(kv *api.KV, deploymentID, nodeName, instanceName, attributeName, attributeValue string) error

SetNodeInstanceAttribute sets an attribute value to a node instance

Deprecated: Use SetInstanceAttribute

will be removed in Yorc 4.0

func SetNodeProperty

func SetNodeProperty(kv *api.KV, deploymentID, nodeName, propertyName, propertyValue string) error

SetNodeProperty sets a node property

func SetRelationshipAttributeComplexForAllInstances

func SetRelationshipAttributeComplexForAllInstances(kv *api.KV, deploymentID, nodeName, requirementIndex, attributeName string, attributeValue interface{}) error

SetRelationshipAttributeComplexForAllInstances sets the same relationship attribute value that may be a literal or a complex data type to all instances of a given node.

It does the same thing than iterating over instances ids and calling SetInstanceRelationshipAttributeComplex but use a consulutil.ConsulStore to do it in parallel. We can expect better performances with a large number of instances

func SetRelationshipAttributeForAllInstances

func SetRelationshipAttributeForAllInstances(kv *api.KV, deploymentID, nodeName, requirementIndex, attributeName, attributeValue string) error

SetRelationshipAttributeForAllInstances sets the same relationship attribute value to all instances of a given node.

It does the same thing than iterating over instances ids and calling SetInstanceRelationshipAttribute but use a consulutil.ConsulStore to do it in parallel. We can expect better performances with a large number of instances

func StoreDeploymentDefinition

func StoreDeploymentDefinition(ctx context.Context, kv *api.KV, deploymentID string, defPath string) error

StoreDeploymentDefinition takes a defPath and parse it as a tosca.Topology then it store it in consul under consulutil.DeploymentKVPrefix/deploymentID

func TypeHasAttribute

func TypeHasAttribute(kv *api.KV, deploymentID, typeName, attributeName string, exploreParents bool) (bool, error)

TypeHasAttribute returns true if the type has a attribute named attributeName defined

exploreParents switch enable attribute check on parent types

func TypeHasCapability

func TypeHasCapability(kv *api.KV, deploymentID, typeName, capabilityTypeName string) (bool, error)

TypeHasCapability checks if a given TOSCA type has a capability which type is derived from capabilityTypeName

func TypeHasProperty

func TypeHasProperty(kv *api.KV, deploymentID, typeName, propertyName string, exploreParents bool) (bool, error)

TypeHasProperty returns true if the type has a property named propertyName defined

exploreParents switch enable property check on parent types

Types

type DeploymentStatus

type DeploymentStatus int

DeploymentStatus x ENUM( INITIAL, DEPLOYMENT_IN_PROGRESS, DEPLOYED, UNDEPLOYMENT_IN_PROGRESS, UNDEPLOYED, DEPLOYMENT_FAILED, UNDEPLOYMENT_FAILED, SCALING_IN_PROGRESS )

const (
	// INITIAL is a DeploymentStatus of type INITIAL
	INITIAL DeploymentStatus = iota
	// DEPLOYMENT_IN_PROGRESS is a DeploymentStatus of type DEPLOYMENT_IN_PROGRESS
	DEPLOYMENT_IN_PROGRESS
	// DEPLOYED is a DeploymentStatus of type DEPLOYED
	DEPLOYED
	// UNDEPLOYMENT_IN_PROGRESS is a DeploymentStatus of type UNDEPLOYMENT_IN_PROGRESS
	UNDEPLOYMENT_IN_PROGRESS
	// UNDEPLOYED is a DeploymentStatus of type UNDEPLOYED
	UNDEPLOYED
	// DEPLOYMENT_FAILED is a DeploymentStatus of type DEPLOYMENT_FAILED
	DEPLOYMENT_FAILED
	// UNDEPLOYMENT_FAILED is a DeploymentStatus of type UNDEPLOYMENT_FAILED
	UNDEPLOYMENT_FAILED
	// SCALING_IN_PROGRESS is a DeploymentStatus of type SCALING_IN_PROGRESS
	SCALING_IN_PROGRESS
)

func DeploymentStatusFromString

func DeploymentStatusFromString(status string, ignoreCase bool) (DeploymentStatus, error)

DeploymentStatusFromString returns a DeploymentStatus from its textual representation.

If ignoreCase is 'true' the given status is upper cased to match the generated status strings. If the given status does not match any known status an error is returned

func GetDeploymentStatus

func GetDeploymentStatus(kv *api.KV, deploymentID string) (DeploymentStatus, error)

GetDeploymentStatus returns a DeploymentStatus for a given deploymentId

If the given deploymentId doesn't refer to an existing deployment an error is returned. This error could be checked with

IsDeploymentNotFoundError(err error) bool

For example:

if status, err := GetDeploymentStatus(kv, deploymentId); err != nil {
	if IsDeploymentNotFoundError(err) {
		// Do something in case of deployment not found
	}
}

func ParseDeploymentStatus

func ParseDeploymentStatus(name string) (DeploymentStatus, error)

ParseDeploymentStatus attempts to convert a string to a DeploymentStatus

func (DeploymentStatus) String

func (i DeploymentStatus) String() string

type OperationInputResult

type OperationInputResult struct {
	NodeName     string
	InstanceName string
	Value        string
	IsSecret     bool
}

An OperationInputResult represents a result of retrieving an operation input

As in case of attributes it may have different values based on the instance name this struct contains the necessary information to identify the result context

func GetOperationInput

func GetOperationInput(kv *api.KV, deploymentID, nodeName string, operation prov.Operation, inputName string) ([]OperationInputResult, error)

GetOperationInput retrieves the value of an input for a given operation

func GetOperationInputPropertyDefinitionDefault

func GetOperationInputPropertyDefinitionDefault(kv *api.KV, deploymentID, nodeName string, operation prov.Operation, inputName string) ([]OperationInputResult, error)

GetOperationInputPropertyDefinitionDefault retrieves the default value of an input of type property definition for a given operation

type TOSCAValue

type TOSCAValue struct {
	Value    interface{}
	IsSecret bool
}

A TOSCAValue is the result of a resolved property or attribute

func GetCapabilityPropertyValue

func GetCapabilityPropertyValue(kv *api.KV, deploymentID, nodeName, capabilityName, propertyName string, nestedKeys ...string) (*TOSCAValue, error)

GetCapabilityPropertyValue retrieves the value for a given property in a given node capability

It returns true if a value is found false otherwise as first return parameter. If the property is not found in the node then the type hierarchy is explored to find a default value.

func GetInstanceAttributeValue

func GetInstanceAttributeValue(kv *api.KV, deploymentID, nodeName, instanceName, attributeName string, nestedKeys ...string) (*TOSCAValue, error)

GetInstanceAttributeValue retrieves the given attribute for a node instance

It returns true if a value is found false otherwise as first return parameter. If the attribute is not found in the node then the type hierarchy is explored to find a default value. If the attribute is still not found then it will explore the HostedOn hierarchy. If still not found then it will check node properties as the spec states "TOSCA orchestrators will automatically reflect (i.e., make available) any property defined on an entity making it available as an attribute of the entity with the same name as the property."

func GetInstanceCapabilityAttributeValue

func GetInstanceCapabilityAttributeValue(kv *api.KV, deploymentID, nodeName, instanceName, capabilityName, attributeName string, nestedKeys ...string) (*TOSCAValue, error)

GetInstanceCapabilityAttributeValue retrieves the value for a given attribute in a given node instance capability

It returns true if a value is found false otherwise as first return parameter. If the attribute is not found in the node then the type hierarchy is explored to find a default value. If still not found check properties as the spec states "TOSCA orchestrators will automatically reflect (i.e., make available) any property defined on an entity making it available as an attribute of the entity with the same name as the property."

func GetNodePropertyValue

func GetNodePropertyValue(kv *api.KV, deploymentID, nodeName, propertyName string, nestedKeys ...string) (*TOSCAValue, error)

GetNodePropertyValue retrieves the value for a given property in a given node

It returns true if a value is found false otherwise as first return parameter. If the property is not found in the node then the type hierarchy is explored to find a default value. If the property is still not found then it will explore the HostedOn hierarchy

func GetNodeTypeCapabilityPropertyValue

func GetNodeTypeCapabilityPropertyValue(kv *api.KV, deploymentID, nodeType, capabilityName, propertyName, propDataType string, nestedKeys ...string) (*TOSCAValue, error)

GetNodeTypeCapabilityPropertyValue retrieves the property value of a node type capability identified by its name

It explores the type hierarchy (derived_from) to found the given capability.

func GetRelationshipAttributeValueFromRequirement

func GetRelationshipAttributeValueFromRequirement(kv *api.KV, deploymentID, nodeName, instanceName, requirementIndex, attributeName string, nestedKeys ...string) (*TOSCAValue, error)

GetRelationshipAttributeValueFromRequirement retrieves the value for a given attribute in a given node instance requirement

It returns true if a value is found false otherwise as first return parameter. If the attribute is not found in the node then the type hierarchy is explored to find a default value. If still not found check properties as the spec states "TOSCA orchestrators will automatically reflect (i.e., make available) any property defined on an entity making it available as an attribute of the entity with the same name as the property."

func GetRelationshipPropertyValueFromRequirement

func GetRelationshipPropertyValueFromRequirement(kv *api.KV, deploymentID, nodeName, requirementIndex, propertyName string, nestedKeys ...string) (*TOSCAValue, error)

GetRelationshipPropertyValueFromRequirement returns the value of a relationship's property identified by a requirement index on a node

func GetTopologyOutputValue

func GetTopologyOutputValue(kv *api.KV, deploymentID, outputName string, nestedKeys ...string) (*TOSCAValue, error)

GetTopologyOutputValue returns the value of a given topology output

func (*TOSCAValue) RawString

func (v *TOSCAValue) RawString() string

RawString returns the native format of the value. If value is a literal then it will be a string. If value is a complex value it will be its JSON representation.

func (*TOSCAValue) String

func (v *TOSCAValue) String() string

String allows to not print secrets in case of involontary usage.

If you want to allways have the actual string representation of the value then use RawString instead.

Jump to

Keyboard shortcuts

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