compute

package
v1.1.26 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminListInstancesOptions

type AdminListInstancesOptions struct {
	Limit      int    `url:"limit,omitempty"`
	Page       int    `url:"page,omitempty"`
	UserID     string `url:"userID,omitempty"`
	CustomerID string `url:"customerID,omitempty"`
	Status     string `url:"status,omitempty"`
	Zone       string `url:"zone,omitempty"`
	TemplateID string `url:"templateID,omitempty"`
}

AdminListInstancesOptions provides filtering for the admin instance list endpoint.

type AdminListInstancesResponse

type AdminListInstancesResponse struct {
	Pages     int        `json:"pages"`
	Items     int        `json:"items"`
	Instances []Instance `json:"instances"`
}

AdminListInstancesResponse is the paginated response for admin instance listing.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides access to the Compute API endpoints.

func NewClient

func NewClient(d doFunc) *Client

NewClient creates a new Compute client backed by the root SDK client's do function.

func (*Client) AdminDeleteInstance

func (c *Client) AdminDeleteInstance(ctx context.Context, instanceID string) error

AdminDeleteInstance deletes an instance by ID as admin.

func (*Client) AdminGetInstance

func (c *Client) AdminGetInstance(ctx context.Context, instanceID string) (*Instance, error)

AdminGetInstance fetches an instance by ID as admin.

func (*Client) AdminListInstances

func (c *Client) AdminListInstances(ctx context.Context, opts *AdminListInstancesOptions) (*AdminListInstancesResponse, error)

AdminListInstances lists instances with optional filtering.

func (*Client) AdminResetInstance

func (c *Client) AdminResetInstance(ctx context.Context, instanceID string) error

AdminResetInstance resets an instance as admin.

func (*Client) AdminRestartInstance

func (c *Client) AdminRestartInstance(ctx context.Context, instanceID string) error

AdminRestartInstance restarts an instance as admin.

func (*Client) AdminStartInstance

func (c *Client) AdminStartInstance(ctx context.Context, instanceID string) error

AdminStartInstance starts an instance as admin.

func (*Client) AdminStopInstance

func (c *Client) AdminStopInstance(ctx context.Context, instanceID string) error

AdminStopInstance stops an instance as admin.

func (*Client) CreateInstance

func (c *Client) CreateInstance(ctx context.Context, req InstanceCreateRequest) (*Instance, error)

CreateInstance creates a new compute instance.

func (*Client) DeleteInstance

func (c *Client) DeleteInstance(ctx context.Context, instanceID string) error

DeleteInstance deletes an instance by ID.

func (*Client) GetInstance

func (c *Client) GetInstance(ctx context.Context, instanceID string) (*Instance, error)

GetInstance fetches a single instance by ID.

func (*Client) ListInstances

func (c *Client) ListInstances(ctx context.Context) ([]Instance, error)

ListInstances lists all instances for the current user.

func (*Client) ListTemplateZones

func (c *Client) ListTemplateZones(ctx context.Context, templateID string) ([]string, error)

ListTemplateZones lists all zones available for a template.

func (*Client) ListTemplates

func (c *Client) ListTemplates(ctx context.Context) ([]Template, error)

ListTemplates lists all available instance templates.

func (*Client) ResetInstance

func (c *Client) ResetInstance(ctx context.Context, instanceID string) error

ResetInstance resets an instance to its original state.

func (*Client) RestartInstance

func (c *Client) RestartInstance(ctx context.Context, instanceID string) error

RestartInstance restarts an instance.

func (*Client) StartInstance

func (c *Client) StartInstance(ctx context.Context, instanceID string) error

StartInstance starts a stopped instance.

func (*Client) StopInstance

func (c *Client) StopInstance(ctx context.Context, instanceID string) error

StopInstance stops a running instance.

type Instance

type Instance struct {
	ID          string `json:"id"`
	UserID      string `json:"userID"`
	CustomerID  string `json:"customerID"`
	Name        string `json:"name"`
	Zone        string `json:"zone"`
	MachineType string `json:"machineType"`
	ExternalIP  string `json:"externalIp"`
	InternalIP  string `json:"internalIp"`
	Status      string `json:"status"`
	TemplateID  string `json:"templateId"`
	CreatedAt   string `json:"createdAt"`
}

Instance represents a compute instance.

type InstanceCreateRequest

type InstanceCreateRequest struct {
	TemplateID string `json:"templateID"`
	Zone       string `json:"zone"`
}

InstanceCreateRequest is the body for creating a new instance.

type ListOpts

type ListOpts struct {
	Limit int
	Page  int
}

ListOpts holds pagination parameters for admin list endpoints.

type Template

type Template struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	MachineType string `json:"machineType"`
	DiskSizeGb  int    `json:"diskSizeGb"`
	DiskType    string `json:"diskType"`
	Image       string `json:"image"`
	Region      string `json:"region"`
}

Template represents a compute instance template.

Jump to

Keyboard shortcuts

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