mirror of
https://github.com/getcompanion-ai/computer-host.git
synced 2026-04-15 08:03:40 +00:00
feat: phase 1
This commit is contained in:
parent
4a9dc91ebf
commit
6489e270ce
9 changed files with 194 additions and 13 deletions
|
|
@ -15,6 +15,7 @@ type Service interface {
|
|||
GetMachine(context.Context, contracthost.MachineID) (*contracthost.GetMachineResponse, error)
|
||||
ListMachines(context.Context) (*contracthost.ListMachinesResponse, error)
|
||||
StartMachine(context.Context, contracthost.MachineID) (*contracthost.GetMachineResponse, error)
|
||||
EnsureExecRelay(context.Context, contracthost.MachineID) (*contracthost.GetMachineResponse, error)
|
||||
StopMachine(context.Context, contracthost.MachineID) error
|
||||
DeleteMachine(context.Context, contracthost.MachineID) error
|
||||
Health(context.Context) (*contracthost.HealthResponse, error)
|
||||
|
|
@ -166,6 +167,20 @@ func (h *Handler) handleMachine(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
if len(parts) == 2 && parts[1] == "exec-relay" {
|
||||
if r.Method != http.MethodPost {
|
||||
writeMethodNotAllowed(w)
|
||||
return
|
||||
}
|
||||
response, err := h.service.EnsureExecRelay(r.Context(), machineID)
|
||||
if err != nil {
|
||||
writeError(w, statusForError(err), err)
|
||||
return
|
||||
}
|
||||
writeJSON(w, http.StatusOK, response)
|
||||
return
|
||||
}
|
||||
|
||||
if len(parts) == 2 && parts[1] == "snapshots" {
|
||||
switch r.Method {
|
||||
case http.MethodGet:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue