From ffa4444199a4a95811ff66907dc56d71c356f921 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 10 Jul 2025 23:25:24 +0000
Subject: [PATCH 01/13] chore: update SDK settings
---
.release-please-manifest.json | 3 +
.stats.yml | 2 +-
CONTRIBUTING.md | 2 +-
README.md | 22 ++++--
aliases.go | 4 +-
api.md | 44 ++++++------
client.go | 4 +-
client_test.go | 6 +-
field.go | 2 +-
go.mod | 2 +-
internal/apierror/apierror.go | 4 +-
internal/apiform/encoder.go | 2 +-
internal/apiform/form_test.go | 2 +-
internal/apiform/richparam.go | 2 +-
internal/apijson/decodeparam_test.go | 4 +-
internal/apijson/decoder.go | 2 +-
internal/apijson/decoderesp_test.go | 4 +-
internal/apijson/subfield.go | 2 +-
internal/apijson/union.go | 2 +-
internal/apiquery/encoder.go | 2 +-
internal/apiquery/query_test.go | 2 +-
internal/apiquery/richparam.go | 2 +-
internal/encoding/json/decode.go | 2 +-
internal/encoding/json/encode.go | 4 +-
internal/encoding/json/sentinel/null.go | 2 +-
.../encoding/json/sentinel/sentinel_test.go | 4 +-
internal/encoding/json/time.go | 2 +-
internal/paramutil/field.go | 4 +-
internal/paramutil/union.go | 2 +-
internal/requestconfig/requestconfig.go | 8 +--
internal/version.go | 2 +-
node.go | 10 +--
node_test.go | 6 +-
option/requestoption.go | 4 +-
packages/param/encoder.go | 2 +-
packages/param/encoder_test.go | 2 +-
packages/param/null.go | 2 +-
packages/param/null_test.go | 2 +-
packages/param/option.go | 2 +-
packages/param/param.go | 2 +-
packages/respjson/decoder_test.go | 4 +-
release-please-config.json | 67 +++++++++++++++++++
usage_test.go | 6 +-
vm.go | 12 ++--
vm_test.go | 6 +-
vmscript.go | 10 +--
vmscript_test.go | 6 +-
47 files changed, 186 insertions(+), 108 deletions(-)
create mode 100644 .release-please-manifest.json
create mode 100644 release-please-config.json
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
new file mode 100644
index 0000000..c476280
--- /dev/null
+++ b/.release-please-manifest.json
@@ -0,0 +1,3 @@
+{
+ ".": "0.0.1-alpha.0"
+}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index ae0037c..33604b5 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 10
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/the-san-francisco-compute-company%2Fsfc-nodes-b800806859333bacc88fa4236eae35c8cdbec62970b7fb9ad440a330f24a1622.yml
openapi_spec_hash: fa672b6ca8953a8059961a7559a607a9
-config_hash: c41bbd00e07f543c79f5d6d61fbee825
+config_hash: ba0ad07ed829c1e78fe717ee17542d69
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index faa8c90..536f5f7 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -41,7 +41,7 @@ To use a local version of this library from source in another project, edit the
directive. This can be done through the CLI with the following:
```sh
-$ go mod edit -replace github.com/stainless-sdks/sfc-nodes-go=/path/to/sfc-nodes-go
+$ go mod edit -replace github.com/sfcompute/nodes-go=/path/to/nodes-go
```
## Running tests
diff --git a/README.md b/README.md
index 2350924..4ed49aa 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# SFC Nodes Go API Library
-
+
The SFC Nodes Go library provides convenient access to the [SFC Nodes REST API](https://docs.sfcompute.com/api-reference#tag/nodes)
from applications written in Go.
@@ -9,18 +9,26 @@ It is generated with [Stainless](https://www.stainless.com/).
## Installation
+
+
```go
import (
- "github.com/stainless-sdks/sfc-nodes-go" // imported as sfcnodes
+ "github.com/sfcompute/nodes-go" // imported as sfcnodes
)
```
+
+
Or to pin the version:
+
+
```sh
-go get -u 'github.com/stainless-sdks/sfc-nodes-go@v0.0.1-alpha.0'
+go get -u 'github.com/sfcompute/nodes-go@v0.0.1-alpha.0'
```
+
+
## Requirements
This library requires Go 1.18+.
@@ -36,8 +44,8 @@ import (
"context"
"fmt"
- "github.com/stainless-sdks/sfc-nodes-go"
- "github.com/stainless-sdks/sfc-nodes-go/option"
+ "github.com/sfcompute/nodes-go"
+ "github.com/sfcompute/nodes-go/option"
)
func main() {
@@ -264,7 +272,7 @@ client.Nodes.List(context.TODO(), ...,
The request option `option.WithDebugLog(nil)` may be helpful while debugging.
-See the [full list of request options](https://pkg.go.dev/github.com/stainless-sdks/sfc-nodes-go/option).
+See the [full list of request options](https://pkg.go.dev/github.com/sfcompute/nodes-go/option).
### Pagination
@@ -461,7 +469,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
-We are keen for your feedback; please open an [issue](https://www.github.com/stainless-sdks/sfc-nodes-go/issues) with questions, bugs, or suggestions.
+We are keen for your feedback; please open an [issue](https://www.github.com/sfcompute/nodes-go/issues) with questions, bugs, or suggestions.
## Contributing
diff --git a/aliases.go b/aliases.go
index e4f0514..0a63a38 100644
--- a/aliases.go
+++ b/aliases.go
@@ -3,8 +3,8 @@
package sfcnodes
import (
- "github.com/stainless-sdks/sfc-nodes-go/internal/apierror"
- "github.com/stainless-sdks/sfc-nodes-go/packages/param"
+ "github.com/sfcompute/nodes-go/internal/apierror"
+ "github.com/sfcompute/nodes-go/packages/param"
)
// aliased to make [param.APIUnion] private when embedding
diff --git a/api.md b/api.md
index 763d96e..7858d72 100644
--- a/api.md
+++ b/api.md
@@ -2,50 +2,50 @@
Response Types:
-- sfcnodes.VmListResponse
-- sfcnodes.VmLogsResponse
-- sfcnodes.VmReplaceResponse
-- sfcnodes.VmSSHResponse
+- sfcnodes.VmListResponse
+- sfcnodes.VmLogsResponse
+- sfcnodes.VmReplaceResponse
+- sfcnodes.VmSSHResponse
Methods:
-- client.Vms.List(ctx context.Context) (sfcnodes.VmListResponse, error)
-- client.Vms.Logs(ctx context.Context, query sfcnodes.VmLogsParams) (sfcnodes.VmLogsResponse, error)
-- client.Vms.Replace(ctx context.Context, body sfcnodes.VmReplaceParams) (sfcnodes.VmReplaceResponse, error)
-- client.Vms.SSH(ctx context.Context, query sfcnodes.VmSSHParams) (sfcnodes.VmSSHResponse, error)
+- client.Vms.List(ctx context.Context) (sfcnodes.VmListResponse, error)
+- client.Vms.Logs(ctx context.Context, query sfcnodes.VmLogsParams) (sfcnodes.VmLogsResponse, error)
+- client.Vms.Replace(ctx context.Context, body sfcnodes.VmReplaceParams) (sfcnodes.VmReplaceResponse, error)
+- client.Vms.SSH(ctx context.Context, query sfcnodes.VmSSHParams) (sfcnodes.VmSSHResponse, error)
## Script
Params Types:
-- sfcnodes.UserDataUnionParam
+- sfcnodes.UserDataUnionParam
Response Types:
-- sfcnodes.UserDataUnion
-- sfcnodes.VmScriptNewResponse
-- sfcnodes.VmScriptGetResponse
+- sfcnodes.UserDataUnion
+- sfcnodes.VmScriptNewResponse
+- sfcnodes.VmScriptGetResponse
Methods:
-- client.Vms.Script.New(ctx context.Context, body sfcnodes.VmScriptNewParams) (sfcnodes.VmScriptNewResponse, error)
-- client.Vms.Script.Get(ctx context.Context) (sfcnodes.VmScriptGetResponse, error)
+- client.Vms.Script.New(ctx context.Context, body sfcnodes.VmScriptNewParams) (sfcnodes.VmScriptNewResponse, error)
+- client.Vms.Script.Get(ctx context.Context) (sfcnodes.VmScriptGetResponse, error)
# Nodes
Params Types:
-- sfcnodes.NodeType
+- sfcnodes.NodeType
Response Types:
-- sfcnodes.Node
-- sfcnodes.NodeType
-- sfcnodes.UpdateNode
+- sfcnodes.Node
+- sfcnodes.NodeType
+- sfcnodes.UpdateNode
Methods:
-- client.Nodes.New(ctx context.Context, body sfcnodes.NodeNewParams) ([]sfcnodes.Node, error)
-- client.Nodes.List(ctx context.Context) ([]sfcnodes.Node, error)
-- client.Nodes.Extend(ctx context.Context, id string, body sfcnodes.NodeExtendParams) (sfcnodes.UpdateNode, error)
-- client.Nodes.Release(ctx context.Context, id string, body sfcnodes.NodeReleaseParams) (sfcnodes.UpdateNode, error)
+- client.Nodes.New(ctx context.Context, body sfcnodes.NodeNewParams) ([]sfcnodes.Node, error)
+- client.Nodes.List(ctx context.Context) ([]sfcnodes.Node, error)
+- client.Nodes.Extend(ctx context.Context, id string, body sfcnodes.NodeExtendParams) (sfcnodes.UpdateNode, error)
+- client.Nodes.Release(ctx context.Context, id string, body sfcnodes.NodeReleaseParams) (sfcnodes.UpdateNode, error)
diff --git a/client.go b/client.go
index b4fc1ec..728aeee 100644
--- a/client.go
+++ b/client.go
@@ -7,8 +7,8 @@ import (
"net/http"
"os"
- "github.com/stainless-sdks/sfc-nodes-go/internal/requestconfig"
- "github.com/stainless-sdks/sfc-nodes-go/option"
+ "github.com/sfcompute/nodes-go/internal/requestconfig"
+ "github.com/sfcompute/nodes-go/option"
)
// Client creates a struct with services and top level methods that help with
diff --git a/client_test.go b/client_test.go
index 3b280b8..f6d40b1 100644
--- a/client_test.go
+++ b/client_test.go
@@ -10,9 +10,9 @@ import (
"testing"
"time"
- "github.com/stainless-sdks/sfc-nodes-go"
- "github.com/stainless-sdks/sfc-nodes-go/internal"
- "github.com/stainless-sdks/sfc-nodes-go/option"
+ "github.com/sfcompute/nodes-go"
+ "github.com/sfcompute/nodes-go/internal"
+ "github.com/sfcompute/nodes-go/option"
)
type closureTransport struct {
diff --git a/field.go b/field.go
index 27351e8..8967052 100644
--- a/field.go
+++ b/field.go
@@ -1,7 +1,7 @@
package sfcnodes
import (
- "github.com/stainless-sdks/sfc-nodes-go/packages/param"
+ "github.com/sfcompute/nodes-go/packages/param"
"io"
"time"
)
diff --git a/go.mod b/go.mod
index bbd0b90..f115e1a 100644
--- a/go.mod
+++ b/go.mod
@@ -1,4 +1,4 @@
-module github.com/stainless-sdks/sfc-nodes-go
+module github.com/sfcompute/nodes-go
go 1.21
diff --git a/internal/apierror/apierror.go b/internal/apierror/apierror.go
index 73ebc9c..da282b4 100644
--- a/internal/apierror/apierror.go
+++ b/internal/apierror/apierror.go
@@ -7,8 +7,8 @@ import (
"net/http"
"net/http/httputil"
- "github.com/stainless-sdks/sfc-nodes-go/internal/apijson"
- "github.com/stainless-sdks/sfc-nodes-go/packages/respjson"
+ "github.com/sfcompute/nodes-go/internal/apijson"
+ "github.com/sfcompute/nodes-go/packages/respjson"
)
// Error represents an error that originates from the API, i.e. when a request is
diff --git a/internal/apiform/encoder.go b/internal/apiform/encoder.go
index 8ab1fda..16563e4 100644
--- a/internal/apiform/encoder.go
+++ b/internal/apiform/encoder.go
@@ -13,7 +13,7 @@ import (
"sync"
"time"
- "github.com/stainless-sdks/sfc-nodes-go/packages/param"
+ "github.com/sfcompute/nodes-go/packages/param"
)
var encoders sync.Map // map[encoderEntry]encoderFunc
diff --git a/internal/apiform/form_test.go b/internal/apiform/form_test.go
index 34431fe..0d05c4a 100644
--- a/internal/apiform/form_test.go
+++ b/internal/apiform/form_test.go
@@ -2,7 +2,7 @@ package apiform
import (
"bytes"
- "github.com/stainless-sdks/sfc-nodes-go/packages/param"
+ "github.com/sfcompute/nodes-go/packages/param"
"io"
"mime/multipart"
"strings"
diff --git a/internal/apiform/richparam.go b/internal/apiform/richparam.go
index 3c4b822..b50e778 100644
--- a/internal/apiform/richparam.go
+++ b/internal/apiform/richparam.go
@@ -1,7 +1,7 @@
package apiform
import (
- "github.com/stainless-sdks/sfc-nodes-go/packages/param"
+ "github.com/sfcompute/nodes-go/packages/param"
"mime/multipart"
"reflect"
)
diff --git a/internal/apijson/decodeparam_test.go b/internal/apijson/decodeparam_test.go
index 9ac2a53..8f08d4e 100644
--- a/internal/apijson/decodeparam_test.go
+++ b/internal/apijson/decodeparam_test.go
@@ -3,8 +3,8 @@ package apijson_test
import (
"encoding/json"
"fmt"
- "github.com/stainless-sdks/sfc-nodes-go/internal/apijson"
- "github.com/stainless-sdks/sfc-nodes-go/packages/param"
+ "github.com/sfcompute/nodes-go/internal/apijson"
+ "github.com/sfcompute/nodes-go/packages/param"
"reflect"
"testing"
)
diff --git a/internal/apijson/decoder.go b/internal/apijson/decoder.go
index d5ffb1f..b426199 100644
--- a/internal/apijson/decoder.go
+++ b/internal/apijson/decoder.go
@@ -7,7 +7,7 @@ package apijson
import (
"encoding/json"
"fmt"
- "github.com/stainless-sdks/sfc-nodes-go/packages/param"
+ "github.com/sfcompute/nodes-go/packages/param"
"reflect"
"strconv"
"sync"
diff --git a/internal/apijson/decoderesp_test.go b/internal/apijson/decoderesp_test.go
index 034a83b..b42e733 100644
--- a/internal/apijson/decoderesp_test.go
+++ b/internal/apijson/decoderesp_test.go
@@ -2,8 +2,8 @@ package apijson_test
import (
"encoding/json"
- "github.com/stainless-sdks/sfc-nodes-go/internal/apijson"
- "github.com/stainless-sdks/sfc-nodes-go/packages/respjson"
+ "github.com/sfcompute/nodes-go/internal/apijson"
+ "github.com/sfcompute/nodes-go/packages/respjson"
"testing"
)
diff --git a/internal/apijson/subfield.go b/internal/apijson/subfield.go
index 0d60a39..c3315ff 100644
--- a/internal/apijson/subfield.go
+++ b/internal/apijson/subfield.go
@@ -1,7 +1,7 @@
package apijson
import (
- "github.com/stainless-sdks/sfc-nodes-go/packages/respjson"
+ "github.com/sfcompute/nodes-go/packages/respjson"
"reflect"
)
diff --git a/internal/apijson/union.go b/internal/apijson/union.go
index e21a3af..7f3d8dc 100644
--- a/internal/apijson/union.go
+++ b/internal/apijson/union.go
@@ -2,7 +2,7 @@ package apijson
import (
"errors"
- "github.com/stainless-sdks/sfc-nodes-go/packages/param"
+ "github.com/sfcompute/nodes-go/packages/param"
"reflect"
"github.com/tidwall/gjson"
diff --git a/internal/apiquery/encoder.go b/internal/apiquery/encoder.go
index 1dcce98..96e583f 100644
--- a/internal/apiquery/encoder.go
+++ b/internal/apiquery/encoder.go
@@ -9,7 +9,7 @@ import (
"sync"
"time"
- "github.com/stainless-sdks/sfc-nodes-go/packages/param"
+ "github.com/sfcompute/nodes-go/packages/param"
)
var encoders sync.Map // map[reflect.Type]encoderFunc
diff --git a/internal/apiquery/query_test.go b/internal/apiquery/query_test.go
index 778f152..1e4ed70 100644
--- a/internal/apiquery/query_test.go
+++ b/internal/apiquery/query_test.go
@@ -1,7 +1,7 @@
package apiquery
import (
- "github.com/stainless-sdks/sfc-nodes-go/packages/param"
+ "github.com/sfcompute/nodes-go/packages/param"
"net/url"
"testing"
"time"
diff --git a/internal/apiquery/richparam.go b/internal/apiquery/richparam.go
index 3176728..b106153 100644
--- a/internal/apiquery/richparam.go
+++ b/internal/apiquery/richparam.go
@@ -1,7 +1,7 @@
package apiquery
import (
- "github.com/stainless-sdks/sfc-nodes-go/packages/param"
+ "github.com/sfcompute/nodes-go/packages/param"
"reflect"
)
diff --git a/internal/encoding/json/decode.go b/internal/encoding/json/decode.go
index bbe9b1d..03ed35e 100644
--- a/internal/encoding/json/decode.go
+++ b/internal/encoding/json/decode.go
@@ -14,7 +14,7 @@ import (
"encoding"
"encoding/base64"
"fmt"
- "github.com/stainless-sdks/sfc-nodes-go/internal/encoding/json/shims"
+ "github.com/sfcompute/nodes-go/internal/encoding/json/shims"
"reflect"
"strconv"
"strings"
diff --git a/internal/encoding/json/encode.go b/internal/encoding/json/encode.go
index 18dd6db..22c054b 100644
--- a/internal/encoding/json/encode.go
+++ b/internal/encoding/json/encode.go
@@ -19,8 +19,8 @@ import (
"encoding"
"encoding/base64"
"fmt"
- "github.com/stainless-sdks/sfc-nodes-go/internal/encoding/json/sentinel"
- "github.com/stainless-sdks/sfc-nodes-go/internal/encoding/json/shims"
+ "github.com/sfcompute/nodes-go/internal/encoding/json/sentinel"
+ "github.com/sfcompute/nodes-go/internal/encoding/json/shims"
"math"
"reflect"
"slices"
diff --git a/internal/encoding/json/sentinel/null.go b/internal/encoding/json/sentinel/null.go
index 6182007..2934516 100644
--- a/internal/encoding/json/sentinel/null.go
+++ b/internal/encoding/json/sentinel/null.go
@@ -1,7 +1,7 @@
package sentinel
import (
- "github.com/stainless-sdks/sfc-nodes-go/internal/encoding/json/shims"
+ "github.com/sfcompute/nodes-go/internal/encoding/json/shims"
"reflect"
"sync"
)
diff --git a/internal/encoding/json/sentinel/sentinel_test.go b/internal/encoding/json/sentinel/sentinel_test.go
index c1b96b0..91d5e73 100644
--- a/internal/encoding/json/sentinel/sentinel_test.go
+++ b/internal/encoding/json/sentinel/sentinel_test.go
@@ -1,8 +1,8 @@
package sentinel_test
import (
- "github.com/stainless-sdks/sfc-nodes-go/internal/encoding/json/sentinel"
- "github.com/stainless-sdks/sfc-nodes-go/packages/param"
+ "github.com/sfcompute/nodes-go/internal/encoding/json/sentinel"
+ "github.com/sfcompute/nodes-go/packages/param"
"reflect"
"slices"
"testing"
diff --git a/internal/encoding/json/time.go b/internal/encoding/json/time.go
index 637da39..9e3bda3 100644
--- a/internal/encoding/json/time.go
+++ b/internal/encoding/json/time.go
@@ -2,7 +2,7 @@
package json
import (
- "github.com/stainless-sdks/sfc-nodes-go/internal/encoding/json/shims"
+ "github.com/sfcompute/nodes-go/internal/encoding/json/shims"
"reflect"
"time"
)
diff --git a/internal/paramutil/field.go b/internal/paramutil/field.go
index 8e60442..1401d48 100644
--- a/internal/paramutil/field.go
+++ b/internal/paramutil/field.go
@@ -1,8 +1,8 @@
package paramutil
import (
- "github.com/stainless-sdks/sfc-nodes-go/packages/param"
- "github.com/stainless-sdks/sfc-nodes-go/packages/respjson"
+ "github.com/sfcompute/nodes-go/packages/param"
+ "github.com/sfcompute/nodes-go/packages/respjson"
)
func AddrIfPresent[T comparable](v param.Opt[T]) *T {
diff --git a/internal/paramutil/union.go b/internal/paramutil/union.go
index 453075f..ee26796 100644
--- a/internal/paramutil/union.go
+++ b/internal/paramutil/union.go
@@ -2,7 +2,7 @@ package paramutil
import (
"fmt"
- "github.com/stainless-sdks/sfc-nodes-go/packages/param"
+ "github.com/sfcompute/nodes-go/packages/param"
"reflect"
)
diff --git a/internal/requestconfig/requestconfig.go b/internal/requestconfig/requestconfig.go
index 8b16a6f..c0e6231 100644
--- a/internal/requestconfig/requestconfig.go
+++ b/internal/requestconfig/requestconfig.go
@@ -18,10 +18,10 @@ import (
"strings"
"time"
- "github.com/stainless-sdks/sfc-nodes-go/internal"
- "github.com/stainless-sdks/sfc-nodes-go/internal/apierror"
- "github.com/stainless-sdks/sfc-nodes-go/internal/apiform"
- "github.com/stainless-sdks/sfc-nodes-go/internal/apiquery"
+ "github.com/sfcompute/nodes-go/internal"
+ "github.com/sfcompute/nodes-go/internal/apierror"
+ "github.com/sfcompute/nodes-go/internal/apiform"
+ "github.com/sfcompute/nodes-go/internal/apiquery"
)
func getDefaultHeaders() map[string]string {
diff --git a/internal/version.go b/internal/version.go
index 1e49ee4..4ff68e4 100644
--- a/internal/version.go
+++ b/internal/version.go
@@ -2,4 +2,4 @@
package internal
-const PackageVersion = "0.0.1-alpha.0"
+const PackageVersion = "0.0.1-alpha.0" // x-release-please-version
diff --git a/node.go b/node.go
index 6fc4ac0..70ae784 100644
--- a/node.go
+++ b/node.go
@@ -9,11 +9,11 @@ import (
"fmt"
"net/http"
- "github.com/stainless-sdks/sfc-nodes-go/internal/apijson"
- "github.com/stainless-sdks/sfc-nodes-go/internal/requestconfig"
- "github.com/stainless-sdks/sfc-nodes-go/option"
- "github.com/stainless-sdks/sfc-nodes-go/packages/param"
- "github.com/stainless-sdks/sfc-nodes-go/packages/respjson"
+ "github.com/sfcompute/nodes-go/internal/apijson"
+ "github.com/sfcompute/nodes-go/internal/requestconfig"
+ "github.com/sfcompute/nodes-go/option"
+ "github.com/sfcompute/nodes-go/packages/param"
+ "github.com/sfcompute/nodes-go/packages/respjson"
)
// NodeService contains methods and other services that help with interacting with
diff --git a/node_test.go b/node_test.go
index 3493f22..8600afb 100644
--- a/node_test.go
+++ b/node_test.go
@@ -8,9 +8,9 @@ import (
"os"
"testing"
- "github.com/stainless-sdks/sfc-nodes-go"
- "github.com/stainless-sdks/sfc-nodes-go/internal/testutil"
- "github.com/stainless-sdks/sfc-nodes-go/option"
+ "github.com/sfcompute/nodes-go"
+ "github.com/sfcompute/nodes-go/internal/testutil"
+ "github.com/sfcompute/nodes-go/option"
)
func TestNodeNewWithOptionalParams(t *testing.T) {
diff --git a/option/requestoption.go b/option/requestoption.go
index e1bb0ac..7aac142 100644
--- a/option/requestoption.go
+++ b/option/requestoption.go
@@ -11,7 +11,7 @@ import (
"strings"
"time"
- "github.com/stainless-sdks/sfc-nodes-go/internal/requestconfig"
+ "github.com/sfcompute/nodes-go/internal/requestconfig"
"github.com/tidwall/sjson"
)
@@ -19,7 +19,7 @@ import (
// which can be supplied to clients, services, and methods. You can read more about this functional
// options pattern in our [README].
//
-// [README]: https://pkg.go.dev/github.com/stainless-sdks/sfc-nodes-go#readme-requestoptions
+// [README]: https://pkg.go.dev/github.com/sfcompute/nodes-go#readme-requestoptions
type RequestOption = requestconfig.RequestOption
// WithBaseURL returns a RequestOption that sets the BaseURL for the client.
diff --git a/packages/param/encoder.go b/packages/param/encoder.go
index 6d69469..e35ae27 100644
--- a/packages/param/encoder.go
+++ b/packages/param/encoder.go
@@ -6,7 +6,7 @@ import (
"reflect"
"time"
- shimjson "github.com/stainless-sdks/sfc-nodes-go/internal/encoding/json"
+ shimjson "github.com/sfcompute/nodes-go/internal/encoding/json"
"github.com/tidwall/sjson"
)
diff --git a/packages/param/encoder_test.go b/packages/param/encoder_test.go
index 296df07..f64ff67 100644
--- a/packages/param/encoder_test.go
+++ b/packages/param/encoder_test.go
@@ -5,7 +5,7 @@ import (
"testing"
"time"
- "github.com/stainless-sdks/sfc-nodes-go/packages/param"
+ "github.com/sfcompute/nodes-go/packages/param"
)
type Struct struct {
diff --git a/packages/param/null.go b/packages/param/null.go
index 9acb987..84da2ef 100644
--- a/packages/param/null.go
+++ b/packages/param/null.go
@@ -1,6 +1,6 @@
package param
-import "github.com/stainless-sdks/sfc-nodes-go/internal/encoding/json/sentinel"
+import "github.com/sfcompute/nodes-go/internal/encoding/json/sentinel"
// NullMap returns a non-nil map with a length of 0.
// When used with [MarshalObject] or [MarshalUnion], it will be marshaled as null.
diff --git a/packages/param/null_test.go b/packages/param/null_test.go
index a54fd02..82dab7a 100644
--- a/packages/param/null_test.go
+++ b/packages/param/null_test.go
@@ -2,7 +2,7 @@ package param_test
import (
"encoding/json"
- "github.com/stainless-sdks/sfc-nodes-go/packages/param"
+ "github.com/sfcompute/nodes-go/packages/param"
"testing"
)
diff --git a/packages/param/option.go b/packages/param/option.go
index c936818..1c1a6a7 100644
--- a/packages/param/option.go
+++ b/packages/param/option.go
@@ -3,7 +3,7 @@ package param
import (
"encoding/json"
"fmt"
- shimjson "github.com/stainless-sdks/sfc-nodes-go/internal/encoding/json"
+ shimjson "github.com/sfcompute/nodes-go/internal/encoding/json"
"time"
)
diff --git a/packages/param/param.go b/packages/param/param.go
index a93de5a..500a3f5 100644
--- a/packages/param/param.go
+++ b/packages/param/param.go
@@ -2,7 +2,7 @@ package param
import (
"encoding/json"
- "github.com/stainless-sdks/sfc-nodes-go/internal/encoding/json/sentinel"
+ "github.com/sfcompute/nodes-go/internal/encoding/json/sentinel"
"reflect"
)
diff --git a/packages/respjson/decoder_test.go b/packages/respjson/decoder_test.go
index 3b8cc07..d6c2b7d 100644
--- a/packages/respjson/decoder_test.go
+++ b/packages/respjson/decoder_test.go
@@ -3,8 +3,8 @@ package respjson_test
import (
"encoding/json"
"fmt"
- "github.com/stainless-sdks/sfc-nodes-go/internal/apijson"
- rj "github.com/stainless-sdks/sfc-nodes-go/packages/respjson"
+ "github.com/sfcompute/nodes-go/internal/apijson"
+ rj "github.com/sfcompute/nodes-go/packages/respjson"
"reflect"
"testing"
)
diff --git a/release-please-config.json b/release-please-config.json
new file mode 100644
index 0000000..a38198e
--- /dev/null
+++ b/release-please-config.json
@@ -0,0 +1,67 @@
+{
+ "packages": {
+ ".": {}
+ },
+ "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json",
+ "include-v-in-tag": true,
+ "include-component-in-tag": false,
+ "versioning": "prerelease",
+ "prerelease": true,
+ "bump-minor-pre-major": true,
+ "bump-patch-for-minor-pre-major": false,
+ "pull-request-header": "Automated Release PR",
+ "pull-request-title-pattern": "release: ${version}",
+ "changelog-sections": [
+ {
+ "type": "feat",
+ "section": "Features"
+ },
+ {
+ "type": "fix",
+ "section": "Bug Fixes"
+ },
+ {
+ "type": "perf",
+ "section": "Performance Improvements"
+ },
+ {
+ "type": "revert",
+ "section": "Reverts"
+ },
+ {
+ "type": "chore",
+ "section": "Chores"
+ },
+ {
+ "type": "docs",
+ "section": "Documentation"
+ },
+ {
+ "type": "style",
+ "section": "Styles"
+ },
+ {
+ "type": "refactor",
+ "section": "Refactors"
+ },
+ {
+ "type": "test",
+ "section": "Tests",
+ "hidden": true
+ },
+ {
+ "type": "build",
+ "section": "Build System"
+ },
+ {
+ "type": "ci",
+ "section": "Continuous Integration",
+ "hidden": true
+ }
+ ],
+ "release-type": "go",
+ "extra-files": [
+ "internal/version.go",
+ "README.md"
+ ]
+}
\ No newline at end of file
diff --git a/usage_test.go b/usage_test.go
index e944712..c9cd49c 100644
--- a/usage_test.go
+++ b/usage_test.go
@@ -7,9 +7,9 @@ import (
"os"
"testing"
- "github.com/stainless-sdks/sfc-nodes-go"
- "github.com/stainless-sdks/sfc-nodes-go/internal/testutil"
- "github.com/stainless-sdks/sfc-nodes-go/option"
+ "github.com/sfcompute/nodes-go"
+ "github.com/sfcompute/nodes-go/internal/testutil"
+ "github.com/sfcompute/nodes-go/option"
)
func TestUsage(t *testing.T) {
diff --git a/vm.go b/vm.go
index 84f5af2..e3d9f0c 100644
--- a/vm.go
+++ b/vm.go
@@ -7,12 +7,12 @@ import (
"net/http"
"net/url"
- "github.com/stainless-sdks/sfc-nodes-go/internal/apijson"
- "github.com/stainless-sdks/sfc-nodes-go/internal/apiquery"
- "github.com/stainless-sdks/sfc-nodes-go/internal/requestconfig"
- "github.com/stainless-sdks/sfc-nodes-go/option"
- "github.com/stainless-sdks/sfc-nodes-go/packages/param"
- "github.com/stainless-sdks/sfc-nodes-go/packages/respjson"
+ "github.com/sfcompute/nodes-go/internal/apijson"
+ "github.com/sfcompute/nodes-go/internal/apiquery"
+ "github.com/sfcompute/nodes-go/internal/requestconfig"
+ "github.com/sfcompute/nodes-go/option"
+ "github.com/sfcompute/nodes-go/packages/param"
+ "github.com/sfcompute/nodes-go/packages/respjson"
)
// VmService contains methods and other services that help with interacting with
diff --git a/vm_test.go b/vm_test.go
index 9e13184..d82085d 100644
--- a/vm_test.go
+++ b/vm_test.go
@@ -8,9 +8,9 @@ import (
"os"
"testing"
- "github.com/stainless-sdks/sfc-nodes-go"
- "github.com/stainless-sdks/sfc-nodes-go/internal/testutil"
- "github.com/stainless-sdks/sfc-nodes-go/option"
+ "github.com/sfcompute/nodes-go"
+ "github.com/sfcompute/nodes-go/internal/testutil"
+ "github.com/sfcompute/nodes-go/option"
)
func TestVmList(t *testing.T) {
diff --git a/vmscript.go b/vmscript.go
index a42f66a..278d01a 100644
--- a/vmscript.go
+++ b/vmscript.go
@@ -7,11 +7,11 @@ import (
"encoding/json"
"net/http"
- "github.com/stainless-sdks/sfc-nodes-go/internal/apijson"
- "github.com/stainless-sdks/sfc-nodes-go/internal/requestconfig"
- "github.com/stainless-sdks/sfc-nodes-go/option"
- "github.com/stainless-sdks/sfc-nodes-go/packages/param"
- "github.com/stainless-sdks/sfc-nodes-go/packages/respjson"
+ "github.com/sfcompute/nodes-go/internal/apijson"
+ "github.com/sfcompute/nodes-go/internal/requestconfig"
+ "github.com/sfcompute/nodes-go/option"
+ "github.com/sfcompute/nodes-go/packages/param"
+ "github.com/sfcompute/nodes-go/packages/respjson"
)
// VmScriptService contains methods and other services that help with interacting
diff --git a/vmscript_test.go b/vmscript_test.go
index 0eb5177..a72b883 100644
--- a/vmscript_test.go
+++ b/vmscript_test.go
@@ -8,9 +8,9 @@ import (
"os"
"testing"
- "github.com/stainless-sdks/sfc-nodes-go"
- "github.com/stainless-sdks/sfc-nodes-go/internal/testutil"
- "github.com/stainless-sdks/sfc-nodes-go/option"
+ "github.com/sfcompute/nodes-go"
+ "github.com/sfcompute/nodes-go/internal/testutil"
+ "github.com/sfcompute/nodes-go/option"
)
func TestVmScriptNew(t *testing.T) {
From 8c07ae781f2bb35c073b99392fcfad92a05cfe68 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 10 Jul 2025 23:25:36 +0000
Subject: [PATCH 02/13] codegen metadata
---
.stats.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.stats.yml b/.stats.yml
index 33604b5..ae13f6b 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 10
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/the-san-francisco-compute-company%2Fsfc-nodes-b800806859333bacc88fa4236eae35c8cdbec62970b7fb9ad440a330f24a1622.yml
openapi_spec_hash: fa672b6ca8953a8059961a7559a607a9
-config_hash: ba0ad07ed829c1e78fe717ee17542d69
+config_hash: 3e08ccabfd0014b8308a6dd422ed2523
From 110513d668ba98d7f7f296b8c499f32a126c1616 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 10 Jul 2025 23:50:11 +0000
Subject: [PATCH 03/13] codegen metadata
---
.stats.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.stats.yml b/.stats.yml
index ae13f6b..6b3f10c 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 10
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/the-san-francisco-compute-company%2Fsfc-nodes-b800806859333bacc88fa4236eae35c8cdbec62970b7fb9ad440a330f24a1622.yml
openapi_spec_hash: fa672b6ca8953a8059961a7559a607a9
-config_hash: 3e08ccabfd0014b8308a6dd422ed2523
+config_hash: 44dfe3c197701732ea4c9e8d0cce0ea0
From f2747426edbc8d37571b1896eb639b1ce9290705 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 11 Jul 2025 00:25:02 +0000
Subject: [PATCH 04/13] codegen metadata
---
.stats.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.stats.yml b/.stats.yml
index 6b3f10c..8e839c3 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 10
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/the-san-francisco-compute-company%2Fsfc-nodes-b800806859333bacc88fa4236eae35c8cdbec62970b7fb9ad440a330f24a1622.yml
openapi_spec_hash: fa672b6ca8953a8059961a7559a607a9
-config_hash: 44dfe3c197701732ea4c9e8d0cce0ea0
+config_hash: 499c74ded37140a0ec9c4acdafb8e634
From 4ec488f47f3be8686f911403dc5f28159e0fa055 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 11 Jul 2025 02:12:01 +0000
Subject: [PATCH 05/13] chore: lint tests in subpackages
---
scripts/lint | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/lint b/scripts/lint
index 9f37abf..7e03a7b 100755
--- a/scripts/lint
+++ b/scripts/lint
@@ -5,7 +5,7 @@ set -e
cd "$(dirname "$0")/.."
echo "==> Running Go build"
-go build .
+go build ./...
echo "==> Checking tests compile"
-go test -run=^$ .
+go test -run=^$ ./...
From 5a3ea36fb89e3c4cfcbe3b612644f98a5ae33e31 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 17 Jul 2025 23:20:38 +0000
Subject: [PATCH 06/13] feat(api): update via SDK Studio
---
.stats.yml | 4 +-
README.md | 2 +-
api.md | 4 --
client.go | 12 ++--
client_test.go | 16 ++---
internal/requestconfig/requestconfig.go | 4 +-
node_test.go | 8 +--
option/requestoption.go | 8 +--
usage_test.go | 2 +-
vm.go | 85 -------------------------
vm_test.go | 52 +--------------
vmscript_test.go | 4 +-
12 files changed, 32 insertions(+), 169 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index 8e839c3..420b13b 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 10
+configured_endpoints: 8
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/the-san-francisco-compute-company%2Fsfc-nodes-b800806859333bacc88fa4236eae35c8cdbec62970b7fb9ad440a330f24a1622.yml
openapi_spec_hash: fa672b6ca8953a8059961a7559a607a9
-config_hash: 499c74ded37140a0ec9c4acdafb8e634
+config_hash: e089259785c0c81187a2b25ae04b8459
diff --git a/README.md b/README.md
index 4ed49aa..ce85fc3 100644
--- a/README.md
+++ b/README.md
@@ -50,7 +50,7 @@ import (
func main() {
client := sfcnodes.NewClient(
- option.WithBearerToken("My Bearer Token"), // defaults to os.LookupEnv("SFC_BEARER_TOKEN")
+ option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("SFC_API_KEY")
)
nodes, err := client.Nodes.List(context.TODO())
if err != nil {
diff --git a/api.md b/api.md
index 7858d72..898faee 100644
--- a/api.md
+++ b/api.md
@@ -2,16 +2,12 @@
Response Types:
-- sfcnodes.VmListResponse
- sfcnodes.VmLogsResponse
-- sfcnodes.VmReplaceResponse
- sfcnodes.VmSSHResponse
Methods:
-- client.Vms.List(ctx context.Context) (sfcnodes.VmListResponse, error)
- client.Vms.Logs(ctx context.Context, query sfcnodes.VmLogsParams) (sfcnodes.VmLogsResponse, error)
-- client.Vms.Replace(ctx context.Context, body sfcnodes.VmReplaceParams) (sfcnodes.VmReplaceResponse, error)
- client.Vms.SSH(ctx context.Context, query sfcnodes.VmSSHParams) (sfcnodes.VmSSHResponse, error)
## Script
diff --git a/client.go b/client.go
index 728aeee..aa13789 100644
--- a/client.go
+++ b/client.go
@@ -20,23 +20,23 @@ type Client struct {
Nodes NodeService
}
-// DefaultClientOptions read from the environment (SFC_BEARER_TOKEN,
+// DefaultClientOptions read from the environment (SFC_API_KEY,
// SFC_NODES_BASE_URL). This should be used to initialize new clients.
func DefaultClientOptions() []option.RequestOption {
defaults := []option.RequestOption{option.WithEnvironmentProduction()}
if o, ok := os.LookupEnv("SFC_NODES_BASE_URL"); ok {
defaults = append(defaults, option.WithBaseURL(o))
}
- if o, ok := os.LookupEnv("SFC_BEARER_TOKEN"); ok {
- defaults = append(defaults, option.WithBearerToken(o))
+ if o, ok := os.LookupEnv("SFC_API_KEY"); ok {
+ defaults = append(defaults, option.WithAPIKey(o))
}
return defaults
}
// NewClient generates a new client with the default option read from the
-// environment (SFC_BEARER_TOKEN, SFC_NODES_BASE_URL). The option passed in as
-// arguments are applied after these default arguments, and all option will be
-// passed down to the services and requests that this client makes.
+// environment (SFC_API_KEY, SFC_NODES_BASE_URL). The option passed in as arguments
+// are applied after these default arguments, and all option will be passed down to
+// the services and requests that this client makes.
func NewClient(opts ...option.RequestOption) (r Client) {
opts = append(DefaultClientOptions(), opts...)
diff --git a/client_test.go b/client_test.go
index f6d40b1..663cd48 100644
--- a/client_test.go
+++ b/client_test.go
@@ -26,7 +26,7 @@ func (t *closureTransport) RoundTrip(req *http.Request) (*http.Response, error)
func TestUserAgentHeader(t *testing.T) {
var userAgent string
client := sfcnodes.NewClient(
- option.WithBearerToken("My Bearer Token"),
+ option.WithAPIKey("My API Key"),
option.WithHTTPClient(&http.Client{
Transport: &closureTransport{
fn: func(req *http.Request) (*http.Response, error) {
@@ -47,7 +47,7 @@ func TestUserAgentHeader(t *testing.T) {
func TestRetryAfter(t *testing.T) {
retryCountHeaders := make([]string, 0)
client := sfcnodes.NewClient(
- option.WithBearerToken("My Bearer Token"),
+ option.WithAPIKey("My API Key"),
option.WithHTTPClient(&http.Client{
Transport: &closureTransport{
fn: func(req *http.Request) (*http.Response, error) {
@@ -81,7 +81,7 @@ func TestRetryAfter(t *testing.T) {
func TestDeleteRetryCountHeader(t *testing.T) {
retryCountHeaders := make([]string, 0)
client := sfcnodes.NewClient(
- option.WithBearerToken("My Bearer Token"),
+ option.WithAPIKey("My API Key"),
option.WithHTTPClient(&http.Client{
Transport: &closureTransport{
fn: func(req *http.Request) (*http.Response, error) {
@@ -111,7 +111,7 @@ func TestDeleteRetryCountHeader(t *testing.T) {
func TestOverwriteRetryCountHeader(t *testing.T) {
retryCountHeaders := make([]string, 0)
client := sfcnodes.NewClient(
- option.WithBearerToken("My Bearer Token"),
+ option.WithAPIKey("My API Key"),
option.WithHTTPClient(&http.Client{
Transport: &closureTransport{
fn: func(req *http.Request) (*http.Response, error) {
@@ -141,7 +141,7 @@ func TestOverwriteRetryCountHeader(t *testing.T) {
func TestRetryAfterMs(t *testing.T) {
attempts := 0
client := sfcnodes.NewClient(
- option.WithBearerToken("My Bearer Token"),
+ option.WithAPIKey("My API Key"),
option.WithHTTPClient(&http.Client{
Transport: &closureTransport{
fn: func(req *http.Request) (*http.Response, error) {
@@ -167,7 +167,7 @@ func TestRetryAfterMs(t *testing.T) {
func TestContextCancel(t *testing.T) {
client := sfcnodes.NewClient(
- option.WithBearerToken("My Bearer Token"),
+ option.WithAPIKey("My API Key"),
option.WithHTTPClient(&http.Client{
Transport: &closureTransport{
fn: func(req *http.Request) (*http.Response, error) {
@@ -187,7 +187,7 @@ func TestContextCancel(t *testing.T) {
func TestContextCancelDelay(t *testing.T) {
client := sfcnodes.NewClient(
- option.WithBearerToken("My Bearer Token"),
+ option.WithAPIKey("My API Key"),
option.WithHTTPClient(&http.Client{
Transport: &closureTransport{
fn: func(req *http.Request) (*http.Response, error) {
@@ -215,7 +215,7 @@ func TestContextDeadline(t *testing.T) {
go func() {
client := sfcnodes.NewClient(
- option.WithBearerToken("My Bearer Token"),
+ option.WithAPIKey("My API Key"),
option.WithHTTPClient(&http.Client{
Transport: &closureTransport{
fn: func(req *http.Request) (*http.Response, error) {
diff --git a/internal/requestconfig/requestconfig.go b/internal/requestconfig/requestconfig.go
index c0e6231..502c885 100644
--- a/internal/requestconfig/requestconfig.go
+++ b/internal/requestconfig/requestconfig.go
@@ -210,7 +210,7 @@ type RequestConfig struct {
CustomHTTPDoer HTTPDoer
HTTPClient *http.Client
Middlewares []middleware
- BearerToken string
+ APIKey string
// If ResponseBodyInto not nil, then we will attempt to deserialize into
// ResponseBodyInto. If Destination is a []byte, then it will return the body as
// is.
@@ -577,7 +577,7 @@ func (cfg *RequestConfig) Clone(ctx context.Context) *RequestConfig {
BaseURL: cfg.BaseURL,
HTTPClient: cfg.HTTPClient,
Middlewares: cfg.Middlewares,
- BearerToken: cfg.BearerToken,
+ APIKey: cfg.APIKey,
}
return new
diff --git a/node_test.go b/node_test.go
index 8600afb..d2794ae 100644
--- a/node_test.go
+++ b/node_test.go
@@ -24,7 +24,7 @@ func TestNodeNewWithOptionalParams(t *testing.T) {
}
client := sfcnodes.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
+ option.WithAPIKey("My API Key"),
)
_, err := client.Nodes.New(context.TODO(), sfcnodes.NodeNewParams{
DesiredCount: 1,
@@ -55,7 +55,7 @@ func TestNodeList(t *testing.T) {
}
client := sfcnodes.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
+ option.WithAPIKey("My API Key"),
)
_, err := client.Nodes.List(context.TODO())
if err != nil {
@@ -78,7 +78,7 @@ func TestNodeExtend(t *testing.T) {
}
client := sfcnodes.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
+ option.WithAPIKey("My API Key"),
)
_, err := client.Nodes.Extend(
context.TODO(),
@@ -108,7 +108,7 @@ func TestNodeRelease(t *testing.T) {
}
client := sfcnodes.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
+ option.WithAPIKey("My API Key"),
)
_, err := client.Nodes.Release(
context.TODO(),
diff --git a/option/requestoption.go b/option/requestoption.go
index 7aac142..ac2dcf9 100644
--- a/option/requestoption.go
+++ b/option/requestoption.go
@@ -265,10 +265,10 @@ func WithEnvironmentProduction() RequestOption {
return requestconfig.WithDefaultBaseURL("https://api.sfcompute.com/")
}
-// WithBearerToken returns a RequestOption that sets the client setting "bearer_token".
-func WithBearerToken(value string) RequestOption {
+// WithAPIKey returns a RequestOption that sets the client setting "api_key".
+func WithAPIKey(value string) RequestOption {
return requestconfig.RequestOptionFunc(func(r *requestconfig.RequestConfig) error {
- r.BearerToken = value
- return r.Apply(WithHeader("authorization", fmt.Sprintf("Bearer %s", r.BearerToken)))
+ r.APIKey = value
+ return r.Apply(WithHeader("authorization", fmt.Sprintf("Bearer %s", r.APIKey)))
})
}
diff --git a/usage_test.go b/usage_test.go
index c9cd49c..8f5122a 100644
--- a/usage_test.go
+++ b/usage_test.go
@@ -22,7 +22,7 @@ func TestUsage(t *testing.T) {
}
client := sfcnodes.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
+ option.WithAPIKey("My API Key"),
)
nodes, err := client.Nodes.List(context.TODO())
if err != nil {
diff --git a/vm.go b/vm.go
index e3d9f0c..f5c8ce4 100644
--- a/vm.go
+++ b/vm.go
@@ -36,13 +36,6 @@ func NewVmService(opts ...option.RequestOption) (r VmService) {
return
}
-func (r *VmService) List(ctx context.Context, opts ...option.RequestOption) (res *VmListResponse, err error) {
- opts = append(r.Options[:], opts...)
- path := "v0/vms/instances"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
- return
-}
-
func (r *VmService) Logs(ctx context.Context, query VmLogsParams, opts ...option.RequestOption) (res *VmLogsResponse, err error) {
opts = append(r.Options[:], opts...)
path := "v0/vms/logs2"
@@ -50,13 +43,6 @@ func (r *VmService) Logs(ctx context.Context, query VmLogsParams, opts ...option
return
}
-func (r *VmService) Replace(ctx context.Context, body VmReplaceParams, opts ...option.RequestOption) (res *VmReplaceResponse, err error) {
- opts = append(r.Options[:], opts...)
- path := "v0/vms/replace"
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
- return
-}
-
func (r *VmService) SSH(ctx context.Context, query VmSSHParams, opts ...option.RequestOption) (res *VmSSHResponse, err error) {
opts = append(r.Options[:], opts...)
path := "v0/vms/ssh"
@@ -64,46 +50,6 @@ func (r *VmService) SSH(ctx context.Context, query VmSSHParams, opts ...option.R
return
}
-type VmListResponse struct {
- Data []VmListResponseData `json:"data,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Data respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r VmListResponse) RawJSON() string { return r.JSON.raw }
-func (r *VmListResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
-type VmListResponseData struct {
- ID string `json:"id,required"`
- ClusterID string `json:"cluster_id,required"`
- CurrentStatus string `json:"current_status,required"`
- InstanceGroupID string `json:"instance_group_id,required"`
- LastUpdatedAt string `json:"last_updated_at,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- ID respjson.Field
- ClusterID respjson.Field
- CurrentStatus respjson.Field
- InstanceGroupID respjson.Field
- LastUpdatedAt respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r VmListResponseData) RawJSON() string { return r.JSON.raw }
-func (r *VmListResponseData) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
type VmLogsResponse struct {
Data []VmLogsResponseData `json:"data,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
@@ -147,24 +93,6 @@ func (r *VmLogsResponseData) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type VmReplaceResponse struct {
- Replaced string `json:"replaced,required"`
- ReplacedBy string `json:"replaced_by,required"`
- // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
- JSON struct {
- Replaced respjson.Field
- ReplacedBy respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
- } `json:"-"`
-}
-
-// Returns the unmodified JSON received from the API
-func (r VmReplaceResponse) RawJSON() string { return r.JSON.raw }
-func (r *VmReplaceResponse) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
type VmSSHResponse struct {
SSHHostname string `json:"ssh_hostname,required"`
SSHPort int64 `json:"ssh_port,required"`
@@ -230,19 +158,6 @@ const (
VmLogsParamsOrderBySeqnumDesc VmLogsParamsOrderBy = "seqnum_desc"
)
-type VmReplaceParams struct {
- VmID string `json:"vm_id,required"`
- paramObj
-}
-
-func (r VmReplaceParams) MarshalJSON() (data []byte, err error) {
- type shadow VmReplaceParams
- return param.MarshalObject(r, (*shadow)(&r))
-}
-func (r *VmReplaceParams) UnmarshalJSON(data []byte) error {
- return apijson.UnmarshalRoot(data, r)
-}
-
type VmSSHParams struct {
VmID string `query:"vm_id,required" json:"-"`
paramObj
diff --git a/vm_test.go b/vm_test.go
index d82085d..2447ca7 100644
--- a/vm_test.go
+++ b/vm_test.go
@@ -13,29 +13,6 @@ import (
"github.com/sfcompute/nodes-go/option"
)
-func TestVmList(t *testing.T) {
- t.Skip("skipped: tests are disabled for the time being")
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := sfcnodes.NewClient(
- option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
- )
- _, err := client.Vms.List(context.TODO())
- if err != nil {
- var apierr *sfcnodes.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
-
func TestVmLogsWithOptionalParams(t *testing.T) {
t.Skip("skipped: tests are disabled for the time being")
baseURL := "http://localhost:4010"
@@ -47,7 +24,7 @@ func TestVmLogsWithOptionalParams(t *testing.T) {
}
client := sfcnodes.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
+ option.WithAPIKey("My API Key"),
)
_, err := client.Vms.Logs(context.TODO(), sfcnodes.VmLogsParams{
InstanceID: "instance_id",
@@ -67,31 +44,6 @@ func TestVmLogsWithOptionalParams(t *testing.T) {
}
}
-func TestVmReplace(t *testing.T) {
- t.Skip("skipped: tests are disabled for the time being")
- baseURL := "http://localhost:4010"
- if envURL, ok := os.LookupEnv("TEST_API_BASE_URL"); ok {
- baseURL = envURL
- }
- if !testutil.CheckTestServer(t, baseURL) {
- return
- }
- client := sfcnodes.NewClient(
- option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
- )
- _, err := client.Vms.Replace(context.TODO(), sfcnodes.VmReplaceParams{
- VmID: "vm_id",
- })
- if err != nil {
- var apierr *sfcnodes.Error
- if errors.As(err, &apierr) {
- t.Log(string(apierr.DumpRequest(true)))
- }
- t.Fatalf("err should be nil: %s", err.Error())
- }
-}
-
func TestVmSSH(t *testing.T) {
t.Skip("skipped: tests are disabled for the time being")
baseURL := "http://localhost:4010"
@@ -103,7 +55,7 @@ func TestVmSSH(t *testing.T) {
}
client := sfcnodes.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
+ option.WithAPIKey("My API Key"),
)
_, err := client.Vms.SSH(context.TODO(), sfcnodes.VmSSHParams{
VmID: "vm_id",
diff --git a/vmscript_test.go b/vmscript_test.go
index a72b883..83373b2 100644
--- a/vmscript_test.go
+++ b/vmscript_test.go
@@ -24,7 +24,7 @@ func TestVmScriptNew(t *testing.T) {
}
client := sfcnodes.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
+ option.WithAPIKey("My API Key"),
)
_, err := client.Vms.Script.New(context.TODO(), sfcnodes.VmScriptNewParams{
Script: sfcnodes.UserDataUnionParam{
@@ -51,7 +51,7 @@ func TestVmScriptGet(t *testing.T) {
}
client := sfcnodes.NewClient(
option.WithBaseURL(baseURL),
- option.WithBearerToken("My Bearer Token"),
+ option.WithAPIKey("My API Key"),
)
_, err := client.Vms.Script.Get(context.TODO())
if err != nil {
From 59732a1b52f5adf2d65e59f781528be6d0f797f0 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 22 Jul 2025 04:38:57 +0000
Subject: [PATCH 07/13] fix(client): process custom base url ahead of time
---
option/requestoption.go | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/option/requestoption.go b/option/requestoption.go
index ac2dcf9..cc3a7b1 100644
--- a/option/requestoption.go
+++ b/option/requestoption.go
@@ -27,14 +27,15 @@ type RequestOption = requestconfig.RequestOption
// For security reasons, ensure that the base URL is trusted.
func WithBaseURL(base string) RequestOption {
u, err := url.Parse(base)
+ if err == nil && u.Path != "" && !strings.HasSuffix(u.Path, "/") {
+ u.Path += "/"
+ }
+
return requestconfig.RequestOptionFunc(func(r *requestconfig.RequestConfig) error {
if err != nil {
- return fmt.Errorf("requestoption: WithBaseURL failed to parse url %s\n", err)
+ return fmt.Errorf("requestoption: WithBaseURL failed to parse url %s", err)
}
- if u.Path != "" && !strings.HasSuffix(u.Path, "/") {
- u.Path += "/"
- }
r.BaseURL = u
return nil
})
From fec30f08a19dc84278c73cca1b4f4a1277e3b724 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 22 Jul 2025 04:39:10 +0000
Subject: [PATCH 08/13] codegen metadata
---
.stats.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.stats.yml b/.stats.yml
index 420b13b..53833b1 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 8
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/the-san-francisco-compute-company%2Fsfc-nodes-b800806859333bacc88fa4236eae35c8cdbec62970b7fb9ad440a330f24a1622.yml
openapi_spec_hash: fa672b6ca8953a8059961a7559a607a9
-config_hash: e089259785c0c81187a2b25ae04b8459
+config_hash: 7e937b892b1b5d7bd0e9cb9023e90cca
From 12e255e98656f76cdfcde49976a3ee33eff7a799 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 22 Jul 2025 05:20:44 +0000
Subject: [PATCH 09/13] codegen metadata
---
.stats.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.stats.yml b/.stats.yml
index 53833b1..adb8762 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 8
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/the-san-francisco-compute-company%2Fsfc-nodes-b800806859333bacc88fa4236eae35c8cdbec62970b7fb9ad440a330f24a1622.yml
openapi_spec_hash: fa672b6ca8953a8059961a7559a607a9
-config_hash: 7e937b892b1b5d7bd0e9cb9023e90cca
+config_hash: e310f0f1f4275f17d4a3872005f33a90
From d8fdc35e3b33c1a5a4b6c25569684c20c40b32b4 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 22 Jul 2025 06:13:59 +0000
Subject: [PATCH 10/13] codegen metadata
---
.stats.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.stats.yml b/.stats.yml
index adb8762..4497bf2 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 8
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/the-san-francisco-compute-company%2Fsfc-nodes-b800806859333bacc88fa4236eae35c8cdbec62970b7fb9ad440a330f24a1622.yml
openapi_spec_hash: fa672b6ca8953a8059961a7559a607a9
-config_hash: e310f0f1f4275f17d4a3872005f33a90
+config_hash: eef7f1ef61a018bf17b996862a8c0e01
From 834cc67601b75f3312c1c7b039f60540b145d6b8 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 22 Jul 2025 20:54:22 +0000
Subject: [PATCH 11/13] feat(api): api update
---
.stats.yml | 4 ++--
node.go | 22 ++++++++--------------
2 files changed, 10 insertions(+), 16 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index 4497bf2..92f925a 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 8
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/the-san-francisco-compute-company%2Fsfc-nodes-b800806859333bacc88fa4236eae35c8cdbec62970b7fb9ad440a330f24a1622.yml
-openapi_spec_hash: fa672b6ca8953a8059961a7559a607a9
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/the-san-francisco-compute-company%2Fsfc-nodes-73c29dd8765024819248125163d7c3e2d7dcdae819088fd7b1c3f0db5b3b89c0.yml
+openapi_spec_hash: 9a1923a47f368e9262d54060fe7f2a80
config_hash: eef7f1ef61a018bf17b996862a8c0e01
diff --git a/node.go b/node.go
index 70ae784..1d719b5 100644
--- a/node.go
+++ b/node.go
@@ -81,11 +81,9 @@ type Node struct {
// Any of "H100", "H200".
GPUType NodeGPUType `json:"gpu_type,required"`
Name string `json:"name,required"`
- Node string `json:"node,required"`
- // Any of "OnDemand", "Reserved".
+ // Any of "on_demand", "reserved".
NodeType NodeType `json:"node_type,required"`
Owner string `json:"owner,required"`
- StartAt int64 `json:"start_at,required"`
// Any of "Pending", "Running", "Terminated", "Failed", "Unknown".
Status NodeStatus `json:"status,required"`
CreatedAt int64 `json:"created_at,nullable"`
@@ -94,28 +92,26 @@ type Node struct {
ProcurementID string `json:"procurement_id,nullable"`
// Any of "Uninitialized", "Active", "Ended", "AwaitingCapacity".
ProcurementStatus NodeProcurementStatus `json:"procurement_status,nullable"`
+ StartAt int64 `json:"start_at,nullable"`
UpdatedAt int64 `json:"updated_at,nullable"`
// Possible zones to choose from when creating a node.
//
- // TODO (ENG-1976): Support dynamic zones through an endpoint.
- //
- // Any of "HayesValley".
+ // Any of "hayesvalley".
Zone NodeZone `json:"zone,nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
GPUType respjson.Field
Name respjson.Field
- Node respjson.Field
NodeType respjson.Field
Owner respjson.Field
- StartAt respjson.Field
Status respjson.Field
CreatedAt respjson.Field
EndAt respjson.Field
MaxPricePerHour respjson.Field
ProcurementID respjson.Field
ProcurementStatus respjson.Field
+ StartAt respjson.Field
UpdatedAt respjson.Field
Zone respjson.Field
ExtraFields map[string]respjson.Field
@@ -156,19 +152,17 @@ const (
)
// Possible zones to choose from when creating a node.
-//
-// TODO (ENG-1976): Support dynamic zones through an endpoint.
type NodeZone string
const (
- NodeZoneHayesValley NodeZone = "HayesValley"
+ NodeZoneHayesvalley NodeZone = "hayesvalley"
)
type NodeType string
const (
- NodeTypeOnDemand NodeType = "OnDemand"
- NodeTypeReserved NodeType = "Reserved"
+ NodeTypeOnDemand NodeType = "on_demand"
+ NodeTypeReserved NodeType = "reserved"
)
type UpdateNode struct {
@@ -198,7 +192,7 @@ type NodeNewParams struct {
// Custom node names. Names cannot follow the vm*id pattern vm*{16_hex_chars} as
// this is reserved for system-generated IDs.
Names []string `json:"names,omitzero"`
- // Any of "OnDemand", "Reserved".
+ // Any of "on_demand", "reserved".
NodeType NodeType `json:"node_type,omitzero"`
paramObj
}
From f419ced0cd6952e529b1bcc031f37d2db0bad646 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 25 Jul 2025 03:09:22 +0000
Subject: [PATCH 12/13] feat(api): api update
---
.stats.yml | 4 +-
README.md | 2 +-
api.md | 11 +-
node.go | 275 +++++++++++++++++++++++++++++++++++++-------------
node_test.go | 26 ++---
usage_test.go | 2 +-
6 files changed, 226 insertions(+), 94 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index 92f925a..274a7d9 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 8
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/the-san-francisco-compute-company%2Fsfc-nodes-73c29dd8765024819248125163d7c3e2d7dcdae819088fd7b1c3f0db5b3b89c0.yml
-openapi_spec_hash: 9a1923a47f368e9262d54060fe7f2a80
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/the-san-francisco-compute-company%2Fsfc-nodes-d41b5a590956acc71242ed938a212ee64655756fbd4c2af91db937f97f4fd4f5.yml
+openapi_spec_hash: 19777fc4ebc8a243cf8ce3a9ad0e1da4
config_hash: eef7f1ef61a018bf17b996862a8c0e01
diff --git a/README.md b/README.md
index ce85fc3..2012a5d 100644
--- a/README.md
+++ b/README.md
@@ -56,7 +56,7 @@ func main() {
if err != nil {
panic(err.Error())
}
- fmt.Printf("%+v\n", nodes)
+ fmt.Printf("%+v\n", nodes.Data)
}
```
diff --git a/api.md b/api.md
index 898faee..590644a 100644
--- a/api.md
+++ b/api.md
@@ -37,11 +37,12 @@ Response Types:
- sfcnodes.Node
- sfcnodes.NodeType
-- sfcnodes.UpdateNode
+- sfcnodes.NodeNewResponse
+- sfcnodes.NodeListResponse
Methods:
-- client.Nodes.New(ctx context.Context, body sfcnodes.NodeNewParams) ([]sfcnodes.Node, error)
-- client.Nodes.List(ctx context.Context) ([]sfcnodes.Node, error)
-- client.Nodes.Extend(ctx context.Context, id string, body sfcnodes.NodeExtendParams) (sfcnodes.UpdateNode, error)
-- client.Nodes.Release(ctx context.Context, id string, body sfcnodes.NodeReleaseParams) (sfcnodes.UpdateNode, error)
+- client.Nodes.New(ctx context.Context, body sfcnodes.NodeNewParams) (sfcnodes.NodeNewResponse, error)
+- client.Nodes.List(ctx context.Context) (sfcnodes.NodeListResponse, error)
+- client.Nodes.Extend(ctx context.Context, id string, body sfcnodes.NodeExtendParams) (sfcnodes.Node, error)
+- client.Nodes.Release(ctx context.Context, id string) (sfcnodes.Node, error)
diff --git a/node.go b/node.go
index 1d719b5..8f45fef 100644
--- a/node.go
+++ b/node.go
@@ -4,7 +4,6 @@ package sfcnodes
import (
"context"
- "encoding/json"
"errors"
"fmt"
"net/http"
@@ -36,7 +35,7 @@ func NewNodeService(opts ...option.RequestOption) (r NodeService) {
}
// Create VM nodes
-func (r *NodeService) New(ctx context.Context, body NodeNewParams, opts ...option.RequestOption) (res *[]Node, err error) {
+func (r *NodeService) New(ctx context.Context, body NodeNewParams, opts ...option.RequestOption) (res *NodeNewResponse, err error) {
opts = append(r.Options[:], opts...)
path := "v1/nodes"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
@@ -44,15 +43,15 @@ func (r *NodeService) New(ctx context.Context, body NodeNewParams, opts ...optio
}
// List all VM nodes for the authenticated account
-func (r *NodeService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Node, err error) {
+func (r *NodeService) List(ctx context.Context, opts ...option.RequestOption) (res *NodeListResponse, err error) {
opts = append(r.Options[:], opts...)
path := "v1/nodes"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return
}
-// Extend the end time of a reservation-based VM node by purchasing additional time
-func (r *NodeService) Extend(ctx context.Context, id string, body NodeExtendParams, opts ...option.RequestOption) (res *UpdateNode, err error) {
+// Purchase additional time to extend the end time of a reserved VM node
+func (r *NodeService) Extend(ctx context.Context, id string, body NodeExtendParams, opts ...option.RequestOption) (res *Node, err error) {
opts = append(r.Options[:], opts...)
if id == "" {
err = errors.New("missing required id parameter")
@@ -65,14 +64,14 @@ func (r *NodeService) Extend(ctx context.Context, id string, body NodeExtendPara
// Release an on-demand VM node from its procurement, reducing the procurement's
// desired quantity by 1
-func (r *NodeService) Release(ctx context.Context, id string, body NodeReleaseParams, opts ...option.RequestOption) (res *UpdateNode, err error) {
+func (r *NodeService) Release(ctx context.Context, id string, opts ...option.RequestOption) (res *Node, err error) {
opts = append(r.Options[:], opts...)
if id == "" {
err = errors.New("missing required id parameter")
return
}
path := fmt.Sprintf("v1/nodes/%s/release", id)
- err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, body, &res, opts...)
+ err = requestconfig.ExecuteNewRequest(ctx, http.MethodPatch, path, nil, &res, opts...)
return
}
@@ -83,39 +82,48 @@ type Node struct {
Name string `json:"name,required"`
// Any of "on_demand", "reserved".
NodeType NodeType `json:"node_type,required"`
+ Object string `json:"object,required"`
Owner string `json:"owner,required"`
- // Any of "Pending", "Running", "Terminated", "Failed", "Unknown".
- Status NodeStatus `json:"status,required"`
- CreatedAt int64 `json:"created_at,nullable"`
- EndAt int64 `json:"end_at,nullable"`
- MaxPricePerHour int64 `json:"max_price_per_hour,nullable"`
- ProcurementID string `json:"procurement_id,nullable"`
- // Any of "Uninitialized", "Active", "Ended", "AwaitingCapacity".
+ // Node Status
+ //
+ // Any of "pending", "running", "terminated", "failed", "unknown".
+ Status NodeStatus `json:"status,required"`
+ // Creation time as Unix timestamp in seconds
+ CreatedAt int64 `json:"created_at,nullable"`
+ // End time as Unix timestamp in seconds
+ EndAt int64 `json:"end_at,nullable"`
+ // Max price per hour you're willing to pay for a node in cents
+ MaxPricePerNodeHour int64 `json:"max_price_per_node_hour,nullable"`
+ ProcurementID string `json:"procurement_id,nullable"`
+ // Any of "uninitialized", "active", "ended", "awaiting_capacity".
ProcurementStatus NodeProcurementStatus `json:"procurement_status,nullable"`
- StartAt int64 `json:"start_at,nullable"`
- UpdatedAt int64 `json:"updated_at,nullable"`
- // Possible zones to choose from when creating a node.
+ // Start time as Unix timestamp in seconds
+ StartAt int64 `json:"start_at,nullable"`
+ // Last updated time as Unix timestamp in seconds
+ UpdatedAt int64 `json:"updated_at,nullable"`
+ // Choose from these zones when creating a node
//
// Any of "hayesvalley".
Zone NodeZone `json:"zone,nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- ID respjson.Field
- GPUType respjson.Field
- Name respjson.Field
- NodeType respjson.Field
- Owner respjson.Field
- Status respjson.Field
- CreatedAt respjson.Field
- EndAt respjson.Field
- MaxPricePerHour respjson.Field
- ProcurementID respjson.Field
- ProcurementStatus respjson.Field
- StartAt respjson.Field
- UpdatedAt respjson.Field
- Zone respjson.Field
- ExtraFields map[string]respjson.Field
- raw string
+ ID respjson.Field
+ GPUType respjson.Field
+ Name respjson.Field
+ NodeType respjson.Field
+ Object respjson.Field
+ Owner respjson.Field
+ Status respjson.Field
+ CreatedAt respjson.Field
+ EndAt respjson.Field
+ MaxPricePerNodeHour respjson.Field
+ ProcurementID respjson.Field
+ ProcurementStatus respjson.Field
+ StartAt respjson.Field
+ UpdatedAt respjson.Field
+ Zone respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
} `json:"-"`
}
@@ -132,26 +140,27 @@ const (
NodeGPUTypeH200 NodeGPUType = "H200"
)
+// Node Status
type NodeStatus string
const (
- NodeStatusPending NodeStatus = "Pending"
- NodeStatusRunning NodeStatus = "Running"
- NodeStatusTerminated NodeStatus = "Terminated"
- NodeStatusFailed NodeStatus = "Failed"
- NodeStatusUnknown NodeStatus = "Unknown"
+ NodeStatusPending NodeStatus = "pending"
+ NodeStatusRunning NodeStatus = "running"
+ NodeStatusTerminated NodeStatus = "terminated"
+ NodeStatusFailed NodeStatus = "failed"
+ NodeStatusUnknown NodeStatus = "unknown"
)
type NodeProcurementStatus string
const (
- NodeProcurementStatusUninitialized NodeProcurementStatus = "Uninitialized"
- NodeProcurementStatusActive NodeProcurementStatus = "Active"
- NodeProcurementStatusEnded NodeProcurementStatus = "Ended"
- NodeProcurementStatusAwaitingCapacity NodeProcurementStatus = "AwaitingCapacity"
+ NodeProcurementStatusUninitialized NodeProcurementStatus = "uninitialized"
+ NodeProcurementStatusActive NodeProcurementStatus = "active"
+ NodeProcurementStatusEnded NodeProcurementStatus = "ended"
+ NodeProcurementStatusAwaitingCapacity NodeProcurementStatus = "awaiting_capacity"
)
-// Possible zones to choose from when creating a node.
+// Choose from these zones when creating a node
type NodeZone string
const (
@@ -165,32 +174,171 @@ const (
NodeTypeReserved NodeType = "reserved"
)
-type UpdateNode struct {
- Node Node `json:"node,required"`
+type NodeNewResponse struct {
+ Data []NodeNewResponseData `json:"data,required"`
+ Object string `json:"object,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
- Node respjson.Field
+ Data respjson.Field
+ Object respjson.Field
ExtraFields map[string]respjson.Field
raw string
} `json:"-"`
}
// Returns the unmodified JSON received from the API
-func (r UpdateNode) RawJSON() string { return r.JSON.raw }
-func (r *UpdateNode) UnmarshalJSON(data []byte) error {
+func (r NodeNewResponse) RawJSON() string { return r.JSON.raw }
+func (r *NodeNewResponse) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-type NodeNewParams struct {
- DesiredCount int64 `json:"desired_count,required"`
- MaxPricePerHour int64 `json:"max_price_per_hour,required"`
+type NodeNewResponseData struct {
+ ID string `json:"id,required"`
+ // Any of "H100", "H200".
+ GPUType string `json:"gpu_type,required"`
+ Name string `json:"name,required"`
+ // Any of "on_demand", "reserved".
+ NodeType NodeType `json:"node_type,required"`
+ Object string `json:"object,required"`
+ Owner string `json:"owner,required"`
+ // Node Status
+ //
+ // Any of "pending", "running", "terminated", "failed", "unknown".
+ Status string `json:"status,required"`
+ // Creation time as Unix timestamp in seconds
+ CreatedAt int64 `json:"created_at,nullable"`
+ // End time as Unix timestamp in seconds
+ EndAt int64 `json:"end_at,nullable"`
+ // Max price per hour you're willing to pay for a node in cents
+ MaxPricePerNodeHour int64 `json:"max_price_per_node_hour,nullable"`
+ ProcurementID string `json:"procurement_id,nullable"`
+ // Any of "uninitialized", "active", "ended", "awaiting_capacity".
+ ProcurementStatus string `json:"procurement_status,nullable"`
+ // Start time as Unix timestamp in seconds
+ StartAt int64 `json:"start_at,nullable"`
+ // Last updated time as Unix timestamp in seconds
+ UpdatedAt int64 `json:"updated_at,nullable"`
+ // Choose from these zones when creating a node
+ //
+ // Any of "hayesvalley".
+ Zone string `json:"zone,nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ GPUType respjson.Field
+ Name respjson.Field
+ NodeType respjson.Field
+ Object respjson.Field
+ Owner respjson.Field
+ Status respjson.Field
+ CreatedAt respjson.Field
+ EndAt respjson.Field
+ MaxPricePerNodeHour respjson.Field
+ ProcurementID respjson.Field
+ ProcurementStatus respjson.Field
+ StartAt respjson.Field
+ UpdatedAt respjson.Field
+ Zone respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r NodeNewResponseData) RawJSON() string { return r.JSON.raw }
+func (r *NodeNewResponseData) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type NodeListResponse struct {
+ Data []NodeListResponseData `json:"data,required"`
+ Object string `json:"object,required"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ Data respjson.Field
+ Object respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r NodeListResponse) RawJSON() string { return r.JSON.raw }
+func (r *NodeListResponse) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type NodeListResponseData struct {
+ ID string `json:"id,required"`
+ // Any of "H100", "H200".
+ GPUType string `json:"gpu_type,required"`
+ Name string `json:"name,required"`
+ // Any of "on_demand", "reserved".
+ NodeType NodeType `json:"node_type,required"`
+ Object string `json:"object,required"`
+ Owner string `json:"owner,required"`
+ // Node Status
+ //
+ // Any of "pending", "running", "terminated", "failed", "unknown".
+ Status string `json:"status,required"`
+ // Creation time as Unix timestamp in seconds
+ CreatedAt int64 `json:"created_at,nullable"`
// End time as Unix timestamp in seconds
+ EndAt int64 `json:"end_at,nullable"`
+ // Max price per hour you're willing to pay for a node in cents
+ MaxPricePerNodeHour int64 `json:"max_price_per_node_hour,nullable"`
+ ProcurementID string `json:"procurement_id,nullable"`
+ // Any of "uninitialized", "active", "ended", "awaiting_capacity".
+ ProcurementStatus string `json:"procurement_status,nullable"`
+ // Start time as Unix timestamp in seconds
+ StartAt int64 `json:"start_at,nullable"`
+ // Last updated time as Unix timestamp in seconds
+ UpdatedAt int64 `json:"updated_at,nullable"`
+ // Choose from these zones when creating a node
+ //
+ // Any of "hayesvalley".
+ Zone string `json:"zone,nullable"`
+ // JSON contains metadata for fields, check presence with [respjson.Field.Valid].
+ JSON struct {
+ ID respjson.Field
+ GPUType respjson.Field
+ Name respjson.Field
+ NodeType respjson.Field
+ Object respjson.Field
+ Owner respjson.Field
+ Status respjson.Field
+ CreatedAt respjson.Field
+ EndAt respjson.Field
+ MaxPricePerNodeHour respjson.Field
+ ProcurementID respjson.Field
+ ProcurementStatus respjson.Field
+ StartAt respjson.Field
+ UpdatedAt respjson.Field
+ Zone respjson.Field
+ ExtraFields map[string]respjson.Field
+ raw string
+ } `json:"-"`
+}
+
+// Returns the unmodified JSON received from the API
+func (r NodeListResponseData) RawJSON() string { return r.JSON.raw }
+func (r *NodeListResponseData) UnmarshalJSON(data []byte) error {
+ return apijson.UnmarshalRoot(data, r)
+}
+
+type NodeNewParams struct {
+ DesiredCount int64 `json:"desired_count,required"`
+ // Max price per hour for a node in cents
+ MaxPricePerNodeHour int64 `json:"max_price_per_node_hour,required"`
+ // Zone to create the nodes in. See Zone enum for valid values.
+ Zone string `json:"zone,required"`
+ // End time as Unix timestamp in seconds. If provided, end time must be aligned to
+ // the hour. If not provided, the node will be created as an on-demand node.
EndAt param.Opt[int64] `json:"end_at,omitzero"`
// Start time as Unix timestamp in seconds
- StartAt param.Opt[int64] `json:"start_at,omitzero"`
- Zone param.Opt[string] `json:"zone,omitzero"`
- // Custom node names. Names cannot follow the vm*id pattern vm*{16_hex_chars} as
- // this is reserved for system-generated IDs.
+ StartAt param.Opt[int64] `json:"start_at,omitzero"`
+ // Custom node names. Names cannot follow the vm\_{alpha_numeric_chars} as this is
+ // reserved for system-generated IDs. Names cannot be numeric strings.
Names []string `json:"names,omitzero"`
// Any of "on_demand", "reserved".
NodeType NodeType `json:"node_type,omitzero"`
@@ -206,10 +354,11 @@ func (r *NodeNewParams) UnmarshalJSON(data []byte) error {
}
type NodeExtendParams struct {
- // Duration in seconds to extend the node by
+ // Duration in seconds to extend the node Must be at least 1 hour (3600 seconds)
+ // and a multiple of 1 hour.
DurationSeconds int64 `json:"duration_seconds,required"`
// Max price per hour for the extension in cents
- MaxPricePerHour int64 `json:"max_price_per_hour,required"`
+ MaxPricePerNodeHour int64 `json:"max_price_per_node_hour,required"`
paramObj
}
@@ -220,15 +369,3 @@ func (r NodeExtendParams) MarshalJSON() (data []byte, err error) {
func (r *NodeExtendParams) UnmarshalJSON(data []byte) error {
return apijson.UnmarshalRoot(data, r)
}
-
-type NodeReleaseParams struct {
- Body any
- paramObj
-}
-
-func (r NodeReleaseParams) MarshalJSON() (data []byte, err error) {
- return json.Marshal(r.Body)
-}
-func (r *NodeReleaseParams) UnmarshalJSON(data []byte) error {
- return json.Unmarshal(data, &r.Body)
-}
diff --git a/node_test.go b/node_test.go
index d2794ae..50e142d 100644
--- a/node_test.go
+++ b/node_test.go
@@ -27,13 +27,13 @@ func TestNodeNewWithOptionalParams(t *testing.T) {
option.WithAPIKey("My API Key"),
)
_, err := client.Nodes.New(context.TODO(), sfcnodes.NodeNewParams{
- DesiredCount: 1,
- MaxPricePerHour: 1000,
- EndAt: sfcnodes.Int(1640995200),
- Names: []string{"string"},
- NodeType: sfcnodes.NodeTypeOnDemand,
- StartAt: sfcnodes.Int(1640995200),
- Zone: sfcnodes.String("zone"),
+ DesiredCount: 1,
+ MaxPricePerNodeHour: 1000,
+ Zone: "hayesvalley",
+ EndAt: sfcnodes.Int(0),
+ Names: []string{"cuda-crunch"},
+ NodeType: sfcnodes.NodeTypeOnDemand,
+ StartAt: sfcnodes.Int(1640995200),
})
if err != nil {
var apierr *sfcnodes.Error
@@ -84,8 +84,8 @@ func TestNodeExtend(t *testing.T) {
context.TODO(),
"id",
sfcnodes.NodeExtendParams{
- DurationSeconds: 7200,
- MaxPricePerHour: 1000,
+ DurationSeconds: 7200,
+ MaxPricePerNodeHour: 1000,
},
)
if err != nil {
@@ -110,13 +110,7 @@ func TestNodeRelease(t *testing.T) {
option.WithBaseURL(baseURL),
option.WithAPIKey("My API Key"),
)
- _, err := client.Nodes.Release(
- context.TODO(),
- "id",
- sfcnodes.NodeReleaseParams{
- Body: map[string]interface{}{},
- },
- )
+ _, err := client.Nodes.Release(context.TODO(), "id")
if err != nil {
var apierr *sfcnodes.Error
if errors.As(err, &apierr) {
diff --git a/usage_test.go b/usage_test.go
index 8f5122a..050bf6d 100644
--- a/usage_test.go
+++ b/usage_test.go
@@ -28,5 +28,5 @@ func TestUsage(t *testing.T) {
if err != nil {
t.Fatalf("err should be nil: %s", err.Error())
}
- t.Logf("%+v\n", nodes)
+ t.Logf("%+v\n", nodes.Data)
}
From ea791d6315eeb2afd228ab3c8ee1a6d1bc0546be Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 25 Jul 2025 03:09:36 +0000
Subject: [PATCH 13/13] release: 0.1.0-alpha.1
---
.release-please-manifest.json | 2 +-
CHANGELOG.md | 23 +++++++++++++++++++++++
README.md | 2 +-
internal/version.go | 2 +-
4 files changed, 26 insertions(+), 3 deletions(-)
create mode 100644 CHANGELOG.md
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index c476280..ba6c348 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.0.1-alpha.0"
+ ".": "0.1.0-alpha.1"
}
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..88e5ec1
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,23 @@
+# Changelog
+
+## 0.1.0-alpha.1 (2025-07-25)
+
+Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/sfcompute/nodes-go/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
+
+### Features
+
+* **api:** api update ([f419ced](https://github.com/sfcompute/nodes-go/commit/f419ced0cd6952e529b1bcc031f37d2db0bad646))
+* **api:** api update ([834cc67](https://github.com/sfcompute/nodes-go/commit/834cc67601b75f3312c1c7b039f60540b145d6b8))
+* **api:** update via SDK Studio ([5a3ea36](https://github.com/sfcompute/nodes-go/commit/5a3ea36fb89e3c4cfcbe3b612644f98a5ae33e31))
+
+
+### Bug Fixes
+
+* **client:** process custom base url ahead of time ([59732a1](https://github.com/sfcompute/nodes-go/commit/59732a1b52f5adf2d65e59f781528be6d0f797f0))
+
+
+### Chores
+
+* configure new SDK language ([6e68d64](https://github.com/sfcompute/nodes-go/commit/6e68d64dc949d10023baf84985a7aa35be588a0e))
+* lint tests in subpackages ([4ec488f](https://github.com/sfcompute/nodes-go/commit/4ec488f47f3be8686f911403dc5f28159e0fa055))
+* update SDK settings ([ffa4444](https://github.com/sfcompute/nodes-go/commit/ffa4444199a4a95811ff66907dc56d71c356f921))
diff --git a/README.md b/README.md
index 2012a5d..022c43d 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,7 @@ Or to pin the version:
```sh
-go get -u 'github.com/sfcompute/nodes-go@v0.0.1-alpha.0'
+go get -u 'github.com/sfcompute/nodes-go@v0.1.0-alpha.1'
```
diff --git a/internal/version.go b/internal/version.go
index 4ff68e4..5ed22d7 100644
--- a/internal/version.go
+++ b/internal/version.go
@@ -2,4 +2,4 @@
package internal
-const PackageVersion = "0.0.1-alpha.0" // x-release-please-version
+const PackageVersion = "0.1.0-alpha.1" // x-release-please-version