/
volumesnapshotdata.go
executable file
·33 lines (28 loc) · 1.13 KB
/
volumesnapshotdata.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
package kubernetes
import (
snapshotv1 "github.com/openebs/k8s-snapshot-client/snapshot/pkg/apis/volumesnapshot/v1"
"github.com/weaveworks/scope/report"
)
// VolumeSnapshotData represent kubernetes VolumeSnapshotData interface
type VolumeSnapshotData interface {
Meta
GetNode(probeID string) report.Node
}
// volumeSnapshotData represents kubernetes volume snapshot data
type volumeSnapshotData struct {
*snapshotv1.VolumeSnapshotData
Meta
}
// NewVolumeSnapshotData returns new Volume Snapshot Data type
func NewVolumeSnapshotData(p *snapshotv1.VolumeSnapshotData) VolumeSnapshotData {
return &volumeSnapshotData{VolumeSnapshotData: p, Meta: meta{p.ObjectMeta}}
}
// GetNode returns VolumeSnapshotData as Node
func (p *volumeSnapshotData) GetNode(probeID string) report.Node {
return p.MetaNode(report.MakeVolumeSnapshotDataNodeID(p.UID())).WithLatests(map[string]string{
report.ControlProbeID: probeID,
NodeType: "Volume Snapshot Data",
VolumeName: p.Spec.PersistentVolumeRef.Name,
VolumeSnapshotName: p.Spec.VolumeSnapshotRef.Name,
}).WithLatestActiveControls(Describe)
}