Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.9.8"
".": "0.10.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 37
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fhypeman-0541294848c0b8de2c31a105855c740dc98d1480dd27a20a52d7bc291ba001d8.yml
openapi_spec_hash: 03714883bdadb4a6a743a7faec477a05
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fhypeman-fa1e2bdf81a0cf5ecd0c01200b07d0bc08861f834b539c751aa0fec0496fdf2c.yml
openapi_spec_hash: c70af233ec40cdc23b9a2886b508905e
config_hash: d452c139da1e46a44a68b91e8a40de72
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 0.10.0 (2026-02-13)

Full Changelog: [v0.9.8...v0.10.0](https://github.com/kernel/hypeman-go/compare/v0.9.8...v0.10.0)

### Features

* Add metadata field to instances ([8ce4014](https://github.com/kernel/hypeman-go/commit/8ce40145c0f6db8e928efa9c2909521a6d452579))
* Better stop behavior ([12cfb4e](https://github.com/kernel/hypeman-go/commit/12cfb4e4ddfc198c65b09efeb73c8db0fd609f5f))

## 0.9.8 (2026-02-11)

Full Changelog: [v0.9.7...v0.9.8](https://github.com/kernel/hypeman-go/compare/v0.9.7...v0.9.8)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Or to pin the version:
<!-- x-release-please-start-version -->

```sh
go get -u 'github.com/kernel/hypeman-go@v0.9.8'
go get -u 'github.com/kernel/hypeman-go@v0.10.0'
```

<!-- x-release-please-end -->
Expand Down
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Methods:
- <code title="get /instances/{id}/logs">client.Instances.<a href="https://pkg.go.dev/github.com/kernel/hypeman-go#InstanceService.Logs">Logs</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, query <a href="https://pkg.go.dev/github.com/kernel/hypeman-go">hypeman</a>.<a href="https://pkg.go.dev/github.com/kernel/hypeman-go#InstanceLogsParams">InstanceLogsParams</a>) (\*<a href="https://pkg.go.dev/builtin#string">string</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /instances/{id}/restore">client.Instances.<a href="https://pkg.go.dev/github.com/kernel/hypeman-go#InstanceService.Restore">Restore</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>) (\*<a href="https://pkg.go.dev/github.com/kernel/hypeman-go">hypeman</a>.<a href="https://pkg.go.dev/github.com/kernel/hypeman-go#Instance">Instance</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /instances/{id}/standby">client.Instances.<a href="https://pkg.go.dev/github.com/kernel/hypeman-go#InstanceService.Standby">Standby</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>) (\*<a href="https://pkg.go.dev/github.com/kernel/hypeman-go">hypeman</a>.<a href="https://pkg.go.dev/github.com/kernel/hypeman-go#Instance">Instance</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /instances/{id}/start">client.Instances.<a href="https://pkg.go.dev/github.com/kernel/hypeman-go#InstanceService.Start">Start</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>) (\*<a href="https://pkg.go.dev/github.com/kernel/hypeman-go">hypeman</a>.<a href="https://pkg.go.dev/github.com/kernel/hypeman-go#Instance">Instance</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /instances/{id}/start">client.Instances.<a href="https://pkg.go.dev/github.com/kernel/hypeman-go#InstanceService.Start">Start</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/kernel/hypeman-go">hypeman</a>.<a href="https://pkg.go.dev/github.com/kernel/hypeman-go#InstanceStartParams">InstanceStartParams</a>) (\*<a href="https://pkg.go.dev/github.com/kernel/hypeman-go">hypeman</a>.<a href="https://pkg.go.dev/github.com/kernel/hypeman-go#Instance">Instance</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="get /instances/{id}/stat">client.Instances.<a href="https://pkg.go.dev/github.com/kernel/hypeman-go#InstanceService.Stat">Stat</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>, query <a href="https://pkg.go.dev/github.com/kernel/hypeman-go">hypeman</a>.<a href="https://pkg.go.dev/github.com/kernel/hypeman-go#InstanceStatParams">InstanceStatParams</a>) (\*<a href="https://pkg.go.dev/github.com/kernel/hypeman-go">hypeman</a>.<a href="https://pkg.go.dev/github.com/kernel/hypeman-go#PathInfo">PathInfo</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
- <code title="post /instances/{id}/stop">client.Instances.<a href="https://pkg.go.dev/github.com/kernel/hypeman-go#InstanceService.Stop">Stop</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, id <a href="https://pkg.go.dev/builtin#string">string</a>) (\*<a href="https://pkg.go.dev/github.com/kernel/hypeman-go">hypeman</a>.<a href="https://pkg.go.dev/github.com/kernel/hypeman-go#Instance">Instance</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

Expand Down
38 changes: 36 additions & 2 deletions instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,14 @@ func (r *InstanceService) Standby(ctx context.Context, id string, opts ...option
}

// Start a stopped instance
func (r *InstanceService) Start(ctx context.Context, id string, opts ...option.RequestOption) (res *Instance, err error) {
func (r *InstanceService) Start(ctx context.Context, id string, body InstanceStartParams, opts ...option.RequestOption) (res *Instance, err error) {
opts = slices.Concat(r.Options, opts)
if id == "" {
err = errors.New("missing required id parameter")
return
}
path := fmt.Sprintf("instances/%s/start", id)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, nil, &res, opts...)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return
}

Expand Down Expand Up @@ -195,6 +195,11 @@ type Instance struct {
DiskIoBps string `json:"disk_io_bps"`
// Environment variables
Env map[string]string `json:"env"`
// App exit code (null if VM hasn't exited)
ExitCode int64 `json:"exit_code,nullable"`
// Human-readable description of exit (e.g., "command not found", "killed by signal
// 9 (SIGKILL) - OOM")
ExitMessage string `json:"exit_message"`
// GPU information attached to the instance
GPU InstanceGPU `json:"gpu"`
// Whether a snapshot exists for this instance
Expand All @@ -205,6 +210,8 @@ type Instance struct {
//
// Any of "cloud-hypervisor", "qemu", "vz".
Hypervisor InstanceHypervisor `json:"hypervisor"`
// User-defined key-value metadata
Metadata map[string]string `json:"metadata"`
// Network configuration of the instance
Network InstanceNetwork `json:"network"`
// Writable overlay disk size (human-readable)
Expand All @@ -230,10 +237,13 @@ type Instance struct {
State respjson.Field
DiskIoBps respjson.Field
Env respjson.Field
ExitCode respjson.Field
ExitMessage respjson.Field
GPU respjson.Field
HasSnapshot respjson.Field
HotplugSize respjson.Field
Hypervisor respjson.Field
Metadata respjson.Field
Network respjson.Field
OverlaySize respjson.Field
Size respjson.Field
Expand Down Expand Up @@ -465,8 +475,14 @@ type InstanceNewParams struct {
SkipKernelHeaders param.Opt[bool] `json:"skip_kernel_headers,omitzero"`
// Number of virtual CPUs
Vcpus param.Opt[int64] `json:"vcpus,omitzero"`
// Override image CMD (like docker run <image> <command>). Omit to use image
// default.
Cmd []string `json:"cmd,omitzero"`
// Device IDs or names to attach for GPU/PCI passthrough
Devices []string `json:"devices,omitzero"`
// Override image entrypoint (like docker run --entrypoint). Omit to use image
// default.
Entrypoint []string `json:"entrypoint,omitzero"`
// Environment variables
Env map[string]string `json:"env,omitzero"`
// GPU configuration for the instance
Expand All @@ -475,6 +491,8 @@ type InstanceNewParams struct {
//
// Any of "cloud-hypervisor", "qemu", "vz".
Hypervisor InstanceNewParamsHypervisor `json:"hypervisor,omitzero"`
// User-defined key-value metadata for the instance
Metadata map[string]string `json:"metadata,omitzero"`
// Network configuration for the instance
Network InstanceNewParamsNetwork `json:"network,omitzero"`
// Volumes to attach to the instance at creation time
Expand Down Expand Up @@ -572,6 +590,22 @@ const (
InstanceLogsParamsSourceHypeman InstanceLogsParamsSource = "hypeman"
)

type InstanceStartParams struct {
// Override image CMD for this run. Omit to keep previous value.
Cmd []string `json:"cmd,omitzero"`
// Override image entrypoint for this run. Omit to keep previous value.
Entrypoint []string `json:"entrypoint,omitzero"`
paramObj
}

func (r InstanceStartParams) MarshalJSON() (data []byte, err error) {
type shadow InstanceStartParams
return param.MarshalObject(r, (*shadow)(&r))
}
func (r *InstanceStartParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}

type InstanceStatParams struct {
// Path to stat in the guest filesystem
Path string `query:"path,required" json:"-"`
Expand Down
25 changes: 19 additions & 6 deletions instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ func TestInstanceNewWithOptionalParams(t *testing.T) {
option.WithAPIKey("My API Key"),
)
_, err := client.Instances.New(context.TODO(), hypeman.InstanceNewParams{
Image: "docker.io/library/alpine:latest",
Name: "my-workload-1",
Devices: []string{"l4-gpu"},
DiskIoBps: hypeman.String("100MB/s"),
Image: "docker.io/library/alpine:latest",
Name: "my-workload-1",
Cmd: []string{"echo", "hello"},
Devices: []string{"l4-gpu"},
DiskIoBps: hypeman.String("100MB/s"),
Entrypoint: []string{"/bin/sh", "-c"},
Env: map[string]string{
"PORT": "3000",
"NODE_ENV": "production",
Expand All @@ -40,6 +42,10 @@ func TestInstanceNewWithOptionalParams(t *testing.T) {
},
HotplugSize: hypeman.String("2GB"),
Hypervisor: hypeman.InstanceNewParamsHypervisorCloudHypervisor,
Metadata: map[string]string{
"team": "backend",
"purpose": "staging",
},
Network: hypeman.InstanceNewParamsNetwork{
BandwidthDownload: hypeman.String("1Gbps"),
BandwidthUpload: hypeman.String("1Gbps"),
Expand Down Expand Up @@ -182,7 +188,7 @@ func TestInstanceStandby(t *testing.T) {
}
}

func TestInstanceStart(t *testing.T) {
func TestInstanceStartWithOptionalParams(t *testing.T) {
t.Skip("Prism tests are disabled")
baseURL := "http://localhost:4010"
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
Expand All @@ -195,7 +201,14 @@ func TestInstanceStart(t *testing.T) {
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
_, err := client.Instances.Start(context.TODO(), "id")
_, err := client.Instances.Start(
context.TODO(),
"id",
hypeman.InstanceStartParams{
Cmd: []string{"string"},
Entrypoint: []string{"string"},
},
)
if err != nil {
var apierr *hypeman.Error
if errors.As(err, &apierr) {
Expand Down
2 changes: 1 addition & 1 deletion internal/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

package internal

const PackageVersion = "0.9.8" // x-release-please-version
const PackageVersion = "0.10.0" // x-release-please-version