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
package compute
import (
"context"
commonv1 "github.com/johnandersen777/socialweb-computer-kcp/api/common/v1alpha1"
)
const (
CapabilityProvision = "compute.provision"
CapabilityRelease = "compute.release"
)
type Shape struct {
CPUs int32
Mem string
Disk string
}
type ProvisionRequest struct {
Name string
Owner commonv1.ObjectRef
Requester string
Role string
Shape Shape
UserData commonv1.SecretRef
Contract *commonv1.StrongRef
}
type Instance struct {
Ref commonv1.ObjectRef
Phase string
Addresses []string
Message string
}
type Provider interface {
Provision(ctx context.Context, req ProvisionRequest) (Instance, error)
Instance(ctx context.Context, ref commonv1.ObjectRef) (Instance, error)
Release(ctx context.Context, ref commonv1.ObjectRef) error
}