Stop instance (graceful shutdown)
client.Instances.Stop(ctx, id) (*Instance, error)
/instances/{id}/stop
Stop instance (graceful shutdown)
Parameters
id string
Returns
Stop instance (graceful shutdown)
package main
import (
"context"
"fmt"
"github.com/onkernel/hypeman-go"
"github.com/onkernel/hypeman-go/option"
)
func main() {
client := hypeman.NewClient(
option.WithAPIKey("My API Key"),
)
instance, err := client.Instances.Stop(context.TODO(), "id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", instance.ID)
}
{
"id": "tz4a98xxat96iws9zmbrgj3a",
"created_at": "2025-01-15T10:30:00Z",
"image": "docker.io/library/alpine:latest",
"name": "my-workload-1",
"state": "Created",
"env": {
"foo": "string"
},
"has_snapshot": false,
"hotplug_size": "2GB",
"network": {
"enabled": true,
"ip": "192.168.100.10",
"mac": "02:00:00:ab:cd:ef",
"name": "default"
},
"overlay_size": "10GB",
"size": "2GB",
"started_at": "2025-01-15T10:30:05Z",
"state_error": "failed to query VMM: connection refused",
"stopped_at": "2025-01-15T12:30:00Z",
"vcpus": 2,
"volumes": [
{
"mount_path": "/mnt/data",
"volume_id": "vol-abc123",
"overlay": true,
"overlay_size": "1GB",
"readonly": true
}
]
}
Returns Examples
{
"id": "tz4a98xxat96iws9zmbrgj3a",
"created_at": "2025-01-15T10:30:00Z",
"image": "docker.io/library/alpine:latest",
"name": "my-workload-1",
"state": "Created",
"env": {
"foo": "string"
},
"has_snapshot": false,
"hotplug_size": "2GB",
"network": {
"enabled": true,
"ip": "192.168.100.10",
"mac": "02:00:00:ab:cd:ef",
"name": "default"
},
"overlay_size": "10GB",
"size": "2GB",
"started_at": "2025-01-15T10:30:05Z",
"state_error": "failed to query VMM: connection refused",
"stopped_at": "2025-01-15T12:30:00Z",
"vcpus": 2,
"volumes": [
{
"mount_path": "/mnt/data",
"volume_id": "vol-abc123",
"overlay": true,
"overlay_size": "1GB",
"readonly": true
}
]
}