Documentation
¶
Index ¶
- Constants
- func GetCanonicalName(entityPtr EntityPtr) string
- func GetDataTypeMetadata(metadata map[string]string) map[string]string
- func GetDescription(entityPtr EntityPtr) (string, bool)
- func GetKey(entityPtr EntityPtr) string
- func GetMetadata(entityPtr EntityPtr) (map[string]string, bool)
- func Inherit(entityPtr EntityPtr) bool
- func PreRead(entityPtr EntityPtr) bool
- func Render(entityPtr EntityPtr) bool
- func SetInputs(entityPtr EntityPtr, inputs map[string]ard.Value) bool
- func SetMetadata(entityPtr EntityPtr, name string, value string) bool
- func ValidateRequiredFields(entityPtr EntityPtr) bool
- type Context
- func (self *Context) Clone(data ard.Value) *Context
- func (self *Context) EmbedScriptlet(name string, scriptlet string)
- func (self *Context) FieldChild(name ard.Value, data ard.Value) *Context
- func (self *Context) FieldChildren() []*Context
- func (self *Context) FormatBadData() string
- func (self *Context) GetAncestor(generation int) *Context
- func (self *Context) GetCanonicalNamespace() *string
- func (self *Context) GetFieldChild(name string) (*Context, bool)
- func (self *Context) GetLocation() (int, int)
- func (self *Context) GetRequiredFieldChild(name string) (*Context, bool)
- func (self *Context) HasQuirk(quirk Quirk) bool
- func (self *Context) ImportScriptlet(name string, path string)
- func (self *Context) Is(typeNames ...ard.TypeName) bool
- func (self *Context) ListChild(index int, data ard.Value) *Context
- func (self *Context) MapChild(name ard.Value, data ard.Value) *Context
- func (self *Context) NewFunctionCall(name string, arguments []any) *FunctionCall
- func (self *Context) NewImportContext(url exturl.URL) *Context
- func (self *Context) Read(context contextpkg.Context) (ard.Value, ard.Locator, error)
- func (self *Context) ReadBoolean() *bool
- func (self *Context) ReadFields(entityPtr EntityPtr) []string
- func (self *Context) ReadFloat() *float64
- func (self *Context) ReadInteger() *int64
- func (self *Context) ReadListItems(read Reader, process Processor) bool
- func (self *Context) ReadMapItems(read Reader, process Processor) bool
- func (self *Context) ReadSequencedListItems(read Reader, process Processor) bool
- func (self *Context) ReadString() *string
- func (self *Context) ReadStringList() *[]string
- func (self *Context) ReadStringListFixed(length int) *[]string
- func (self *Context) ReadStringListMinLength(length int) *[]string
- func (self *Context) ReadStringMap() *map[string]any
- func (self *Context) ReadStringOrStringList() *[]string
- func (self *Context) ReadStringStringMap() *map[string]string
- func (self *Context) Report(skip int, item string, message string) bool
- func (self *Context) ReportCopyLoop(name string) bool
- func (self *Context) ReportDuplicateMapKey(key string) bool
- func (self *Context) ReportError(err error) bool
- func (self *Context) ReportFieldReferenceNotFound(types ...reflect.Type) bool
- func (self *Context) ReportImportIncompatible(url exturl.URL) bool
- func (self *Context) ReportImportLoop(url exturl.URL) bool
- func (self *Context) ReportIncompatible(name string, target string, kind string) bool
- func (self *Context) ReportIncompatibleExtension(extension string, requiredExtensions []string) bool
- func (self *Context) ReportIncompatibleType(type_ EntityPtr, parentType EntityPtr) bool
- func (self *Context) ReportIncompatibleTypeInSet(type_ EntityPtr) bool
- func (self *Context) ReportInheritanceLoop(parentType EntityPtr) bool
- func (self *Context) ReportKeynameMalformedSequencedList() bool
- func (self *Context) ReportKeynameMissing() bool
- func (self *Context) ReportKeynameUnsupported() bool
- func (self *Context) ReportKeynameUnsupportedValue() bool
- func (self *Context) ReportMissingEntrySchema(kind string) bool
- func (self *Context) ReportNameAmbiguous(type_ reflect.Type, name string, entityPtrs ...EntityPtr) bool
- func (self *Context) ReportNameInvalid(entityPtr EntityPtr, name string) bool
- func (self *Context) ReportNotInRange(name string, value uint64, lower uint64, upper uint64) bool
- func (self *Context) ReportPath(skip int, message string) bool
- func (self *Context) ReportPathf(skip int, f string, arg ...any) bool
- func (self *Context) ReportPrimitiveType() bool
- func (self *Context) ReportProblematic(skip int, problematic problems.Problematic) bool
- func (self *Context) ReportReferenceAmbiguous(kind string, entityPtr EntityPtr) bool
- func (self *Context) ReportReferenceNotFound(kind string, entityPtr EntityPtr) bool
- func (self *Context) ReportRefinement(parentValue ard.Value) bool
- func (self *Context) ReportRepositoryInaccessible(repositoryName string) bool
- func (self *Context) ReportReservedMetadata() bool
- func (self *Context) ReportTypeIncomplete(parentType EntityPtr) bool
- func (self *Context) ReportURL(skip int, item string, message string, row int, column int) bool
- func (self *Context) ReportUndeclared(kind string) bool
- func (self *Context) ReportUnknown(kind string) bool
- func (self *Context) ReportUnknownDataType(dataTypeName string) bool
- func (self *Context) ReportUnsupportedType() bool
- func (self *Context) ReportValueAspectWrongType(aspect string, value ard.Value, allowedTypeNames ...ard.TypeName) bool
- func (self *Context) ReportValueInvalid(kind string, reason string) bool
- func (self *Context) ReportValueMalformed(kind string, reason string) bool
- func (self *Context) ReportValueRequired(kind string) bool
- func (self *Context) ReportValueWrongFormat(format string) bool
- func (self *Context) ReportValueWrongLength(kind string, length int) bool
- func (self *Context) ReportValueWrongType(allowedTypeNames ...ard.TypeName) bool
- func (self *Context) Reportf(skip int, f string, arg ...any) bool
- func (self *Context) SequencedListChild(index int, name string, data ard.Value) *Context
- func (self *Context) SetReadTag(fieldName string, tag string)
- func (self *Context) ValidateType(requiredTypeNames ...ard.TypeName) bool
- func (self *Context) ValidateUnsupportedFields(keys []string)
- type ContextContainer
- type Contextual
- type EntityPtr
- type EntityPtrSet
- type EntityPtrs
- type FunctionCall
- type Grammar
- type GrammarVersion
- type GrammarVersions
- type HasInputs
- type HasMetadata
- type Hierarchical
- type Hierarchy
- func (self *Hierarchy) AddTo(entityPtr EntityPtr)
- func (self *Hierarchy) Empty() bool
- func (self *Hierarchy) Find(entityPtr EntityPtr) (*Hierarchy, bool)
- func (self *Hierarchy) GetContext() *Context
- func (self *Hierarchy) IsCompatible(baseEntityPtr EntityPtr, entityPtr EntityPtr) bool
- func (self Hierarchy) Len() int
- func (self Hierarchy) Less(i, j int) bool
- func (self *Hierarchy) Merge(hierarchy *Hierarchy, hierarchyContext HierarchyContext)
- func (self *Hierarchy) Print(indent int)
- func (self *Hierarchy) PrintChild(indent int, treePrefix terminal.TreePrefix, last bool)
- func (self *Hierarchy) PrintChildren(indent int, treePrefix terminal.TreePrefix)
- func (self *Hierarchy) Range(f func(EntityPtr, EntityPtr) bool)
- func (self *Hierarchy) Root() *Hierarchy
- func (self Hierarchy) Swap(i, j int)
- type HierarchyContext
- type ImportSpec
- type Importer
- type Inherits
- type Mappable
- type NameTransformer
- type Namespace
- func (self *Namespace) Empty() bool
- func (self *Namespace) Lookup(name string) (EntityPtr, bool)
- func (self *Namespace) LookupForType(name string, type_ reflect.Type) (EntityPtr, bool)
- func (self *Namespace) Merge(namespace *Namespace, nameTransformer NameTransformer)
- func (self *Namespace) Print(indent int)
- func (self *Namespace) Range(f func(EntityPtr) bool)
- func (self *Namespace) Set(name string, entityPtr EntityPtr) (EntityPtr, bool)
- type PreReadable
- type Processor
- type Quirk
- type Quirks
- type ReadField
- type ReadMode
- type Reader
- type Readers
- type Renderable
- type Scriptlet
- type ScriptletNamespace
- func (self *ScriptletNamespace) Lookup(name string) (*Scriptlet, bool)
- func (self *ScriptletNamespace) Merge(namespace *ScriptletNamespace)
- func (self *ScriptletNamespace) Range(f func(string, *Scriptlet) bool)
- func (self *ScriptletNamespace) RegisterScriptlet(name string, scriptlet string, nativeArgumentIndexes []int)
- func (self *ScriptletNamespace) RegisterScriptlets(scriptlets map[string]string, nativeArgumentIndexes map[string][]int, ...)
- func (self *ScriptletNamespace) Set(name string, scriptlet *Scriptlet)
- type TypesByName
Constants ¶
View Source
const ( MetadataType = "puccini.type" MetadataConverter = "puccini.converter" MetadataComparer = "puccini.comparer" MetadataQuirks = "puccini.quirks" MetadataDataTypePrefix = "puccini.data-type:" MetadataScriptletPrefix = "puccini.scriptlet:" MetadataScriptletImportPrefix = "puccini.scriptlet.import:" MetadataCanonicalName = "tosca.canonical-name" MetadataNormative = "tosca.normative" MetadataFunctionPrefix = "tosca.function." MetadataContraintPrefix = "tosca.constraint." )
Variables ¶
This section is empty.
Functions ¶
func GetCanonicalName ¶
func GetDescription ¶
From HasMetadata interface
func GetMetadata ¶
From HasMetadata interface
func SetMetadata ¶
From HasMetadata interface
Types ¶
type Context ¶
type Context struct { Parent *Context Name string Path ard.Path URL exturl.URL RepositoryURL exturl.URL Bases []exturl.URL Data ard.Value Locator ard.Locator CanonicalNamespace *string Namespace *Namespace ScriptletNamespace *ScriptletNamespace Hierarchy *Hierarchy Problems *problems.Problems Quirks Quirks Grammar *Grammar FunctionPrefix string ReadTagOverrides map[string]string }
func (*Context) EmbedScriptlet ¶
func (*Context) FieldChild ¶
func (*Context) FieldChildren ¶
func (*Context) FormatBadData ¶
func (*Context) GetAncestor ¶
func (*Context) GetCanonicalNamespace ¶
func (*Context) GetLocation ¶
func (*Context) GetRequiredFieldChild ¶
func (*Context) ImportScriptlet ¶
func (*Context) NewFunctionCall ¶
func (self *Context) NewFunctionCall(name string, arguments []any) *FunctionCall
func (*Context) Read ¶ added in v0.22.4
func (self *Context) Read(context contextpkg.Context) (ard.Value, ard.Locator, error)
func (*Context) ReadBoolean ¶
func (*Context) ReadFields ¶
From "read" tags
func (*Context) ReadInteger ¶
func (*Context) ReadListItems ¶
func (*Context) ReadMapItems ¶
func (*Context) ReadSequencedListItems ¶
func (*Context) ReadString ¶
func (*Context) ReadStringList ¶
func (*Context) ReadStringListFixed ¶
func (*Context) ReadStringListMinLength ¶
func (*Context) ReadStringMap ¶
func (*Context) ReadStringOrStringList ¶
func (*Context) ReadStringStringMap ¶
func (*Context) ReportCopyLoop ¶
func (*Context) ReportDuplicateMapKey ¶
func (*Context) ReportError ¶
func (*Context) ReportFieldReferenceNotFound ¶
func (*Context) ReportImportIncompatible ¶
func (*Context) ReportIncompatible ¶
func (*Context) ReportIncompatibleExtension ¶
func (*Context) ReportIncompatibleType ¶
func (*Context) ReportIncompatibleTypeInSet ¶
func (*Context) ReportInheritanceLoop ¶
func (*Context) ReportKeynameMalformedSequencedList ¶
func (*Context) ReportKeynameMissing ¶
func (*Context) ReportKeynameUnsupported ¶
func (*Context) ReportKeynameUnsupportedValue ¶
func (*Context) ReportMissingEntrySchema ¶
func (*Context) ReportNameAmbiguous ¶
func (*Context) ReportNameInvalid ¶
func (*Context) ReportNotInRange ¶
func (*Context) ReportPrimitiveType ¶
func (*Context) ReportProblematic ¶
func (self *Context) ReportProblematic(skip int, problematic problems.Problematic) bool
func (*Context) ReportReferenceAmbiguous ¶
func (*Context) ReportReferenceNotFound ¶
func (*Context) ReportRefinement ¶
func (*Context) ReportRepositoryInaccessible ¶
func (*Context) ReportReservedMetadata ¶
func (*Context) ReportTypeIncomplete ¶
func (*Context) ReportUndeclared ¶
func (*Context) ReportUnknown ¶
func (*Context) ReportUnknownDataType ¶
func (*Context) ReportUnsupportedType ¶
func (*Context) ReportValueAspectWrongType ¶
func (*Context) ReportValueInvalid ¶
func (*Context) ReportValueMalformed ¶
func (*Context) ReportValueRequired ¶
func (*Context) ReportValueWrongFormat ¶
func (*Context) ReportValueWrongLength ¶
func (*Context) ReportValueWrongType ¶
func (*Context) SequencedListChild ¶
func (*Context) SetReadTag ¶
func (*Context) ValidateType ¶
func (*Context) ValidateUnsupportedFields ¶
type ContextContainer ¶
type ContextContainer struct {
Context *Context
}
func NewContextContainer ¶
func NewContextContainer(context *Context) *ContextContainer
func (*ContextContainer) GetContext ¶
func (self *ContextContainer) GetContext() *Context
(Contextual interface)
type Contextual ¶
type Contextual interface {
GetContext() *Context
}
type EntityPtrSet ¶
type EntityPtrSet map[EntityPtr]struct{}
func (EntityPtrSet) Add ¶
func (self EntityPtrSet) Add(entityPtr EntityPtr)
func (EntityPtrSet) Contains ¶
func (self EntityPtrSet) Contains(entityPtr EntityPtr) bool
type EntityPtrs ¶
type EntityPtrs []EntityPtr
type FunctionCall ¶
type FunctionCall struct { Name string `json:"name" yaml:"name"` Arguments []any `json:"arguments" yaml:"arguments"` URL string `json:"url,omitempty" yaml:"url,omitempty"` Row int `json:"row,omitempty" yaml:"row,omitempty"` Column int `json:"column,omitempty" yaml:"column,omitempty"` Path string `json:"path,omitempty" yaml:"path,omitempty"` }
func NewFunctionCall ¶
type Grammar ¶
type Grammar struct { Versions GrammarVersions Readers Readers InvalidNamespaceCharacters string }
func NewGrammar ¶
func NewGrammar() Grammar
func (*Grammar) RegisterReader ¶
type GrammarVersion ¶
type GrammarVersions ¶
type GrammarVersions map[string][]GrammarVersion
type HasMetadata ¶
type Hierarchical ¶
type Hierarchical interface {
GetParent() EntityPtr
}
type Hierarchy ¶
type Hierarchy struct {
// contains filtered or unexported fields
}
func NewHierarchy ¶
func NewHierarchy() *Hierarchy
func NewHierarchyFor ¶
func NewHierarchyFor(entityPtr EntityPtr, work reflection.EntityWork, hierarchyContext HierarchyContext) *Hierarchy
func (*Hierarchy) GetContext ¶
func (*Hierarchy) IsCompatible ¶
func (*Hierarchy) Merge ¶
func (self *Hierarchy) Merge(hierarchy *Hierarchy, hierarchyContext HierarchyContext)
func (*Hierarchy) Print ¶
Note that the same name could be printed out twice in the hierarchy, even under the same parent! That's because we are printing the local name of the type, and types imported from other files can have the same name (though you would need a namespace_prefix to avoid a namespace error)
func (*Hierarchy) PrintChild ¶
func (self *Hierarchy) PrintChild(indent int, treePrefix terminal.TreePrefix, last bool)
func (*Hierarchy) PrintChildren ¶
func (self *Hierarchy) PrintChildren(indent int, treePrefix terminal.TreePrefix)
type ImportSpec ¶
type ImportSpec struct { URL exturl.URL NameTransformer NameTransformer Implicit bool }
func GetImportSpecs ¶
func GetImportSpecs(entityPtr EntityPtr) []*ImportSpec
From Importer interface
type Importer ¶
type Importer interface {
GetImportSpecs() []*ImportSpec
}
type NameTransformer ¶
type Namespace ¶
type Namespace struct {
// contains filtered or unexported fields
}
func NewNamespace ¶
func NewNamespace() *Namespace
func (*Namespace) LookupForType ¶
func (*Namespace) Merge ¶
func (self *Namespace) Merge(namespace *Namespace, nameTransformer NameTransformer)
type PreReadable ¶
type PreReadable interface {
PreRead()
}
type Quirk ¶
type Quirk string
const ( // In TOSCA 1.0-1.3 the Simple Profile is implicitly imported by default. This quirk will disable // implicit imports. QuirkImportsImplicitDisable Quirk = "imports.implicit.disable" // Allows imported files to contain a `topology_template` // section, which is ignored. QuirkImportsTopologyTemplateIgnore Quirk = "imports.topology_template.ignore" // By default Puccini will report an error if a file imports // another file with an incompatible grammar. This quirk will disable the check. QuirkImportsVersionPermissive Quirk = "imports.version.permissive" // Allows the "import" syntax to be a sequenced list, in which the // name is ignored. QuirkImportsSequencedList Quirk = "imports.sequencedlist" // By default Puccini is strict about "string"-typed values // and will consider integers, floats, and boolean values to be problems. This quirk will accept // such values and convert them as sensibly as possible to strings. This includes accepting floats // and integers for the TOSCA "version" primitive type. Note that string conversions may very well // *not* be identical to the literal YAML. For example, `1.0000` in YAML (a float) would become // the string `1` in TOSCA. QuirkDataTypesStringPermissive Quirk = "data_types.string.permissive" // By default Puccini requires all "timestamp" values to be // specified as strings in the ISO 8601 format. However, some YAML environments may support the // optional !!timestamp type. This quirk will allow such values. Note that such values will not have // the "$originalString" key, because the literal YAML is not preserved by the YAML parser. QuirkDataTypesTimestampPermissive Quirk = "data_types.timestamp.permissive" // By default Puccini will ensure that capabilities have // the minimum number of incoming relationships. This quirk will disable that validation. QuirkCapabilitiesOccurrencesPermissive Quirk = "capabilities.occurrences.permissive" // This will ignore any type that is has the `tosca.normative: 'true'` metadata. QuirkNamespaceNormativeIgnore Quirk = "namespace.normative.ignore" // In TOSCA 1.0-1.3 all the normative types have long // names, such as "tosca.nodes.Compute", prefixed names ("tosca:Compute"), and also short names // ("Compute"). Those short names are annoying because it means you can't use those names for your // own types. This quirk disables the short names (the prefixed names remain). QuirkNamespaceNormativeShortcutsDisable Quirk = "namespace.normative.shortcuts.disable" // According to the examples in the TOSCA 1.0-1.3 specs, // the `requirements` key under `substitution_mappings` is syntactically a map. However, this syntax // is inconsistent because it doesn't match the syntax in node templates, which is a sequenced list. // (In node types, too, it is a sequenced list, although grammatically it works like a map.) This // quirk allows the expected syntax to be a sequenced list. QuirkSubstitutionMappingsRequirementsList Quirk = "substitution_mappings.requirements.list" // Normally the `requirements` under // `substitution_mappings` must be mapped to an assigned requirement in a node template. This quirk // allows unassigned requirements to be mapped. QuirkSubstitutionMappingsRequirementsPermissive Quirk = "substitution_mappings.requirements.permissive" // Ignores the "annotation_types" keyword in service templates and the // "annotations" keyword in parameter definitions. QuirkAnnotationsIgnore Quirk = "annotations.ignore" // Allows interface types, definitions, and assignments to // refer to operations directly in addition to using the "operations" keyname. This allows TOSCA 1.3 // and 2.0 to support the TOSCA 1.2 grammar. QuirkInterfacesOperationsPermissive Quirk = "interfaces.operations.permissive" // Combines "imports.topology_template.ignore", "data_types.string.permissive", // "capabilities.occurrences.permissive", "substitution_mappings.requirements.permissive", // "substitution_mappings.requirements.list" QuirkETSINFV Quirk = "etsinfv" // Combines "annotations.ignore", "imports.sequencedlist", "imports.version.permissive" QuirkONAP Quirk = "onap" )
type ReadField ¶
type ReadField struct { FieldName string Key string Context *Context Entity reflect.Value Reader Reader Mode ReadMode Important bool Wildcard bool }
func NewReadField ¶
type Renderable ¶
type Renderable interface {
Render()
}
type Scriptlet ¶
type ScriptletNamespace ¶
type ScriptletNamespace struct {
// contains filtered or unexported fields
}
func NewScriptletNamespace ¶
func NewScriptletNamespace() *ScriptletNamespace
func (*ScriptletNamespace) Lookup ¶
func (self *ScriptletNamespace) Lookup(name string) (*Scriptlet, bool)
func (*ScriptletNamespace) Merge ¶
func (self *ScriptletNamespace) Merge(namespace *ScriptletNamespace)
func (*ScriptletNamespace) Range ¶
func (self *ScriptletNamespace) Range(f func(string, *Scriptlet) bool)
func (*ScriptletNamespace) RegisterScriptlet ¶
func (self *ScriptletNamespace) RegisterScriptlet(name string, scriptlet string, nativeArgumentIndexes []int)
func (*ScriptletNamespace) RegisterScriptlets ¶
func (*ScriptletNamespace) Set ¶
func (self *ScriptletNamespace) Set(name string, scriptlet *Scriptlet)
type TypesByName ¶
Click to show internal directories.
Click to hide internal directories.