-
Notifications
You must be signed in to change notification settings - Fork 239
/
resource.go
52 lines (41 loc) · 977 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package resource
import (
"go/ast"
)
//go:generate stringer -type=Kind -output=resource_string.go
type Kind int
const (
Unknown Kind = iota
// Infrastructure SDK Resources
PubSubTopic
PubSubSubscription
SQLDatabase
Metric
CronJob
CacheCluster
CacheKeyspace
ConfigLoad
Secrets
// API Framework Resources
APIEndpoint
AuthHandler
Middleware
ServiceStruct
)
type Resource interface {
// Node is embedded so we can use the resource in a [posmap.Map].
// The position should be the position of the resource declaration.
ast.Node
// Kind is the kind of resource this is.
Kind() Kind
// SortKey is a string that can be used to sort resources.
// The sort key's value is arbitrary but should provide a
// consistent sort order regardless of the parsing order.
// The sort key only matters between resources of the same Kind.
SortKey() string
}
type Named interface {
Resource
// ResourceName is the name of the resource.
ResourceName() string
}