/
resource.go
36 lines (29 loc) · 1006 Bytes
/
resource.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
package resources
import "github.com/aws/aws-sdk-go-v2/service/cloudwatch/types"
type MetricBlob struct {
Name string `json:"name"`
Values []float64 `json:"values"`
}
type ResourceType string
const (
AwsElasticacheRedisNode ResourceType = "AWS::Elasticache::RedisNode"
AwsElasticacheMemcachedNode ResourceType = "AWS::Elasticache::MemcachedNode"
AwsDynamoDbTable = "AWS::DynamoDB::Table"
AwsDynamoDbGsi = "AWS::DynamoDB::GSI"
)
type ResourceSummary struct {
ID string `json:"id"`
Type ResourceType `json:"type"`
AdditionalData map[string]string `json:"additional_data"`
Metrics []MetricBlob `json:"metrics"`
Resource Resource
}
type ResourceMetricTargets struct {
Namespace string
Dimensions []types.Dimension
Targets map[string][]string
}
type Resource interface {
GetAll() ([]*ResourceSummary, error)
GetMetricTargets(r *ResourceSummary) ResourceMetricTargets
}