client

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2021 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package client provides a REST wrapper to the kVDI API.

Package client provides a REST wrapper to the kVDI API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client provides a REST wrapper to the kVDI API.

func New

func New(opts *Opts) (*Client, error)

New creates a new kVDI client.

func (*Client) Close

func (c *Client) Close()

Close will stop the token refresh goroutine if it's running.

func (*Client) CreateDesktopSession

func (c *Client) CreateDesktopSession(opts *types.CreateSessionRequest) (*types.CreateSessionResponse, error)

CreateDesktopSession creates a new desktop session.

func (*Client) CreateDesktopTemplate

func (c *Client) CreateDesktopTemplate(req *desktopsv1.Template) error

CreateDesktopTemplate creates a new DesktopTemplate for this cluster.

func (*Client) CreateVDIRole

func (c *Client) CreateVDIRole(req *types.CreateRoleRequest) error

CreateVDIRole creates a new VDIRole for this cluster.

func (*Client) CreateVDIUser

func (c *Client) CreateVDIUser(req *types.CreateUserRequest) error

CreateVDIUser creates a new VDIUser for this cluster, if possible.

func (*Client) DeleteDesktopSession

func (c *Client) DeleteDesktopSession(nn NamespacedName) error

DeleteDesktopSession terminates the given desktop session.

func (*Client) DeleteDesktopTemplate

func (c *Client) DeleteDesktopTemplate(name string) error

DeleteDesktopTemplate will delete the given DesktopTemplate.

func (*Client) DeleteVDIRole

func (c *Client) DeleteVDIRole(name string) error

DeleteVDIRole will delete the given VDIRole.

func (*Client) DeleteVDIUser

func (c *Client) DeleteVDIUser(name string) error

DeleteVDIUser will delete the given VDIUser.

func (*Client) GetDesktopAudioProxy

func (c *Client) GetDesktopAudioProxy(nn NamespacedName) (io.ReadWriteCloser, error)

GetDesktopAudioProxy returns a ReadWriteCloser proxying the audio of the given session.

func (*Client) GetDesktopDisplayProxy

func (c *Client) GetDesktopDisplayProxy(nn NamespacedName) (io.ReadWriteCloser, error)

GetDesktopDisplayProxy returns a ReadWriteCloser proxying the display of the given session.

func (*Client) GetDesktopFile

func (c *Client) GetDesktopFile(nn NamespacedName, path string) (io.ReadCloser, error)

GetDesktopFile retrieves a ReadCloser containing the contents of the requested file

func (*Client) GetDesktopSessions

func (c *Client) GetDesktopSessions() (*types.DesktopSessionsResponse, error)

GetDesktopSessions retrieves the status of currently running desktop sessions in kVDI.

func (*Client) GetDesktopTemplate

func (c *Client) GetDesktopTemplate(name string) (*desktopsv1.Template, error)

GetDesktopTemplate retrieves a single DesktopTemplate in kVDI by its name.

func (*Client) GetDesktopTemplates

func (c *Client) GetDesktopTemplates() ([]*desktopsv1.Template, error)

GetDesktopTemplates returns a list of available DesktopTemplates. This is the same as doing `kubectl get desktoptemplates -o json`.

func (*Client) GetNamespaces

func (c *Client) GetNamespaces() ([]string, error)

GetNamespaces retrieves a list of namespaces the current user has access to.

func (*Client) GetServerConfig

func (c *Client) GetServerConfig() (*appv1.VDIClusterSpec, error)

GetServerConfig returns the VDICluster configuration of the server.

func (*Client) GetServerVersion

func (c *Client) GetServerVersion() (version, gitCommit string, err error)

GetServerVersion will return the version and git commit of the running API server.

func (*Client) GetServiceAccounts

func (c *Client) GetServiceAccounts(namespace string) ([]string, error)

GetServiceAccounts retrieves all the service accounts the current user can use in the given namespace.

func (*Client) GetVDIRole

func (c *Client) GetVDIRole(name string) (*rbacv1.VDIRole, error)

GetVDIRole retrieves a single VDIRole in kVDI by its name.

func (*Client) GetVDIRoles

func (c *Client) GetVDIRoles() ([]*rbacv1.VDIRole, error)

GetVDIRoles retrieves the available VDIRoles for kVDI. This is the same as doing `kubectl get vdiroles -l "kvdi.io/cluster-ref=kvdi" -o json`.

func (*Client) GetVDIUser

func (c *Client) GetVDIUser(name string) (*types.VDIUser, error)

GetVDIUser returns a single VDIUser by name, if possible. VDIUsers are not like DesktopTemplates and VDIRoles in that they are not CRDs, and are just used as an internal abstraction on the concept of a user.

func (*Client) GetVDIUsers

func (c *Client) GetVDIUsers() ([]*types.VDIUser, error)

GetVDIUsers returns a list of available VDIUsers, if possible. VDIUsers are not like DesktopTemplates and VDIRoles in that they are not CRDs, and are just used as an internal abstraction on the concept of a user.

func (*Client) PutDesktopFile

func (c *Client) PutDesktopFile(nn NamespacedName, name string, contents io.Reader) error

PutDesktopFile uploads a file to the given desktop session.

func (*Client) SetAutoRefreshToken

func (c *Client) SetAutoRefreshToken(val bool)

SetAutoRefreshToken will set whether the client should try to auto refresh tokens after an unauthorized response. The default value is true. Use this method to disable the behavior.

func (*Client) StatDesktopFile

func (c *Client) StatDesktopFile(nn NamespacedName, path string) (*types.StatDesktopFileResponse, error)

StatDesktopFile retrieves stat information for the given path on the desktop.

func (*Client) UpdateDesktopTemplate

func (c *Client) UpdateDesktopTemplate(name string, req *desktopsv1.Template) error

UpdateDesktopTemplate will update a DesktopTemplate. Unlike CreateRoleRequest, the properties provided in the request are merged into the remote state. So only attributes defined in the payload are applied to the remote object.

func (*Client) UpdateVDIRole

func (c *Client) UpdateVDIRole(name string, req *types.UpdateRoleRequest) error

UpdateVDIRole will update a VDIRole. All existing properties are overwritten by those in the request, even if nil or unset.

func (*Client) UpdateVDIUser

func (c *Client) UpdateVDIUser(name string, req *types.UpdateUserRequest) error

UpdateVDIUser will update a VDIUser, if possible. If a password is provided, the password is changed for the user. If a list of role names are provided, the user's roles are updated to match those provided in the payload.

func (*Client) WhoAmI

func (c *Client) WhoAmI() (*types.VDIUser, error)

WhoAmI retrieves the user details for the currently authenticated account.

type NamespacedName

type NamespacedName ktypes.NamespacedName

NamespacedName casts the Kubernetes NamespacedName for ease of use when using this package.

func (NamespacedName) String

func (n NamespacedName) String() string

type Opts

type Opts struct {
	// The full URL to the kVDI app server (e.g. https://kvdi.local)
	URL string
	// The username to use to authenticate.
	Username string
	// The password to use to authenticate.
	Password string
	// TODO: Allow for API keys tied to roles for auth providers that don't allow us
	// to independently verify credentials (e.g. OpenID).
	APIKey string
	// The PEM encoded CA certificate to use when validating the kVDI server certificate.
	// When using the generated certificate, this can be found in the kvdi-app
	// server TLS secret.
	TLSCACert []byte
	// Set to true to skip TLS verification.
	TLSInsecureSkipVerify bool
}

Opts are options to pass to New when creating a new client interface.

Jump to

Keyboard shortcuts

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