vms

package
v0.0.0-...-e71a76f Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	V2 clients.V2

	client.BaseClient[Client]
}

Client is the client for the Deployment service. It is used as a wrapper around the Client.

func New

func New(v2 clients.V2, cache ...*core.Cache) *Client

New creates a new VM service client.

func (*Client) CheckQuota

func (c *Client) CheckQuota(id, userID string, quota *model.Quotas, opts ...opts.QuotaOpts) error

CheckQuota checks if the user has enough quota to create or update a VM.

Make sure to specify either opts.Create or opts.Update in the options (opts.Create takes priority). When checking quota for opts.Create and opts.CreateSnapshot, id is not used.

It returns an error if the user does not have enough quotas.

func (*Client) Create

func (c *Client) Create(id, ownerID string, dtoVmCreate *body.VmCreate) error

Create creates a new VM.

It returns an error if the VM already exists (name clash).

func (*Client) Delete

func (c *Client) Delete(id string) error

Delete deletes an existing VM.

It returns an error if the VM is not found.

func (*Client) DoAction

func (c *Client) DoAction(id string, dtoAction *body.VmActionCreate) error

DoAction performs an action on the VM.

func (*Client) Get

func (c *Client) Get(id string, opts ...opts.GetOpts) (*model.VM, error)

Get gets an existing VM.

It can be fetched in multiple ways including ID, name, transfer code, and Harbor webhook. It supports service.AuthInfo, and will restrict the result to ensure the user has access to the model.

func (*Client) GetConnectionString

func (c *Client) GetConnectionString(id string) (*string, error)

GetConnectionString gets the connection string for the VM.

It returns nil if the VM is not found.

func (*Client) GetHost

func (c *Client) GetHost(vmID string) (*model.VmHost, error)

GetHost gets the host for the VM.

It returns an error if the VM is not found.

func (*Client) GetUsage

func (c *Client) GetUsage(userID string) (*model.VmUsage, error)

GetUsage gets the usage for the user.

func (*Client) GpuGroups

func (c *Client) GpuGroups() api.GpuGroups

GpuGroups returns the client for the GPU Groups service.

func (*Client) GpuLeases

func (c *Client) GpuLeases() api.GpuLeases

GpuLeases returns the client for the GPU Leases service.

func (*Client) HttpProxyNameAvailable

func (c *Client) HttpProxyNameAvailable(id, name string) (bool, error)

HttpProxyNameAvailable checks if the given name is available for an HTTP proxy.

func (*Client) IsAccessible

func (c *Client) IsAccessible(id string) (bool, error)

IsAccessible checks if the VM is accessible by the caller. This is useful when providing auth info and check if it's enough to access a VM. It is lightweight since it does not require the VM to be fetched.

It returns an error if the VM is not found.

func (*Client) IsBeingDeleted

func (c *Client) IsBeingDeleted(id string) (bool, error)

IsBeingDeleted checks if the VM is being deleted.

This returns true while the VM is being deleted, and after it has been deleted.

func (*Client) K8s

func (c *Client) K8s() *k8s_service.Client

K8s returns the client for the K8s service.

func (*Client) List

func (c *Client) List(opts ...opts.ListOpts) ([]model.VM, error)

List lists VMs.

It supports service.AuthInfo, and will restrict the result to ensure the user has access to the model.

func (*Client) NameAvailable

func (c *Client) NameAvailable(name string) (bool, error)

NameAvailable checks if the given name is available.

func (*Client) Repair

func (c *Client) Repair(id string) error

Repair repairs an existing VM.

Trigger repair jobs for every subsystem.

func (*Client) Snapshots

func (c *Client) Snapshots() api.Snapshots

Snapshots returns the client for the Snapshots service.

func (*Client) SshConnectionString

func (c *Client) SshConnectionString(id string) (*string, error)

SshConnectionString gets the SSH connection string for the VM.

It returns nil if the VM is not found.

func (*Client) Update

func (c *Client) Update(id string, dtoVmUpdate *body.VmUpdate) error

Update updates an existing VM.

It returns an error if the VM is not found.

func (*Client) UpdateOwner

func (c *Client) UpdateOwner(id string, params *model.VmUpdateOwnerParams) error

UpdateOwner updates the owner of the VM.

This is the second step of the owner update process, where the transfer is actually done.

It returns an error if the VM is not found.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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