-
Notifications
You must be signed in to change notification settings - Fork 0
/
cluster_object.go
59 lines (50 loc) · 1.74 KB
/
cluster_object.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
53
54
55
56
57
58
59
package types
import (
"time"
)
type ClusterObjectKind string
var (
ClusterObjectKindNamespace ClusterObjectKind = "namespace"
AllValidClusterObjectKinds = [...]ClusterObjectKind{
ClusterObjectKindNamespace,
}
)
// ValidClusterObjectKind checks if the given status is a valid cluster object type.
func ValidClusterObjectKind(t ClusterObjectKind) bool {
for _, ClusterObjectKind := range AllValidClusterObjectKinds {
if t == ClusterObjectKind {
return true
}
}
return false
}
// ClusterObject type for core_instance cluster objects.
type ClusterObject struct {
ID string `json:"id" yaml:"id" db:"id"`
Name string `json:"name" yaml:"name" db:"name"`
Kind ClusterObjectKind `json:"kind" yaml:"kind" db:"kind"`
CreatedAt time.Time `json:"createdAt" yaml:"createdAt" db:"created_at"`
UpdatedAt time.Time `json:"updatedAt" yaml:"updatedAt" db:"updated_at"`
}
// ClusterObjects paginated list.
type ClusterObjects struct {
Items []ClusterObject `json:"items" yaml:"items"`
EndCursor *string `json:"endCursor" yaml:"endCursor"`
}
// ClusterObjectParams request payload for querying the core_instance cluster objects.
type ClusterObjectParams struct {
Last *uint
Name *string
Kind *ClusterObjectKind
Before *string
}
// CreateClusterObject request payload for creating a core_instance cluster object.
type CreateClusterObject struct {
Name string `json:"name" yaml:"name"`
Kind ClusterObjectKind `json:"kind" yaml:"kind"`
}
// UpdateClusterObject request payload for updating a core_instance cluster object.
type UpdateClusterObject struct {
Name *string `json:"name" yaml:"name"`
Kind *ClusterObjectKind `json:"kind" yaml:"kind"`
}