Skip to content

Commit 1a92917

Browse files
Merge pull request #9 from hdresearch/release-please--branches--main--changes--next
release: 0.1.0-alpha.3
2 parents f1acf4e + d80da63 commit 1a92917

File tree

8 files changed

+113
-7
lines changed

8 files changed

+113
-7
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.1.0-alpha.2"
2+
".": "0.1.0-alpha.3"
33
}

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 9
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hdr-parth-agrawal%2Ffirecracker-manager-5abc6ae5528da145dff4c50ea70cce67638d737cc5d67ed39fed93b30032053f.yml
3-
openapi_spec_hash: 718f1d7cd3862c03d0a700489a29b902
4-
config_hash: 42b27355c32dc9b2891e7c07c1a80ab2
1+
configured_endpoints: 10
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hdr-parth-agrawal%2Ffirecracker-manager-b0e551d58b1c9c3a43b42d8d5866bba7dce7125f1dce627eedf8457ed581e8d8.yml
3+
openapi_spec_hash: 9a86633a5456bb4290242dc28d6f1774
4+
config_hash: ed897099634e5370025375b19f936397

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 0.1.0-alpha.3 (2025-04-03)
4+
5+
Full Changelog: [v0.1.0-alpha.2...v0.1.0-alpha.3](https://github.com/hdresearch/vers-sdk-go/compare/v0.1.0-alpha.2...v0.1.0-alpha.3)
6+
7+
### Features
8+
9+
* **api:** update via SDK Studio ([#8](https://github.com/hdresearch/vers-sdk-go/issues/8)) ([b0abc42](https://github.com/hdresearch/vers-sdk-go/commit/b0abc42f2718f586cdcea385c19160724a687ef1))
10+
311
## 0.1.0-alpha.2 (2025-04-03)
412

513
Full Changelog: [v0.1.0-alpha.1...v0.1.0-alpha.2](https://github.com/hdresearch/vers-sdk-go/compare/v0.1.0-alpha.1...v0.1.0-alpha.2)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Or to pin the version:
2424
<!-- x-release-please-start-version -->
2525

2626
```sh
27-
go get -u 'github.com/hdresearch/vers-sdk-go@v0.1.0-alpha.2'
27+
go get -u 'github.com/hdresearch/vers-sdk-go@v0.1.0-alpha.3'
2828
```
2929

3030
<!-- x-release-please-end -->

api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Methods:
1818
Response Types:
1919

2020
- <a href="https://pkg.go.dev/github.com/hdresearch/vers-sdk-go">vers</a>.<a href="https://pkg.go.dev/github.com/hdresearch/vers-sdk-go#Vm">Vm</a>
21+
- <a href="https://pkg.go.dev/github.com/hdresearch/vers-sdk-go">vers</a>.<a href="https://pkg.go.dev/github.com/hdresearch/vers-sdk-go#APIVmExecuteResponse">APIVmExecuteResponse</a>
2122

2223
Methods:
2324

@@ -26,3 +27,4 @@ Methods:
2627
- <code title="get /api/vm">client.API.Vm.<a href="https://pkg.go.dev/github.com/hdresearch/vers-sdk-go#APIVmService.List">List</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>) ([]<a href="https://pkg.go.dev/github.com/hdresearch/vers-sdk-go">vers</a>.<a href="https://pkg.go.dev/github.com/hdresearch/vers-sdk-go#Vm">Vm</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
2728
- <code title="delete /api/vm/{vm_id}">client.API.Vm.<a href="https://pkg.go.dev/github.com/hdresearch/vers-sdk-go#APIVmService.Delete">Delete</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, vmID <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/hdresearch/vers-sdk-go">vers</a>.<a href="https://pkg.go.dev/github.com/hdresearch/vers-sdk-go#APIVmDeleteParams">APIVmDeleteParams</a>) <a href="https://pkg.go.dev/builtin#error">error</a></code>
2829
- <code title="post /api/vm/{vm_id}/branch">client.API.Vm.<a href="https://pkg.go.dev/github.com/hdresearch/vers-sdk-go#APIVmService.NewBranch">NewBranch</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, vmID <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/hdresearch/vers-sdk-go">vers</a>.<a href="https://pkg.go.dev/github.com/hdresearch/vers-sdk-go#APIVmNewBranchParams">APIVmNewBranchParams</a>) (<a href="https://pkg.go.dev/github.com/hdresearch/vers-sdk-go">vers</a>.<a href="https://pkg.go.dev/github.com/hdresearch/vers-sdk-go#Vm">Vm</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>
30+
- <code title="post /api/vm/{vm_id}/execute">client.API.Vm.<a href="https://pkg.go.dev/github.com/hdresearch/vers-sdk-go#APIVmService.Execute">Execute</a>(ctx <a href="https://pkg.go.dev/context">context</a>.<a href="https://pkg.go.dev/context#Context">Context</a>, vmID <a href="https://pkg.go.dev/builtin#string">string</a>, body <a href="https://pkg.go.dev/github.com/hdresearch/vers-sdk-go">vers</a>.<a href="https://pkg.go.dev/github.com/hdresearch/vers-sdk-go#APIVmExecuteParams">APIVmExecuteParams</a>) (<a href="https://pkg.go.dev/github.com/hdresearch/vers-sdk-go">vers</a>.<a href="https://pkg.go.dev/github.com/hdresearch/vers-sdk-go#APIVmExecuteResponse">APIVmExecuteResponse</a>, <a href="https://pkg.go.dev/builtin#error">error</a>)</code>

apivm.go

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,17 @@ func (r *APIVmService) NewBranch(ctx context.Context, vmID string, body APIVmNew
9494
return
9595
}
9696

97+
func (r *APIVmService) Execute(ctx context.Context, vmID string, body APIVmExecuteParams, opts ...option.RequestOption) (res *APIVmExecuteResponse, err error) {
98+
opts = append(r.Options[:], opts...)
99+
if vmID == "" {
100+
err = errors.New("missing required vm_id parameter")
101+
return
102+
}
103+
path := fmt.Sprintf("api/vm/%s/execute", vmID)
104+
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
105+
return
106+
}
107+
97108
type Vm struct {
98109
// The ID of the VM.
99110
ID string `json:"id,required"`
@@ -176,6 +187,54 @@ func (r VmState) IsKnown() bool {
176187
return false
177188
}
178189

190+
type APIVmExecuteResponse struct {
191+
ID string `json:"id,required"`
192+
CommandResult APIVmExecuteResponseCommandResult `json:"command_result,required"`
193+
JSON apiVmExecuteResponseJSON `json:"-"`
194+
}
195+
196+
// apiVmExecuteResponseJSON contains the JSON metadata for the struct
197+
// [APIVmExecuteResponse]
198+
type apiVmExecuteResponseJSON struct {
199+
ID apijson.Field
200+
CommandResult apijson.Field
201+
raw string
202+
ExtraFields map[string]apijson.Field
203+
}
204+
205+
func (r *APIVmExecuteResponse) UnmarshalJSON(data []byte) (err error) {
206+
return apijson.UnmarshalRoot(data, r)
207+
}
208+
209+
func (r apiVmExecuteResponseJSON) RawJSON() string {
210+
return r.raw
211+
}
212+
213+
type APIVmExecuteResponseCommandResult struct {
214+
ExitCode int64 `json:"exit_code,required"`
215+
Stderr string `json:"stderr,required"`
216+
Stdout string `json:"stdout,required"`
217+
JSON apiVmExecuteResponseCommandResultJSON `json:"-"`
218+
}
219+
220+
// apiVmExecuteResponseCommandResultJSON contains the JSON metadata for the struct
221+
// [APIVmExecuteResponseCommandResult]
222+
type apiVmExecuteResponseCommandResultJSON struct {
223+
ExitCode apijson.Field
224+
Stderr apijson.Field
225+
Stdout apijson.Field
226+
raw string
227+
ExtraFields map[string]apijson.Field
228+
}
229+
230+
func (r *APIVmExecuteResponseCommandResult) UnmarshalJSON(data []byte) (err error) {
231+
return apijson.UnmarshalRoot(data, r)
232+
}
233+
234+
func (r apiVmExecuteResponseCommandResultJSON) RawJSON() string {
235+
return r.raw
236+
}
237+
179238
type APIVmUpdateParams struct {
180239
Body APIVmUpdateParamsBody `json:"body,required"`
181240
}
@@ -219,3 +278,11 @@ type APIVmNewBranchParams struct {
219278
func (r APIVmNewBranchParams) MarshalJSON() (data []byte, err error) {
220279
return apijson.MarshalRoot(r.Body)
221280
}
281+
282+
type APIVmExecuteParams struct {
283+
Command param.Field[string] `json:"command,required"`
284+
}
285+
286+
func (r APIVmExecuteParams) MarshalJSON() (data []byte, err error) {
287+
return apijson.MarshalRoot(r)
288+
}

apivm_test.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,32 @@ func TestAPIVmNewBranch(t *testing.T) {
145145
t.Fatalf("err should be nil: %s", err.Error())
146146
}
147147
}
148+
149+
func TestAPIVmExecute(t *testing.T) {
150+
t.Skip("skipped: tests are disabled for the time being")
151+
baseURL := "http://localhost:4010"
152+
if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
153+
baseURL = envURL
154+
}
155+
if !testutil.CheckTestServer(t, baseURL) {
156+
return
157+
}
158+
client := vers.NewClient(
159+
option.WithBaseURL(baseURL),
160+
option.WithAPIKey("My API Key"),
161+
)
162+
_, err := client.API.Vm.Execute(
163+
context.TODO(),
164+
"vm_id",
165+
vers.APIVmExecuteParams{
166+
Command: vers.F("command"),
167+
},
168+
)
169+
if err != nil {
170+
var apierr *vers.Error
171+
if errors.As(err, &apierr) {
172+
t.Log(string(apierr.DumpRequest(true)))
173+
}
174+
t.Fatalf("err should be nil: %s", err.Error())
175+
}
176+
}

internal/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
package internal
44

5-
const PackageVersion = "0.1.0-alpha.2" // x-release-please-version
5+
const PackageVersion = "0.1.0-alpha.3" // x-release-please-version

0 commit comments

Comments
 (0)