isardvdi

package module
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

README

IsardVDI SDK Go

This is the client library of IsardVDI for the Golang language.

go get -u gitlab.com/isard/isardvdi-sdk-go@latest

Documentation

Index

Constants

View Source
const (
	DomainStateUnknown                  = "Unknown"
	DomainStateFailed                   = "Failed"
	DomainStateStarting                 = "Starting"
	DomainStateStartingDomainDisposable = "StartingDomainDisposable"
	DomainStateStarted                  = "Started"
	DomainStateStopping                 = "Stopping"
	DomainStateShuttingDown             = "Shutting-down"
	DomainStateStopped                  = "Stopped"
	DomainStateCreating                 = "Creating"
	DomainStateCreatingAndStarting      = "CreatingAndStarting"
	DomainStateCreatingDiskFromScratch  = "CreatingDiskFromScratch"
	DomainStateCreatingFromBuilder      = "CreatingFromBuilder"
	DomainStateCreatingDomain           = "CreatingDomain"
	DomainStateUpdating                 = "Updating"
	DomainStateDeleting                 = "Deleting"
	DomainStateDeletingDomainDisk       = "DeletingDomainDisk"
	DomainStateDiskDeleted              = "DiskDeleted"
)

Variables

View Source
var (
	ErrBadRequest = Err{
		Err:        "bad_request",
		Msg:        "Bad request",
		StatusCode: http.StatusBadRequest,
	}
	ErrUnauthorized = Err{
		Err:        "unauthorized",
		Msg:        "Unauthorized",
		StatusCode: http.StatusUnauthorized,
	}
	ErrForbidden = Err{
		Err:        "forbidden",
		Msg:        "Forbidden",
		StatusCode: http.StatusForbidden,
	}
	ErrNotFound = Err{
		Err:        "not_found",
		Msg:        "Not found",
		StatusCode: http.StatusNotFound,
	}
	ErrConflict = Err{
		Err:        "conflict",
		Msg:        "Conflict",
		StatusCode: http.StatusConflict,
	}
	ErrInternalServer = Err{
		Err:        "internal_server",
		Msg:        "Internal server error",
		StatusCode: http.StatusInternalServerError,
	}
	ErrGatewayTimeout = Err{
		Err:        "gateway_timeout",
		Msg:        "Gateway timeout",
		StatusCode: http.StatusGatewayTimeout,
	}
	ErrPreconditionRequired = Err{
		Err:        "precondition_required",
		Msg:        "Precondition required",
		StatusCode: http.StatusPreconditionRequired,
	}
	ErrInsufficientStorage = Err{
		Err:        "insufficient_storage",
		Msg:        "Insufficient storage",
		StatusCode: http.StatusInsufficientStorage,
	}
)
View Source
var Version = "Unknown version"

Functions

func GetBool

func GetBool(b *bool) bool

func GetInt

func GetInt(i *int) int

func GetString

func GetString(s *string) string

Types

type AdminDesktop

type AdminDesktop struct {
	ID                *string `json:"id,omitempty"`
	State             *string `json:"status,omitempty"`
	Name              *string `json:"name,omitempty"`
	Description       *string `json:"description,omitempty"`
	User              *string `json:"user,omitempty"`
	HypervisorStarted *string `json:"hyp_started,omitempty"`
}

TODO: This should be removed when the admin/domains endpoint and the user/desktops endpoints are unified

type Cfg

type Cfg struct {
	Token       string
	Host        string
	IgnoreCerts bool `mapstructure:"ignore_certs"`
}

type Client

type Client struct {
	BaseURL   *url.URL
	UserAgent string
	Token     string

	BeforeRequestHook func(*Client) error
	// contains filtered or unexported fields
}

func NewClient

func NewClient(cfg *Cfg) (*Client, error)

func (*Client) AdminDesktopList

func (c *Client) AdminDesktopList(ctx context.Context) ([]*AdminDesktop, error)

func (*Client) AdminGroupCreate

func (c *Client) AdminGroupCreate(ctx context.Context, category, uid, name, description, externalAppID, externalGID string) (*Group, error)

func (*Client) AdminHypervisorOnlyForced

func (c *Client) AdminHypervisorOnlyForced(ctx context.Context, id string, onlyForced bool) error

func (*Client) AdminHypervisorUpdate

func (c *Client) AdminHypervisorUpdate(ctx context.Context, h *Hypervisor) error

func (*Client) AdminTemplateList

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

func (*Client) AdminUserAutoRegister added in v1.9.0

