deployments

package
v3.2.4 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2019 License: Apache-2.0 Imports: 28 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 CleanupPurgedDeployments

func CleanupPurgedDeployments(ctx context.Context, cc *api.Client, evictionTimeout time.Duration, extraDeployments ...string) error

CleanupPurgedDeployments definitively removes purged deployments

Deployment are cleaned-up if they have been purged for at least evictionTimeout or if the are in the extraDeployments list

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 GetCapabilityPropertyType

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

GetCapabilityPropertyType retrieves the type for a given property in a given node capability It returns false if there is no such property

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 GetInstanceStateString

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

GetInstanceStateString retrieves the string value of the state attribute 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 GetPoliciesForType

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

GetPoliciesForType retrieves all policies with or derived from policyTypeName

func GetPoliciesForTypeAndNode

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

GetPoliciesForTypeAndNode retrieves all policies with or derived from policyTypeName and with nodeName as target

func GetPolicyTargets

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

GetPolicyTargets retrieves the policy template targets these targets are node names

func GetPolicyTargetsForType

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

GetPolicyTargetsForType retrieves the policy type targets this targets are node types

func GetPolicyType

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

GetPolicyType returns the type of the policy

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) (string, string, error)

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

func GetRepositoryURLFromName

func GetRepositoryURLFromName(kv *api.KV, deploymentID, repoName string) (string, 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 GetRequirementNameByIndexForNode

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

GetRequirementNameByIndexForNode returns the requirement name for a given node and requirement index

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) This function returns a nil array for an empty string property value

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 particularly 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 HasAnyRequirementCapability

func HasAnyRequirementCapability(kv *api.KV, deploymentID, nodeName, requirement, capabilityType string) (bool, string, error)

HasAnyRequirementCapability returns true and the the related node name addressing the capability if node with name nodeName has the requirement with the capability type equal or derived from the provided type otherwise it returns false and empty string

func HasAnyRequirementFromNodeType

func HasAnyRequirementFromNodeType(kv *api.KV, deploymentID, nodeName, requirement, nodeType string) (bool, string, error)

HasAnyRequirementFromNodeType returns true and the the related node name addressing the capability if node with name nodeName has the requirement with the node type equal or derived from the provided type otherwise it returns false and empty string

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 IsInconsistentDeploymentError

func IsInconsistentDeploymentError(err error) bool

IsInconsistentDeploymentError checks if an error is an inconsistent deployment error

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 IsOperationImplemented

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

IsOperationImplemented checks if a given operation is implemented either in the node template or in the node type hierarchy

An implemented operation means that it has a non empty primary implementation or file for an implementation artifact

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 IsTargetForPolicy

func IsTargetForPolicy(kv *api.KV, deploymentID, policyName, nodeName string, recursive bool) (bool, error)

IsTargetForPolicy returns true if the node name is a policy target

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 LookupInstanceAttributeValue

func LookupInstanceAttributeValue(ctx context.Context, kv *api.KV, deploymentID, nodeName, instanceName, attribute string, nestedKeys ...string) (string, error)

LookupInstanceAttributeValue executes a lookup to retrieve instance attribute value when attribute can be long to retrieve

func NewInconsistentDeploymentError

func NewInconsistentDeploymentError(deploymentID string) error

NewInconsistentDeploymentError allows to create a new inconsistentDeploymentError error

func NodeHasAttribute added in v3.2.1

func NodeHasAttribute(kv *api.KV, deploymentID, nodeName, attributeName string, exploreParents bool) (bool, error)

NodeHasAttribute returns true if the node type has an attribute named attributeName defined

exploreParents switch enable attribute check on parent types

This is basically a shorthand for GetNodeType then TypeHasAttribute

func NodeHasProperty added in v3.2.1

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

NodeHasProperty returns true if the node type has a property named propertyName defined

exploreParents switch enable property check on parent types

This is basically a shorthand for GetNodeType then TypeHasProperty

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 SetDeploymentStatus

func SetDeploymentStatus(ctx context.Context, kv *api.KV, deploymentID string, status DeploymentStatus) error

SetDeploymentStatus sets the deployment status to the given status.

