This repository has been archived by the owner on Sep 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 83
/
field.go
76 lines (63 loc) · 1.52 KB
/
field.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
package ksonnet
// Field is a Kubernetes field.
type Field struct {
kind string
description string
properties map[string]Property
version string
group string
codebase string
identifier string
}
var _ Object = (*Field)(nil)
// NewField creates an instance of Field.
func NewField(id, desc, codebase, group, ver, kind string, props map[string]Property) *Field {
return &Field{
identifier: id,
description: desc,
group: group,
codebase: codebase,
version: ver,
kind: kind,
properties: props,
}
}
// Kind is the kind for this field.
func (f *Field) Kind() string {
return f.kind
}
// Version is the version for this field.
func (f *Field) Version() string {
return f.version
}
// Codebase is the codebase for this field.
func (f *Field) Codebase() string {
return f.codebase
}
// Group is the group for this field.
func (f *Field) Group() string {
if f.group == "" {
return "core"
}
return f.group
}
// QualifiedGroup is the group for this field.
func (f *Field) QualifiedGroup() string {
return f.Group()
}
// Description is the description for this field.
func (f *Field) Description() string {
return f.description
}
// Identifier is the identifier for this field.
func (f *Field) Identifier() string {
return f.identifier
}
// IsType returns if this item is a type. It always returns false.
func (f *Field) IsType() bool {
return false
}
// Properties are the properties for this field.
func (f *Field) Properties() map[string]Property {
return f.properties
}