Documentation
¶
Index ¶
- type Client
- func (c *Client) CheckQuota(id, userID string, quota *model.Quotas, opts ...opts.QuotaOpts) error
- func (c *Client) Create(id, ownerID string, dtoVmCreate *body.VmCreate) error
- func (c *Client) Delete(id string) error
- func (c *Client) DoAction(id string, dtoAction *body.VmActionCreate) error
- func (c *Client) Get(id string, opts ...opts.GetOpts) (*model.VM, error)
- func (c *Client) GetConnectionString(id string) (*string, error)
- func (c *Client) GetHost(vmID string) (*model.VmHost, error)
- func (c *Client) GetUsage(userID string) (*model.VmUsage, error)
- func (c *Client) GpuGroups() api.GpuGroups
- func (c *Client) GpuLeases() api.GpuLeases
- func (c *Client) HttpProxyNameAvailable(id, name string) (bool, error)
- func (c *Client) IsAccessible(id string) (bool, error)
- func (c *Client) IsBeingDeleted(id string) (bool, error)
- func (c *Client) K8s() *k8s_service.Client
- func (c *Client) List(opts ...opts.ListOpts) ([]model.VM, error)
- func (c *Client) NameAvailable(name string) (bool, error)
- func (c *Client) Repair(id string) error
- func (c *Client) Snapshots() api.Snapshots
- func (c *Client) SshConnectionString(id string) (*string, error)
- func (c *Client) Update(id string, dtoVmUpdate *body.VmUpdate) error
- func (c *Client) UpdateOwner(id string, params *model.VmUpdateOwnerParams) error
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 (*Client) CheckQuota ¶
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 ¶
Create creates a new VM.
It returns an error if the VM already exists (name clash).
func (*Client) DoAction ¶
func (c *Client) DoAction(id string, dtoAction *body.VmActionCreate) error
DoAction performs an action on the VM.
func (*Client) Get ¶
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 ¶
GetConnectionString gets the connection string for the VM.
It returns nil if the VM is not found.
func (*Client) GetHost ¶
GetHost gets the host for the VM.
It returns an error if the VM is not found.
func (*Client) HttpProxyNameAvailable ¶
HttpProxyNameAvailable checks if the given name is available for an HTTP proxy.
func (*Client) IsAccessible ¶
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 ¶
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 ¶
List lists VMs.
It supports service.AuthInfo, and will restrict the result to ensure the user has access to the model.
func (*Client) NameAvailable ¶
NameAvailable checks if the given name is available.
func (*Client) SshConnectionString ¶
SshConnectionString gets the SSH connection string for the VM.
It returns nil 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.