mirror of
https://github.com/getcompanion-ai/computer-host.git
synced 2026-04-15 03:00:42 +00:00
feat: initial contracts
This commit is contained in:
parent
58f95324f4
commit
6f0f0643fe
7 changed files with 127 additions and 0 deletions
5
contract/health.go
Normal file
5
contract/health.go
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
package host
|
||||
|
||||
type HealthResponse struct {
|
||||
OK bool `json:"ok"`
|
||||
}
|
||||
17
contract/machines.go
Normal file
17
contract/machines.go
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
package host
|
||||
|
||||
type CreateMachineRequest struct {
|
||||
MachineID MachineID `json:"machine_id"`
|
||||
}
|
||||
|
||||
type CreateMachineResponse struct {
|
||||
Machine Machine `json:"machine"`
|
||||
}
|
||||
|
||||
type GetMachineResponse struct {
|
||||
Machine Machine `json:"machine"`
|
||||
}
|
||||
|
||||
type ListMachinesResponse struct {
|
||||
Machines []Machine `json:"machines"`
|
||||
}
|
||||
34
contract/types.go
Normal file
34
contract/types.go
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
package host
|
||||
|
||||
import "time"
|
||||
|
||||
type MachineID string
|
||||
|
||||
type MachinePhase string
|
||||
|
||||
type VolumeID string
|
||||
|
||||
type VolumeKind string
|
||||
|
||||
const (
|
||||
MachinePhasePending MachinePhase = "pending"
|
||||
MachinePhaseRunning MachinePhase = "running"
|
||||
MachinePhaseStopping MachinePhase = "stopping"
|
||||
MachinePhaseStopped MachinePhase = "stopped"
|
||||
MachinePhaseFailed MachinePhase = "failed"
|
||||
MachinePhaseDeleting MachinePhase = "deleting"
|
||||
)
|
||||
|
||||
const (
|
||||
VolumeKindSystem VolumeKind = "system"
|
||||
VolumeKindUser VolumeKind = "user"
|
||||
)
|
||||
|
||||
type Machine struct {
|
||||
ID MachineID `json:"id"`
|
||||
Phase MachinePhase `json:"phase"`
|
||||
RuntimeHost string `json:"runtime_host,omitempty"`
|
||||
Error string `json:"error,omitempty"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
StartedAt *time.Time `json:"started_at,omitempty"`
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue