sfcnodes

package module
v0.1.0-alpha.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2026 License: Apache-2.0 Imports: 18 Imported by: 1

README

SFC Nodes Go API Library

Go Reference

The SFC Nodes Go library provides convenient access to the SFC Nodes REST API from applications written in Go.

It is generated with Stainless.

Installation

import (
	"github.com/sfcompute/nodes-go" // imported as sfcnodes
)

Or to pin the version:

go get -u 'github.com/sfcompute/[email protected]'

Requirements

This library requires Go 1.22+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"

	"github.com/sfcompute/nodes-go"
	"github.com/sfcompute/nodes-go/option"
)

func main() {
	client := sfcnodes.NewClient(
		option.WithBearerToken("My Bearer Token"), // defaults to os.LookupEnv("SFC_NODES_BEARER_TOKEN")
	)
	listResponseNode, err := client.Nodes.List(context.TODO(), sfcnodes.NodeListParams{})
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", listResponseNode.Data)
}

Request fields

The sfcnodes library uses the omitzero semantics from the Go 1.24+ encoding/json release for request fields.

Required primitive fields (int64, string, etc.) feature the tag `json:"...,required"`. These fields are always serialized, even their zero values.

Optional primitive types are wrapped in a param.Opt[T]. These fields can be set with the provided constructors, sfcnodes.String(string), sfcnodes.Int(int64), etc.

Any param.Opt[T], map, slice, struct or string enum uses the tag `json:"...,omitzero"`. Its zero value is considered omitted.

The param.IsOmitted(any) function can confirm the presence of any omitzero field.

p := sfcnodes.ExampleParams{
	ID:   "id_xxx",               // required property
	Name: sfcnodes.String("..."), // optional property

	Point: sfcnodes.Point{
		X: 0,               // required field will serialize as 0
		Y: sfcnodes.Int(1), // optional field will serialize as 1
		// ... omitted non-required fields will not be serialized
	},

	Origin: sfcnodes.Origin{}, // the zero value of [Origin] is considered omitted
}

To send null instead of a param.Opt[T], use param.Null[T](). To send null instead of a struct T, use param.NullStruct[T]().

p.Name = param.Null[string]()       // 'null' instead of string
p.Point = param.NullStruct[Point]() // 'null' instead of struct

param.IsNull(p.Name)  // true
param.IsNull(p.Point) // true

Request structs contain a .SetExtraFields(map[string]any) method which can send non-conforming fields in the request body. Extra fields overwrite any struct fields with a matching key. For security reasons, only use SetExtraFields with trusted data.

To send a custom value instead of a struct, use param.Override[T](value).

// In cases where the API specifies a given type,
// but you want to send something else, use [SetExtraFields]:
p.SetExtraFields(map[string]any{
	"x": 0.01, // send "x" as a float instead of int
})

// Send a number instead of an object
custom := param.Override[sfcnodes.FooParams](12)
Request unions

Unions are represented as a struct with fields prefixed by "Of" for each of its variants, only one field can be non-zero. The non-zero field will be serialized.

Sub-properties of the union can be accessed via methods on the union struct. These methods return a mutable pointer to the underlying data, if present.

// Only one field can be non-zero, use param.IsOmitted() to check if a field is set
type AnimalUnionParam struct {
	OfCat *Cat `json:",omitzero,inline`
	OfDog *Dog `json:",omitzero,inline`
}

animal := AnimalUnionParam{
	OfCat: &Cat{
		Name: "Whiskers",
		Owner: PersonParam{
			Address: AddressParam{Street: "3333 Coyote Hill Rd", Zip: 0},
		},
	},
}

// Mutating a field
if address := animal.GetOwner().GetAddress(); address != nil {
	address.ZipCode = 94304
}
Response objects

All fields in response structs are ordinary value types (not pointers or wrappers). Response structs also include a special JSON field containing metadata about each property.

type Animal struct {
	Name   string `json:"name,nullable"`
	Owners int    `json:"owners"`
	Age    int    `json:"age"`
	JSON   struct {
		Name        respjson.Field
		Owner       respjson.Field
		Age         respjson.Field
		ExtraFields map[string]respjson.Field
	} `json:"-"`
}

To handle optional data, use the .Valid() method on the JSON field. .Valid() returns true if a field is not null, not present, or couldn't be marshaled.

If .Valid() is false, the corresponding field will simply be its zero value.

raw := `{"owners": 1, "name": null}`

var res Animal
json.Unmarshal([]byte(raw), &res)

// Accessing regular fields

res.Owners // 1
res.Name   // ""
res.Age    // 0

// Optional field checks

res.JSON.Owners.Valid() // true
res.JSON.Name.Valid()   // false
res.JSON.Age.Valid()    // false

// Raw JSON values

res.JSON.Owners.Raw()                  // "1"
res.JSON.Name.Raw() == "null"          // true
res.JSON.Name.Raw() == respjson.Null   // true
res.JSON.Age.Raw() == ""               // true
res.JSON.Age.Raw() == respjson.Omitted // true

These .JSON structs also include an ExtraFields map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
Response Unions

In responses, unions are represented by a flattened struct containing all possible fields from each of the object variants. To convert it to a variant use the .AsFooVariant() method or the .AsAny() method if present.

If a response value union contains primitive values, primitive fields will be alongside the properties but prefixed with Of and feature the tag json:"...,inline".

type AnimalUnion struct {
	// From variants [Dog], [Cat]
	Owner Person `json:"owner"`
	// From variant [Dog]
	DogBreed string `json:"dog_breed"`
	// From variant [Cat]
	CatBreed string `json:"cat_breed"`
	// ...

	JSON struct {
		Owner respjson.Field
		// ...
	} `json:"-"`
}

// If animal variant
if animal.Owner.Address.ZipCode == "" {
	panic("missing zip code")
}

