Documentation
¶
Index ¶
- Constants
- func GetCanonicalName(entityPtr EntityPtr) string
- func GetDescription(entityPtr EntityPtr) (string, bool)
- func GetEntityTypeName(type_ reflect.Type) string
- func GetInformationMetadata(metadata map[string]string) map[string]string
- func GetKey(entityPtr EntityPtr) string
- func GetMetadata(entityPtr EntityPtr) (map[string]string, 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 []interface{}) *FunctionCall
- func (self *Context) NewImportContext(url urlpkg.URL) *Context
- 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) ReadStringMap() *map[string]interface{}
- func (self *Context) ReadStringOrStringList() *[]string
- func (self *Context) ReadStringStringMap() *map[string]string
- func (self *Context) Report(skip int, message string) bool
- func (self *Context) ReportAspectWrongType(aspect string, value ard.Value, allowedTypeNames ...ard.TypeName) 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) ReportFieldMalformedSequencedList() bool
- func (self *Context) ReportFieldMissing() bool
- func (self *Context) ReportFieldReferenceNotFound(types ...reflect.Type) bool
- func (self *Context) ReportFieldUnsupported() bool
- func (self *Context) ReportFieldUnsupportedValue() bool
- func (self *Context) ReportImportIncompatible(url urlpkg.URL) bool
- func (self *Context) ReportImportLoop(url urlpkg.URL) bool
- func (self *Context) ReportInSection(skip int, message string, row int, column int) 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) ReportMissingEntrySchema(kind string) bool
- func (self *Context) ReportNameAmbiguous(type_ reflect.Type, name string, entityPtrs ...EntityPtr) 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 ...interface{}) bool
- func (self *Context) ReportPrimitiveType() bool
- func (self *Context) ReportProblematic(skip int, problematic problems.Problematic) bool
- func (self *Context) ReportPropertyRequired(kind string) bool
- func (self *Context) ReportReferenceAmbiguous(kind string, entityPtr EntityPtr) bool
- func (self *Context) ReportReferenceNotFound(kind string, entityPtr EntityPtr) bool
- func (self *Context) ReportRepositoryInaccessible(repositoryName string) bool
- func (self *Context) ReportReservedMetadata() bool
- func (self *Context) ReportTypeIncomplete(parentType EntityPtr) 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) ReportValueMalformed(kind string, reason 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 ...interface{}) 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 Contextual
- type EntityPtr
- type EntityPtrs
- type FunctionCall
- type Grammar
- type GrammarVersion
- type GrammarVersions
- 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) Lookup(name string, type_ reflect.Type) (*Hierarchy, 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 HierarchyDescendants
- 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, EntityPtr) bool)
- func (self *Namespace) Set(name string, entityPtr EntityPtr) (EntityPtr, bool)
- type PreReadable
- type Processor
- type Quirk
- type Quirks
- type ReadField
- type Reader
- type Readers
- 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 []uint)
- func (self *ScriptletNamespace) RegisterScriptlets(scriptlets map[string]string, nativeArgumentIndexes map[string][]uint, ...)
- func (self *ScriptletNamespace) Set(name string, scriptlet *Scriptlet)
- type TypesByName
Constants ¶
const ( ReadFieldModeDefault = 0 ReadFieldModeList = 1 ReadFieldModeSequencedList = 2 ReadFieldModeUniqueSequencedList = 3 ReadFieldModeItem = 4 )
Variables ¶
This section is empty.
Functions ¶
func GetCanonicalName ¶
func GetDescription ¶ added in v0.13.0
From HasMetadata interface
func GetInformationMetadata ¶ added in v0.15.0
func GetMetadata ¶
From HasMetadata interface
func SetMetadata ¶ added in v0.13.0
From HasMetadata interface
func ValidateRequiredFields ¶
From "require" tags
Types ¶
type Context ¶
type Context struct { Parent *Context Name string Path ard.Path URL urlpkg.URL Data ard.Value Locator ard.Locator CanonicalNamespace *string Namespace *Namespace ScriptletNamespace *ScriptletNamespace Hierarchy *Hierarchy Problems *problems.Problems Quirks Quirks Grammar *Grammar ReadTagOverrides map[string]string }
func NewContext ¶
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 []interface{}) *FunctionCall
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) ReadStringMap ¶
func (*Context) ReadStringOrStringList ¶
func (*Context) ReadStringStringMap ¶
func (*Context) ReportAspectWrongType ¶ added in v0.16.0
func (*Context) ReportCopyLoop ¶
func (*Context) ReportDuplicateMapKey ¶ added in v0.13.0
func (*Context) ReportError ¶
func (*Context) ReportFieldMalformedSequencedList ¶
func (*Context) ReportFieldMissing ¶
func (*Context) ReportFieldReferenceNotFound ¶
func (*Context) ReportFieldUnsupported ¶
func (*Context) ReportFieldUnsupportedValue ¶
func (*Context) ReportImportIncompatible ¶
func (*Context) ReportInSection ¶
func (*Context) ReportIncompatible ¶
func (*Context) ReportIncompatibleExtension ¶
func (*Context) ReportIncompatibleType ¶
func (*Context) ReportIncompatibleTypeInSet ¶ added in v0.11.0
func (*Context) ReportInheritanceLoop ¶
func (*Context) ReportMissingEntrySchema ¶
func (*Context) ReportNameAmbiguous ¶
func (*Context) ReportNotInRange ¶
func (*Context) ReportPathf ¶
func (*Context) ReportPrimitiveType ¶
func (*Context) ReportProblematic ¶
func (self *Context) ReportProblematic(skip int, problematic problems.Problematic) bool
func (*Context) ReportPropertyRequired ¶
func (*Context) ReportReferenceAmbiguous ¶
func (*Context) ReportReferenceNotFound ¶
func (*Context) ReportRepositoryInaccessible ¶
func (*Context) ReportReservedMetadata ¶
func (*Context) ReportTypeIncomplete ¶
func (*Context) ReportUndeclared ¶
func (*Context) ReportUnknown ¶
func (*Context) ReportUnknownDataType ¶
func (*Context) ReportUnsupportedType ¶
func (*Context) ReportValueMalformed ¶
func (*Context) ReportValueWrongFormat ¶
func (*Context) ReportValueWrongLength ¶
func (*Context) ReportValueWrongType ¶
func (*Context) SequencedListChild ¶
func (*Context) SetReadTag ¶ added in v0.13.0
func (*Context) ValidateType ¶
func (*Context) ValidateUnsupportedFields ¶
type Contextual ¶
type Contextual interface {
GetContext() *Context
}
type EntityPtrs ¶
type EntityPtrs []interface{}
func (EntityPtrs) Len ¶
func (self EntityPtrs) Len() int
func (EntityPtrs) Less ¶
func (self EntityPtrs) Less(i, j int) bool
func (EntityPtrs) Swap ¶
func (self EntityPtrs) Swap(i, j int)
type FunctionCall ¶
type FunctionCall struct { Name string `json:"name" yaml:"name"` Arguments []interface{} `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 }
func NewGrammar ¶
func NewGrammar() Grammar
func (*Grammar) RegisterReader ¶
type GrammarVersion ¶
type GrammarVersions ¶
type GrammarVersions map[string][]GrammarVersion
type HasMetadata ¶
type HasMetadata interface { GetDescription() (string, bool) GetMetadata() (map[string]string, bool) // should return a copy SetMetadata(name string, value string) bool }
Must be thread-safe!
type Hierarchical ¶
type Hierarchical interface {
GetParent() EntityPtr
}
type Hierarchy ¶
type Hierarchy struct {
// contains filtered or unexported fields
}
func NewHierarchy ¶
func NewHierarchy() *Hierarchy
func NewHierarchyFor ¶ added in v0.14.0
func NewHierarchyFor(entityPtr EntityPtr, 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 HierarchyDescendants ¶
type HierarchyDescendants []EntityPtr
type ImportSpec ¶
type ImportSpec struct { URL url.URL NameTransformer NameTransformer Implicit bool }
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 NewNamespaceFor ¶ added in v0.14.0
From "namespace" tags
func (*Namespace) LookupForType ¶
func (*Namespace) Merge ¶
func (self *Namespace) Merge(namespace *Namespace, nameTransformer NameTransformer)
type PreReadable ¶
type PreReadable interface {
PreRead()
}
type Quirk ¶ added in v0.12.0
type Quirk string
const QuirkDataTypesStringPermissive Quirk = "data_types.string.permissive"
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.
const QuirkDataTypesTimestampPermissive Quirk = "data_types.timestamp.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.
const QuirkImportsImplicitDisable Quirk = "imports.implicit.disable"
In TOSCA 1.0-1.3 the Simple Profile is implicitly imported by default. This quirk will disable implicit imports.
const QuirkImportsPermissive Quirk = "imports.permissive"
By default Puccini will report an error if a unit imports another unit with an incompatible grammar. This quirk will disable the check.
const QuirkNamespaceNormativeIgnore Quirk = "namespace.normative.ignore"
This will ignore any type that is has the "puccini.normative: 'true'" metadata.
const QuirkNamespaceNormativeShortcutsDisable Quirk = "namespace.normative.shortcuts.disable"
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).
const QuirkSubstitutionMappingsRequirementsList Quirk = "substitution_mappings.requirements.list"
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 changes the expected syntax to be a sequenced list.
type ReadField ¶
type ReadField struct { FieldName string Key string Context *Context Entity reflect.Value Reader Reader Mode int Important bool Wildcard bool }
func NewReadField ¶
type Scriptlet ¶
type ScriptletNamespace ¶
type ScriptletNamespace struct {
// contains filtered or unexported fields
}
func NewScriptletNamespace ¶ added in v0.14.0
func NewScriptletNamespace() *ScriptletNamespace
func (*ScriptletNamespace) Lookup ¶ added in v0.14.0
func (self *ScriptletNamespace) Lookup(name string) (*Scriptlet, bool)
func (*ScriptletNamespace) Merge ¶
func (self *ScriptletNamespace) Merge(namespace *ScriptletNamespace)
func (*ScriptletNamespace) Range ¶ added in v0.14.0
func (self *ScriptletNamespace) Range(f func(string, *Scriptlet) bool)
func (*ScriptletNamespace) RegisterScriptlet ¶
func (self *ScriptletNamespace) RegisterScriptlet(name string, scriptlet string, nativeArgumentIndexes []uint)
func (*ScriptletNamespace) RegisterScriptlets ¶
func (*ScriptletNamespace) Set ¶ added in v0.14.0
func (self *ScriptletNamespace) Set(name string, scriptlet *Scriptlet)
type TypesByName ¶
func (TypesByName) Len ¶
func (self TypesByName) Len() int
func (TypesByName) Less ¶
func (self TypesByName) Less(i, j int) bool
func (TypesByName) Swap ¶
func (self TypesByName) Swap(i, j int)