-
Notifications
You must be signed in to change notification settings - Fork 0
/
formatter.go
49 lines (42 loc) · 1.59 KB
/
formatter.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
package monitor
import (
"github.com/rancher/norman/types"
)
const (
ResourceNode = "node"
ResourceCluster = "cluster"
ResourceEtcd = "etcd"
ResourceAPIServer = "apiserver"
ResourceScheduler = "scheduler"
ResourceControllerManager = "controllermanager"
ResourceIngressController = "ingressController"
ResourceFluentd = "fluentd"
ResourceWorkload = "workload"
ResourcePod = "pod"
ResourceContainer = "container"
)
const (
queryAction = "query"
querycluster = "querycluster"
queryproject = "queryproject"
listclustermetricname = "listclustermetricname"
listprojectmetricname = "listprojectmetricname"
)
func GraphFormatter(apiContext *types.APIContext, resource *types.RawResource) {
resource.AddAction(apiContext, queryAction)
}
func QueryGraphCollectionFormatter(apiContext *types.APIContext, collection *types.GenericCollection) {
collection.AddAction(apiContext, queryAction)
}
func MetricFormatter(apiContext *types.APIContext, resource *types.RawResource) {
resource.AddAction(apiContext, querycluster)
resource.AddAction(apiContext, queryproject)
resource.AddAction(apiContext, listclustermetricname)
resource.AddAction(apiContext, listprojectmetricname)
}
func MetricCollectionFormatter(apiContext *types.APIContext, collection *types.GenericCollection) {
collection.AddAction(apiContext, querycluster)
collection.AddAction(apiContext, queryproject)
collection.AddAction(apiContext, listclustermetricname)
collection.AddAction(apiContext, listprojectmetricname)
}