vers

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

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

Go to latest
Published: Aug 14, 2025 License: Apache-2.0 Imports: 13 Imported by: 1

README

Vers Go API Library

Go Reference

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

It is generated with Stainless.

Installation

import (
	"github.com/hdresearch/vers-sdk-go" // imported as vers
)

Or to pin the version:

go get -u 'github.com/hdresearch/vers-sdk-go@v0.1.0-alpha.19'

Requirements

This library requires Go 1.18+.

Usage

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

package main

import (
	"context"
	"fmt"

	"github.com/hdresearch/vers-sdk-go"
	"github.com/hdresearch/vers-sdk-go/option"
)

func main() {
	client := vers.NewClient(
		option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("VERS_API_KEY")
	)
	clusters, err := client.API.Cluster.List(context.TODO())
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", clusters.OperationID)
}

Request fields

All request parameters are wrapped in a generic Field type, which we use to distinguish zero values from null or omitted fields.

This prevents accidentally sending a zero value if you forget a required parameter, and enables explicitly sending null, false, '', or 0 on optional parameters. Any field not specified is not sent.

To construct fields with values, use the helpers String(), Int(), Float(), or most commonly, the generic F[T](). To send a null, use Null[T](), and to send a nonconforming value, use Raw[T](any). For example:

params := FooParams{
	Name: vers.F("hello"),

	// Explicitly send `"description": null`
	Description: vers.Null[string](),

	Point: vers.F(vers.Point{
		X: vers.Int(0),
		Y: vers.Int(1),

		// In cases where the API specifies a given type,
		// but you want to send something else, use `Raw`:
		Z: vers.Raw[int64](0.01), // sends a float
	}),
}
Response objects

All fields in response structs are value types (not pointers or wrappers).

If a given field is null, not present, or invalid, the corresponding field will simply be its zero value.

All response structs also include a special JSON field, containing more detailed information about each property, which you can use like so:

if res.Name == "" {
	// true if `"name"` is either not present or explicitly null
	res.JSON.Name.IsNull()

	// true if the `"name"` key was not present in the response JSON at all
	res.JSON.Name.IsMissing()

	// When the API returns data that cannot be coerced to the expected type:
	if res.JSON.Name.IsInvalid() {
		raw := res.JSON.Name.Raw()

		legacyName := struct{
			First string `json:"first"`
			Last  string `json:"last"`
		}{}
		json.Unmarshal([]byte(raw), &legacyName)
		name = legacyName.First + " " + legacyName.Last
	}
}

