Codex implementation of restart

This commit is contained in:
Fedor Korotkov
2025-10-29 06:36:07 -07:00
parent c744d724dc
commit a7a0dea41b
8 changed files with 204 additions and 1 deletions
+12
View File
@@ -88,6 +88,18 @@ func (service *VMsService) Delete(ctx context.Context, name string) error {
return nil
}
func (service *VMsService) Restart(ctx context.Context, name string) (*v1.VM, error) {
var vm v1.VM
err := service.client.request(ctx, http.MethodPost, fmt.Sprintf("vms/%s/restart", url.PathEscape(name)),
nil, &vm, nil)
if err != nil {
return nil, err
}
return &vm, nil
}
func (service *VMsService) PortForward(
ctx context.Context,
name string,
+2
View File
@@ -63,6 +63,8 @@ type VM struct {
RestartPolicy RestartPolicy `json:"restart_policy,omitempty"`
RestartedAt time.Time `json:"restarted_at,omitempty"`
RestartCount uint64 `json:"restart_count,omitempty"`
// RestartRequested indicates that the worker should restart the VM in-place.
RestartRequested bool `json:"restart_requested,omitempty"`
// RandomSerial controls whether the worker will run the
// "tart set --random-serial" when instantiating this VM.