-
Notifications
You must be signed in to change notification settings - Fork 5
/
typedname.go
84 lines (57 loc) · 2.41 KB
/
typedname.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package px
import (
"github.com/lyraproj/issue/issue"
)
type Namespace string
// Identifier TypedName namespaces. Used by a service to identify what the type of entity a loader
// will look for.
// NsType denotes a type in the Puppet type system
const NsType = Namespace(`type`)
// NsFunction denotes a callable function
const NsFunction = Namespace(`function`)
// NsInterface denotes an entity that must have an "interface" property that appoints
// an object type which in turn contains a declaration of the methods that the interface
// implements.
const NsInterface = Namespace(`interface`)
// NsDefinition denotes an entity that describes something that is provided by a remote service. Examples
// of such entities are callable API's and steps that can participate in a workflow.
const NsDefinition = Namespace(`definition`)
// NsHandler denotes a handler for a state in a workflow
const NsHandler = Namespace(`handler`)
// NsService denotes a remote service
const NsService = Namespace(`service`)
// NsStep denotes a Puppet DSL specific step (not to be confused with a Definition of an step)
const NsStep = Namespace(`step`)
// Here in case of future Bolt integration with the Evaluator
const NsPlan = Namespace(`plan`)
const NsTask = Namespace(`task`)
// For internal use only
// NsAllocator returns a function capable of allocating an instance of an object
// without initializing its content
const NsAllocator = Namespace(`allocator`)
// NsConstructor denotes a function that both allocates an initializes an object based
// on parameter values
const NsConstructor = Namespace(`constructor`)
type TypedName interface {
PuppetObject
issue.Named
IsParent(n TypedName) bool
IsQualified() bool
MapKey() string
Authority() URI
Namespace() Namespace
Parts() []string
// PartsList returns the parts as a List
PartsList() List
// Child returns the typed name with its leading segment stripped off, e.g.
// A::B::C returns B::C
Child() TypedName
// Parent returns the typed name with its final segment stripped off, e.g.
// A::B::C returns A::B
Parent() TypedName
RelativeTo(parent TypedName) (TypedName, bool)
}
var NewTypedName func(namespace Namespace, name string) TypedName
var NewTypedName2 func(namespace Namespace, name string, nameAuthority URI) TypedName
// TypedNameFromMapKey recreates a TypedName from a given MapKey that was produced by a TypedName
var TypedNameFromMapKey func(mapKey string) TypedName