Documentation
¶
Index ¶
- func Bool(b bool) param.Opt[bool]
- func BoolPtr(v bool) *bool
- func DefaultClientOptions() []option.RequestOption
- func File(rdr io.Reader, filename string, contentType string) file
- func Float(f float64) param.Opt[float64]
- func FloatPtr(v float64) *float64
- func Int(i int64) param.Opt[int64]
- func IntPtr(v int64) *int64
- func Opt[T comparable](v T) param.Opt[T]
- func Ptr[T any](v T) *T
- func String(s string) param.Opt[string]
- func StringPtr(v string) *string
- func Time(t time.Time) param.Opt[time.Time]
- func TimePtr(v time.Time) *time.Time
- type AvailableDevice
- type Client
- func (r *Client) Delete(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, ...) error
- func (r *Client) Get(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Patch(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Post(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Put(ctx context.Context, path string, params any, res any, ...) error
- type Device
- type DeviceNewParams
- type DeviceService
- func (r *DeviceService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)
- func (r *DeviceService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Device, err error)
- func (r *DeviceService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Device, err error)
- func (r *DeviceService) ListAvailable(ctx context.Context, opts ...option.RequestOption) (res *[]AvailableDevice, err error)
- func (r *DeviceService) New(ctx context.Context, body DeviceNewParams, opts ...option.RequestOption) (res *Device, err error)
- type DeviceType
- type Error
- type HealthCheckResponse
- type HealthCheckResponseStatus
- type HealthService
- type Image
- type ImageNewParams
- type ImageService
- func (r *ImageService) Delete(ctx context.Context, name string, opts ...option.RequestOption) (err error)
- func (r *ImageService) Get(ctx context.Context, name string, opts ...option.RequestOption) (res *Image, err error)
- func (r *ImageService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Image, err error)
- func (r *ImageService) New(ctx context.Context, body ImageNewParams, opts ...option.RequestOption) (res *Image, err error)
- type ImageStatus
- type Ingress
- type IngressMatch
- type IngressMatchParam
- type IngressNewParams
- type IngressRule
- type IngressRuleParam
- type IngressService
- func (r *IngressService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)
- func (r *IngressService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Ingress, err error)
- func (r *IngressService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Ingress, err error)
- func (r *IngressService) New(ctx context.Context, body IngressNewParams, opts ...option.RequestOption) (res *Ingress, err error)
- type IngressTarget
- type IngressTargetParam
- type Instance
- type InstanceLogsParams
- type InstanceLogsParamsSource
- type InstanceNetwork
- type InstanceNewParams
- type InstanceNewParamsNetwork
- type InstanceService
- func (r *InstanceService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)
- func (r *InstanceService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Instance, err error)
- func (r *InstanceService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Instance, err error)
- func (r *InstanceService) LogsStreaming(ctx context.Context, id string, query InstanceLogsParams, ...) (stream *ssestream.Stream[string])
- func (r *InstanceService) New(ctx context.Context, body InstanceNewParams, opts ...option.RequestOption) (res *Instance, err error)
- func (r *InstanceService) Restore(ctx context.Context, id string, opts ...option.RequestOption) (res *Instance, err error)
- func (r *InstanceService) Standby(ctx context.Context, id string, opts ...option.RequestOption) (res *Instance, err error)
- func (r *InstanceService) Start(ctx context.Context, id string, opts ...option.RequestOption) (res *Instance, err error)
- func (r *InstanceService) Stat(ctx context.Context, id string, query InstanceStatParams, ...) (res *PathInfo, err error)
- func (r *InstanceService) Stop(ctx context.Context, id string, opts ...option.RequestOption) (res *Instance, err error)
- type InstanceStatParams
- type InstanceState
- type InstanceVolumeAttachParams
- type InstanceVolumeDetachParams
- type InstanceVolumeService
- type PathInfo
- type Volume
- type VolumeAttachment
- type VolumeMount
- type VolumeMountParam
- type VolumeNewParams
- type VolumeService
- func (r *VolumeService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)
- func (r *VolumeService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Volume, err error)
- func (r *VolumeService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Volume, err error)
- func (r *VolumeService) New(ctx context.Context, body VolumeNewParams, opts ...option.RequestOption) (res *Volume, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultClientOptions ¶
func DefaultClientOptions() []option.RequestOption
DefaultClientOptions read from the environment (HYPEMAN_API_KEY, HYPEMAN_BASE_URL). This should be used to initialize new clients.
func Opt ¶
func Opt[T comparable](v T) param.Opt[T]
Types ¶
type AvailableDevice ¶
type AvailableDevice struct {
// PCI device ID (hex)
DeviceID string `json:"device_id,required"`
// IOMMU group number
IommuGroup int64 `json:"iommu_group,required"`
// PCI address
PciAddress string `json:"pci_address,required"`
// PCI vendor ID (hex)
VendorID string `json:"vendor_id,required"`
// Currently bound driver (null if none)
CurrentDriver string `json:"current_driver,nullable"`
// Human-readable device name
DeviceName string `json:"device_name"`
// Human-readable vendor name
VendorName string `json:"vendor_name"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
DeviceID respjson.Field
IommuGroup respjson.Field
PciAddress respjson.Field
VendorID respjson.Field
CurrentDriver respjson.Field
DeviceName respjson.Field
VendorName respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AvailableDevice) RawJSON ¶
func (r AvailableDevice) RawJSON() string
Returns the unmodified JSON received from the API
func (*AvailableDevice) UnmarshalJSON ¶
func (r *AvailableDevice) UnmarshalJSON(data []byte) error
type Client ¶
type Client struct {
Options []option.RequestOption
Health HealthService
Images ImageService
Instances InstanceService
Volumes VolumeService
Devices DeviceService
Ingresses IngressService
}
Client creates a struct with services and top level methods that help with interacting with the hypeman 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 (HYPEMAN_API_KEY, HYPEMAN_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.
type Device ¶
type Device struct {
// Auto-generated unique identifier (CUID2 format)
ID string `json:"id,required"`
// Whether the device is currently bound to the vfio-pci driver, which is required
// for VM passthrough.
//
// - true: Device is bound to vfio-pci and ready for (or currently in use by) a VM.
// The device's native driver has been unloaded.
// - false: Device is using its native driver (e.g., nvidia) or no driver. Hypeman
// will automatically bind to vfio-pci when attaching to an instance.
BoundToVfio bool `json:"bound_to_vfio,required"`
// Registration timestamp (RFC3339)
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// PCI device ID (hex)
DeviceID string `json:"device_id,required"`
// IOMMU group number
IommuGroup int64 `json:"iommu_group,required"`
// PCI address
PciAddress string `json:"pci_address,required"`
// Type of PCI device
//
// Any of "gpu", "pci".
Type DeviceType `json:"type,required"`
// PCI vendor ID (hex)
VendorID string `json:"vendor_id,required"`
// Instance ID if attached
AttachedTo string `json:"attached_to,nullable"`
// Device name (user-provided or auto-generated from PCI address)
Name string `json:"name"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
BoundToVfio respjson.Field
CreatedAt respjson.Field
DeviceID respjson.Field
IommuGroup respjson.Field
PciAddress respjson.Field
Type respjson.Field
VendorID respjson.Field
AttachedTo respjson.Field
Name respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (*Device) UnmarshalJSON ¶
type DeviceNewParams ¶
type DeviceNewParams struct {
// PCI address of the device (required, e.g., "0000:a2:00.0")
PciAddress string `json:"pci_address,required"`
// Optional globally unique device name. If not provided, a name is auto-generated
// from the PCI address (e.g., "pci-0000-a2-00-0")
Name param.Opt[string] `json:"name,omitzero"`
// contains filtered or unexported fields
}
func (DeviceNewParams) MarshalJSON ¶
func (r DeviceNewParams) MarshalJSON() (data []byte, err error)
func (*DeviceNewParams) UnmarshalJSON ¶
func (r *DeviceNewParams) UnmarshalJSON(data []byte) error
type DeviceService ¶
type DeviceService struct {
Options []option.RequestOption
}
DeviceService contains methods and other services that help with interacting with the hypeman 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 NewDeviceService method instead.
func NewDeviceService ¶
func NewDeviceService(opts ...option.RequestOption) (r DeviceService)
NewDeviceService 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 (*DeviceService) Delete ¶
func (r *DeviceService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)
Unregister device
func (*DeviceService) Get ¶
func (r *DeviceService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Device, err error)
Get device details
func (*DeviceService) List ¶
func (r *DeviceService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Device, err error)
List registered devices
func (*DeviceService) ListAvailable ¶
func (r *DeviceService) ListAvailable(ctx context.Context, opts ...option.RequestOption) (res *[]AvailableDevice, err error)
Discover passthrough-capable devices on host
func (*DeviceService) New ¶
func (r *DeviceService) New(ctx context.Context, body DeviceNewParams, opts ...option.RequestOption) (res *Device, err error)
Register a device for passthrough
type DeviceType ¶
type DeviceType string
Type of PCI device
const ( DeviceTypeGPU DeviceType = "gpu" DeviceTypePci DeviceType = "pci" )
type HealthCheckResponse ¶
type HealthCheckResponse struct {
// Any of "ok".
Status HealthCheckResponseStatus `json:"status,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Status respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (HealthCheckResponse) RawJSON ¶
func (r HealthCheckResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*HealthCheckResponse) UnmarshalJSON ¶
func (r *HealthCheckResponse) UnmarshalJSON(data []byte) error
type HealthCheckResponseStatus ¶
type HealthCheckResponseStatus string
const (
HealthCheckResponseStatusOk HealthCheckResponseStatus = "ok"
)
type HealthService ¶
type HealthService struct {
Options []option.RequestOption
}
HealthService contains methods and other services that help with interacting with the hypeman 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 NewHealthService method instead.
func NewHealthService ¶
func NewHealthService(opts ...option.RequestOption) (r HealthService)
NewHealthService 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 (*HealthService) Check ¶
func (r *HealthService) Check(ctx context.Context, opts ...option.RequestOption) (res *HealthCheckResponse, err error)
Health check
type Image ¶
type Image struct {
// Creation timestamp (RFC3339)
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// Resolved manifest digest
Digest string `json:"digest,required"`
// Normalized OCI image reference (tag or digest)
Name string `json:"name,required"`
// Build status
//
// Any of "pending", "pulling", "converting", "ready", "failed".
Status ImageStatus `json:"status,required"`
// CMD from container metadata
Cmd []string `json:"cmd,nullable"`
// Entrypoint from container metadata
Entrypoint []string `json:"entrypoint,nullable"`
// Environment variables from container metadata
Env map[string]string `json:"env"`
// Error message if status is failed
Error string `json:"error,nullable"`
// Position in build queue (null if not queued)
QueuePosition int64 `json:"queue_position,nullable"`
// Disk size in bytes (null until ready)
SizeBytes int64 `json:"size_bytes,nullable"`
// Working directory from container metadata
WorkingDir string `json:"working_dir,nullable"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreatedAt respjson.Field
Digest respjson.Field
Name respjson.Field
Status respjson.Field
Cmd respjson.Field
Entrypoint respjson.Field
Env respjson.Field
Error respjson.Field
QueuePosition respjson.Field
SizeBytes respjson.Field
WorkingDir respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (*Image) UnmarshalJSON ¶
type ImageNewParams ¶
type ImageNewParams struct {
// OCI image reference (e.g., docker.io/library/nginx:latest)
Name string `json:"name,required"`
// contains filtered or unexported fields
}
func (ImageNewParams) MarshalJSON ¶
func (r ImageNewParams) MarshalJSON() (data []byte, err error)
func (*ImageNewParams) UnmarshalJSON ¶
func (r *ImageNewParams) UnmarshalJSON(data []byte) error
type ImageService ¶
type ImageService struct {
Options []option.RequestOption
}
ImageService contains methods and other services that help with interacting with the hypeman 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 NewImageService method instead.
func NewImageService ¶
func NewImageService(opts ...option.RequestOption) (r ImageService)
NewImageService 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 (*ImageService) Delete ¶
func (r *ImageService) Delete(ctx context.Context, name string, opts ...option.RequestOption) (err error)
Delete image
func (*ImageService) Get ¶
func (r *ImageService) Get(ctx context.Context, name string, opts ...option.RequestOption) (res *Image, err error)
Get image details
func (*ImageService) List ¶
func (r *ImageService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Image, err error)
List images
func (*ImageService) New ¶
func (r *ImageService) New(ctx context.Context, body ImageNewParams, opts ...option.RequestOption) (res *Image, err error)
Pull and convert OCI image
type ImageStatus ¶
type ImageStatus string
Build status
const ( ImageStatusPending ImageStatus = "pending" ImageStatusPulling ImageStatus = "pulling" ImageStatusConverting ImageStatus = "converting" ImageStatusReady ImageStatus = "ready" ImageStatusFailed ImageStatus = "failed" )
type Ingress ¶
type Ingress struct {
// Auto-generated unique identifier
ID string `json:"id,required"`
// Creation timestamp (RFC3339)
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// Human-readable name
Name string `json:"name,required"`
// Routing rules for this ingress
Rules []IngressRule `json:"rules,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
Name respjson.Field
Rules respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (*Ingress) UnmarshalJSON ¶
type IngressMatch ¶
type IngressMatch struct {
// Hostname to match. Can be:
//
// - Literal: "api.example.com" (exact match on Host header)
// - Pattern: "{instance}.example.com" (dynamic routing based on subdomain)
//
// Pattern hostnames use named captures in curly braces (e.g., {instance}, {app})
// that extract parts of the hostname for routing. The extracted values can be
// referenced in the target.instance field.
Hostname string `json:"hostname,required"`
// Host port to listen on for this rule (default 80)
Port int64 `json:"port"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Hostname respjson.Field
Port respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (IngressMatch) RawJSON ¶
func (r IngressMatch) RawJSON() string
Returns the unmodified JSON received from the API
func (IngressMatch) ToParam ¶
func (r IngressMatch) ToParam() IngressMatchParam
ToParam converts this IngressMatch to a IngressMatchParam.
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 IngressMatchParam.Overrides()
func (*IngressMatch) UnmarshalJSON ¶
func (r *IngressMatch) UnmarshalJSON(data []byte) error
type IngressMatchParam ¶
type IngressMatchParam struct {
// Hostname to match. Can be:
//
// - Literal: "api.example.com" (exact match on Host header)
// - Pattern: "{instance}.example.com" (dynamic routing based on subdomain)
//
// Pattern hostnames use named captures in curly braces (e.g., {instance}, {app})
// that extract parts of the hostname for routing. The extracted values can be
// referenced in the target.instance field.
Hostname string `json:"hostname,required"`
// Host port to listen on for this rule (default 80)
Port param.Opt[int64] `json:"port,omitzero"`
// contains filtered or unexported fields
}
The property Hostname is required.
func (IngressMatchParam) MarshalJSON ¶
func (r IngressMatchParam) MarshalJSON() (data []byte, err error)
func (*IngressMatchParam) UnmarshalJSON ¶
func (r *IngressMatchParam) UnmarshalJSON(data []byte) error
type IngressNewParams ¶
type IngressNewParams struct {
// Human-readable name (lowercase letters, digits, and dashes only; cannot start or
// end with a dash)
Name string `json:"name,required"`
// Routing rules for this ingress
Rules []IngressRuleParam `json:"rules,omitzero,required"`
// contains filtered or unexported fields
}
func (IngressNewParams) MarshalJSON ¶
func (r IngressNewParams) MarshalJSON() (data []byte, err error)
func (*IngressNewParams) UnmarshalJSON ¶
func (r *IngressNewParams) UnmarshalJSON(data []byte) error
type IngressRule ¶
type IngressRule struct {
Match IngressMatch `json:"match,required"`
Target IngressTarget `json:"target,required"`
// Auto-create HTTP to HTTPS redirect for this hostname (only applies when tls is
// enabled)
RedirectHTTP bool `json:"redirect_http"`
// Enable TLS termination (certificate auto-issued via ACME).
Tls bool `json:"tls"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Match respjson.Field
Target respjson.Field
RedirectHTTP respjson.Field
Tls respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (IngressRule) RawJSON ¶
func (r IngressRule) RawJSON() string
Returns the unmodified JSON received from the API
func (IngressRule) ToParam ¶
func (r IngressRule) ToParam() IngressRuleParam
ToParam converts this IngressRule to a IngressRuleParam.
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 IngressRuleParam.Overrides()
func (*IngressRule) UnmarshalJSON ¶
func (r *IngressRule) UnmarshalJSON(data []byte) error
type IngressRuleParam ¶
type IngressRuleParam struct {
Match IngressMatchParam `json:"match,omitzero,required"`
Target IngressTargetParam `json:"target,omitzero,required"`
// Auto-create HTTP to HTTPS redirect for this hostname (only applies when tls is
// enabled)
RedirectHTTP param.Opt[bool] `json:"redirect_http,omitzero"`
// Enable TLS termination (certificate auto-issued via ACME).
Tls param.Opt[bool] `json:"tls,omitzero"`
// contains filtered or unexported fields
}
The properties Match, Target are required.
func (IngressRuleParam) MarshalJSON ¶
func (r IngressRuleParam) MarshalJSON() (data []byte, err error)
func (*IngressRuleParam) UnmarshalJSON ¶
func (r *IngressRuleParam) UnmarshalJSON(data []byte) error
type IngressService ¶
type IngressService struct {
Options []option.RequestOption
}
IngressService contains methods and other services that help with interacting with the hypeman 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 NewIngressService method instead.
func NewIngressService ¶
func NewIngressService(opts ...option.RequestOption) (r IngressService)
NewIngressService 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 (*IngressService) Delete ¶
func (r *IngressService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)
Delete ingress
func (*IngressService) Get ¶
func (r *IngressService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Ingress, err error)
Get ingress details
func (*IngressService) List ¶
func (r *IngressService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Ingress, err error)
List ingresses
func (*IngressService) New ¶
func (r *IngressService) New(ctx context.Context, body IngressNewParams, opts ...option.RequestOption) (res *Ingress, err error)
Create ingress
type IngressTarget ¶
type IngressTarget struct {
// Target instance name, ID, or capture reference.
//
// - For literal hostnames: Use the instance name or ID directly (e.g., "my-api")
// - For pattern hostnames: Reference a capture from the hostname (e.g.,
// "{instance}")
//
// When using pattern hostnames, the instance is resolved dynamically at request
// time.
Instance string `json:"instance,required"`
// Target port on the instance
Port int64 `json:"port,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Instance respjson.Field
Port respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (IngressTarget) RawJSON ¶
func (r IngressTarget) RawJSON() string
Returns the unmodified JSON received from the API
func (IngressTarget) ToParam ¶
func (r IngressTarget) ToParam() IngressTargetParam
ToParam converts this IngressTarget to a IngressTargetParam.
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 IngressTargetParam.Overrides()
func (*IngressTarget) UnmarshalJSON ¶
func (r *IngressTarget) UnmarshalJSON(data []byte) error
type IngressTargetParam ¶
type IngressTargetParam struct {
// Target instance name, ID, or capture reference.
//
// - For literal hostnames: Use the instance name or ID directly (e.g., "my-api")
// - For pattern hostnames: Reference a capture from the hostname (e.g.,
// "{instance}")
//
// When using pattern hostnames, the instance is resolved dynamically at request
// time.
Instance string `json:"instance,required"`
// Target port on the instance
Port int64 `json:"port,required"`
// contains filtered or unexported fields
}
The properties Instance, Port are required.
func (IngressTargetParam) MarshalJSON ¶
func (r IngressTargetParam) MarshalJSON() (data []byte, err error)
func (*IngressTargetParam) UnmarshalJSON ¶
func (r *IngressTargetParam) UnmarshalJSON(data []byte) error
type Instance ¶
type Instance struct {
// Auto-generated unique identifier (CUID2 format)
ID string `json:"id,required"`
// Creation timestamp (RFC3339)
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// OCI image reference
Image string `json:"image,required"`
// Human-readable name
Name string `json:"name,required"`
// Instance state:
//
// - Created: VMM created but not started (Cloud Hypervisor native)
// - Running: VM is actively running (Cloud Hypervisor native)
// - Paused: VM is paused (Cloud Hypervisor native)
// - Shutdown: VM shut down but VMM exists (Cloud Hypervisor native)
// - Stopped: No VMM running, no snapshot exists
// - Standby: No VMM running, snapshot exists (can be restored)
// - Unknown: Failed to determine state (see state_error for details)
//
// Any of "Created", "Running", "Paused", "Shutdown", "Stopped", "Standby",
// "Unknown".
State InstanceState `json:"state,required"`
// Environment variables
Env map[string]string `json:"env"`
// Whether a snapshot exists for this instance
HasSnapshot bool `json:"has_snapshot"`
// Hotplug memory size (human-readable)
HotplugSize string `json:"hotplug_size"`
// Network configuration of the instance
Network InstanceNetwork `json:"network"`
// Writable overlay disk size (human-readable)
OverlaySize string `json:"overlay_size"`
// Base memory size (human-readable)
Size string `json:"size"`
// Start timestamp (RFC3339)
StartedAt time.Time `json:"started_at,nullable" format:"date-time"`
// Error message if state couldn't be determined (only set when state is Unknown)
StateError string `json:"state_error,nullable"`
// Stop timestamp (RFC3339)
StoppedAt time.Time `json:"stopped_at,nullable" format:"date-time"`
// Number of virtual CPUs
Vcpus int64 `json:"vcpus"`
// Volumes attached to the instance
Volumes []VolumeMount `json:"volumes"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
Image respjson.Field
Name respjson.Field
State respjson.Field
Env respjson.Field
HasSnapshot respjson.Field
HotplugSize respjson.Field
Network respjson.Field
OverlaySize respjson.Field
Size respjson.Field
StartedAt respjson.Field
StateError respjson.Field
StoppedAt respjson.Field
Vcpus respjson.Field
Volumes respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (*Instance) UnmarshalJSON ¶
type InstanceLogsParams ¶
type InstanceLogsParams struct {
// Continue streaming new lines after initial output
Follow param.Opt[bool] `query:"follow,omitzero" json:"-"`
// Number of lines to return from end
Tail param.Opt[int64] `query:"tail,omitzero" json:"-"`
// Log source to stream:
//
// - app: Guest application logs (serial console output)
// - vmm: Cloud Hypervisor VMM logs (hypervisor stdout+stderr)
// - hypeman: Hypeman operations log (actions taken on this instance)
//
// Any of "app", "vmm", "hypeman".
Source InstanceLogsParamsSource `query:"source,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (InstanceLogsParams) URLQuery ¶
func (r InstanceLogsParams) URLQuery() (v url.Values, err error)
URLQuery serializes InstanceLogsParams's query parameters as `url.Values`.
type InstanceLogsParamsSource ¶
type InstanceLogsParamsSource string
Log source to stream:
- app: Guest application logs (serial console output) - vmm: Cloud Hypervisor VMM logs (hypervisor stdout+stderr) - hypeman: Hypeman operations log (actions taken on this instance)
const ( InstanceLogsParamsSourceApp InstanceLogsParamsSource = "app" InstanceLogsParamsSourceVmm InstanceLogsParamsSource = "vmm" InstanceLogsParamsSourceHypeman InstanceLogsParamsSource = "hypeman" )
type InstanceNetwork ¶
type InstanceNetwork struct {
// Whether instance is attached to the default network
Enabled bool `json:"enabled"`
// Assigned IP address (null if no network)
IP string `json:"ip,nullable"`
// Assigned MAC address (null if no network)
Mac string `json:"mac,nullable"`
// Network name (always "default" when enabled)
Name string `json:"name"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Enabled respjson.Field
IP respjson.Field
Mac respjson.Field
Name respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
Network configuration of the instance
func (InstanceNetwork) RawJSON ¶
func (r InstanceNetwork) RawJSON() string
Returns the unmodified JSON received from the API
func (*InstanceNetwork) UnmarshalJSON ¶
func (r *InstanceNetwork) UnmarshalJSON(data []byte) error
type InstanceNewParams ¶
type InstanceNewParams struct {
// OCI image reference
Image string `json:"image,required"`
// Human-readable name (lowercase letters, digits, and dashes only; cannot start or
// end with a dash)
Name string `json:"name,required"`
// Additional memory for hotplug (human-readable format like "3GB", "1G")
HotplugSize param.Opt[string] `json:"hotplug_size,omitzero"`
// Writable overlay disk size (human-readable format like "10GB", "50G")
OverlaySize param.Opt[string] `json:"overlay_size,omitzero"`
// Base memory size (human-readable format like "1GB", "512MB", "2G")
Size param.Opt[string] `json:"size,omitzero"`
// Number of virtual CPUs
Vcpus param.Opt[int64] `json:"vcpus,omitzero"`
// Device IDs or names to attach for GPU/PCI passthrough
Devices []string `json:"devices,omitzero"`
// Environment variables
Env map[string]string `json:"env,omitzero"`
// Network configuration for the instance
Network InstanceNewParamsNetwork `json:"network,omitzero"`
// Volumes to attach to the instance at creation time
Volumes []VolumeMountParam `json:"volumes,omitzero"`
// contains filtered or unexported fields
}
func (InstanceNewParams) MarshalJSON ¶
func (r InstanceNewParams) MarshalJSON() (data []byte, err error)
func (*InstanceNewParams) UnmarshalJSON ¶
func (r *InstanceNewParams) UnmarshalJSON(data []byte) error
type InstanceNewParamsNetwork ¶
type InstanceNewParamsNetwork struct {
// Whether to attach instance to the default network
Enabled param.Opt[bool] `json:"enabled,omitzero"`
// contains filtered or unexported fields
}
Network configuration for the instance
func (InstanceNewParamsNetwork) MarshalJSON ¶
func (r InstanceNewParamsNetwork) MarshalJSON() (data []byte, err error)
func (*InstanceNewParamsNetwork) UnmarshalJSON ¶
func (r *InstanceNewParamsNetwork) UnmarshalJSON(data []byte) error
type InstanceService ¶
type InstanceService struct {
Options []option.RequestOption
Volumes InstanceVolumeService
}
InstanceService contains methods and other services that help with interacting with the hypeman 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 NewInstanceService method instead.
func NewInstanceService ¶
func NewInstanceService(opts ...option.RequestOption) (r InstanceService)
NewInstanceService 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 (*InstanceService) Delete ¶
func (r *InstanceService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)
Stop and delete instance
func (*InstanceService) Get ¶
func (r *InstanceService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Instance, err error)
Get instance details
func (*InstanceService) List ¶
func (r *InstanceService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Instance, err error)
List instances
func (*InstanceService) LogsStreaming ¶
func (r *InstanceService) LogsStreaming(ctx context.Context, id string, query InstanceLogsParams, opts ...option.RequestOption) (stream *ssestream.Stream[string])
Streams instance logs as Server-Sent Events. Use the `source` parameter to select which log to stream:
- `app` (default): Guest application logs (serial console) - `vmm`: Cloud Hypervisor VMM logs - `hypeman`: Hypeman operations log
Returns the last N lines (controlled by `tail` parameter), then optionally continues streaming new lines if `follow=true`.
func (*InstanceService) New ¶
func (r *InstanceService) New(ctx context.Context, body InstanceNewParams, opts ...option.RequestOption) (res *Instance, err error)
Create and start instance
func (*InstanceService) Restore ¶
func (r *InstanceService) Restore(ctx context.Context, id string, opts ...option.RequestOption) (res *Instance, err error)
Restore instance from standby
func (*InstanceService) Standby ¶
func (r *InstanceService) Standby(ctx context.Context, id string, opts ...option.RequestOption) (res *Instance, err error)
Put instance in standby (pause, snapshot, delete VMM)
func (*InstanceService) Start ¶
func (r *InstanceService) Start(ctx context.Context, id string, opts ...option.RequestOption) (res *Instance, err error)
Start a stopped instance
func (*InstanceService) Stat ¶
func (r *InstanceService) Stat(ctx context.Context, id string, query InstanceStatParams, opts ...option.RequestOption) (res *PathInfo, err error)
Returns information about a path in the guest filesystem. Useful for checking if a path exists, its type, and permissions before performing file operations.
func (*InstanceService) Stop ¶
func (r *InstanceService) Stop(ctx context.Context, id string, opts ...option.RequestOption) (res *Instance, err error)
Stop instance (graceful shutdown)
type InstanceStatParams ¶
type InstanceStatParams struct {
// Path to stat in the guest filesystem
Path string `query:"path,required" json:"-"`
// Follow symbolic links (like stat vs lstat)
FollowLinks param.Opt[bool] `query:"follow_links,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (InstanceStatParams) URLQuery ¶
func (r InstanceStatParams) URLQuery() (v url.Values, err error)
URLQuery serializes InstanceStatParams's query parameters as `url.Values`.
type InstanceState ¶
type InstanceState string
Instance state:
- Created: VMM created but not started (Cloud Hypervisor native) - Running: VM is actively running (Cloud Hypervisor native) - Paused: VM is paused (Cloud Hypervisor native) - Shutdown: VM shut down but VMM exists (Cloud Hypervisor native) - Stopped: No VMM running, no snapshot exists - Standby: No VMM running, snapshot exists (can be restored) - Unknown: Failed to determine state (see state_error for details)
const ( InstanceStateCreated InstanceState = "Created" InstanceStateRunning InstanceState = "Running" InstanceStatePaused InstanceState = "Paused" InstanceStateShutdown InstanceState = "Shutdown" InstanceStateStopped InstanceState = "Stopped" InstanceStateStandby InstanceState = "Standby" InstanceStateUnknown InstanceState = "Unknown" )
type InstanceVolumeAttachParams ¶
type InstanceVolumeAttachParams struct {
ID string `path:"id,required" json:"-"`
// Path where volume should be mounted
MountPath string `json:"mount_path,required"`
// Mount as read-only
Readonly param.Opt[bool] `json:"readonly,omitzero"`
// contains filtered or unexported fields
}
func (InstanceVolumeAttachParams) MarshalJSON ¶
func (r InstanceVolumeAttachParams) MarshalJSON() (data []byte, err error)
func (*InstanceVolumeAttachParams) UnmarshalJSON ¶
func (r *InstanceVolumeAttachParams) UnmarshalJSON(data []byte) error
type InstanceVolumeDetachParams ¶
type InstanceVolumeDetachParams struct {
ID string `path:"id,required" json:"-"`
// contains filtered or unexported fields
}
type InstanceVolumeService ¶
type InstanceVolumeService struct {
Options []option.RequestOption
}
InstanceVolumeService contains methods and other services that help with interacting with the hypeman 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 NewInstanceVolumeService method instead.
func NewInstanceVolumeService ¶
func NewInstanceVolumeService(opts ...option.RequestOption) (r InstanceVolumeService)
NewInstanceVolumeService 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 (*InstanceVolumeService) Attach ¶
func (r *InstanceVolumeService) Attach(ctx context.Context, volumeID string, params InstanceVolumeAttachParams, opts ...option.RequestOption) (res *Instance, err error)
Attach volume to instance
func (*InstanceVolumeService) Detach ¶
func (r *InstanceVolumeService) Detach(ctx context.Context, volumeID string, body InstanceVolumeDetachParams, opts ...option.RequestOption) (res *Instance, err error)
Detach volume from instance
type PathInfo ¶
type PathInfo struct {
// Whether the path exists
Exists bool `json:"exists,required"`
// Error message if stat failed (e.g., permission denied). Only set when exists is
// false due to an error rather than the path not existing.
Error string `json:"error,nullable"`
// True if this is a directory
IsDir bool `json:"is_dir"`
// True if this is a regular file
IsFile bool `json:"is_file"`
// True if this is a symbolic link (only set when follow_links=false)
IsSymlink bool `json:"is_symlink"`
// Symlink target path (only set when is_symlink=true)
LinkTarget string `json:"link_target,nullable"`
// File mode (Unix permissions)
Mode int64 `json:"mode"`
// File size in bytes
Size int64 `json:"size"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Exists respjson.Field
Error respjson.Field
IsDir respjson.Field
IsFile respjson.Field
IsSymlink respjson.Field
LinkTarget respjson.Field
Mode respjson.Field
Size respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (*PathInfo) UnmarshalJSON ¶
type Volume ¶
type Volume struct {
// Unique identifier
ID string `json:"id,required"`
// Creation timestamp (RFC3339)
CreatedAt time.Time `json:"created_at,required" format:"date-time"`
// Volume name
Name string `json:"name,required"`
// Size in gigabytes
SizeGB int64 `json:"size_gb,required"`
// List of current attachments (empty if not attached)
Attachments []VolumeAttachment `json:"attachments"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
Name respjson.Field
SizeGB respjson.Field
Attachments respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (*Volume) UnmarshalJSON ¶
type VolumeAttachment ¶
type VolumeAttachment struct {
// ID of the instance this volume is attached to
InstanceID string `json:"instance_id,required"`
// Mount path in the guest
MountPath string `json:"mount_path,required"`
// Whether the attachment is read-only
Readonly bool `json:"readonly,required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
InstanceID respjson.Field
MountPath respjson.Field
Readonly respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (VolumeAttachment) RawJSON ¶
func (r VolumeAttachment) RawJSON() string
Returns the unmodified JSON received from the API
func (*VolumeAttachment) UnmarshalJSON ¶
func (r *VolumeAttachment) UnmarshalJSON(data []byte) error
type VolumeMount ¶
type VolumeMount struct {
// Path where volume is mounted in the guest
MountPath string `json:"mount_path,required"`
// Volume identifier
VolumeID string `json:"volume_id,required"`
// Create per-instance overlay for writes (requires readonly=true)
Overlay bool `json:"overlay"`
// Max overlay size as human-readable string (e.g., "1GB"). Required if
// overlay=true.
OverlaySize string `json:"overlay_size"`
// Whether volume is mounted read-only
Readonly bool `json:"readonly"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
MountPath respjson.Field
VolumeID respjson.Field
Overlay respjson.Field
OverlaySize respjson.Field
Readonly respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (VolumeMount) RawJSON ¶
func (r VolumeMount) RawJSON() string
Returns the unmodified JSON received from the API
func (VolumeMount) ToParam ¶
func (r VolumeMount) ToParam() VolumeMountParam
ToParam converts this VolumeMount to a VolumeMountParam.
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 VolumeMountParam.Overrides()
func (*VolumeMount) UnmarshalJSON ¶
func (r *VolumeMount) UnmarshalJSON(data []byte) error
type VolumeMountParam ¶
type VolumeMountParam struct {
// Path where volume is mounted in the guest
MountPath string `json:"mount_path,required"`
// Volume identifier
VolumeID string `json:"volume_id,required"`
// Create per-instance overlay for writes (requires readonly=true)
Overlay param.Opt[bool] `json:"overlay,omitzero"`
// Max overlay size as human-readable string (e.g., "1GB"). Required if
// overlay=true.
OverlaySize param.Opt[string] `json:"overlay_size,omitzero"`
// Whether volume is mounted read-only
Readonly param.Opt[bool] `json:"readonly,omitzero"`
// contains filtered or unexported fields
}
The properties MountPath, VolumeID are required.
func (VolumeMountParam) MarshalJSON ¶
func (r VolumeMountParam) MarshalJSON() (data []byte, err error)
func (*VolumeMountParam) UnmarshalJSON ¶
func (r *VolumeMountParam) UnmarshalJSON(data []byte) error
type VolumeNewParams ¶
type VolumeNewParams struct {
// Volume name
Name string `json:"name,required"`
// Size in gigabytes
SizeGB int64 `json:"size_gb,required"`
// Optional custom identifier (auto-generated if not provided)
ID param.Opt[string] `json:"id,omitzero"`
// contains filtered or unexported fields
}
func (VolumeNewParams) MarshalJSON ¶
func (r VolumeNewParams) MarshalJSON() (data []byte, err error)
func (*VolumeNewParams) UnmarshalJSON ¶
func (r *VolumeNewParams) UnmarshalJSON(data []byte) error
type VolumeService ¶
type VolumeService struct {
Options []option.RequestOption
}
VolumeService contains methods and other services that help with interacting with the hypeman 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 NewVolumeService method instead.
func NewVolumeService ¶
func NewVolumeService(opts ...option.RequestOption) (r VolumeService)
NewVolumeService 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 (*VolumeService) Delete ¶
func (r *VolumeService) Delete(ctx context.Context, id string, opts ...option.RequestOption) (err error)
Delete volume
func (*VolumeService) Get ¶
func (r *VolumeService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *Volume, err error)
Get volume details
func (*VolumeService) List ¶
func (r *VolumeService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Volume, err error)
List volumes
func (*VolumeService) New ¶
func (r *VolumeService) New(ctx context.Context, body VolumeNewParams, opts ...option.RequestOption) (res *Volume, err error)
Creates a new volume. Supports two modes:
- JSON body: Creates an empty volume of the specified size
- Multipart form: Creates a volume pre-populated with content from a tar.gz archive
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
push
command
Example: Push a local Docker image to hypeman
|
Example: Push a local Docker image to hypeman |
|
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. |
|
Package lib provides manually-maintained functionality that extends the auto-generated SDK.
|
Package lib provides manually-maintained functionality that extends the auto-generated SDK. |
|
packages
|
|
|
shared
|
|