forked from atlassian/gostatsd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloudprovider.go
33 lines (28 loc) · 1.04 KB
/
cloudprovider.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 gostatsd
import (
"context"
"github.com/sirupsen/logrus"
"github.com/spf13/viper"
)
// CloudProviderFactory is a function that returns a CloudProvider.
type CloudProviderFactory func(v *viper.Viper, logger logrus.FieldLogger) (CloudProvider, error)
// Instance represents a cloud instance.
type Instance struct {
ID string
Tags Tags
}
// CloudProvider represents a cloud provider.
type CloudProvider interface {
// Name returns the name of the cloud provider.
Name() string
// Instance returns instances details from the cloud provider.
// ip -> nil pointer if instance was not found.
// map is returned even in case of errors because it may contain partial data.
Instance(context.Context, ...IP) (map[IP]*Instance, error)
// MaxInstancesBatch returns maximum number of instances that could be requested via the Instance method.
MaxInstancesBatch() int
// SelfIP returns host's IPv4 address.
SelfIP() (IP, error)
// EstimatedTags returns a guess of how many tags are likely to be added by the CloudProvider
EstimatedTags() int
}