// Switch on the variant
switch variant := animal.AsAny().(type) {
case Dog:
case Cat:
default:
	panic("unexpected type")
}
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := sfcnodes.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.Nodes.List(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

The request option option.WithDebugLog(nil) may be helpful while debugging.

See the full list of request options.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

Errors

When the API returns a non-success status code, we return an error with type *sfcnodes.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.Nodes.List(context.TODO(), sfcnodes.NodeListParams{})
if err != nil {
	var apierr *sfcnodes.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/v1/nodes": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.Nodes.List(
	ctx,
	sfcnodes.NodeListParams{},
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)
File uploads

Request parameters that correspond to file uploads in multipart requests are typed as io.Reader. The contents of the io.Reader will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing Name() string or ContentType() string on the run-time type of io.Reader. Note that os.File implements Name() string, so a file returned by os.Open will be sent with the file name on disk.

We also provide a helper sfcnodes.File(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

Retries

Certain errors will be automatically retried 0 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := sfcnodes.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.Nodes.List(
	context.TODO(),
	sfcnodes.NodeListParams{},
	option.WithMaxRetries(5),
)
Accessing raw response data (e.g. response headers)

You can access the raw HTTP response data by using the option.WithResponseInto() request option. This is useful when you need to examine response headers, status codes, or other details.

// Create a variable to store the HTTP response
var response *http.Response
listResponseNode, err := client.Nodes.List(
	context.TODO(),
	sfcnodes.NodeListParams{},
	option.WithResponseInto(&response),
)
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", listResponseNode)

fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Undocumented endpoints

To make requests to undocumented endpoints, you can use client.Get, client.Post, and other HTTP verbs. RequestOptions on the client, such as retries, will be respected when making these requests.

var (
    // params can be an io.Reader, a []byte, an encoding/json serializable object,
    // or a "…Params" struct defined in this library.
    params map[string]any

    // result can be an []byte, *http.Response, a encoding/json deserializable object,
    // or a model defined in this library.
    result *http.Response
)
err := client.Post(context.Background(), "/unspecified", params, &result)
if err != nil {
    …
}
Undocumented request params

To make requests using undocumented parameters, you may use either the option.WithQuerySet() or the option.WithJSONSet() methods.

params := FooNewParams{
    ID:   "id_xxxx",
    Data: FooNewParamsData{
        FirstName: sfcnodes.String("John"),
    },
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Undocumented response properties

To access undocumented response properties, you may either access the raw JSON of the response as a string with result.JSON.RawJSON(), or get the raw JSON of a particular field on the result with result.JSON.Foo.Raw().

Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields() which returns the extra fields as a map[string]Field.

Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := sfcnodes.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals.)
  2. Changes that we do not expect to impact the vast majority of users in practice.

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 with questions, bugs, or suggestions.

Contributing

See the contributing documentation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) param.Opt[bool]

func BoolPtr

func BoolPtr(v bool) *bool

func DefaultClientOptions

func DefaultClientOptions() []option.RequestOption

DefaultClientOptions read from the environment (SFC_NODES_BEARER_TOKEN, SFC_NODES_BASE_URL). This should be used to initialize new clients.

func File

func File(rdr io.Reader, filename string, contentType string) file

func Float

func Float(f float64) param.Opt[float64]

func FloatPtr

func FloatPtr(v float64) *float64

func Int

func Int(i int64) param.Opt[int64]

func IntPtr

func IntPtr(v int64) *int64

func Opt

func Opt[T comparable](v T) param.Opt[T]

func Ptr

func Ptr[T any](v T) *T

func String

func String(s string) param.Opt[string]

func StringPtr

func StringPtr(v string) *string

func Time

func Time(t time.Time) param.Opt[time.Time]

func TimePtr

func TimePtr(v time.Time) *time.Time

Types

type AcceleratorType

type AcceleratorType string
const (
	AcceleratorTypeH100 AcceleratorType = "H100"
	AcceleratorTypeH200 AcceleratorType = "H200"
)

type Client

type Client struct {
	Options []option.RequestOption
	VMs     VMService
	Nodes   NodeService
	Zones   ZoneService
}

Client creates a struct with services and top level methods that help with interacting with the sfc-nodes API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r Client)

