forked from AliyunContainerService/pouch
/
meta.go
45 lines (35 loc) · 1.25 KB
/
meta.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
package meta
// List represents list interface.
type List interface {
GetResourceVersion() int64
SetResourceVersion(version int64)
}
// ListMetaAccessor represents list meta accessor interface.
type ListMetaAccessor interface {
GetListMeta() List
}
// Object represents meta's object interface.
type Object interface {
GetUID() string
SetUID(uid string)
GetName() string
SetName(name string)
GetResourceVersion() int64
SetResourceVersion(version int64)
}
// ObjectMetaAccessor represents object meta accessor interface.
type ObjectMetaAccessor interface {
GetObjectMeta() Object
}
// GetUID returns meta's uid.
func (meta *ObjectMeta) GetUID() string { return meta.UID }
// GetName returns meta's name.
func (meta *ObjectMeta) GetName() string { return meta.Name }
// GetResourceVersion returns meta's resource version.
func (meta *ObjectMeta) GetResourceVersion() int64 { return meta.ResourceVersion }
// SetUID is used to set meta's uid.
func (meta *ObjectMeta) SetUID(uid string) { meta.UID = uid }
// SetName is used to set meta's name.
func (meta *ObjectMeta) SetName(name string) { meta.Name = name }
// SetResourceVersion is used to set meta's resource version.
func (meta *ObjectMeta) SetResourceVersion(version int64) { meta.ResourceVersion = version }