func (c *Client) AdminUserAutoRegister(ctx context.Context, registerTkn string, roleID string, groupID string) (string, error)

func (*Client) AdminUserCreate

func (c *Client) AdminUserCreate(ctx context.Context, provider, role, category, group, uid, username, pwd string) (*User, error)

func (*Client) AdminUserDelete

func (c *Client) AdminUserDelete(ctx context.Context, id string) error

func (*Client) AdminUserList

func (c *Client) AdminUserList(ctx context.Context) ([]*User, error)

func (*Client) AdminUserRequiredDisclaimerAcknowledgement added in v1.6.0

func (c *Client) AdminUserRequiredDisclaimerAcknowledgement(ctx context.Context, id string) (bool, error)

func (*Client) AdminUserRequiredEmailVerification added in v1.6.0

func (c *Client) AdminUserRequiredEmailVerification(ctx context.Context, id string) (bool, error)

func (*Client) AdminUserRequiredPasswordReset added in v1.6.0

func (c *Client) AdminUserRequiredPasswordReset(ctx context.Context, id string) (bool, error)

func (*Client) AdminUserResetPassword added in v1.7.0

func (c *Client) AdminUserResetPassword(ctx context.Context, id, pwd string) error

func (*Client) AuthForm

func (c *Client) AuthForm(ctx context.Context, category, usr, pwd string) (string, error)

func (*Client) DesktopCreate

func (c *Client) DesktopCreate(ctx context.Context, name, templateID string) (*Desktop, error)

func (*Client) DesktopCreateFromScratch

func (c *Client) DesktopCreateFromScratch(ctx context.Context, name string, xml string) (*Desktop, error)

func (*Client) DesktopDelete

func (c *Client) DesktopDelete(ctx context.Context, id string) error

func (*Client) DesktopGet

func (c *Client) DesktopGet(ctx context.Context, id string) (*Desktop, error)

func (*Client) DesktopList

func (c *Client) DesktopList(ctx context.Context) ([]*Desktop, error)

func (*Client) DesktopStart

func (c *Client) DesktopStart(ctx context.Context, id string) error

func (*Client) DesktopStop

func (c *Client) DesktopStop(ctx context.Context, id string) error

func (*Client) DesktopUpdate

func (c *Client) DesktopUpdate(ctx context.Context, id string, opts DesktopUpdateOptions) error

func (*Client) DesktopViewer

func (c *Client) DesktopViewer(ctx context.Context, t DesktopViewer, id string) (string, error)

func (*Client) HypervisorDelete added in v1.3.0

func (c *Client) HypervisorDelete(ctx context.Context, id string) error

func (*Client) HypervisorGet

func (c *Client) HypervisorGet(ctx context.Context, id string) (*Hypervisor, error)

func (*Client) HypervisorList

func (c *Client) HypervisorList(ctx context.Context) ([]*Hypervisor, error)

func (*Client) Maintenance

func (c *Client) Maintenance(ctx context.Context) (bool, error)

func (*Client) OrchestratorGPUBookingList added in v1.2.0

func (c *Client) OrchestratorGPUBookingList(ctx context.Context) ([]*OrchestratorGPUBooking, error)

func (*Client) OrchestratorHypervisorAddToDeadRow

func (c *Client) OrchestratorHypervisorAddToDeadRow(ctx context.Context, id string) (time.Time, error)

func (*Client) OrchestratorHypervisorGet

func (c *Client) OrchestratorHypervisorGet(ctx context.Context, id string) (*OrchestratorHypervisor, error)

func (*Client) OrchestratorHypervisorList

func (c *Client) OrchestratorHypervisorList(ctx context.Context) ([]*OrchestratorHypervisor, error)

func (*Client) OrchestratorHypervisorManage

func (c *Client) OrchestratorHypervisorManage(ctx context.Context, id string) error

func (*Client) OrchestratorHypervisorRemoveFromDeadRow

func (c *Client) OrchestratorHypervisorRemoveFromDeadRow(ctx context.Context, id string) error

func (*Client) OrchestratorHypervisorStopDesktops

func (c *Client) OrchestratorHypervisorStopDesktops(ctx context.Context, id string) error

func (*Client) OrchestratorHypervisorUnmanage

func (c *Client) OrchestratorHypervisorUnmanage(ctx context.Context, id string) error

func (*Client) SetBeforeRequestHook

func (c *Client) SetBeforeRequestHook(hook func(*Client) error)

func (*Client) SetToken

func (c *Client) SetToken(tkn string)

func (*Client) StatsCategoryList

func (c *Client) StatsCategoryList(ctx context.Context) ([]*StatsCategory, error)

func (*Client) StatsDeploymentByCategory

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

func (*Client) StatsDesktops

func (c *Client) StatsDesktops(ctx context.Context) ([]*StatsDesktop, error)

func (*Client) StatsDomainsStatus added in v1.5.0

func (c *Client) StatsDomainsStatus(ctx context.Context) (*StatsDomainsStatus, error)

func (*Client) StatsHypervisors

func (c *Client) StatsHypervisors(ctx context.Context) ([]*StatsHypervisor, error)

func (*Client) StatsTemplates

func (c *Client) StatsTemplates(ctx context.Context) ([]*StatsTemplate, error)

func (*Client) StatsUsers

func (c *Client) StatsUsers(ctx context.Context) ([]*StatsUser, error)

func (*Client) TemplateCreateFromDesktop

func (c *Client) TemplateCreateFromDesktop(ctx context.Context, name string, desktopID string) (*Template, error)

func (*Client) TemplateList

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

func (*Client) URL

func (c *Client) URL() *url.URL

func (*Client) UserOwnsDesktop

func (c *Client) UserOwnsDesktop(ctx context.Context, opts *UserOwnsDesktopOpts) error

func (*Client) UserVPN

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

func (*Client) Version

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

type Desktop

type Desktop struct {
	ID          *string `json:"id,omitempty"`
	State       *string `json:"state,omitempty"`
	Type        *string `json:"type,omitempty"`
	Template    *string `json:"template,omitempty"`
	Name        *string `json:"name,omitempty"`
	Description *string `json:"description,omitempty"`
	IP          *string `json:"ip,omitempty"`
}

type DesktopUpdateOptions

type DesktopUpdateOptions struct {
	ForcedHyp []string `json:"forced_hyp,omitempty"`
}

type DesktopViewer

type DesktopViewer string
const (
	DesktopViewerSpice      DesktopViewer = "spice"
	DesktopViewerVNCBrowser DesktopViewer = "vnc-browser"
	DesktopViewerRdpGW      DesktopViewer = "rdp-gw"
	DesktopViewerRdpVPN     DesktopViewer = "rdp-vpn"
	DesktopViewerRdpBrowser DesktopViewer = "rdp-browser"
)

type DesktopViewerRsp

type DesktopViewerRsp struct {
	Kind     *string `json:"kind,omitempty"`
	Protocol *string `json:"protocol,omitempty"`
	URLP     *string `json:"urlp,omitempty"`
	Cookie   *string `json:"cookie,omitempty"`
	Content  *string `json:"content,omitempty"`
}

type DomainState added in v1.5.0

type DomainState string

type Err

type Err struct {
	Err             string  `json:"error"`
	Msg             string  `json:"msg"`
	Description     *string `json:"description,omitempty"`
	DescriptionCode *string `json:"description_code,omitempty"`
	StatusCode      int     `json:"-"`
	Params          *map[string]interface{}
}

func (Err) Error

func (e Err) Error() string

func (Err) Is

func (e Err) Is(target error) bool

type Group

type Group struct {
	ID            *string `json:"id,omitempty"`
	UID           *string `json:"uid,omitempty"`
	Category      *string `json:"parent_category,omitempty"`
	Name          *string `json:"name,omitempty"`
	Description   *string `json:"description,omitempty"`
	ExternalAppID *string `json:"external_app_id,omitempty"`
	ExternalGID   *string `json:"external_gid,omitempty"`
}

type Hypervisor

type Hypervisor struct {
	ID         *string           `json:"id,omitempty"`
	URI        *string           `json:"uri,omitempty"`
	Status     *HypervisorStatus `json:"status,omitempty"`
	OnlyForced *bool             `json:"only_forced,omitempty"`
	Buffering  *bool             `json:"buffering_hyper,omitempty"`
}

type HypervisorStatus

type HypervisorStatus string
const (
	HypervisorStatusOnline   HypervisorStatus = "Online"
	HypervisorStatusOffline  HypervisorStatus = "Offline"
	HypervisorStatusError    HypervisorStatus = "Error"
	HypervisorStatusDeleting HypervisorStatus = "Deleting"
)

type Interface

type Interface interface {
	URL() *url.URL

	Version(context.Context) (string, error)
	Maintenance(context.Context) (bool, error)

	SetBeforeRequestHook(func(*Client) error)

	AuthForm(ctx context.Context, category, usr, pwd string) (string, error)
	SetToken(string)

	UserVPN(context.Context) (string, error)
	UserOwnsDesktop(context.Context, *UserOwnsDesktopOpts) error

	AdminUserList(ctx context.Context) ([]*User, error)
	AdminUserCreate(ctx context.Context, provider, role, category, group, uid, username, pwd string) (*User, error)
	AdminUserDelete(ctx context.Context, id string) error
	AdminUserResetPassword(ctx context.Context, id, pwd string) error
	AdminUserRequiredDisclaimerAcknowledgement(ctx context.Context, id string) (bool, error)
	AdminUserRequiredEmailVerification(ctx context.Context, id string) (bool, error)
	AdminUserRequiredPasswordReset(ctx context.Context, id string) (bool, error)
	AdminUserAutoRegister(ctx context.Context, registerTkn, roleID, groupID string) (id string, err error)

	AdminGroupCreate(ctx context.Context, category, uid, name, description, externalAppID, externalGID string) (*Group, error)
	AdminDesktopList(context.Context) ([]*AdminDesktop, error)
	AdminTemplateList(context.Context) ([]*Template, error)
	AdminHypervisorUpdate(context.Context, *Hypervisor) error
	AdminHypervisorOnlyForced(ctx context.Context, id string, onlyForced bool) error

	HypervisorList(context.Context) ([]*Hypervisor, error)
	HypervisorGet(ctx context.Context, id string) (*Hypervisor, error)
	HypervisorDelete(ctx context.Context, id string) error

	DesktopList(context.Context) ([]*Desktop, error)
	DesktopGet(ctx context.Context, id string) (*Desktop, error)
	DesktopCreate(ctx context.Context, name, templateID string) (*Desktop, error)
	DesktopCreateFromScratch(ctx context.Context, name, xml string) (*Desktop, error)
	DesktopUpdate(ctx context.Context, id string, opts DesktopUpdateOptions) error
	DesktopDelete(ctx context.Context, id string) error
	DesktopStart(ctx context.Context, id string) error
	DesktopStop(ctx context.Context, id string) error
	DesktopViewer(ctx context.Context, t DesktopViewer, id string) (string, error)

	TemplateList(context.Context) ([]*Template, error)
	TemplateCreateFromDesktop(ctx context.Context, name, desktopID string) (*Template, error)

	StatsCategoryList(context.Context) ([]*StatsCategory, error)
	StatsDeploymentByCategory(ctx context.Context) ([]*StatsDeploymentByCategory, error)
	StatsUsers(ctx context.Context) ([]*StatsUser, error)
	StatsDesktops(ctx context.Context) ([]*StatsDesktop, error)
	StatsTemplates(ctx context.Context) ([]*StatsTemplate, error)
	StatsHypervisors(ctx context.Context) ([]*StatsHypervisor, error)
	StatsDomainsStatus(ctx context.Context) (*StatsDomainsStatus, error)

	OrchestratorHypervisorList(ctx context.Context) ([]*OrchestratorHypervisor, error)
	OrchestratorHypervisorGet(ctx context.Context, id string) (*OrchestratorHypervisor, error)
	OrchestratorHypervisorManage(ctx context.Context, id string) error
	OrchestratorHypervisorUnmanage(ctx context.Context, id string) error
	OrchestratorHypervisorAddToDeadRow(ctx context.Context, id string) (time.Time, error)
	OrchestratorHypervisorRemoveFromDeadRow(ctx context.Context, id string) error
	OrchestratorHypervisorStopDesktops(ctx context.Context, id string) error
	OrchestratorGPUBookingList(ctx context.Context) ([]*OrchestratorGPUBooking, error)
}

type OrchestratorGPUBooking added in v1.2.0

type OrchestratorGPUBooking struct {
	Brand   string                     `json:"brand,omitempty"`
	Model   string                     `json:"model,omitempty"`
	Profile string                     `json:"profile,omitempty"`
	Now     OrchestratorGPUBookingTime `json:"now,omitempty"`
	Create  OrchestratorGPUBookingTime `json:"to_create,omitempty"`
	Destroy OrchestratorGPUBookingTime `json:"to_destroy,omitempty"`
}

type OrchestratorGPUBookingTime added in v1.2.0

type OrchestratorGPUBookingTime struct {
	Time  time.Time `json:"date,omitempty"`
	Units int       `json:"units,omitempty"`
}

type OrchestratorHypervisor