NewClient generates a new client with the default option read from the environment (SFC_NODES_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.

func (*Client) Delete

func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Execute

func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error

Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.

If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.

The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.

If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.

Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.

The response body will be deserialized into the res variable, depending on its type:

  • A pointer to a *http.Response is populated by the raw response.
  • A pointer to a byte array will be populated with the contents of the request body.
  • A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
  • A nil value will not read the response body.

For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.

func (*Client) Get

func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Patch

func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Post

func (r *Client) Post(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Put

func (r *Client) Put(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

type CreateNodesRequestParam

type CreateNodesRequestParam struct {
	DesiredCount int64 `json:"desired_count" api:"required"`
	// Max price per hour for a node in cents
	MaxPricePerNodeHour int64 `json:"max_price_per_node_hour" api:"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 autoreserved node
	EndAt param.Opt[int64] `json:"end_at,omitzero"`
	// Allow auto reserved nodes to be created in any zone that meets the requirements
	AnyZone param.Opt[bool] `json:"any_zone,omitzero"`
	// User script to be executed during the VM's boot process Data should be base64
	// encoded
	CloudInitUserData param.Opt[string] `json:"cloud_init_user_data,omitzero" format:"byte"`
	// (Optional) If set, enables forwarding to the VM on port 443.
	Forward443 param.Opt[bool] `json:"forward_443,omitzero"`
	// Custom image ID to use for the VM instances
	ImageID param.Opt[string] `json:"image_id,omitzero"`
	// Start time as Unix timestamp in seconds Optional for reserved nodes. If not
	// provided, defaults to now
	StartAt param.Opt[int64] `json:"start_at,omitzero"`
	// Zone to create the nodes in. Required for auto reserved nodes if any_zone is
	// false.
	Zone param.Opt[string] `json:"zone,omitzero"`
	// Custom node names Names cannot begin with 'vm*' or 'n*' as this is reserved for
	// system-generated IDs Names cannot be numeric strings Names cannot exceed 128
	// characters
	Names []string `json:"names,omitzero"`
	// Any of "autoreserved", "reserved".
	NodeType NodeType `json:"node_type,omitzero"`
	// contains filtered or unexported fields
}

The properties DesiredCount, MaxPricePerNodeHour are required.

func (CreateNodesRequestParam) MarshalJSON

func (r CreateNodesRequestParam) MarshalJSON() (data []byte, err error)

func (*CreateNodesRequestParam) UnmarshalJSON

func (r *CreateNodesRequestParam) UnmarshalJSON(data []byte) error

type Error

type Error = apierror.Error

type ExtendNodeRequestParam

type ExtendNodeRequestParam struct {
	// 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" api:"required"`
	// Max price per hour for the extension in cents
	MaxPricePerNodeHour int64 `json:"max_price_per_node_hour" api:"required"`
	// contains filtered or unexported fields
}

The properties DurationSeconds, MaxPricePerNodeHour are required.

func (ExtendNodeRequestParam) MarshalJSON

func (r ExtendNodeRequestParam) MarshalJSON() (data []byte, err error)

func (*ExtendNodeRequestParam) UnmarshalJSON

func (r *ExtendNodeRequestParam) UnmarshalJSON(data []byte) error

type ListResponseNode

type ListResponseNode struct {
	Data   []ListResponseNodeData `json:"data" api:"required"`
	Object string                 `json:"object" api:"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
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ListResponseNode) RawJSON

func (r ListResponseNode) RawJSON() string

Returns the unmodified JSON received from the API

func (*ListResponseNode) UnmarshalJSON

func (r *ListResponseNode) UnmarshalJSON(data []byte) error

type ListResponseNodeData

type ListResponseNodeData struct {
	ID string `json:"id" api:"required"`
	// Any of "H100", "H200".
	GPUType AcceleratorType `json:"gpu_type" api:"required"`
	Name    string          `json:"name" api:"required"`
	// Any of "autoreserved", "reserved".
	NodeType NodeType `json:"node_type" api:"required"`
	Object   string   `json:"object" api:"required"`
	Owner    string   `json:"owner" api:"required"`
	// Node Status
	//
	// Any of "pending", "awaitingcapacity", "running", "released", "terminated",
	// "deleted", "failed", "unknown".
	Status Status `json:"status" api:"required"`
	// Creation time as Unix timestamp in seconds
	CreatedAt int64                         `json:"created_at" api:"nullable"`
	CurrentVM ListResponseNodeDataCurrentVM `json:"current_vm" api:"nullable"`
	// Deletion time as Unix timestamp in seconds
	DeletedAt int64 `json:"deleted_at" api:"nullable"`
	// End time as Unix timestamp in seconds
	EndAt int64 `json:"end_at" api:"nullable"`
	// Max price per hour you're willing to pay for a node in cents
	MaxPricePerNodeHour int64  `json:"max_price_per_node_hour" api:"nullable"`
	ProcurementID       string `json:"procurement_id" api:"nullable"`
	// Start time as Unix timestamp in seconds
	StartAt int64 `json:"start_at" api:"nullable"`
	// Last updated time as Unix timestamp in seconds
	UpdatedAt int64                   `json:"updated_at" api:"nullable"`
	VMs       ListResponseNodeDataVMs `json:"vms" api:"nullable"`
	Zone      string                  `json:"zone" api:"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
		CurrentVM           respjson.Field
		DeletedAt           respjson.Field
		EndAt               respjson.Field
		MaxPricePerNodeHour respjson.Field
		ProcurementID       respjson.Field
		StartAt             respjson.Field
		UpdatedAt           respjson.Field
		VMs                 respjson.Field
		Zone                respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ListResponseNodeData) RawJSON

func (r ListResponseNodeData) RawJSON() string

Returns the unmodified JSON received from the API

func (*ListResponseNodeData) UnmarshalJSON

func (r *ListResponseNodeData) UnmarshalJSON(data []byte) error

type ListResponseNodeDataCurrentVM

type ListResponseNodeDataCurrentVM struct {
	ID        string `json:"id" api:"required"`
	CreatedAt int64  `json:"created_at" api:"required"`
	EndAt     int64  `json:"end_at" api:"required"`
	Object    string `json:"object" api:"required"`
	StartAt   int64  `json:"start_at" api:"required"`
	// Any of "Pending", "Running", "Destroyed", "NodeFailure", "Unspecified".
	Status    string `json:"status" api:"required"`
	UpdatedAt int64  `json:"updated_at" api:"required"`
	Zone      string `json:"zone" api:"required"`
	ImageID   string `json:"image_id" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CreatedAt   respjson.Field
		EndAt       respjson.Field
		Object      respjson.Field
		StartAt     respjson.Field
		Status      respjson.Field
		UpdatedAt   respjson.Field
		Zone        respjson.Field
		ImageID     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ListResponseNodeDataCurrentVM) RawJSON

Returns the unmodified JSON received from the API

func (*ListResponseNodeDataCurrentVM) UnmarshalJSON

func (r *ListResponseNodeDataCurrentVM) UnmarshalJSON(data []byte) error

type ListResponseNodeDataVMs

type ListResponseNodeDataVMs struct {
	Data   []ListResponseNodeDataVMsData `json:"data" api:"required"`
	Object string                        `json:"object" api:"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
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ListResponseNodeDataVMs) RawJSON

func (r ListResponseNodeDataVMs) RawJSON() string

Returns the unmodified JSON received from the API

func (*ListResponseNodeDataVMs) UnmarshalJSON

func (r *ListResponseNodeDataVMs) UnmarshalJSON(data []byte) error

type ListResponseNodeDataVMsData

type ListResponseNodeDataVMsData struct {
	ID        string `json:"id" api:"required"`
	CreatedAt int64  `json:"created_at" api:"required"`
	EndAt     int64  `json:"end_at" api:"required"`
	Object    string `json:"object" api:"required"`
	StartAt   int64  `json:"start_at" api:"required"`
	// Any of "Pending", "Running", "Destroyed", "NodeFailure", "Unspecified".
	Status    string `json:"status" api:"required"`
	UpdatedAt int64  `json:"updated_at" api:"required"`
	Zone      string `json:"zone" api:"required"`
	ImageID   string `json:"image_id" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CreatedAt   respjson.Field
		EndAt       respjson.Field
		Object      respjson.Field
		StartAt     respjson.Field
		Status      respjson.Field
		UpdatedAt   respjson.Field
		Zone        respjson.Field
		ImageID     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ListResponseNodeDataVMsData) RawJSON

func (r ListResponseNodeDataVMsData) RawJSON() string

Returns the unmodified JSON received from the API

func (*ListResponseNodeDataVMsData) UnmarshalJSON

func (r *ListResponseNodeDataVMsData) UnmarshalJSON(data []byte) error

type Node

type Node struct {
	ID string `json:"id" api:"required"`
	// Any of "H100", "H200".
	GPUType AcceleratorType `json:"gpu_type" api:"required"`
	Name    string          `json:"name" api:"required"`
	// Any of "autoreserved", "reserved".
	NodeType NodeType `json:"node_type" api:"required"`
	Object   string   `json:"object" api:"required"`
	Owner    string   `json:"owner" api:"required"`
	// Node Status
	//
	// Any of "pending", "awaitingcapacity", "running", "released", "terminated",
	// "deleted", "failed", "unknown".
	Status Status `json:"status" api:"required"`
	// Creation time as Unix timestamp in seconds
	CreatedAt int64         `json:"created_at" api:"nullable"`
	CurrentVM NodeCurrentVM `json:"current_vm" api:"nullable"`
	// Deletion time as Unix timestamp in seconds
	DeletedAt int64 `json:"deleted_at" api:"nullable"`
	// End time as Unix timestamp in seconds
	EndAt int64 `json:"end_at" api:"nullable"`
	// Max price per hour you're willing to pay for a node in cents
	MaxPricePerNodeHour int64  `json:"max_price_per_node_hour" api:"nullable"`
	ProcurementID       string `json:"procurement_id" api:"nullable"`
	// Start time as Unix timestamp in seconds
	StartAt int64 `json:"start_at" api:"nullable"`
	// Last updated time as Unix timestamp in seconds
	UpdatedAt int64   `json:"updated_at" api:"nullable"`
	VMs       NodeVMs `json:"vms" api:"nullable"`
	Zone      string  `json:"zone" api:"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
		CurrentVM           respjson.Field
		DeletedAt           respjson.Field
		EndAt               respjson.Field
		MaxPricePerNodeHour respjson.Field
		ProcurementID       respjson.Field
		StartAt             respjson.Field
		UpdatedAt           respjson.Field
		VMs                 respjson.Field
		Zone                respjson.Field
		ExtraFields         map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Node) RawJSON

func (r Node) RawJSON() string

Returns the unmodified JSON received from the API

func (*Node) UnmarshalJSON

func (r *Node) UnmarshalJSON(data []byte) error

type NodeCurrentVM

type NodeCurrentVM struct {
	ID        string `json:"id" api:"required"`
	CreatedAt int64  `json:"created_at" api:"required"`
	EndAt     int64  `json:"end_at" api:"required"`
	Object    string `json:"object" api:"required"`
	StartAt   int64  `json:"start_at" api:"required"`
	// Any of "Pending", "Running", "Destroyed", "NodeFailure", "Unspecified".
	Status    string `json:"status" api:"required"`
	UpdatedAt int64  `json:"updated_at" api:"required"`
	Zone      string `json:"zone" api:"required"`
	ImageID   string `json:"image_id" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CreatedAt   respjson.Field
		EndAt       respjson.Field
		Object      respjson.Field
		StartAt     respjson.Field
		Status      respjson.Field
		UpdatedAt   respjson.Field
		Zone        respjson.Field
		ImageID     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NodeCurrentVM) RawJSON

func (r NodeCurrentVM) RawJSON() string

Returns the unmodified JSON received from the API

func (*NodeCurrentVM) UnmarshalJSON

func (r *NodeCurrentVM) UnmarshalJSON(data []byte) error

type NodeExtendParams

type NodeExtendParams struct {
	ExtendNodeRequest ExtendNodeRequestParam
	// contains filtered or unexported fields
}

func (NodeExtendParams) MarshalJSON

func (r NodeExtendParams) MarshalJSON() (data []byte, err error)

func (*NodeExtendParams) UnmarshalJSON

func (r *NodeExtendParams) UnmarshalJSON(data []byte) error

type NodeListParams

type NodeListParams struct {
	// Filter nodes by node_id Use ?id=n_b1dc52505c6db142&id=n_b1dc52505c6db133 to
	// specify multiple IDs. Cannot combine with name or node_type
	ID []string `query:"id,omitzero" json:"-"`
	// Filter nodes by their names Use ?name=val1&name=val2 to specify multiple names.
	// Cannot combine with id or node_type
	Name []string `query:"name,omitzero" json:"-"`
	// Filter nodes by their type Cannot combine with id or name
	//
	// Any of "autoreserved", "reserved".
	Type NodeType `query:"type,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (NodeListParams) URLQuery

func (r NodeListParams) URLQuery() (v url.Values, err error)

URLQuery serializes NodeListParams's query parameters as `url.Values`.

type NodeNewParams

type NodeNewParams struct {
	CreateNodesRequest CreateNodesRequestParam
	// contains filtered or unexported fields
}

func (NodeNewParams) MarshalJSON

func (r NodeNewParams) MarshalJSON() (data []byte, err error)

func (*NodeNewParams) UnmarshalJSON

func (r *NodeNewParams) UnmarshalJSON(data []byte) error

type NodeRedeployParams

type NodeRedeployParams struct {
	// Update the cloud init user data for VMs running on this node Data should be
	// base64 encoded
	CloudInitUserData param.Opt[string] `json:"cloud_init_user_data,omitzero" format:"byte"`
	// Redeploy node with this VM image ID
	ImageID param.Opt[string] `json:"image_id,omitzero"`
	// If false, then the new VM will inherit any configuration (like image_id,
	// cloud_init_user_data) that is left empty in this request from the current VM.
	//
	// If true, then any configuration left empty will be set as empty in the new VM.
	// E.g if cloud_init_user_data is left unset and override_empty is true, then the
	// new VM will not have any cloud init user data. override_empty defaults to false.
	OverrideEmpty param.Opt[bool] `json:"override_empty,omitzero"`
	// contains filtered or unexported fields
}

func (NodeRedeployParams) MarshalJSON

func (r NodeRedeployParams) MarshalJSON() (data []byte, err error)

func (*NodeRedeployParams) UnmarshalJSON

func (r *NodeRedeployParams) UnmarshalJSON(data []byte) error

type NodeService

type NodeService struct {
	Options []option.RequestOption
}

NodeService contains methods and other services that help with interacting with the sfc-nodes API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewNodeService method instead.

func NewNodeService

func NewNodeService(opts ...option.RequestOption) (r NodeService)

NewNodeService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*NodeService) Delete

func (r *NodeService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)

Delete a node by id. The node cannot be deleted if it has active or pending VMs.

func (*NodeService) Extend

func (r *NodeService) Extend(ctx context.Context, id string, body NodeExtendParams, opts ...option.RequestOption) (res *Node, err error)

Purchase additional time to extend the end time of a reserved VM node

func (*NodeService) Get

func (r *NodeService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Node, err error)

Retrieve details of a specific node by its ID or name

func (*NodeService) List

func (r *NodeService) List(ctx context.Context, query NodeListParams, opts ...option.RequestOption) (res *ListResponseNode, err error)

List all nodes for the authenticated account

func (*NodeService) New

func (r *NodeService) New(ctx context.Context, body NodeNewParams, opts ...option.RequestOption) (res *ListResponseNode, err error)

Create VM nodes

func (*NodeService) Redeploy

func (r *NodeService) Redeploy(ctx context.Context, id string, body NodeRedeployParams, opts ...option.RequestOption) (res *Node, err error)

Redeploy a node by replacing its current VM with a new one. Optionally update the VM image and cloud init user data.

func (*NodeService) Release

func (r *NodeService) Release(ctx context.Context, id string, opts ...option.RequestOption) (res *Node, err error)

Release an auto reserved VM node from its procurement, reducing the procurement's desired quantity by 1

type NodeType

type NodeType string
const (
	NodeTypeAutoreserved NodeType = "autoreserved"
	NodeTypeReserved     NodeType = "reserved"
)

type NodeVMs

type NodeVMs struct {
	Data   []NodeVMsData `json:"data" api:"required"`
	Object string        `json:"object" api:"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
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NodeVMs) RawJSON

func (r NodeVMs) RawJSON() string

Returns the unmodified JSON received from the API

func (*NodeVMs) UnmarshalJSON

func (r *NodeVMs) UnmarshalJSON(data []byte) error

type NodeVMsData

type NodeVMsData struct {
	ID        string `json:"id" api:"required"`
	CreatedAt int64  `json:"created_at" api:"required"`
	EndAt     int64  `json:"end_at" api:"required"`
	Object    string `json:"object" api:"required"`
	StartAt   int64  `json:"start_at" api:"required"`
	// Any of "Pending", "Running", "Destroyed", "NodeFailure", "Unspecified".
	Status    string `json:"status" api:"required"`
	UpdatedAt int64  `json:"updated_at" api:"required"`
	Zone      string `json:"zone" api:"required"`
	ImageID   string `json:"image_id" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		ID          respjson.Field
		CreatedAt   respjson.Field
		EndAt       respjson.Field
		Object      respjson.Field
		StartAt     respjson.Field
		Status      respjson.Field
		UpdatedAt   respjson.Field
		Zone        respjson.Field
		ImageID     respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (NodeVMsData) RawJSON

func (r NodeVMsData) RawJSON() string

Returns the unmodified JSON received from the API

func (*NodeVMsData) UnmarshalJSON

func (r *NodeVMsData) UnmarshalJSON(data []byte) error

type Status

type Status string

Node Status

const (
	StatusPending          Status = "pending"
	StatusAwaitingcapacity Status = "awaitingcapacity"
	StatusRunning          Status = "running"
	StatusReleased         Status = "released"
	StatusTerminated       Status = "terminated"
	StatusDeleted          Status = "deleted"
	StatusFailed           Status = "failed"
	StatusUnknown          Status = "unknown"
)

type UserDataUnion

type UserDataUnion struct {
	// This field will be present if the value is a [string] instead of an object.
	OfString string `json:",inline"`
	// This field will be present if the value is a [[]int64] instead of an object.
	OfIntArray []int64 `json:",inline"`
	JSON       struct {
		OfString   respjson.Field
		OfIntArray respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

UserDataUnion contains all possible properties and values from [string], [[]int64].

Use the methods beginning with 'As' to cast the union to one of its variants.

If the underlying value is not a json object, one of the following properties will be valid: OfString OfIntArray]

func (UserDataUnion) AsIntArray

func (u UserDataUnion) AsIntArray() (v []int64)

func (UserDataUnion) AsString

func (u UserDataUnion) AsString() (v string)

func (UserDataUnion) RawJSON

func (u UserDataUnion) RawJSON() string

Returns the unmodified JSON received from the API

func (UserDataUnion) ToParam

func (r UserDataUnion) ToParam() UserDataUnionParam

ToParam converts this UserDataUnion to a UserDataUnionParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with UserDataUnionParam.Overrides()

func (*UserDataUnion) UnmarshalJSON

func (r *UserDataUnion) UnmarshalJSON(data []byte) error

type UserDataUnionParam

type UserDataUnionParam struct {
	OfString   param.Opt[string] `json:",omitzero,inline"`
	OfIntArray []int64           `json:",omitzero,inline"`
	// contains filtered or unexported fields
}

Only one field can be non-zero.

Use param.IsOmitted to confirm if a field is set.

func (UserDataUnionParam) MarshalJSON

func (u UserDataUnionParam) MarshalJSON() ([]byte, error)

func (*UserDataUnionParam) UnmarshalJSON

func (u *UserDataUnionParam) UnmarshalJSON(data []byte) error

type VMImageGetResponse

type VMImageGetResponse struct {
	// The presigned URL that can be used to download the image
	DownloadURL string `json:"download_url" api:"required"`
	// Timestamp when the presigned URL expires (RFC 3339 format)
	ExpiresAt string `json:"expires_at" api:"required"`
	// The image ID
	ImageID string `json:"image_id" api:"required"`
	// Human readable name of the image. Must be unique per account.
	Name string `json:"name" api:"required"`
	// Any of "image".
	Object VMImageGetResponseObject `json:"object" api:"required"`
	// Size of the image file in bytes
	ObjectSize int64 `json:"object_size" api:"required"`
	// SHA256 hash of the image file for integrity verification
	Sha256Hash string `json:"sha256_hash" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		DownloadURL respjson.Field
		ExpiresAt   respjson.Field
		ImageID     respjson.Field
		Name        respjson.Field
		Object      respjson.Field
		ObjectSize  respjson.Field
		Sha256Hash  respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response body for image download presigned URL generation

func (VMImageGetResponse) RawJSON

func (r VMImageGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*VMImageGetResponse) UnmarshalJSON

func (r *VMImageGetResponse) UnmarshalJSON(data []byte) error

type VMImageGetResponseObject

type VMImageGetResponseObject string
const (
	VMImageGetResponseObjectImage VMImageGetResponseObject = "image"
)

type VMImageListResponse

type VMImageListResponse struct {
	Data    []VMImageListResponseData `json:"data" api:"required"`
	HasMore bool                      `json:"has_more" api:"required"`
	// Any of "list".
	Object VMImageListResponseObject `json:"object" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		HasMore     respjson.Field
		Object      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response body for listing images

func (VMImageListResponse) RawJSON

func (r VMImageListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*VMImageListResponse) UnmarshalJSON

func (r *VMImageListResponse) UnmarshalJSON(data []byte) error

type VMImageListResponseData

type VMImageListResponseData struct {
	// Creation timestamp as Unix timestamp in seconds
	CreatedAt int64 `json:"created_at" api:"required"`
	// The image ID
	ImageID string `json:"image_id" api:"required"`
	// Client given name of the image. Must be unique per account.
	Name string `json:"name" api:"required"`
	// Any of "image".
	Object string `json:"object" api:"required"`
	// Upload status of the image
	UploadStatus string `json:"upload_status" api:"required"`
	// SHA256 hash of the image file for integrity verification
	Sha256Hash string `json:"sha256_hash" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		CreatedAt    respjson.Field
		ImageID      respjson.Field
		Name         respjson.Field
		Object       respjson.Field
		UploadStatus respjson.Field
		Sha256Hash   respjson.Field
		ExtraFields  map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Response body for individual image info (used in lists)

func (VMImageListResponseData) RawJSON

func (r VMImageListResponseData) RawJSON() string

Returns the unmodified JSON received from the API

func (*VMImageListResponseData) UnmarshalJSON

func (r *VMImageListResponseData) UnmarshalJSON(data []byte) error

type VMImageListResponseObject

type VMImageListResponseObject string
const (
	VMImageListResponseObjectList VMImageListResponseObject = "list"
)

type VMImageService

type VMImageService struct {
	Options []option.RequestOption
}

VMImageService contains methods and other services that help with interacting with the sfc-nodes API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewVMImageService method instead.

func NewVMImageService

func NewVMImageService(opts ...option.RequestOption) (r VMImageService)

NewVMImageService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*VMImageService) Get

func (r *VMImageService) Get(ctx context.Context, imageID string, opts ...option.RequestOption) (res *VMImageGetResponse, err error)

Get the download URL for a VM image by ID

func (*VMImageService) List

func (r *VMImageService) List(ctx context.Context, opts ...option.RequestOption) (res *VMImageListResponse, err error)

List all VM Images for the authenticated account

type VMLogsParams

type VMLogsParams struct {
	InstanceID string `query:"instance_id" api:"required" json:"-"`
	// Any of "seqnum_asc", "seqnum_desc".
	OrderBy                 VMLogsParamsOrderBy `query:"order_by,omitzero" api:"required" json:"-"`
	BeforeRealtimeTimestamp param.Opt[string]   `query:"before_realtime_timestamp,omitzero" json:"-"`
	BeforeSeqnum            param.Opt[int64]    `query:"before_seqnum,omitzero" json:"-"`
	Limit                   param.Opt[int64]    `query:"limit,omitzero" json:"-"`
	SinceRealtimeTimestamp  param.Opt[string]   `query:"since_realtime_timestamp,omitzero" json:"-"`
	SinceSeqnum             param.Opt[int64]    `query:"since_seqnum,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (VMLogsParams) URLQuery

func (r VMLogsParams) URLQuery() (v url.Values, err error)

URLQuery serializes VMLogsParams's query parameters as `url.Values`.

type VMLogsParamsOrderBy

type VMLogsParamsOrderBy string
const (
	VMLogsParamsOrderBySeqnumAsc  VMLogsParamsOrderBy = "seqnum_asc"
	VMLogsParamsOrderBySeqnumDesc VMLogsParamsOrderBy = "seqnum_desc"
)

type VMLogsResponse

type VMLogsResponse struct {
	Data []VMLogsResponseData `json:"data" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data        respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (VMLogsResponse) RawJSON

func (r VMLogsResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*VMLogsResponse) UnmarshalJSON

func (r *VMLogsResponse) UnmarshalJSON(data []byte) error

type VMLogsResponseData

type VMLogsResponseData struct {
	Data                      []int64 `json:"data" api:"required"`
	InstanceID                string  `json:"instance_id" api:"required"`
	MonotonicTimestampNanoSec int64   `json:"monotonic_timestamp_nano_sec" api:"required"`
	MonotonicTimestampSec     int64   `json:"monotonic_timestamp_sec" api:"required"`
	// In RFC 3339 format
	RealtimeTimestamp string `json:"realtime_timestamp" api:"required"`
	Seqnum            int64  `json:"seqnum" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Data                      respjson.Field
		InstanceID                respjson.Field
		MonotonicTimestampNanoSec respjson.Field
		MonotonicTimestampSec     respjson.Field
		RealtimeTimestamp         respjson.Field
		Seqnum                    respjson.Field
		ExtraFields               map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (VMLogsResponseData) RawJSON

func (r VMLogsResponseData) RawJSON() string

Returns the unmodified JSON received from the API

func (*VMLogsResponseData) UnmarshalJSON

func (r *VMLogsResponseData) UnmarshalJSON(data []byte) error

type VMSSHParams

type VMSSHParams struct {
	VMID string `query:"vm_id" api:"required" json:"-"`
	// contains filtered or unexported fields
}

func (VMSSHParams) URLQuery

func (r VMSSHParams) URLQuery() (v url.Values, err error)

URLQuery serializes VMSSHParams's query parameters as `url.Values`.

type VMScriptGetResponse

type VMScriptGetResponse struct {
	// if the script is valid utf8 then the response may be in either string, or byte
	// form and the client must handle both
	Script UserDataUnion `json:"script" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Script      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (VMScriptGetResponse) RawJSON

func (r VMScriptGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*VMScriptGetResponse) UnmarshalJSON

func (r *VMScriptGetResponse) UnmarshalJSON(data []byte) error

type VMScriptNewParams

type VMScriptNewParams struct {
	// if the script is valid utf8 then the response may be in either string, or byte
	// form and the client must handle both
	Script UserDataUnionParam `json:"script,omitzero" api:"required"`
	// contains filtered or unexported fields
}

func (VMScriptNewParams) MarshalJSON

func (r VMScriptNewParams) MarshalJSON() (data []byte, err error)

func (*VMScriptNewParams) UnmarshalJSON

func (r *VMScriptNewParams) UnmarshalJSON(data []byte) error

type VMScriptNewResponse

type VMScriptNewResponse struct {
	// if the script is valid utf8 then the response may be in either string, or byte
	// form and the client must handle both
	Script UserDataUnion `json:"script" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Script      respjson.Field
		ExtraFields map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (VMScriptNewResponse) RawJSON

func (r VMScriptNewResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*VMScriptNewResponse) UnmarshalJSON

func (r *VMScriptNewResponse) UnmarshalJSON(data []byte) error

type VMScriptService

type VMScriptService struct {
	Options []option.RequestOption
}

VMScriptService contains methods and other services that help with interacting with the sfc-nodes API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewVMScriptService method instead.

func NewVMScriptService

func NewVMScriptService(opts ...option.RequestOption) (r VMScriptService)

NewVMScriptService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*VMScriptService) Get

func (r *VMScriptService) Get(ctx context.Context, opts ...option.RequestOption) (res *VMScriptGetResponse, err error)

func (*VMScriptService) New

type VMService

type VMService struct {
	Options []option.RequestOption
	Script  VMScriptService
	Images  VMImageService
}

VMService contains methods and other services that help with interacting with the sfc-nodes API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewVMService method instead.

func NewVMService

func NewVMService(opts ...option.RequestOption) (r VMService)

NewVMService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*VMService) Logs

func (r *VMService) Logs(ctx context.Context, query VMLogsParams, opts ...option.RequestOption) (res *VMLogsResponse, err error)

func (*VMService) SSH

func (r *VMService) SSH(ctx context.Context, query VMSSHParams, opts ...option.RequestOption) (res *VmsshResponse, err error)

type VmsshResponse

type VmsshResponse struct {
	SSHHostname string `json:"ssh_hostname" api:"required"`
	SSHPort     int64  `json:"ssh_port" api:"required"`
	// Unix timestamp.
	LastAttemptedKeyUpdate int64 `json:"last_attempted_key_update" api:"nullable"`
	// Unix timestamp.
	LastSuccessfulKeyUpdate int64                     `json:"last_successful_key_update" api:"nullable"`
	SSHHostKeys             []VmsshResponseSSHHostKey `json:"ssh_host_keys" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		SSHHostname             respjson.Field
		SSHPort                 respjson.Field
		LastAttemptedKeyUpdate  respjson.Field
		LastSuccessfulKeyUpdate respjson.Field
		SSHHostKeys             respjson.Field
		ExtraFields             map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (VmsshResponse) RawJSON

func (r VmsshResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*VmsshResponse) UnmarshalJSON

func (r *VmsshResponse) UnmarshalJSON(data []byte) error

type VmsshResponseSSHHostKey

type VmsshResponseSSHHostKey struct {
	Base64EncodedKey string `json:"base64_encoded_key" api:"required" format:"byte"`
	KeyType          string `json:"key_type" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		Base64EncodedKey respjson.Field
		KeyType          respjson.Field
		ExtraFields      map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (VmsshResponseSSHHostKey) RawJSON

func (r VmsshResponseSSHHostKey) RawJSON() string

Returns the unmodified JSON received from the API

func (*VmsshResponseSSHHostKey) UnmarshalJSON

func (r *VmsshResponseSSHHostKey) UnmarshalJSON(data []byte) error

type ZoneGetResponse

type ZoneGetResponse struct {
	// The available capacity on this cluster, in the shape of consecutive
	// "availability rectangles".
	AvailableCapacity []ZoneGetResponseAvailableCapacity `json:"available_capacity" api:"required"`
	// Any of "K8s", "VM".
	DeliveryType ZoneGetResponseDeliveryType `json:"delivery_type" api:"required"`
	// Any of "H100", "H200".
	HardwareType AcceleratorType `json:"hardware_type" api:"required"`
	// Any of "Infiniband", "None".
	InterconnectType ZoneGetResponseInterconnectType `json:"interconnect_type" api:"required"`
	Name             string                          `json:"name" api:"required"`
	Object           string                          `json:"object" api:"required"`
	// Any of "NorthAmerica", "AsiaPacific", "EuropeMiddleEastAfrica".
	Region ZoneGetResponseRegion `json:"region" api:"required"`
	// User-facing zone name (e.g., "Hayes Valley", "Land's End")
	DisplayName string `json:"display_name" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AvailableCapacity respjson.Field
		DeliveryType      respjson.Field
		HardwareType      respjson.Field
		InterconnectType  respjson.Field
		Name              respjson.Field
		Object            respjson.Field
		Region            respjson.Field
		DisplayName       respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ZoneGetResponse) RawJSON

func (r ZoneGetResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ZoneGetResponse) UnmarshalJSON

func (r *ZoneGetResponse) UnmarshalJSON(data []byte) error

type ZoneGetResponseAvailableCapacity

type ZoneGetResponseAvailableCapacity struct {
	// Unix timestamp.
	EndTimestamp int64 `json:"end_timestamp" api:"required"`
	// The number of nodes available during this time period
	Quantity int64 `json:"quantity" api:"required"`
	// Unix timestamp.
	StartTimestamp int64 `json:"start_timestamp" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EndTimestamp   respjson.Field
		Quantity       respjson.Field
		StartTimestamp respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ZoneGetResponseAvailableCapacity) RawJSON

Returns the unmodified JSON received from the API

func (*ZoneGetResponseAvailableCapacity) UnmarshalJSON

func (r *ZoneGetResponseAvailableCapacity) UnmarshalJSON(data []byte) error

type ZoneGetResponseDeliveryType

type ZoneGetResponseDeliveryType string
const (
	ZoneGetResponseDeliveryTypeK8s ZoneGetResponseDeliveryType = "K8s"
	ZoneGetResponseDeliveryTypeVM  ZoneGetResponseDeliveryType = "VM"
)

type ZoneGetResponseInterconnectType

type ZoneGetResponseInterconnectType string
const (
	ZoneGetResponseInterconnectTypeInfiniband ZoneGetResponseInterconnectType = "Infiniband"
	ZoneGetResponseInterconnectTypeNone       ZoneGetResponseInterconnectType = "None"
)

type ZoneGetResponseRegion

type ZoneGetResponseRegion string
const (
	ZoneGetResponseRegionNorthAmerica           ZoneGetResponseRegion = "NorthAmerica"
	ZoneGetResponseRegionAsiaPacific            ZoneGetResponseRegion = "AsiaPacific"
	ZoneGetResponseRegionEuropeMiddleEastAfrica ZoneGetResponseRegion = "EuropeMiddleEastAfrica"
)

type ZoneListResponse

type ZoneListResponse struct {
	Data   []ZoneListResponseData `json:"data" api:"required"`
	Object string                 `json:"object" api:"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
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ZoneListResponse) RawJSON

func (r ZoneListResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*ZoneListResponse) UnmarshalJSON

func (r *ZoneListResponse) UnmarshalJSON(data []byte) error

type ZoneListResponseData

type ZoneListResponseData struct {
	// The available capacity on this cluster, in the shape of consecutive
	// "availability rectangles".
	AvailableCapacity []ZoneListResponseDataAvailableCapacity `json:"available_capacity" api:"required"`
	// Any of "K8s", "VM".
	DeliveryType string `json:"delivery_type" api:"required"`
	// Any of "H100", "H200".
	HardwareType AcceleratorType `json:"hardware_type" api:"required"`
	// Any of "Infiniband", "None".
	InterconnectType string `json:"interconnect_type" api:"required"`
	Name             string `json:"name" api:"required"`
	Object           string `json:"object" api:"required"`
	// Any of "NorthAmerica", "AsiaPacific", "EuropeMiddleEastAfrica".
	Region string `json:"region" api:"required"`
	// User-facing zone name (e.g., "Hayes Valley", "Land's End")
	DisplayName string `json:"display_name" api:"nullable"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		AvailableCapacity respjson.Field
		DeliveryType      respjson.Field
		HardwareType      respjson.Field
		InterconnectType  respjson.Field
		Name              respjson.Field
		Object            respjson.Field
		Region            respjson.Field
		DisplayName       respjson.Field
		ExtraFields       map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ZoneListResponseData) RawJSON

func (r ZoneListResponseData) RawJSON() string

Returns the unmodified JSON received from the API

func (*ZoneListResponseData) UnmarshalJSON

func (r *ZoneListResponseData) UnmarshalJSON(data []byte) error

type ZoneListResponseDataAvailableCapacity

type ZoneListResponseDataAvailableCapacity struct {
	// Unix timestamp.
	EndTimestamp int64 `json:"end_timestamp" api:"required"`
	// The number of nodes available during this time period
	Quantity int64 `json:"quantity" api:"required"`
	// Unix timestamp.
	StartTimestamp int64 `json:"start_timestamp" api:"required"`
	// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
	JSON struct {
		EndTimestamp   respjson.Field
		Quantity       respjson.Field
		StartTimestamp respjson.Field
		ExtraFields    map[string]respjson.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (ZoneListResponseDataAvailableCapacity) RawJSON

Returns the unmodified JSON received from the API

func (*ZoneListResponseDataAvailableCapacity) UnmarshalJSON

func (r *ZoneListResponseDataAvailableCapacity) UnmarshalJSON(data []byte) error

type ZoneService

type ZoneService struct {
	Options []option.RequestOption
}

ZoneService contains methods and other services that help with interacting with the sfc-nodes API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewZoneService method instead.

func NewZoneService

func NewZoneService(opts ...option.RequestOption) (r ZoneService)

NewZoneService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*ZoneService) Get

func (r *ZoneService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *ZoneGetResponse, err error)

Get detailed information about a specific zone

func (*ZoneService) List

func (r *ZoneService) List(ctx context.Context, opts ...option.RequestOption) (res *ZoneListResponse, err error)

List all available zones

Directories

Path Synopsis
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
Package json implements encoding and decoding of JSON as defined in RFC 7159.
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
packages
shared

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL