From f3992ffe807e7006a25ae2211cd5cb25fb599bff Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 26 Nov 2025 17:45:10 +0000 Subject: [PATCH 1/2] feat(api): add exec --- .stats.yml | 4 ++-- api.md | 1 + instance.go | 13 +++++++++++++ instance_test.go | 23 +++++++++++++++++++++++ 4 files changed, 39 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0219fc6..1eb1c77 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 18 +configured_endpoints: 19 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fhypeman-5e2239ba23ac3dbbc95b8993a491e99e9fd23fed2e6ea9cecb81b83bf34a00ff.yml openapi_spec_hash: 4708504f9119289926b3341d083a1814 -config_hash: 35db4c99791f175865381f13a8ad6075 +config_hash: 45d3d945ce8eea7a52c8ead4c03fcf3c diff --git a/api.md b/api.md index 81083cd..8f9fefb 100644 --- a/api.md +++ b/api.md @@ -33,6 +33,7 @@ Methods: - client.Instances.Get(ctx context.Context, id string) (hypeman.Instance, error) - client.Instances.List(ctx context.Context) ([]hypeman.Instance, error) - client.Instances.Delete(ctx context.Context, id string) error +- client.Instances.ExecuteCommand(ctx context.Context, id string) error - client.Instances.PutInStandby(ctx context.Context, id string) (hypeman.Instance, error) - client.Instances.RestoreFromStandby(ctx context.Context, id string) (hypeman.Instance, error) - client.Instances.StreamLogs(ctx context.Context, id string, query hypeman.InstanceStreamLogsParams) (string, error) diff --git a/instance.go b/instance.go index 78f1bbd..f4dea06 100644 --- a/instance.go +++ b/instance.go @@ -82,6 +82,19 @@ func (r *InstanceService) Delete(ctx context.Context, id string, opts ...option. return } +// Upgrades to WebSocket for bidirectional streaming for shell access. +func (r *InstanceService) ExecuteCommand(ctx context.Context, id string, opts ...option.RequestOption) (err error) { + opts = slices.Concat(r.Options, opts) + opts = append([]option.RequestOption{option.WithHeader("Accept", "*/*")}, opts...) + if id == "" { + err = errors.New("missing required id parameter") + return + } + path := fmt.Sprintf("instances/%s/exec", id) + err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, nil, opts...) + return +} + // Put instance in standby (pause, snapshot, delete VMM) func (r *InstanceService) PutInStandby(ctx context.Context, id string, opts ...option.RequestOption) (res *Instance, err error) { opts = slices.Concat(r.Options, opts) diff --git a/instance_test.go b/instance_test.go index d88c1a6..6d6ab52 100644 --- a/instance_test.go +++ b/instance_test.go @@ -119,6 +119,29 @@ func TestInstanceDelete(t *testing.T) { } } +func TestInstanceExecuteCommand(t *testing.T) { + t.Skip("Prism tests are disabled") + baseURL := "http://localhost:4010" + if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok { + baseURL = envURL + } + if !testutil.CheckTestServer(t, baseURL) { + return + } + client := hypeman.NewClient( + option.WithBaseURL(baseURL), + option.WithAPIKey("My API Key"), + ) + err := client.Instances.ExecuteCommand(context.TODO(), "id") + if err != nil { + var apierr *hypeman.Error + if errors.As(err, &apierr) { + t.Log(string(apierr.DumpRequest(true))) + } + t.Fatalf("err should be nil: %s", err.Error()) + } +} + func TestInstancePutInStandby(t *testing.T) { t.Skip("Prism tests are disabled") baseURL := "http://localhost:4010" From 99139db39c46c5e494f97c97dd65ef06791c6de4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 26 Nov 2025 17:45:25 +0000 Subject: [PATCH 2/2] release: 0.2.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ README.md | 2 +- internal/version.go | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3d2ac0b..10f3091 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0" + ".": "0.2.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 89d4ebe..dd49d7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.2.0 (2025-11-26) + +Full Changelog: [v0.1.0...v0.2.0](https://github.com/onkernel/hypeman-go/compare/v0.1.0...v0.2.0) + +### Features + +* **api:** add exec ([f3992ff](https://github.com/onkernel/hypeman-go/commit/f3992ffe807e7006a25ae2211cd5cb25fb599bff)) + ## 0.1.0 (2025-11-26) Full Changelog: [v0.0.3...v0.1.0](https://github.com/onkernel/hypeman-go/compare/v0.0.3...v0.1.0) diff --git a/README.md b/README.md index 575df9a..194c0e5 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Or to pin the version: ```sh -go get -u 'github.com/onkernel/hypeman-go@v0.1.0' +go get -u 'github.com/onkernel/hypeman-go@v0.2.0' ``` diff --git a/internal/version.go b/internal/version.go index 02eac73..774c6c4 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "0.1.0" // x-release-please-version +const PackageVersion = "0.2.0" // x-release-please-version