type OrchestratorHypervisor struct {
	ID                  string                       `json:"id,omitempty"`
	Status              HypervisorStatus             `json:"status,omitempty"`
	OnlyForced          bool                         `json:"only_forced,omitempty"`
	Buffering           bool                         `json:"buffering_hyper,omitempty"`
	DestroyTime         time.Time                    `json:"destroy_time,omitempty"`
	Stats               OrchestratorHypervisorStats  `json:"stats,omitempty"`
	MinFreeMemGB        int                          `json:"min_free_mem_gb,omitempty"`
	OrchestratorManaged bool                         `json:"orchestrator_managed,omitempty"`
	GPUOnly             bool                         `json:"gpu_only,omitempty"`
	DesktopsStarted     int                          `json:"desktops_started,omitempty"`
	CPU                 OrchestratorResourceLoad     `json:"-"`
	RAM                 OrchestratorResourceLoad     `json:"-"`
	GPUs                []*OrchestratorHypervisorGPU `json:"gpus,omitempty"`
	BookingsEndTime     time.Time                    `json:"bookings_end_time,omitempty"`
}

type OrchestratorHypervisorGPU added in v1.1.0

type OrchestratorHypervisorGPU struct {
	ID         string `json:"id,omitempty"`
	Brand      string `json:"brand,omitempty"`
	Model      string `json:"model,omitempty"`
	Profile    string `json:"profile,omitempty"`
	TotalUnits int    `json:"total_units,omitempty"`
	UsedUnits  int    `json:"used_units,omitempty"`
	FreeUnits  int    `json:"free_units,omitempty"`
}

type OrchestratorHypervisorStats

type OrchestratorHypervisorStats struct {
	CPUCurrent OrchestratorHypervisorStatsCPU `json:"cpu_current,omitempty"`
	CPU5Min    OrchestratorHypervisorStatsCPU `json:"cpu_5min,omitempty"`
	Mem        OrchestratorHypervisorStatsMem `json:"mem_stats,omitempty"`
}

type OrchestratorHypervisorStatsCPU

type OrchestratorHypervisorStatsCPU struct {
	Idle   float32 `json:"idle,omitempty"`
	Iowait float32 `json:"iowait,omitempty"`
	Kernel float32 `json:"kernel,omitempty"`
	Used   float32 `json:"used,omitempty"`
	User   float32 `json:"user,omitempty"`
}

type OrchestratorHypervisorStatsMem

type OrchestratorHypervisorStatsMem struct {
	Available int `json:"available,omitempty"`
	Buffers   int `json:"buffers,omitempty"`
	Cached    int `json:"cached,omitempty"`
	Free      int `json:"free,omitempty"`
	Total     int `json:"total,omitempty"`
}

type OrchestratorResourceLoad

type OrchestratorResourceLoad struct {
	Total int
	Used  int
	Free  int
}

type StatsCategory

type StatsCategory struct {
	ID          *string
	DesktopNum  *int
	TemplateNum *int
	UserNum     *int
}

type StatsDeploymentByCategory

type StatsDeploymentByCategory struct {
	CategoryID    *string
	DeploymentNum *int
}

type StatsDesktop

type StatsDesktop struct {
	ID   *string `json:"id,omitempty"`
	User *string `json:"user,omitempty"`
}

type StatsDomainsStatus added in v1.5.0

type StatsDomainsStatus struct {
	Desktop  map[DomainState]int `json:"desktop,omitempty"`
	Template map[DomainState]int `json:"template,omitempty"`
}

type StatsHypervisor

type StatsHypervisor struct {
	ID         *string           `json:"id,omitempty"`
	Status     *HypervisorStatus `json:"status,omitempty"`
	OnlyForced *bool             `json:"only_forced,omitempty"`
}

type StatsTemplate

type StatsTemplate struct {
	ID *string `json:"id,omitempty"`
}

type StatsUser

type StatsUser struct {
	ID       *string `json:"id,omitempty"`
	Role     *string `json:"role,omitempty"`
	Category *string `json:"category,omitempty"`
	Group    *string `json:"group,omitempty"`
}

type Template

type Template struct {
	ID   *string
	Name *string
}

type User

type User struct {
	ID       *string `json:"id,omitempty"`
	Provider *string `json:"provider,omitempty"`
	Role     *string `json:"role,omitempty"`
	Category *string `json:"category,omitempty"`
	Group    *string `json:"group,omitempty"`
	UID      *string `json:"uid,omitempty"`
	Username *string `json:"username,omitempty"`
	Name     *string `json:"name,omitempty"`
}

type UserOwnsDesktopOpts

type UserOwnsDesktopOpts struct {
	IP             string
	ProxyVideo     string
	ProxyHyperHost string
	Port           int
}

type UserVPNRsp

type UserVPNRsp struct {
	Kind    *string `json:"kind,omitempty"`
	Content *string `json:"content,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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