These .JSON structs also include an Extras 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()
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 := vers.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.API.Cluster.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"}),
)

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 *vers.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.API.Cluster.List(context.TODO())
if err != nil {
	var apierr *vers.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 "/api/cluster": 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.API.Cluster.List(
	ctx,
	// 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 param.Field[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 vers.FileParam(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 2 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 := vers.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.API.Cluster.List(context.TODO(), 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
clusters, err := client.API.Cluster.List(context.TODO(), option.WithResponseInto(&response))
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", clusters)

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]interface{}

    // 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:   vers.F("id_xxxx"),
    Data: vers.F(FooNewParamsData{
        FirstName: vers.F("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 := vers.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(value bool) param.Field[bool]

Bool is a param field helper which helps specify bools.

func DefaultClientOptions

func DefaultClientOptions() []option.RequestOption

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

func F

func F[T any](value T) param.Field[T]

F is a param field helper used to initialize a param.Field generic struct. This helps specify null, zero values, and overrides, as well as normal values. You can read more about this in our README.

func FileParam

func FileParam(reader io.Reader, filename string, contentType string) param.Field[io.Reader]

FileParam is a param field helper which helps files with a mime content-type.

func Float

func Float(value float64) param.Field[float64]

Float is a param field helper which helps specify floats.

func Int

func Int(value int64) param.Field[int64]

Int is a param field helper which helps specify integers. This is particularly helpful when specifying integer constants for fields.

func Null

func Null[T any]() param.Field[T]

Null is a param field helper which explicitly sends null to the API.

func Raw

func Raw[T any](value any) param.Field[T]

Raw is a param field helper for specifying values for fields when the type you are looking to send is different from the type that is specified in the SDK. For example, if the type of the field is an integer, but you want to send a float, you could do that by setting the corresponding field with Raw[int](0.5).

func String

func String(value string) param.Field[string]

String is a param field helper which helps specify strings.

Types

type APIClusterDeleteResponse

type APIClusterDeleteResponse struct {
	// A struct containing information about an attempted cluster deletion request.
	// Reports information in the event of a partial failure so billing can still be
	// udpated appropriately.
	Data          APIClusterDeleteResponseData          `json:"data,required"`
	DurationNs    int64                                 `json:"duration_ns,required"`
	OperationCode APIClusterDeleteResponseOperationCode `json:"operation_code,required"`
	OperationID   string                                `json:"operation_id,required"`
	// Unix epoch time (secs)
	TimeStart int64                        `json:"time_start,required"`
	JSON      apiClusterDeleteResponseJSON `json:"-"`
}

func (*APIClusterDeleteResponse) UnmarshalJSON

func (r *APIClusterDeleteResponse) UnmarshalJSON(data []byte) (err error)

type APIClusterDeleteResponseData

type APIClusterDeleteResponseData struct {
	ClusterID string `json:"cluster_id,required"`
	// A struct containing information about an attempted VM deletion request. Reports
	// information in the event of a partial failure so billing can still be udpated
	// appropriately.
	Vms     VmDeleteResponse                 `json:"vms,required"`
	FsError string                           `json:"fs_error,nullable"`
	JSON    apiClusterDeleteResponseDataJSON `json:"-"`
}

A struct containing information about an attempted cluster deletion request. Reports information in the event of a partial failure so billing can still be udpated appropriately.

func (*APIClusterDeleteResponseData) UnmarshalJSON

func (r *APIClusterDeleteResponseData) UnmarshalJSON(data []byte) (err error)

type APIClusterDeleteResponseOperationCode

type APIClusterDeleteResponseOperationCode string
const (
	APIClusterDeleteResponseOperationCodeListClusters     APIClusterDeleteResponseOperationCode = "list_clusters"
	APIClusterDeleteResponseOperationCodeGetCluster       APIClusterDeleteResponseOperationCode = "get_cluster"
	APIClusterDeleteResponseOperationCodeCreateCluster    APIClusterDeleteResponseOperationCode = "create_cluster"
	APIClusterDeleteResponseOperationCodeDeleteCluster    APIClusterDeleteResponseOperationCode = "delete_cluster"
	APIClusterDeleteResponseOperationCodeUpdateCluster    APIClusterDeleteResponseOperationCode = "update_cluster"
	APIClusterDeleteResponseOperationCodeGetClusterSSHKey APIClusterDeleteResponseOperationCode = "get_cluster_ssh_key"
	APIClusterDeleteResponseOperationCodeListVms          APIClusterDeleteResponseOperationCode = "list_vms"
	APIClusterDeleteResponseOperationCodeGetVm            APIClusterDeleteResponseOperationCode = "get_vm"
	APIClusterDeleteResponseOperationCodeUpdateVm         APIClusterDeleteResponseOperationCode = "update_vm"
	APIClusterDeleteResponseOperationCodeBranchVm         APIClusterDeleteResponseOperationCode = "branch_vm"
	APIClusterDeleteResponseOperationCodeCommitVm         APIClusterDeleteResponseOperationCode = "commit_vm"
	APIClusterDeleteResponseOperationCodeDeleteVm         APIClusterDeleteResponseOperationCode = "delete_vm"
	APIClusterDeleteResponseOperationCodeGetVmSSHKey      APIClusterDeleteResponseOperationCode = "get_vm_ssh_key"
	APIClusterDeleteResponseOperationCodeUploadRootfs     APIClusterDeleteResponseOperationCode = "upload_rootfs"
	APIClusterDeleteResponseOperationCodeDeleteRootfs     APIClusterDeleteResponseOperationCode = "delete_rootfs"
	APIClusterDeleteResponseOperationCodeListRootfs       APIClusterDeleteResponseOperationCode = "list_rootfs"
)

func (APIClusterDeleteResponseOperationCode) IsKnown

type APIClusterGetResponse

type APIClusterGetResponse struct {
	Data          APIClusterGetResponseData          `json:"data,required"`
	DurationNs    int64                              `json:"duration_ns,required"`
	OperationCode APIClusterGetResponseOperationCode `json:"operation_code,required"`
	OperationID   string                             `json:"operation_id,required"`
	// Unix epoch time (secs)
	TimeStart int64                     `json:"time_start,required"`
	JSON      apiClusterGetResponseJSON `json:"-"`
}

func (*APIClusterGetResponse) UnmarshalJSON

func (r *APIClusterGetResponse) UnmarshalJSON(data []byte) (err error)

type APIClusterGetResponseData

type APIClusterGetResponseData struct {
	// The cluster's ID.
	ID string `json:"id,required"`
	// The size of the cluster's backing file
	FsSizeMib int64 `json:"fs_size_mib,required"`
	// The ID of the cluster's root VM.
	RootVmID string `json:"root_vm_id,required"`
	// How many VMs are currently running on this cluster.
	VmCount int64 `json:"vm_count,required"`
	// The VMs that are children of the cluster, including the root VM.
	Vms []VmDto `json:"vms,required"`
	// Human-readable name assigned to the cluster.
	Alias string                        `json:"alias,nullable"`
	JSON  apiClusterGetResponseDataJSON `json:"-"`
}

func (*APIClusterGetResponseData) UnmarshalJSON

func (r *APIClusterGetResponseData) UnmarshalJSON(data []byte) (err error)

type APIClusterGetResponseOperationCode

type APIClusterGetResponseOperationCode string
const (
	APIClusterGetResponseOperationCodeListClusters     APIClusterGetResponseOperationCode = "list_clusters"
	APIClusterGetResponseOperationCodeGetCluster       APIClusterGetResponseOperationCode = "get_cluster"
	APIClusterGetResponseOperationCodeCreateCluster    APIClusterGetResponseOperationCode = "create_cluster"
	APIClusterGetResponseOperationCodeDeleteCluster    APIClusterGetResponseOperationCode = "delete_cluster"
	APIClusterGetResponseOperationCodeUpdateCluster    APIClusterGetResponseOperationCode = "update_cluster"
	APIClusterGetResponseOperationCodeGetClusterSSHKey APIClusterGetResponseOperationCode = "get_cluster_ssh_key"
	APIClusterGetResponseOperationCodeListVms          APIClusterGetResponseOperationCode = "list_vms"
	APIClusterGetResponseOperationCodeGetVm            APIClusterGetResponseOperationCode = "get_vm"
	APIClusterGetResponseOperationCodeUpdateVm         APIClusterGetResponseOperationCode = "update_vm"
	APIClusterGetResponseOperationCodeBranchVm         APIClusterGetResponseOperationCode = "branch_vm"
	APIClusterGetResponseOperationCodeCommitVm         APIClusterGetResponseOperationCode = "commit_vm"
	APIClusterGetResponseOperationCodeDeleteVm         APIClusterGetResponseOperationCode = "delete_vm"
	APIClusterGetResponseOperationCodeGetVmSSHKey      APIClusterGetResponseOperationCode = "get_vm_ssh_key"
	APIClusterGetResponseOperationCodeUploadRootfs     APIClusterGetResponseOperationCode = "upload_rootfs"
	APIClusterGetResponseOperationCodeDeleteRootfs     APIClusterGetResponseOperationCode = "delete_rootfs"
	APIClusterGetResponseOperationCodeListRootfs       APIClusterGetResponseOperationCode = "list_rootfs"
)

func (APIClusterGetResponseOperationCode) IsKnown

type APIClusterGetSSHKeyResponse

type APIClusterGetSSHKeyResponse struct {
	Data          string                                   `json:"data,required"`
	DurationNs    int64                                    `json:"duration_ns,required"`
	OperationCode APIClusterGetSSHKeyResponseOperationCode `json:"operation_code,required"`
	OperationID   string                                   `json:"operation_id,required"`
	// Unix epoch time (secs)
	TimeStart int64                           `json:"time_start,required"`
	JSON      apiClusterGetSSHKeyResponseJSON `json:"-"`
}

func (*APIClusterGetSSHKeyResponse) UnmarshalJSON

func (r *APIClusterGetSSHKeyResponse) UnmarshalJSON(data []byte) (err error)

type APIClusterGetSSHKeyResponseOperationCode

type APIClusterGetSSHKeyResponseOperationCode string
const (
	APIClusterGetSSHKeyResponseOperationCodeListClusters     APIClusterGetSSHKeyResponseOperationCode = "list_clusters"
	APIClusterGetSSHKeyResponseOperationCodeGetCluster       APIClusterGetSSHKeyResponseOperationCode = "get_cluster"
	APIClusterGetSSHKeyResponseOperationCodeCreateCluster    APIClusterGetSSHKeyResponseOperationCode = "create_cluster"
	APIClusterGetSSHKeyResponseOperationCodeDeleteCluster    APIClusterGetSSHKeyResponseOperationCode = "delete_cluster"
	APIClusterGetSSHKeyResponseOperationCodeUpdateCluster    APIClusterGetSSHKeyResponseOperationCode = "update_cluster"
	APIClusterGetSSHKeyResponseOperationCodeGetClusterSSHKey APIClusterGetSSHKeyResponseOperationCode = "get_cluster_ssh_key"
	APIClusterGetSSHKeyResponseOperationCodeListVms          APIClusterGetSSHKeyResponseOperationCode = "list_vms"
	APIClusterGetSSHKeyResponseOperationCodeGetVm            APIClusterGetSSHKeyResponseOperationCode = "get_vm"
	APIClusterGetSSHKeyResponseOperationCodeUpdateVm         APIClusterGetSSHKeyResponseOperationCode = "update_vm"
	APIClusterGetSSHKeyResponseOperationCodeBranchVm         APIClusterGetSSHKeyResponseOperationCode = "branch_vm"
	APIClusterGetSSHKeyResponseOperationCodeCommitVm         APIClusterGetSSHKeyResponseOperationCode = "commit_vm"
	APIClusterGetSSHKeyResponseOperationCodeDeleteVm         APIClusterGetSSHKeyResponseOperationCode = "delete_vm"
	APIClusterGetSSHKeyResponseOperationCodeGetVmSSHKey      APIClusterGetSSHKeyResponseOperationCode = "get_vm_ssh_key"
	APIClusterGetSSHKeyResponseOperationCodeUploadRootfs     APIClusterGetSSHKeyResponseOperationCode = "upload_rootfs"
	APIClusterGetSSHKeyResponseOperationCodeDeleteRootfs     APIClusterGetSSHKeyResponseOperationCode = "delete_rootfs"
	APIClusterGetSSHKeyResponseOperationCodeListRootfs       APIClusterGetSSHKeyResponseOperationCode = "list_rootfs"
)

func (APIClusterGetSSHKeyResponseOperationCode) IsKnown

type APIClusterListResponse

type APIClusterListResponse struct {
	Data          []APIClusterListResponseData        `json:"data,required"`
	DurationNs    int64                               `json:"duration_ns,required"`
	OperationCode APIClusterListResponseOperationCode `json:"operation_code,required"`
	OperationID   string                              `json:"operation_id,required"`
	// Unix epoch time (secs)
	TimeStart int64                      `json:"time_start,required"`
	JSON      apiClusterListResponseJSON `json:"-"`
}

func (*APIClusterListResponse) UnmarshalJSON

func (r *APIClusterListResponse) UnmarshalJSON(data []byte) (err error)

type APIClusterListResponseData

type APIClusterListResponseData struct {
	// The cluster's ID.
	ID string `json:"id,required"`
	// The size of the cluster's backing file
	FsSizeMib int64 `json:"fs_size_mib,required"`
	// The ID of the cluster's root VM.
	RootVmID string `json:"root_vm_id,required"`
	// How many VMs are currently running on this cluster.
	VmCount int64 `json:"vm_count,required"`
	// The VMs that are children of the cluster, including the root VM.
	Vms []VmDto `json:"vms,required"`
	// Human-readable name assigned to the cluster.
	Alias string                         `json:"alias,nullable"`
	JSON  apiClusterListResponseDataJSON `json:"-"`
}

func (*APIClusterListResponseData) UnmarshalJSON

func (r *APIClusterListResponseData) UnmarshalJSON(data []byte) (err error)

type APIClusterListResponseOperationCode

type APIClusterListResponseOperationCode string
const (
	APIClusterListResponseOperationCodeListClusters     APIClusterListResponseOperationCode = "list_clusters"
	APIClusterListResponseOperationCodeGetCluster       APIClusterListResponseOperationCode = "get_cluster"
	APIClusterListResponseOperationCodeCreateCluster    APIClusterListResponseOperationCode = "create_cluster"
	APIClusterListResponseOperationCodeDeleteCluster    APIClusterListResponseOperationCode = "delete_cluster"
	APIClusterListResponseOperationCodeUpdateCluster    APIClusterListResponseOperationCode = "update_cluster"
	APIClusterListResponseOperationCodeGetClusterSSHKey APIClusterListResponseOperationCode = "get_cluster_ssh_key"
	APIClusterListResponseOperationCodeListVms          APIClusterListResponseOperationCode = "list_vms"
	APIClusterListResponseOperationCodeGetVm            APIClusterListResponseOperationCode = "get_vm"
	APIClusterListResponseOperationCodeUpdateVm         APIClusterListResponseOperationCode = "update_vm"
	APIClusterListResponseOperationCodeBranchVm         APIClusterListResponseOperationCode = "branch_vm"
	APIClusterListResponseOperationCodeCommitVm         APIClusterListResponseOperationCode = "commit_vm"
	APIClusterListResponseOperationCodeDeleteVm         APIClusterListResponseOperationCode = "delete_vm"
	APIClusterListResponseOperationCodeGetVmSSHKey      APIClusterListResponseOperationCode = "get_vm_ssh_key"
	APIClusterListResponseOperationCodeUploadRootfs     APIClusterListResponseOperationCode = "upload_rootfs"
	APIClusterListResponseOperationCodeDeleteRootfs     APIClusterListResponseOperationCode = "delete_rootfs"
	APIClusterListResponseOperationCodeListRootfs       APIClusterListResponseOperationCode = "list_rootfs"
)

func (APIClusterListResponseOperationCode) IsKnown

type APIClusterNewParams

type APIClusterNewParams struct {
	ClusterCreateRequest ClusterCreateRequestUnionParam `json:"cluster_create_request,required"`
}

func (APIClusterNewParams) MarshalJSON

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

type APIClusterNewResponse

type APIClusterNewResponse struct {
	Data          APIClusterNewResponseData          `json:"data,required"`
	DurationNs    int64                              `json:"duration_ns,required"`
	OperationCode APIClusterNewResponseOperationCode `json:"operation_code,required"`
	OperationID   string                             `json:"operation_id,required"`
	// Unix epoch time (secs)
	TimeStart int64                     `json:"time_start,required"`
	JSON      apiClusterNewResponseJSON `json:"-"`
}

func (*APIClusterNewResponse) UnmarshalJSON

func (r *APIClusterNewResponse) UnmarshalJSON(data []byte) (err error)

type APIClusterNewResponseData

type APIClusterNewResponseData struct {
	// The cluster's ID.
	ID string `json:"id,required"`
	// The size of the cluster's backing file
	FsSizeMib int64 `json:"fs_size_mib,required"`
	// The ID of the cluster's root VM.
	RootVmID string `json:"root_vm_id,required"`
	// How many VMs are currently running on this cluster.
	VmCount int64 `json:"vm_count,required"`
	// The VMs that are children of the cluster, including the root VM.
	Vms []VmDto `json:"vms,required"`
	// Human-readable name assigned to the cluster.
	Alias string                        `json:"alias,nullable"`
	JSON  apiClusterNewResponseDataJSON `json:"-"`
}

func (*APIClusterNewResponseData) UnmarshalJSON

func (r *APIClusterNewResponseData) UnmarshalJSON(data []byte) (err error)

type APIClusterNewResponseOperationCode

type APIClusterNewResponseOperationCode string
const (
	APIClusterNewResponseOperationCodeListClusters     APIClusterNewResponseOperationCode = "list_clusters"
	APIClusterNewResponseOperationCodeGetCluster       APIClusterNewResponseOperationCode = "get_cluster"
	APIClusterNewResponseOperationCodeCreateCluster    APIClusterNewResponseOperationCode = "create_cluster"
	APIClusterNewResponseOperationCodeDeleteCluster    APIClusterNewResponseOperationCode = "delete_cluster"
	APIClusterNewResponseOperationCodeUpdateCluster    APIClusterNewResponseOperationCode = "update_cluster"
	APIClusterNewResponseOperationCodeGetClusterSSHKey APIClusterNewResponseOperationCode = "get_cluster_ssh_key"
	APIClusterNewResponseOperationCodeListVms          APIClusterNewResponseOperationCode = "list_vms"
	APIClusterNewResponseOperationCodeGetVm            APIClusterNewResponseOperationCode = "get_vm"
	APIClusterNewResponseOperationCodeUpdateVm         APIClusterNewResponseOperationCode = "update_vm"
	APIClusterNewResponseOperationCodeBranchVm         APIClusterNewResponseOperationCode = "branch_vm"
	APIClusterNewResponseOperationCodeCommitVm         APIClusterNewResponseOperationCode = "commit_vm"
	APIClusterNewResponseOperationCodeDeleteVm         APIClusterNewResponseOperationCode = "delete_vm"
	APIClusterNewResponseOperationCodeGetVmSSHKey      APIClusterNewResponseOperationCode = "get_vm_ssh_key"
	APIClusterNewResponseOperationCodeUploadRootfs     APIClusterNewResponseOperationCode = "upload_rootfs"
	APIClusterNewResponseOperationCodeDeleteRootfs     APIClusterNewResponseOperationCode = "delete_rootfs"
	APIClusterNewResponseOperationCodeListRootfs       APIClusterNewResponseOperationCode = "list_rootfs"
)

func (APIClusterNewResponseOperationCode) IsKnown

type APIClusterService

type APIClusterService struct {
	Options []option.RequestOption
}

APIClusterService contains methods and other services that help with interacting with the vers 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 NewAPIClusterService method instead.

func NewAPIClusterService

func NewAPIClusterService(opts ...option.RequestOption) (r *APIClusterService)

NewAPIClusterService 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 (*APIClusterService) Delete

func (r *APIClusterService) Delete(ctx context.Context, clusterIDOrAlias string, opts ...option.RequestOption) (res *APIClusterDeleteResponse, err error)

Delete a cluster.

func (*APIClusterService) Get

func (r *APIClusterService) Get(ctx context.Context, clusterIDOrAlias string, opts ...option.RequestOption) (res *APIClusterGetResponse, err error)

Retrieve information on a particular cluster.

func (*APIClusterService) GetSSHKey

func (r *APIClusterService) GetSSHKey(ctx context.Context, clusterIDOrAlias string, opts ...option.RequestOption) (res *APIClusterGetSSHKeyResponse, err error)

Get the SSH private key for VM access

func (*APIClusterService) List

List all clusters.

func (*APIClusterService) New

Create a new cluster.

func (*APIClusterService) Update

func (r *APIClusterService) Update(ctx context.Context, clusterIDOrAlias string, body APIClusterUpdateParams, opts ...option.RequestOption) (res *APIClusterUpdateResponse, err error)

Update a cluster's configuration

type APIClusterUpdateParams

type APIClusterUpdateParams struct {
	ClusterPatchRequest ClusterPatchRequestParam `json:"cluster_patch_request,required"`
}

func (APIClusterUpdateParams) MarshalJSON

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

type APIClusterUpdateResponse

type APIClusterUpdateResponse struct {
	Data          APIClusterUpdateResponseData          `json:"data,required"`
	DurationNs    int64                                 `json:"duration_ns,required"`
	OperationCode APIClusterUpdateResponseOperationCode `json:"operation_code,required"`
	OperationID   string                                `json:"operation_id,required"`
	// Unix epoch time (secs)
	TimeStart int64                        `json:"time_start,required"`
	JSON      apiClusterUpdateResponseJSON `json:"-"`
}

func (*APIClusterUpdateResponse) UnmarshalJSON

func (r *APIClusterUpdateResponse) UnmarshalJSON(data []byte) (err error)

type APIClusterUpdateResponseData

type APIClusterUpdateResponseData struct {
	// The cluster's ID.
	ID string `json:"id,required"`
	// The size of the cluster's backing file
	FsSizeMib int64 `json:"fs_size_mib,required"`
	// The ID of the cluster's root VM.
	RootVmID string `json:"root_vm_id,required"`
	// How many VMs are currently running on this cluster.
	VmCount int64 `json:"vm_count,required"`
	// The VMs that are children of the cluster, including the root VM.
	Vms []VmDto `json:"vms,required"`
	// Human-readable name assigned to the cluster.
	Alias string                           `json:"alias,nullable"`
	JSON  apiClusterUpdateResponseDataJSON `json:"-"`
}

func (*APIClusterUpdateResponseData) UnmarshalJSON

func (r *APIClusterUpdateResponseData) UnmarshalJSON(data []byte) (err error)

type APIClusterUpdateResponseOperationCode

type APIClusterUpdateResponseOperationCode string
const (
	APIClusterUpdateResponseOperationCodeListClusters     APIClusterUpdateResponseOperationCode = "list_clusters"
	APIClusterUpdateResponseOperationCodeGetCluster       APIClusterUpdateResponseOperationCode = "get_cluster"
	APIClusterUpdateResponseOperationCodeCreateCluster    APIClusterUpdateResponseOperationCode = "create_cluster"
	APIClusterUpdateResponseOperationCodeDeleteCluster    APIClusterUpdateResponseOperationCode = "delete_cluster"
	APIClusterUpdateResponseOperationCodeUpdateCluster    APIClusterUpdateResponseOperationCode = "update_cluster"
	APIClusterUpdateResponseOperationCodeGetClusterSSHKey APIClusterUpdateResponseOperationCode = "get_cluster_ssh_key"
	APIClusterUpdateResponseOperationCodeListVms          APIClusterUpdateResponseOperationCode = "list_vms"
	APIClusterUpdateResponseOperationCodeGetVm            APIClusterUpdateResponseOperationCode = "get_vm"
	APIClusterUpdateResponseOperationCodeUpdateVm         APIClusterUpdateResponseOperationCode = "update_vm"
	APIClusterUpdateResponseOperationCodeBranchVm         APIClusterUpdateResponseOperationCode = "branch_vm"
	APIClusterUpdateResponseOperationCodeCommitVm         APIClusterUpdateResponseOperationCode = "commit_vm"
	APIClusterUpdateResponseOperationCodeDeleteVm         APIClusterUpdateResponseOperationCode = "delete_vm"
	APIClusterUpdateResponseOperationCodeGetVmSSHKey      APIClusterUpdateResponseOperationCode = "get_vm_ssh_key"
	APIClusterUpdateResponseOperationCodeUploadRootfs     APIClusterUpdateResponseOperationCode = "upload_rootfs"
	APIClusterUpdateResponseOperationCodeDeleteRootfs     APIClusterUpdateResponseOperationCode = "delete_rootfs"
	APIClusterUpdateResponseOperationCodeListRootfs       APIClusterUpdateResponseOperationCode = "list_rootfs"
)

func (APIClusterUpdateResponseOperationCode) IsKnown

type APIHealthService

type APIHealthService struct {
	Options []option.RequestOption
}

APIHealthService contains methods and other services that help with interacting with the vers 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 NewAPIHealthService method instead.

func NewAPIHealthService

func NewAPIHealthService(opts ...option.RequestOption) (r *APIHealthService)

NewAPIHealthService 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 (*APIHealthService) Check

func (r *APIHealthService) Check(ctx context.Context, opts ...option.RequestOption) (res *string, err error)

Get health of the API.

type APIRootfDeleteResponse

type APIRootfDeleteResponse struct {
	Data          APIRootfDeleteResponseData          `json:"data,required"`
	DurationNs    int64                               `json:"duration_ns,required"`
	OperationCode APIRootfDeleteResponseOperationCode `json:"operation_code,required"`
	OperationID   string                              `json:"operation_id,required"`
	// Unix epoch time (secs)
	TimeStart int64                      `json:"time_start,required"`
	JSON      apiRootfDeleteResponseJSON `json:"-"`
}

func (*APIRootfDeleteResponse) UnmarshalJSON

func (r *APIRootfDeleteResponse) UnmarshalJSON(data []byte) (err error)

type APIRootfDeleteResponseData

type APIRootfDeleteResponseData struct {
	RootfsName string                         `json:"rootfs_name,required"`
	JSON       apiRootfDeleteResponseDataJSON `json:"-"`
}

func (*APIRootfDeleteResponseData) UnmarshalJSON

func (r *APIRootfDeleteResponseData) UnmarshalJSON(data []byte) (err error)

type APIRootfDeleteResponseOperationCode

type APIRootfDeleteResponseOperationCode string
const (
	APIRootfDeleteResponseOperationCodeListClusters     APIRootfDeleteResponseOperationCode = "list_clusters"
	APIRootfDeleteResponseOperationCodeGetCluster       APIRootfDeleteResponseOperationCode = "get_cluster"
	APIRootfDeleteResponseOperationCodeCreateCluster    APIRootfDeleteResponseOperationCode = "create_cluster"
	APIRootfDeleteResponseOperationCodeDeleteCluster    APIRootfDeleteResponseOperationCode = "delete_cluster"
	APIRootfDeleteResponseOperationCodeUpdateCluster    APIRootfDeleteResponseOperationCode = "update_cluster"
	APIRootfDeleteResponseOperationCodeGetClusterSSHKey APIRootfDeleteResponseOperationCode = "get_cluster_ssh_key"
	APIRootfDeleteResponseOperationCodeListVms          APIRootfDeleteResponseOperationCode = "list_vms"
	APIRootfDeleteResponseOperationCodeGetVm            APIRootfDeleteResponseOperationCode = "get_vm"
	APIRootfDeleteResponseOperationCodeUpdateVm         APIRootfDeleteResponseOperationCode = "update_vm"
	APIRootfDeleteResponseOperationCodeBranchVm         APIRootfDeleteResponseOperationCode = "branch_vm"
	APIRootfDeleteResponseOperationCodeCommitVm         APIRootfDeleteResponseOperationCode = "commit_vm"
	APIRootfDeleteResponseOperationCodeDeleteVm         APIRootfDeleteResponseOperationCode = "delete_vm"
	APIRootfDeleteResponseOperationCodeGetVmSSHKey      APIRootfDeleteResponseOperationCode = "get_vm_ssh_key"
	APIRootfDeleteResponseOperationCodeUploadRootfs     APIRootfDeleteResponseOperationCode = "upload_rootfs"
	APIRootfDeleteResponseOperationCodeDeleteRootfs     APIRootfDeleteResponseOperationCode = "delete_rootfs"
	APIRootfDeleteResponseOperationCodeListRootfs       APIRootfDeleteResponseOperationCode = "list_rootfs"
)

func (APIRootfDeleteResponseOperationCode) IsKnown

type APIRootfListResponse

type APIRootfListResponse struct {
	Data          APIRootfListResponseData          `json:"data,required"`
	DurationNs    int64                             `json:"duration_ns,required"`
	OperationCode APIRootfListResponseOperationCode `json:"operation_code,required"`
	OperationID   string                            `json:"operation_id,required"`
	// Unix epoch time (secs)
	TimeStart int64                    `json:"time_start,required"`
	JSON      apiRootfListResponseJSON `json:"-"`
}

func (*APIRootfListResponse) UnmarshalJSON

func (r *APIRootfListResponse) UnmarshalJSON(data []byte) (err error)

type APIRootfListResponseData

type APIRootfListResponseData struct {
	RootfsNames []string                     `json:"rootfs_names,required"`
	JSON        apiRootfListResponseDataJSON `json:"-"`
}

func (*APIRootfListResponseData) UnmarshalJSON

func (r *APIRootfListResponseData) UnmarshalJSON(data []byte) (err error)

type APIRootfListResponseOperationCode

type APIRootfListResponseOperationCode string
const (
	APIRootfListResponseOperationCodeListClusters     APIRootfListResponseOperationCode = "list_clusters"
	APIRootfListResponseOperationCodeGetCluster       APIRootfListResponseOperationCode = "get_cluster"
	APIRootfListResponseOperationCodeCreateCluster    APIRootfListResponseOperationCode = "create_cluster"
	APIRootfListResponseOperationCodeDeleteCluster    APIRootfListResponseOperationCode = "delete_cluster"
	APIRootfListResponseOperationCodeUpdateCluster    APIRootfListResponseOperationCode = "update_cluster"
	APIRootfListResponseOperationCodeGetClusterSSHKey APIRootfListResponseOperationCode = "get_cluster_ssh_key"
	APIRootfListResponseOperationCodeListVms          APIRootfListResponseOperationCode = "list_vms"
	APIRootfListResponseOperationCodeGetVm            APIRootfListResponseOperationCode = "get_vm"
	APIRootfListResponseOperationCodeUpdateVm         APIRootfListResponseOperationCode = "update_vm"
	APIRootfListResponseOperationCodeBranchVm         APIRootfListResponseOperationCode = "branch_vm"
	APIRootfListResponseOperationCodeCommitVm         APIRootfListResponseOperationCode = "commit_vm"
	APIRootfListResponseOperationCodeDeleteVm         APIRootfListResponseOperationCode = "delete_vm"
	APIRootfListResponseOperationCodeGetVmSSHKey      APIRootfListResponseOperationCode = "get_vm_ssh_key"
	APIRootfListResponseOperationCodeUploadRootfs     APIRootfListResponseOperationCode = "upload_rootfs"
	APIRootfListResponseOperationCodeDeleteRootfs     APIRootfListResponseOperationCode = "delete_rootfs"
	APIRootfListResponseOperationCodeListRootfs       APIRootfListResponseOperationCode = "list_rootfs"
)

func (APIRootfListResponseOperationCode) IsKnown

type APIRootfService

type APIRootfService struct {
	Options []option.RequestOption
}

APIRootfService contains methods and other services that help with interacting with the vers 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 NewAPIRootfService method instead.

func NewAPIRootfService

func NewAPIRootfService(opts ...option.RequestOption) (r *APIRootfService)

NewAPIRootfService 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 (*APIRootfService) Delete

func (r *APIRootfService) Delete(ctx context.Context, rootfsID string, opts ...option.RequestOption) (res *APIRootfDeleteResponse, err error)

Delete an existing rootfs from the server.

func (*APIRootfService) List

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

List all available rootfs names on the server.

func (*APIRootfService) Upload

func (r *APIRootfService) Upload(ctx context.Context, rootfsID string, body APIRootfUploadParams, opts ...option.RequestOption) (res *APIRootfUploadResponse, err error)

Upload a rootfs tar archive to the server. The archive should contain the Dockerfile and all necessary dependencies.

type APIRootfUploadParams

type APIRootfUploadParams struct {
	// The path of the Dockerfile contained within the tar archive
	Dockerfile param.Field[string] `query:"dockerfile"`
}

func (APIRootfUploadParams) URLQuery

func (r APIRootfUploadParams) URLQuery() (v url.Values)

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

type APIRootfUploadResponse

type APIRootfUploadResponse struct {
	Data          APIRootfUploadResponseData          `json:"data,required"`
	DurationNs    int64                               `json:"duration_ns,required"`
	OperationCode APIRootfUploadResponseOperationCode `json:"operation_code,required"`
	OperationID   string                              `json:"operation_id,required"`
	// Unix epoch time (secs)
	TimeStart int64                      `json:"time_start,required"`
	JSON      apiRootfUploadResponseJSON `json:"-"`
}

func (*APIRootfUploadResponse) UnmarshalJSON

func (r *APIRootfUploadResponse) UnmarshalJSON(data []byte) (err error)

type APIRootfUploadResponseData

type APIRootfUploadResponseData struct {
	RootfsName string                         `json:"rootfs_name,required"`
	JSON       apiRootfUploadResponseDataJSON `json:"-"`
}

func (*APIRootfUploadResponseData) UnmarshalJSON

func (r *APIRootfUploadResponseData) UnmarshalJSON(data []byte) (err error)

type APIRootfUploadResponseOperationCode

type APIRootfUploadResponseOperationCode string
const (
	APIRootfUploadResponseOperationCodeListClusters     APIRootfUploadResponseOperationCode = "list_clusters"
	APIRootfUploadResponseOperationCodeGetCluster       APIRootfUploadResponseOperationCode = "get_cluster"
	APIRootfUploadResponseOperationCodeCreateCluster    APIRootfUploadResponseOperationCode = "create_cluster"
	APIRootfUploadResponseOperationCodeDeleteCluster    APIRootfUploadResponseOperationCode = "delete_cluster"
	APIRootfUploadResponseOperationCodeUpdateCluster    APIRootfUploadResponseOperationCode = "update_cluster"
	APIRootfUploadResponseOperationCodeGetClusterSSHKey APIRootfUploadResponseOperationCode = "get_cluster_ssh_key"
	APIRootfUploadResponseOperationCodeListVms          APIRootfUploadResponseOperationCode = "list_vms"
	APIRootfUploadResponseOperationCodeGetVm            APIRootfUploadResponseOperationCode = "get_vm"
	APIRootfUploadResponseOperationCodeUpdateVm         APIRootfUploadResponseOperationCode = "update_vm"
	APIRootfUploadResponseOperationCodeBranchVm         APIRootfUploadResponseOperationCode = "branch_vm"
	APIRootfUploadResponseOperationCodeCommitVm         APIRootfUploadResponseOperationCode = "commit_vm"
	APIRootfUploadResponseOperationCodeDeleteVm         APIRootfUploadResponseOperationCode = "delete_vm"
	APIRootfUploadResponseOperationCodeGetVmSSHKey      APIRootfUploadResponseOperationCode = "get_vm_ssh_key"
	APIRootfUploadResponseOperationCodeUploadRootfs     APIRootfUploadResponseOperationCode = "upload_rootfs"
	APIRootfUploadResponseOperationCodeDeleteRootfs     APIRootfUploadResponseOperationCode = "delete_rootfs"
	APIRootfUploadResponseOperationCodeListRootfs       APIRootfUploadResponseOperationCode = "list_rootfs"
)

func (APIRootfUploadResponseOperationCode) IsKnown

type APIService

type APIService struct {
	Options   []option.RequestOption
	Cluster   *APIClusterService
	Vm        *APIVmService
	Rootfs    *APIRootfService
	Health    *APIHealthService
	Telemetry *APITelemetryService
}

APIService contains methods and other services that help with interacting with the vers 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 NewAPIService method instead.

func NewAPIService

func NewAPIService(opts ...option.RequestOption) (r *APIService)

NewAPIService 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.

type APITelemetryService

type APITelemetryService struct {
	Options []option.RequestOption
}

APITelemetryService contains methods and other services that help with interacting with the vers 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 NewAPITelemetryService method instead.

func NewAPITelemetryService

func NewAPITelemetryService(opts ...option.RequestOption) (r *APITelemetryService)

NewAPITelemetryService 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 (*APITelemetryService) GetInfo

func (r *APITelemetryService) GetInfo(ctx context.Context, opts ...option.RequestOption) (res *TelemetryDto, err error)

Get telemetry information

type APIVmBranchParams

type APIVmBranchParams struct {
	VmBranchRequest VmBranchRequestParam `json:"vm_branch_request,required"`
}

func (APIVmBranchParams) MarshalJSON

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

type APIVmBranchResponse

type APIVmBranchResponse struct {
	Data          APIVmBranchResponseData          `json:"data,required"`
	DurationNs    int64                            `json:"duration_ns,required"`
	OperationCode APIVmBranchResponseOperationCode `json:"operation_code,required"`
	OperationID   string                           `json:"operation_id,required"`
	// Unix epoch time (secs)
	TimeStart int64                   `json:"time_start,required"`
	JSON      apiVmBranchResponseJSON `json:"-"`
}

func (*APIVmBranchResponse) UnmarshalJSON

func (r *APIVmBranchResponse) UnmarshalJSON(data []byte) (err error)

type APIVmBranchResponseData

type APIVmBranchResponseData struct {
	// The ID of the VM.
	ID string `json:"id,required"`
	// The IDs of direct children branched from this VM.
	Children []string `json:"children,required"`
	// The VM's cluster ID
	ClusterID string `json:"cluster_id,required"`
	// What is the size of the "disk" allocated to this VM
	FsSizeMib int64 `json:"fs_size_mib,required"`
	// The VM's local IP address on the VM subnet
	IPAddress string `json:"ip_address,required"`
	// How much RAM is allocated to this VM
	MemSizeMib int64 `json:"mem_size_mib,required"`
	// The VM's network configuration
	NetworkInfo APIVmBranchResponseDataNetworkInfo `json:"network_info,required"`
	// Whether the VM is running, paused, or not started.
	State APIVmBranchResponseDataState `json:"state,required"`
	// How many vCPUs were allocated to this VM
	VcpuCount int64 `json:"vcpu_count,required"`
	// Human-readable name assigned to the VM.
	Alias string `json:"alias,nullable"`
	// The parent VM's ID, if present. If None, then this VM is a root VM.
	ParentID string                      `json:"parent_id,nullable"`
	JSON     apiVmBranchResponseDataJSON `json:"-"`
}

func (*APIVmBranchResponseData) UnmarshalJSON

func (r *APIVmBranchResponseData) UnmarshalJSON(data []byte) (err error)

type APIVmBranchResponseDataNetworkInfo

type APIVmBranchResponseDataNetworkInfo struct {
	GuestIP     string                                 `json:"guest_ip,required"`
	GuestMac    string                                 `json:"guest_mac,required"`
	SSHPort     int64                                  `json:"ssh_port,required"`
	Tap0IP      string                                 `json:"tap0_ip,required"`
	Tap0Name    string                                 `json:"tap0_name,required"`
	VmNamespace string                                 `json:"vm_namespace,required"`
	JSON        apiVmBranchResponseDataNetworkInfoJSON `json:"-"`
}

The VM's network configuration

func (*APIVmBranchResponseDataNetworkInfo) UnmarshalJSON

func (r *APIVmBranchResponseDataNetworkInfo) UnmarshalJSON(data []byte) (err error)

type APIVmBranchResponseDataState

type APIVmBranchResponseDataState string

Whether the VM is running, paused, or not started.

const (
	APIVmBranchResponseDataStateNotStarted APIVmBranchResponseDataState = "Not started"
	APIVmBranchResponseDataStateRunning    APIVmBranchResponseDataState = "Running"
	APIVmBranchResponseDataStatePaused     APIVmBranchResponseDataState = "Paused"
)

func (APIVmBranchResponseDataState) IsKnown

func (r APIVmBranchResponseDataState) IsKnown() bool

type APIVmBranchResponseOperationCode

type APIVmBranchResponseOperationCode string
const (
	APIVmBranchResponseOperationCodeListClusters     APIVmBranchResponseOperationCode = "list_clusters"
	APIVmBranchResponseOperationCodeGetCluster       APIVmBranchResponseOperationCode = "get_cluster"
	APIVmBranchResponseOperationCodeCreateCluster    APIVmBranchResponseOperationCode = "create_cluster"
	APIVmBranchResponseOperationCodeDeleteCluster    APIVmBranchResponseOperationCode = "delete_cluster"
	APIVmBranchResponseOperationCodeUpdateCluster    APIVmBranchResponseOperationCode = "update_cluster"
	APIVmBranchResponseOperationCodeGetClusterSSHKey APIVmBranchResponseOperationCode = "get_cluster_ssh_key"
	APIVmBranchResponseOperationCodeListVms          APIVmBranchResponseOperationCode = "list_vms"
	APIVmBranchResponseOperationCodeGetVm            APIVmBranchResponseOperationCode = "get_vm"
	APIVmBranchResponseOperationCodeUpdateVm         APIVmBranchResponseOperationCode = "update_vm"
	APIVmBranchResponseOperationCodeBranchVm         APIVmBranchResponseOperationCode = "branch_vm"
	APIVmBranchResponseOperationCodeCommitVm         APIVmBranchResponseOperationCode = "commit_vm"
	APIVmBranchResponseOperationCodeDeleteVm         APIVmBranchResponseOperationCode = "delete_vm"
	APIVmBranchResponseOperationCodeGetVmSSHKey      APIVmBranchResponseOperationCode = "get_vm_ssh_key"
	APIVmBranchResponseOperationCodeUploadRootfs     APIVmBranchResponseOperationCode = "upload_rootfs"
	APIVmBranchResponseOperationCodeDeleteRootfs     APIVmBranchResponseOperationCode = "delete_rootfs"
	APIVmBranchResponseOperationCodeListRootfs       APIVmBranchResponseOperationCode = "list_rootfs"
)

func (APIVmBranchResponseOperationCode) IsKnown

type APIVmCommitParams

type APIVmCommitParams struct {
	VmCommitRequest VmCommitRequestParam `json:"vm_commit_request,required"`
}

func (APIVmCommitParams) MarshalJSON

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

type APIVmCommitResponse

type APIVmCommitResponse struct {
	Data          APIVmCommitResponseData          `json:"data,required"`
	DurationNs    int64                            `json:"duration_ns,required"`
	OperationCode APIVmCommitResponseOperationCode `json:"operation_code,required"`
	OperationID   string                           `json:"operation_id,required"`
	// Unix epoch time (secs)
	TimeStart int64                   `json:"time_start,required"`
	JSON      apiVmCommitResponseJSON `json:"-"`
}

func (*APIVmCommitResponse) UnmarshalJSON

func (r *APIVmCommitResponse) UnmarshalJSON(data []byte) (err error)

type APIVmCommitResponseData

type APIVmCommitResponseData struct {
	ClusterID        string                      `json:"cluster_id,required"`
	CommitID         string                      `json:"commit_id,required"`
	HostArchitecture string                      `json:"host_architecture,required"`
	JSON             apiVmCommitResponseDataJSON `json:"-"`
}

func (*APIVmCommitResponseData) UnmarshalJSON

func (r *APIVmCommitResponseData) UnmarshalJSON(data []byte) (err error)

type APIVmCommitResponseOperationCode

type APIVmCommitResponseOperationCode string
const (
	APIVmCommitResponseOperationCodeListClusters     APIVmCommitResponseOperationCode = "list_clusters"
	APIVmCommitResponseOperationCodeGetCluster       APIVmCommitResponseOperationCode = "get_cluster"
	APIVmCommitResponseOperationCodeCreateCluster    APIVmCommitResponseOperationCode = "create_cluster"
	APIVmCommitResponseOperationCodeDeleteCluster    APIVmCommitResponseOperationCode = "delete_cluster"
	APIVmCommitResponseOperationCodeUpdateCluster    APIVmCommitResponseOperationCode = "update_cluster"
	APIVmCommitResponseOperationCodeGetClusterSSHKey APIVmCommitResponseOperationCode = "get_cluster_ssh_key"
	APIVmCommitResponseOperationCodeListVms          APIVmCommitResponseOperationCode = "list_vms"
	APIVmCommitResponseOperationCodeGetVm            APIVmCommitResponseOperationCode = "get_vm"
	APIVmCommitResponseOperationCodeUpdateVm         APIVmCommitResponseOperationCode = "update_vm"
	APIVmCommitResponseOperationCodeBranchVm         APIVmCommitResponseOperationCode = "branch_vm"
	APIVmCommitResponseOperationCodeCommitVm         APIVmCommitResponseOperationCode = "commit_vm"
	APIVmCommitResponseOperationCodeDeleteVm         APIVmCommitResponseOperationCode = "delete_vm"
	APIVmCommitResponseOperationCodeGetVmSSHKey      APIVmCommitResponseOperationCode = "get_vm_ssh_key"
	APIVmCommitResponseOperationCodeUploadRootfs     APIVmCommitResponseOperationCode = "upload_rootfs"
	APIVmCommitResponseOperationCodeDeleteRootfs     APIVmCommitResponseOperationCode = "delete_rootfs"
	APIVmCommitResponseOperationCodeListRootfs       APIVmCommitResponseOperationCode = "list_rootfs"
)

func (APIVmCommitResponseOperationCode) IsKnown

type APIVmDeleteParams

type APIVmDeleteParams struct {
	// Delete children recursively
	Recursive param.Field[bool] `query:"recursive,required"`
}

func (APIVmDeleteParams) URLQuery

func (r APIVmDeleteParams) URLQuery() (v url.Values)

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

type APIVmDeleteResponse

type APIVmDeleteResponse struct {
	// A struct containing information about an attempted VM deletion request. Reports
	// information in the event of a partial failure so billing can still be udpated
	// appropriately.
	Data          APIVmDeleteResponseData          `json:"data,required"`
	DurationNs    int64                            `json:"duration_ns,required"`
	OperationCode APIVmDeleteResponseOperationCode `json:"operation_code,required"`
	OperationID   string                           `json:"operation_id,required"`
	// Unix epoch time (secs)
	TimeStart int64                   `json:"time_start,required"`
	JSON      apiVmDeleteResponseJSON `json:"-"`
}

func (*APIVmDeleteResponse) UnmarshalJSON

func (r *APIVmDeleteResponse) UnmarshalJSON(data []byte) (err error)

type APIVmDeleteResponseData

type APIVmDeleteResponseData struct {
	DeletedIDs []string                       `json:"deleted_ids,required"`
	Errors     []APIVmDeleteResponseDataError `json:"errors,required"`
	JSON       apiVmDeleteResponseDataJSON    `json:"-"`
}

A struct containing information about an attempted VM deletion request. Reports information in the event of a partial failure so billing can still be udpated appropriately.

func (*APIVmDeleteResponseData) UnmarshalJSON

func (r *APIVmDeleteResponseData) UnmarshalJSON(data []byte) (err error)

type APIVmDeleteResponseDataError

type APIVmDeleteResponseDataError struct {
	ID    string                           `json:"id,required"`
	Error string                           `json:"error,required"`
	JSON  apiVmDeleteResponseDataErrorJSON `json:"-"`
}

Contains a VM ID and the reason that it could not be deleted.

func (*APIVmDeleteResponseDataError) UnmarshalJSON

func (r *APIVmDeleteResponseDataError) UnmarshalJSON(data []byte) (err error)

type APIVmDeleteResponseOperationCode

type APIVmDeleteResponseOperationCode string
const (
	APIVmDeleteResponseOperationCodeListClusters     APIVmDeleteResponseOperationCode = "list_clusters"
	APIVmDeleteResponseOperationCodeGetCluster       APIVmDeleteResponseOperationCode = "get_cluster"
	APIVmDeleteResponseOperationCodeCreateCluster    APIVmDeleteResponseOperationCode = "create_cluster"
	APIVmDeleteResponseOperationCodeDeleteCluster    APIVmDeleteResponseOperationCode = "delete_cluster"
	APIVmDeleteResponseOperationCodeUpdateCluster    APIVmDeleteResponseOperationCode = "update_cluster"
	APIVmDeleteResponseOperationCodeGetClusterSSHKey APIVmDeleteResponseOperationCode = "get_cluster_ssh_key"
	APIVmDeleteResponseOperationCodeListVms          APIVmDeleteResponseOperationCode = "list_vms"
	APIVmDeleteResponseOperationCodeGetVm            APIVmDeleteResponseOperationCode = "get_vm"
	APIVmDeleteResponseOperationCodeUpdateVm         APIVmDeleteResponseOperationCode = "update_vm"
	APIVmDeleteResponseOperationCodeBranchVm         APIVmDeleteResponseOperationCode = "branch_vm"
	APIVmDeleteResponseOperationCodeCommitVm         APIVmDeleteResponseOperationCode = "commit_vm"
	APIVmDeleteResponseOperationCodeDeleteVm         APIVmDeleteResponseOperationCode = "delete_vm"
	APIVmDeleteResponseOperationCodeGetVmSSHKey      APIVmDeleteResponseOperationCode = "get_vm_ssh_key"
	APIVmDeleteResponseOperationCodeUploadRootfs     APIVmDeleteResponseOperationCode = "upload_rootfs"
	APIVmDeleteResponseOperationCodeDeleteRootfs     APIVmDeleteResponseOperationCode = "delete_rootfs"
	APIVmDeleteResponseOperationCodeListRootfs       APIVmDeleteResponseOperationCode = "list_rootfs"
)

func (APIVmDeleteResponseOperationCode) IsKnown

type APIVmGetResponse

type APIVmGetResponse struct {
	Data          APIVmGetResponseData          `json:"data,required"`
	DurationNs    int64                         `json:"duration_ns,required"`
	OperationCode APIVmGetResponseOperationCode `json:"operation_code,required"`
	OperationID   string                        `json:"operation_id,required"`
	// Unix epoch time (secs)
	TimeStart int64                `json:"time_start,required"`
	JSON      apiVmGetResponseJSON `json:"-"`
}

func (*APIVmGetResponse) UnmarshalJSON

func (r *APIVmGetResponse) UnmarshalJSON(data []byte) (err error)

type APIVmGetResponseData

type APIVmGetResponseData struct {
	// The ID of the VM.
	ID string `json:"id,required"`
	// The IDs of direct children branched from this VM.
	Children []string `json:"children,required"`
	// The VM's cluster ID
	ClusterID string `json:"cluster_id,required"`
	// What is the size of the "disk" allocated to this VM
	FsSizeMib int64 `json:"fs_size_mib,required"`
	// The VM's local IP address on the VM subnet
	IPAddress string `json:"ip_address,required"`
	// How much RAM is allocated to this VM
	MemSizeMib int64 `json:"mem_size_mib,required"`
	// The VM's network configuration
	NetworkInfo APIVmGetResponseDataNetworkInfo `json:"network_info,required"`
	// Whether the VM is running, paused, or not started.
	State APIVmGetResponseDataState `json:"state,required"`
	// How many vCPUs were allocated to this VM
	VcpuCount int64 `json:"vcpu_count,required"`
	// Human-readable name assigned to the VM.
	Alias string `json:"alias,nullable"`
	// The parent VM's ID, if present. If None, then this VM is a root VM.
	ParentID string                   `json:"parent_id,nullable"`
	JSON     apiVmGetResponseDataJSON `json:"-"`
}

func (*APIVmGetResponseData) UnmarshalJSON

func (r *APIVmGetResponseData) UnmarshalJSON(data []byte) (err error)

type APIVmGetResponseDataNetworkInfo

type APIVmGetResponseDataNetworkInfo struct {
	GuestIP     string                              `json:"guest_ip,required"`
	GuestMac    string                              `json:"guest_mac,required"`
	SSHPort     int64                               `json:"ssh_port,required"`
	Tap0IP      string                              `json:"tap0_ip,required"`
	Tap0Name    string                              `json:"tap0_name,required"`
	VmNamespace string                              `json:"vm_namespace,required"`
	JSON        apiVmGetResponseDataNetworkInfoJSON `json:"-"`
}

The VM's network configuration

func (*APIVmGetResponseDataNetworkInfo) UnmarshalJSON

func (r *APIVmGetResponseDataNetworkInfo) UnmarshalJSON(data []byte) (err error)

type APIVmGetResponseDataState

type APIVmGetResponseDataState string

Whether the VM is running, paused, or not started.

const (
	APIVmGetResponseDataStateNotStarted APIVmGetResponseDataState = "Not started"
	APIVmGetResponseDataStateRunning    APIVmGetResponseDataState = "Running"
	APIVmGetResponseDataStatePaused     APIVmGetResponseDataState = "Paused"
)

func (APIVmGetResponseDataState) IsKnown

func (r APIVmGetResponseDataState) IsKnown() bool

type APIVmGetResponseOperationCode

type APIVmGetResponseOperationCode string
const (
	APIVmGetResponseOperationCodeListClusters     APIVmGetResponseOperationCode = "list_clusters"
	APIVmGetResponseOperationCodeGetCluster       APIVmGetResponseOperationCode = "get_cluster"
	APIVmGetResponseOperationCodeCreateCluster    APIVmGetResponseOperationCode = "create_cluster"
	APIVmGetResponseOperationCodeDeleteCluster    APIVmGetResponseOperationCode = "delete_cluster"
	APIVmGetResponseOperationCodeUpdateCluster    APIVmGetResponseOperationCode = "update_cluster"
	APIVmGetResponseOperationCodeGetClusterSSHKey APIVmGetResponseOperationCode = "get_cluster_ssh_key"
	APIVmGetResponseOperationCodeListVms          APIVmGetResponseOperationCode = "list_vms"
	APIVmGetResponseOperationCodeGetVm            APIVmGetResponseOperationCode = "get_vm"
	APIVmGetResponseOperationCodeUpdateVm         APIVmGetResponseOperationCode = "update_vm"
	APIVmGetResponseOperationCodeBranchVm         APIVmGetResponseOperationCode = "branch_vm"
	APIVmGetResponseOperationCodeCommitVm         APIVmGetResponseOperationCode = "commit_vm"
	APIVmGetResponseOperationCodeDeleteVm         APIVmGetResponseOperationCode = "delete_vm"
	APIVmGetResponseOperationCodeGetVmSSHKey      APIVmGetResponseOperationCode = "get_vm_ssh_key"
	APIVmGetResponseOperationCodeUploadRootfs     APIVmGetResponseOperationCode = "upload_rootfs"
	APIVmGetResponseOperationCodeDeleteRootfs     APIVmGetResponseOperationCode = "delete_rootfs"
	APIVmGetResponseOperationCodeListRootfs       APIVmGetResponseOperationCode = "list_rootfs"
)

func (APIVmGetResponseOperationCode) IsKnown

func (r APIVmGetResponseOperationCode) IsKnown() bool

type APIVmGetSSHKeyResponse

type APIVmGetSSHKeyResponse struct {
	Data          string                              `json:"data,required"`
	DurationNs    int64                               `json:"duration_ns,required"`
	OperationCode APIVmGetSSHKeyResponseOperationCode `json:"operation_code,required"`
	OperationID   string                              `json:"operation_id,required"`
	// Unix epoch time (secs)
	TimeStart int64                      `json:"time_start,required"`
	JSON      apiVmGetSSHKeyResponseJSON `json:"-"`
}

func (*APIVmGetSSHKeyResponse) UnmarshalJSON

func (r *APIVmGetSSHKeyResponse) UnmarshalJSON(data []byte) (err error)

type APIVmGetSSHKeyResponseOperationCode

type APIVmGetSSHKeyResponseOperationCode string
const (
	APIVmGetSSHKeyResponseOperationCodeListClusters     APIVmGetSSHKeyResponseOperationCode = "list_clusters"
	APIVmGetSSHKeyResponseOperationCodeGetCluster       APIVmGetSSHKeyResponseOperationCode = "get_cluster"
	APIVmGetSSHKeyResponseOperationCodeCreateCluster    APIVmGetSSHKeyResponseOperationCode = "create_cluster"
	APIVmGetSSHKeyResponseOperationCodeDeleteCluster    APIVmGetSSHKeyResponseOperationCode = "delete_cluster"
	APIVmGetSSHKeyResponseOperationCodeUpdateCluster    APIVmGetSSHKeyResponseOperationCode = "update_cluster"
	APIVmGetSSHKeyResponseOperationCodeGetClusterSSHKey APIVmGetSSHKeyResponseOperationCode = "get_cluster_ssh_key"
	APIVmGetSSHKeyResponseOperationCodeListVms          APIVmGetSSHKeyResponseOperationCode = "list_vms"
	APIVmGetSSHKeyResponseOperationCodeGetVm            APIVmGetSSHKeyResponseOperationCode = "get_vm"
	APIVmGetSSHKeyResponseOperationCodeUpdateVm         APIVmGetSSHKeyResponseOperationCode = "update_vm"
	APIVmGetSSHKeyResponseOperationCodeBranchVm         APIVmGetSSHKeyResponseOperationCode = "branch_vm"
	APIVmGetSSHKeyResponseOperationCodeCommitVm         APIVmGetSSHKeyResponseOperationCode = "commit_vm"
	APIVmGetSSHKeyResponseOperationCodeDeleteVm         APIVmGetSSHKeyResponseOperationCode = "delete_vm"
	APIVmGetSSHKeyResponseOperationCodeGetVmSSHKey      APIVmGetSSHKeyResponseOperationCode = "get_vm_ssh_key"
	APIVmGetSSHKeyResponseOperationCodeUploadRootfs     APIVmGetSSHKeyResponseOperationCode = "upload_rootfs"
	APIVmGetSSHKeyResponseOperationCodeDeleteRootfs     APIVmGetSSHKeyResponseOperationCode = "delete_rootfs"
	APIVmGetSSHKeyResponseOperationCodeListRootfs       APIVmGetSSHKeyResponseOperationCode = "list_rootfs"
)

func (APIVmGetSSHKeyResponseOperationCode) IsKnown

type APIVmListResponse

type APIVmListResponse struct {
	Data          []APIVmListResponseData        `json:"data,required"`
	DurationNs    int64                          `json:"duration_ns,required"`
	OperationCode APIVmListResponseOperationCode `json:"operation_code,required"`
	OperationID   string                         `json:"operation_id,required"`
	// Unix epoch time (secs)
	TimeStart int64                 `json:"time_start,required"`
	JSON      apiVmListResponseJSON `json:"-"`
}

func (*APIVmListResponse) UnmarshalJSON

func (r *APIVmListResponse) UnmarshalJSON(data []byte) (err error)

type APIVmListResponseData

type APIVmListResponseData struct {
	// The ID of the VM.
	ID string `json:"id,required"`
	// The IDs of direct children branched from this VM.
	Children []string `json:"children,required"`
	// The VM's cluster ID
	ClusterID string `json:"cluster_id,required"`
	// What is the size of the "disk" allocated to this VM
	FsSizeMib int64 `json:"fs_size_mib,required"`
	// The VM's local IP address on the VM subnet
	IPAddress string `json:"ip_address,required"`
	// How much RAM is allocated to this VM
	MemSizeMib int64 `json:"mem_size_mib,required"`
	// The VM's network configuration
	NetworkInfo APIVmListResponseDataNetworkInfo `json:"network_info,required"`
	// Whether the VM is running, paused, or not started.
	State APIVmListResponseDataState `json:"state,required"`
	// How many vCPUs were allocated to this VM
	VcpuCount int64 `json:"vcpu_count,required"`
	// Human-readable name assigned to the VM.
	Alias string `json:"alias,nullable"`
	// The parent VM's ID, if present. If None, then this VM is a root VM.
	ParentID string                    `json:"parent_id,nullable"`
	JSON     apiVmListResponseDataJSON `json:"-"`
}

func (*APIVmListResponseData) UnmarshalJSON

func (r *APIVmListResponseData) UnmarshalJSON(data []byte) (err error)

type APIVmListResponseDataNetworkInfo

type APIVmListResponseDataNetworkInfo struct {
	GuestIP     string                               `json:"guest_ip,required"`
	GuestMac    string                               `json:"guest_mac,required"`
	SSHPort     int64                                `json:"ssh_port,required"`
	Tap0IP      string                               `json:"tap0_ip,required"`
	Tap0Name    string                               `json:"tap0_name,required"`
	VmNamespace string                               `json:"vm_namespace,required"`
	JSON        apiVmListResponseDataNetworkInfoJSON `json:"-"`
}

The VM's network configuration

func (*APIVmListResponseDataNetworkInfo) UnmarshalJSON

func (r *APIVmListResponseDataNetworkInfo) UnmarshalJSON(data []byte) (err error)

type APIVmListResponseDataState

type APIVmListResponseDataState string

Whether the VM is running, paused, or not started.

const (
	APIVmListResponseDataStateNotStarted APIVmListResponseDataState = "Not started"
	APIVmListResponseDataStateRunning    APIVmListResponseDataState = "Running"
	APIVmListResponseDataStatePaused     APIVmListResponseDataState = "Paused"
)

func (APIVmListResponseDataState) IsKnown

func (r APIVmListResponseDataState) IsKnown() bool

type APIVmListResponseOperationCode

type APIVmListResponseOperationCode string
const (
	APIVmListResponseOperationCodeListClusters     APIVmListResponseOperationCode = "list_clusters"
	APIVmListResponseOperationCodeGetCluster       APIVmListResponseOperationCode = "get_cluster"
	APIVmListResponseOperationCodeCreateCluster    APIVmListResponseOperationCode = "create_cluster"
	APIVmListResponseOperationCodeDeleteCluster    APIVmListResponseOperationCode = "delete_cluster"
	APIVmListResponseOperationCodeUpdateCluster    APIVmListResponseOperationCode = "update_cluster"
	APIVmListResponseOperationCodeGetClusterSSHKey APIVmListResponseOperationCode = "get_cluster_ssh_key"
	APIVmListResponseOperationCodeListVms          APIVmListResponseOperationCode = "list_vms"
	APIVmListResponseOperationCodeGetVm            APIVmListResponseOperationCode = "get_vm"
	APIVmListResponseOperationCodeUpdateVm         APIVmListResponseOperationCode = "update_vm"
	APIVmListResponseOperationCodeBranchVm         APIVmListResponseOperationCode = "branch_vm"
	APIVmListResponseOperationCodeCommitVm         APIVmListResponseOperationCode = "commit_vm"
	APIVmListResponseOperationCodeDeleteVm         APIVmListResponseOperationCode = "delete_vm"
	APIVmListResponseOperationCodeGetVmSSHKey      APIVmListResponseOperationCode = "get_vm_ssh_key"
	APIVmListResponseOperationCodeUploadRootfs     APIVmListResponseOperationCode = "upload_rootfs"
	APIVmListResponseOperationCodeDeleteRootfs     APIVmListResponseOperationCode = "delete_rootfs"
	APIVmListResponseOperationCodeListRootfs       APIVmListResponseOperationCode = "list_rootfs"
)

func (APIVmListResponseOperationCode) IsKnown

type APIVmService

type APIVmService struct {
	Options []option.RequestOption
}

APIVmService contains methods and other services that help with interacting with the vers 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 NewAPIVmService method instead.

func NewAPIVmService

func NewAPIVmService(opts ...option.RequestOption) (r *APIVmService)

NewAPIVmService 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 (*APIVmService) Branch

func (r *APIVmService) Branch(ctx context.Context, vmIDOrAlias string, body APIVmBranchParams, opts ...option.RequestOption) (res *APIVmBranchResponse, err error)

Branch a VM.

func (*APIVmService) Commit

func (r *APIVmService) Commit(ctx context.Context, vmIDOrAlias string, body APIVmCommitParams, opts ...option.RequestOption) (res *APIVmCommitResponse, err error)

Commit a VM.

func (*APIVmService) Delete

func (r *APIVmService) Delete(ctx context.Context, vmIDOrAlias string, body APIVmDeleteParams, opts ...option.RequestOption) (res *APIVmDeleteResponse, err error)

Delete a VM.

func (*APIVmService) Get

func (r *APIVmService) Get(ctx context.Context, vmIDOrAlias string, opts ...option.RequestOption) (res *APIVmGetResponse, err error)

Retrieve information on a particular VM.

func (*APIVmService) GetSSHKey

func (r *APIVmService) GetSSHKey(ctx context.Context, vmIDOrAlias string, opts ...option.RequestOption) (res *APIVmGetSSHKeyResponse, err error)

Get the SSH private key for VM access

func (*APIVmService) List

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

List all VMs.

func (*APIVmService) Update

func (r *APIVmService) Update(ctx context.Context, vmIDOrAlias string, body APIVmUpdateParams, opts ...option.RequestOption) (res *APIVmUpdateResponse, err error)

Update VM state.

type APIVmUpdateParams

type APIVmUpdateParams struct {
	VmPatchRequest VmPatchRequestParam `json:"vm_patch_request,required"`
}

func (APIVmUpdateParams) MarshalJSON

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

type APIVmUpdateResponse

type APIVmUpdateResponse struct {
	Data          APIVmUpdateResponseData          `json:"data,required"`
	DurationNs    int64                            `json:"duration_ns,required"`
	OperationCode APIVmUpdateResponseOperationCode `json:"operation_code,required"`
	OperationID   string                           `json:"operation_id,required"`
	// Unix epoch time (secs)
	TimeStart int64                   `json:"time_start,required"`
	JSON      apiVmUpdateResponseJSON `json:"-"`
}

func (*APIVmUpdateResponse) UnmarshalJSON

func (r *APIVmUpdateResponse) UnmarshalJSON(data []byte) (err error)

type APIVmUpdateResponseData

type APIVmUpdateResponseData struct {
	// The ID of the VM.
	ID string `json:"id,required"`
	// The IDs of direct children branched from this VM.
	Children []string `json:"children,required"`
	// The VM's cluster ID
	ClusterID string `json:"cluster_id,required"`
	// What is the size of the "disk" allocated to this VM
	FsSizeMib int64 `json:"fs_size_mib,required"`
	// The VM's local IP address on the VM subnet
	IPAddress string `json:"ip_address,required"`
	// How much RAM is allocated to this VM
	MemSizeMib int64 `json:"mem_size_mib,required"`
	// The VM's network configuration
	NetworkInfo APIVmUpdateResponseDataNetworkInfo `json:"network_info,required"`
	// Whether the VM is running, paused, or not started.
	State APIVmUpdateResponseDataState `json:"state,required"`
	// How many vCPUs were allocated to this VM
	VcpuCount int64 `json:"vcpu_count,required"`
	// Human-readable name assigned to the VM.
	Alias string `json:"alias,nullable"`
	// The parent VM's ID, if present. If None, then this VM is a root VM.
	ParentID string                      `json:"parent_id,nullable"`
	JSON     apiVmUpdateResponseDataJSON `json:"-"`
}

func (*APIVmUpdateResponseData) UnmarshalJSON

func (r *APIVmUpdateResponseData) UnmarshalJSON(data []byte) (err error)

type APIVmUpdateResponseDataNetworkInfo

type APIVmUpdateResponseDataNetworkInfo struct {
	GuestIP     string                                 `json:"guest_ip,required"`
	GuestMac    string                                 `json:"guest_mac,required"`
	SSHPort     int64                                  `json:"ssh_port,required"`
	Tap0IP      string                                 `json:"tap0_ip,required"`
	Tap0Name    string                                 `json:"tap0_name,required"`
	VmNamespace string                                 `json:"vm_namespace,required"`
	JSON        apiVmUpdateResponseDataNetworkInfoJSON `json:"-"`
}

The VM's network configuration

func (*APIVmUpdateResponseDataNetworkInfo) UnmarshalJSON

func (r *APIVmUpdateResponseDataNetworkInfo) UnmarshalJSON(data []byte) (err error)

type APIVmUpdateResponseDataState

type APIVmUpdateResponseDataState string

Whether the VM is running, paused, or not started.

const (
	APIVmUpdateResponseDataStateNotStarted APIVmUpdateResponseDataState = "Not started"
	APIVmUpdateResponseDataStateRunning    APIVmUpdateResponseDataState = "Running"
	APIVmUpdateResponseDataStatePaused     APIVmUpdateResponseDataState = "Paused"
)

func (APIVmUpdateResponseDataState) IsKnown

func (r APIVmUpdateResponseDataState) IsKnown() bool

type APIVmUpdateResponseOperationCode

type APIVmUpdateResponseOperationCode string
const (
	APIVmUpdateResponseOperationCodeListClusters     APIVmUpdateResponseOperationCode = "list_clusters"
	APIVmUpdateResponseOperationCodeGetCluster       APIVmUpdateResponseOperationCode = "get_cluster"
	APIVmUpdateResponseOperationCodeCreateCluster    APIVmUpdateResponseOperationCode = "create_cluster"
	APIVmUpdateResponseOperationCodeDeleteCluster    APIVmUpdateResponseOperationCode = "delete_cluster"
	APIVmUpdateResponseOperationCodeUpdateCluster    APIVmUpdateResponseOperationCode = "update_cluster"
	APIVmUpdateResponseOperationCodeGetClusterSSHKey APIVmUpdateResponseOperationCode = "get_cluster_ssh_key"
	APIVmUpdateResponseOperationCodeListVms          APIVmUpdateResponseOperationCode = "list_vms"
	APIVmUpdateResponseOperationCodeGetVm            APIVmUpdateResponseOperationCode = "get_vm"
	APIVmUpdateResponseOperationCodeUpdateVm         APIVmUpdateResponseOperationCode = "update_vm"
	APIVmUpdateResponseOperationCodeBranchVm         APIVmUpdateResponseOperationCode = "branch_vm"
	APIVmUpdateResponseOperationCodeCommitVm         APIVmUpdateResponseOperationCode = "commit_vm"
	APIVmUpdateResponseOperationCodeDeleteVm         APIVmUpdateResponseOperationCode = "delete_vm"
	APIVmUpdateResponseOperationCodeGetVmSSHKey      APIVmUpdateResponseOperationCode = "get_vm_ssh_key"
	APIVmUpdateResponseOperationCodeUploadRootfs     APIVmUpdateResponseOperationCode = "upload_rootfs"
	APIVmUpdateResponseOperationCodeDeleteRootfs     APIVmUpdateResponseOperationCode = "delete_rootfs"
	APIVmUpdateResponseOperationCodeListRootfs       APIVmUpdateResponseOperationCode = "list_rootfs"
)

func (APIVmUpdateResponseOperationCode) IsKnown

type Client

type Client struct {
	Options []option.RequestOption
	API     *APIService
}

Client creates a struct with services and top level methods that help with interacting with the vers 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 (VERS_API_KEY, VERS_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 interface{}, res interface{}, 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 interface{}, res interface{}, 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 interface{}, res interface{}, 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 interface{}, res interface{}, 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 interface{}, res interface{}, 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 interface{}, res interface{}, 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 ClusterCreateRequestClusterFromCommitParamsClusterType

type ClusterCreateRequestClusterFromCommitParamsClusterType string
const (
	ClusterCreateRequestClusterFromCommitParamsClusterTypeFromCommit ClusterCreateRequestClusterFromCommitParamsClusterType = "from_commit"
)

func (ClusterCreateRequestClusterFromCommitParamsClusterType) IsKnown

type ClusterCreateRequestClusterFromCommitParamsParam

type ClusterCreateRequestClusterFromCommitParamsParam struct {
	ClusterType param.Field[ClusterCreateRequestClusterFromCommitParamsClusterType] `json:"cluster_type,required"`
	Params      param.Field[ClusterCreateRequestClusterFromCommitParamsParamsParam] `json:"params,required"`
}

func (ClusterCreateRequestClusterFromCommitParamsParam) MarshalJSON

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

type ClusterCreateRequestClusterFromCommitParamsParamsParam

type ClusterCreateRequestClusterFromCommitParamsParamsParam struct {
	CommitKey        param.Field[string] `json:"commit_key,required"`
	ClusterAlias     param.Field[string] `json:"cluster_alias"`
	FsSizeClusterMib param.Field[int64]  `json:"fs_size_cluster_mib"`
	VmAlias          param.Field[string] `json:"vm_alias"`
}

func (ClusterCreateRequestClusterFromCommitParamsParamsParam) MarshalJSON

type ClusterCreateRequestClusterType

type ClusterCreateRequestClusterType string
const (
	ClusterCreateRequestClusterTypeNew        ClusterCreateRequestClusterType = "new"
	ClusterCreateRequestClusterTypeFromCommit ClusterCreateRequestClusterType = "from_commit"
)

func (ClusterCreateRequestClusterType) IsKnown

type ClusterCreateRequestNewClusterParamsClusterType

type ClusterCreateRequestNewClusterParamsClusterType string
const (
	ClusterCreateRequestNewClusterParamsClusterTypeNew ClusterCreateRequestNewClusterParamsClusterType = "new"
)

func (ClusterCreateRequestNewClusterParamsClusterType) IsKnown

type ClusterCreateRequestNewClusterParamsParam

type ClusterCreateRequestNewClusterParamsParam struct {
	ClusterType param.Field[ClusterCreateRequestNewClusterParamsClusterType] `json:"cluster_type,required"`
	Params      param.Field[ClusterCreateRequestNewClusterParamsParamsParam] `json:"params,required"`
}

func (ClusterCreateRequestNewClusterParamsParam) MarshalJSON

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

type ClusterCreateRequestNewClusterParamsParamsParam

type ClusterCreateRequestNewClusterParamsParamsParam struct {
	ClusterAlias param.Field[string] `json:"cluster_alias"`
	// The amount of total space to allocate to the cluster
	FsSizeClusterMib param.Field[int64] `json:"fs_size_cluster_mib"`
	// The size of the VM filesystem (if smaller than the base image + overhead, will
	// cause an error)
	FsSizeVmMib param.Field[int64]  `json:"fs_size_vm_mib"`
	KernelName  param.Field[string] `json:"kernel_name"`
	MemSizeMib  param.Field[int64]  `json:"mem_size_mib"`
	RootfsName  param.Field[string] `json:"rootfs_name"`
	VcpuCount   param.Field[int64]  `json:"vcpu_count"`
	VmAlias     param.Field[string] `json:"vm_alias"`
}

func (ClusterCreateRequestNewClusterParamsParamsParam) MarshalJSON

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

type ClusterCreateRequestParam

type ClusterCreateRequestParam struct {
	ClusterType param.Field[ClusterCreateRequestClusterType] `json:"cluster_type,required"`
	Params      param.Field[interface{}]                     `json:"params,required"`
}

func (ClusterCreateRequestParam) MarshalJSON

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

type ClusterCreateRequestUnionParam

type ClusterCreateRequestUnionParam interface {
	// contains filtered or unexported methods
}

Satisfied by ClusterCreateRequestNewClusterParamsParam, ClusterCreateRequestClusterFromCommitParamsParam, ClusterCreateRequestParam.

type ClusterPatchRequestParam

type ClusterPatchRequestParam struct {
	Alias param.Field[string] `json:"alias"`
}

func (ClusterPatchRequestParam) MarshalJSON

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

type Error

type Error = apierror.Error

type TelemetryDto

type TelemetryDto struct {
	ID                  string           `json:"id,required"`
	FsMibCurrent        int64            `json:"fs_mib_current,required"`
	FsMibMax            int64            `json:"fs_mib_max,required"`
	MemMibCurrent       int64            `json:"mem_mib_current,required"`
	MemMibMax           int64            `json:"mem_mib_max,required"`
	VcpuCurrent         int64            `json:"vcpu_current,required"`
	VcpuMax             int64            `json:"vcpu_max,required"`
	VmNetworkCountInUse int64            `json:"vm_network_count_in_use,required"`
	VmNetworkCountTotal int64            `json:"vm_network_count_total,required"`
	JSON                telemetryDtoJSON `json:"-"`
}

func (*TelemetryDto) UnmarshalJSON

func (r *TelemetryDto) UnmarshalJSON(data []byte) (err error)

type VmBranchRequestParam

type VmBranchRequestParam struct {
	Alias param.Field[string] `json:"alias"`
}

func (VmBranchRequestParam) MarshalJSON

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

type VmCommitRequestParam

type VmCommitRequestParam struct {
	Tags param.Field[[]string] `json:"tags"`
}

func (VmCommitRequestParam) MarshalJSON

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

type VmDeleteResponse

type VmDeleteResponse struct {
	DeletedIDs []string                `json:"deleted_ids,required"`
	Errors     []VmDeleteResponseError `json:"errors,required"`
	JSON       vmDeleteResponseJSON    `json:"-"`
}

A struct containing information about an attempted VM deletion request. Reports information in the event of a partial failure so billing can still be udpated appropriately.

func (*VmDeleteResponse) UnmarshalJSON

func (r *VmDeleteResponse) UnmarshalJSON(data []byte) (err error)

type VmDeleteResponseError

type VmDeleteResponseError struct {
	ID    string                    `json:"id,required"`
	Error string                    `json:"error,required"`
	JSON  vmDeleteResponseErrorJSON `json:"-"`
}

Contains a VM ID and the reason that it could not be deleted.

func (*VmDeleteResponseError) UnmarshalJSON

func (r *VmDeleteResponseError) UnmarshalJSON(data []byte) (err error)

type VmDto

type VmDto struct {
	// The ID of the VM.
	ID string `json:"id,required"`
	// The IDs of direct children branched from this VM.
	Children []string `json:"children,required"`
	// The VM's cluster ID
	ClusterID string `json:"cluster_id,required"`
	// What is the size of the "disk" allocated to this VM
	FsSizeMib int64 `json:"fs_size_mib,required"`
	// The VM's local IP address on the VM subnet
	IPAddress string `json:"ip_address,required"`
	// How much RAM is allocated to this VM
	MemSizeMib int64 `json:"mem_size_mib,required"`
	// The VM's network configuration
	NetworkInfo VmDtoNetworkInfo `json:"network_info,required"`
	// Whether the VM is running, paused, or not started.
	State VmDtoState `json:"state,required"`
	// How many vCPUs were allocated to this VM
	VcpuCount int64 `json:"vcpu_count,required"`
	// Human-readable name assigned to the VM.
	Alias string `json:"alias,nullable"`
	// The parent VM's ID, if present. If None, then this VM is a root VM.
	ParentID string    `json:"parent_id,nullable"`
	JSON     vmDtoJSON `json:"-"`
}

func (*VmDto) UnmarshalJSON

func (r *VmDto) UnmarshalJSON(data []byte) (err error)

type VmDtoNetworkInfo

type VmDtoNetworkInfo struct {
	GuestIP     string               `json:"guest_ip,required"`
	GuestMac    string               `json:"guest_mac,required"`
	SSHPort     int64                `json:"ssh_port,required"`
	Tap0IP      string               `json:"tap0_ip,required"`
	Tap0Name    string               `json:"tap0_name,required"`
	VmNamespace string               `json:"vm_namespace,required"`
	JSON        vmDtoNetworkInfoJSON `json:"-"`
}

The VM's network configuration

func (*VmDtoNetworkInfo) UnmarshalJSON

func (r *VmDtoNetworkInfo) UnmarshalJSON(data []byte) (err error)

type VmDtoState

type VmDtoState string

Whether the VM is running, paused, or not started.

const (
	VmDtoStateNotStarted VmDtoState = "Not started"
	VmDtoStateRunning    VmDtoState = "Running"
	VmDtoStatePaused     VmDtoState = "Paused"
)

func (VmDtoState) IsKnown

func (r VmDtoState) IsKnown() bool

type VmPatchRequestParam

type VmPatchRequestParam struct {
	Alias param.Field[string]              `json:"alias"`
	State param.Field[VmPatchRequestState] `json:"state"`
}

func (VmPatchRequestParam) MarshalJSON

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

type VmPatchRequestState

type VmPatchRequestState string
const (
	VmPatchRequestStateRunning VmPatchRequestState = "Running"
	VmPatchRequestStatePaused  VmPatchRequestState = "Paused"
)

func (VmPatchRequestState) IsKnown

func (r VmPatchRequestState) IsKnown() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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