This function will first check for an update of the current status and do it only if necessary. It will also emit a proper event to notify of status change. It is safe for concurrent use by using a CAS mechanism.

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 SetInstanceListAttributes

func SetInstanceListAttributes(attributes []*AttributeData) error

SetInstanceListAttributes sets a list of instance attributes in order to store all attributes together then publish. This is done for avoiding inconsistency at publish time

func SetInstanceListAttributesComplex

func SetInstanceListAttributesComplex(attributes []*AttributeData) error

SetInstanceListAttributesComplex sets an instance list of attributes that may be a literal or a complex data type All attributes are stored together Then all notifications are published

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 TagDeploymentAsPurged

func TagDeploymentAsPurged(ctx context.Context, cc *api.Client, deploymentID string) error

TagDeploymentAsPurged registers current purge time and emit a deployment status change event and a log for the given deployment

The timestamp will be used to evict purged deployments after an given delay.

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 AttributeData

type AttributeData struct {
	DeploymentID     string
	NodeName         string
	InstanceName     string
	Name             string
	Value            string
	CapabilityName   string
	RequirementIndex string
}

AttributeData represents the related attribute data

func BuildAttributeDataFromPath

func BuildAttributeDataFromPath(aPath string) (*AttributeData, error)

BuildAttributeDataFromPath allows to return attribute data from path as below: - instance attribute: _yorc/deployments/<DEPLOYMENT_ID>/topology/instances/<NODE_NAME>/<INSTANCE_NAME>/attributes/<ATTRIBUTE_NAME> - capability attribute: _yorc/deployments/<DEPLOYMENT_ID>/topology/instances/<NODE_NAME>/<INSTANCE_NAME>/capabilities/(/*)*/attributes/<ATTRIBUTE_NAME> - relationship attribute: _yorc/deployments/<DEPLOYMENT_ID>/topology/relationship_instances/<NODE_NAME>/<REQUIREMENT_INDEX>/<INSTANCE_NAME>/attributes/<ATTRIBUTE_NAME>

type AttributeNotifier

type AttributeNotifier struct {
	NodeName       string
	InstanceName   string
	AttributeName  string
	CapabilityName string
}

AttributeNotifier is an attribute notifying its value changes

func (*AttributeNotifier) NotifyValueChange

func (an *AttributeNotifier) NotifyValueChange(kv *api.KV, deploymentID string) error

NotifyValueChange allows to notify attribute value change

type DeploymentStatus

type DeploymentStatus int

DeploymentStatus x ENUM( INITIAL, DEPLOYMENT_IN_PROGRESS, DEPLOYED, UNDEPLOYMENT_IN_PROGRESS, UNDEPLOYED, DEPLOYMENT_FAILED, UNDEPLOYMENT_FAILED, SCALING_IN_PROGRESS, UPDATE_IN_PROGRESS, UPDATED, UPDATE_FAILURE, PURGED )

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
	// UPDATE_IN_PROGRESS is a DeploymentStatus of type UPDATE_IN_PROGRESS
	UPDATE_IN_PROGRESS
	// UPDATED is a DeploymentStatus of type UPDATED
	UPDATED
	// UPDATE_FAILURE is a DeploymentStatus of type UPDATE_FAILURE
	UPDATE_FAILURE
	// PURGED is a DeploymentStatus of type PURGED
	PURGED
)

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 Notifier

type Notifier interface {
	NotifyValueChange(kv *api.KV, deploymentID string) error
}

Notifier represents the action of notify it's value change

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 OperationOutputNotifier

type OperationOutputNotifier struct {
	NodeName      string
	InstanceName  string
	InterfaceName string
	OperationName string
	OutputName    string
}

OperationOutputNotifier is an operation output notifying its value changes

func (*OperationOutputNotifier) NotifyValueChange

func (oon *OperationOutputNotifier) NotifyValueChange(kv *api.KV, deploymentID string) error

NotifyValueChange allows to notify output value change

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 GetPolicyPropertyValue

func GetPolicyPropertyValue(kv *api.KV, deploymentID, policyName, propertyName string, nestedKeys ...string) (*TOSCAValue, error)

GetPolicyPropertyValue retrieves the value for a given property in a given policy

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

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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