-
Notifications
You must be signed in to change notification settings - Fork 0
/
gcp.go
48 lines (39 loc) · 843 Bytes
/
gcp.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
package googlecloud
import (
"github.com/F1997/categraf/config"
"github.com/F1997/categraf/inputs"
)
const (
inputName = "googlecloud"
)
type (
GoogleCloud struct {
config.PluginConfig
Instances []*Instance `toml:"instances"`
}
)
var _ inputs.Input = new(GoogleCloud)
var _ inputs.InstancesGetter = new(GoogleCloud)
func init() {
inputs.Add(inputName, func() inputs.Input {
return &GoogleCloud{}
})
}
func (g *GoogleCloud) Clone() inputs.Input {
return &GoogleCloud{}
}
func (c *GoogleCloud) Name() string {
return inputName
}
func (c *GoogleCloud) GetInstances() []inputs.Instance {
ret := make([]inputs.Instance, len(c.Instances))
for i := 0; i < len(c.Instances); i++ {
ret[i] = c.Instances[i]
}
return ret
}
func (c *GoogleCloud) Drop() {
for i := 0; i < len(c.Instances); i++ {
c.Instances[i].Drop()
}
}