apiclient

package
v0.14.4 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthToken = iota
	AuthSessionCookie
	AuthRemoteServerToken
)

Enum for authorization methods

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiClient

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

func NewClient

func NewClient(baseURL string, token string, insecureSkipVerify bool) *ApiClient

func NewRemoteSession

func NewRemoteSession(token string) *ApiClient

func NewRemoteToken

func NewRemoteToken(token string) *ApiClient

func (*ApiClient) AppendUserAgent

func (c *ApiClient) AppendUserAgent(userAgent string) *ApiClient

func (*ApiClient) CreateGroup

func (c *ApiClient) CreateGroup(groupName string, maxSpaces uint32, computeUnits uint32, storageUnits uint32, maxTunnels uint32) (string, int, error)

func (*ApiClient) CreateRole added in v0.12.0

func (c *ApiClient) CreateRole(roleName string, permissions []uint16) (string, int, error)

func (*ApiClient) CreateSpace

func (c *ApiClient) CreateSpace(space *model.Space) (int, error)

func (*ApiClient) CreateTemplate

func (c *ApiClient) CreateTemplate(name string, job string, description string, volumes string, groups []string, localContainer bool, IsManual bool, withTerminal bool, withVSCodeTunnel bool, withCodeServer bool, withSSH bool, computeUnits uint32, storageUnits uint32, scheduleEnabled bool, schedule *[]TemplateDetailsDay) (string, int, error)

func (*ApiClient) CreateTemplateVar

func (c *ApiClient) CreateTemplateVar(name string, location string, local bool, value string, protected bool, restricted bool) (string, int, error)

func (*ApiClient) CreateToken

func (c *ApiClient) CreateToken(name string) (string, int, error)

func (*ApiClient) CreateUser

func (c *ApiClient) CreateUser(request *CreateUserRequest) (string, int, error)

func (*ApiClient) CreateVolume

func (c *ApiClient) CreateVolume(name string, definition string, localContainer bool) (*VolumeCreateResponse, int, error)

func (*ApiClient) DeleteGroup

func (c *ApiClient) DeleteGroup(groupId string) (int, error)

func (*ApiClient) DeleteRole added in v0.12.0

func (c *ApiClient) DeleteRole(roleId string) (int, error)

func (*ApiClient) DeleteSpace

func (c *ApiClient) DeleteSpace(spaceId string) (int, error)

func (*ApiClient) DeleteTemplate

func (c *ApiClient) DeleteTemplate(templateId string) (int, error)

func (*ApiClient) DeleteTemplateVar

func (c *ApiClient) DeleteTemplateVar(templateVarId string) (int, error)

func (*ApiClient) DeleteToken

func (c *ApiClient) DeleteToken(tokenId string) (int, error)

func (*ApiClient) DeleteUser

func (c *ApiClient) DeleteUser(userId string) error

func (*ApiClient) DeleteVolume

func (c *ApiClient) DeleteVolume(volumeId string) (int, error)

func (*ApiClient) GetAuditLogs added in v0.12.9

func (c *ApiClient) GetAuditLogs(start int, maxItems int) (*AuditLogs, int, error)

func (*ApiClient) GetGroup

func (c *ApiClient) GetGroup(groupId string) (*GroupInfo, int, error)

func (*ApiClient) GetGroups

func (c *ApiClient) GetGroups() (*GroupInfoList, int, error)

func (*ApiClient) GetPermissions added in v0.12.0

func (c *ApiClient) GetPermissions() (*PermissionInfoList, int, error)

func (*ApiClient) GetRole added in v0.12.0

func (c *ApiClient) GetRole(roleId string) (*RoleDetails, int, error)

func (*ApiClient) GetRoles added in v0.12.0

func (c *ApiClient) GetRoles() (*RoleInfoList, int, error)

func (*ApiClient) GetSpace

func (c *ApiClient) GetSpace(spaceId string) (*model.Space, int, error)

func (*ApiClient) GetSpaceServiceState

func (c *ApiClient) GetSpaceServiceState(spaceId string) (*SpaceServiceState, int, error)

func (*ApiClient) GetSpaces

func (c *ApiClient) GetSpaces(userId string) (*SpaceInfoList, int, error)

func (*ApiClient) GetTemplate

func (c *ApiClient) GetTemplate(templateId string) (*TemplateDetails, int, error)

func (*ApiClient) GetTemplateVar

func (c *ApiClient) GetTemplateVar(templateVarId string) (*TemplateVarValue, int, error)

func (*ApiClient) GetTemplateVars

func (c *ApiClient) GetTemplateVars() (*TemplateVarList, int, error)

func (*ApiClient) GetTemplates

func (c *ApiClient) GetTemplates() (*TemplateList, int, error)

func (*ApiClient) GetTokens

func (c *ApiClient) GetTokens() (*[]TokenInfo, int, error)

func (*ApiClient) GetTunnelDomain added in v0.12.7

func (c *ApiClient) GetTunnelDomain() (string, int, error)

func (*ApiClient) GetTunnels added in v0.12.7

func (c *ApiClient) GetTunnels() ([]TunnelInfo, int, error)

func (*ApiClient) GetUser

func (c *ApiClient) GetUser(userId string) (*model.User, error)

func (*ApiClient) GetUserQuota added in v0.12.0

func (c *ApiClient) GetUserQuota(userId string) (*UserQuota, error)

func (*ApiClient) GetUsers

func (c *ApiClient) GetUsers(state string, location string) (*UserInfoList, error)

func (*ApiClient) GetVolume

func (c *ApiClient) GetVolume(volumeId string) (*VolumeDefinition, int, error)

func (*ApiClient) GetVolumeObject

func (c *ApiClient) GetVolumeObject(volumeId string) (*model.Volume, int, error)

func (*ApiClient) GetVolumes

func (c *ApiClient) GetVolumes() (*VolumeInfoList, int, error)

func (*ApiClient) Login

func (c *ApiClient) Login(email string, password string) (string, int, error)

func (*ApiClient) LoginUserToken added in v0.10.0

func (c *ApiClient) LoginUserToken(userId string, token string) error

Login to the server using a user ID and token

func (*ApiClient) Logout

func (c *ApiClient) Logout() error

func (*ApiClient) Ping

func (c *ApiClient) Ping() (string, error)

func (*ApiClient) SetAuthToken

func (c *ApiClient) SetAuthToken(token string) *ApiClient

func (*ApiClient) SetBaseUrl

func (c *ApiClient) SetBaseUrl(baseURL string) *ApiClient

func (*ApiClient) StartSpace

func (c *ApiClient) StartSpace(spaceId string) (int, error)

func (*ApiClient) StartVolume

func (c *ApiClient) StartVolume(volumeId string) (*StartVolumeResponse, int, error)

func (*ApiClient) StopSpace

func (c *ApiClient) StopSpace(spaceId string) (int, error)

func (*ApiClient) StopVolume

func (c *ApiClient) StopVolume(volumeId string) (int, error)

func (*ApiClient) UpdateGroup

func (c *ApiClient) UpdateGroup(groupId string, groupName string, maxSpaces uint32, computeUnits uint32, storageUnits uint32, maxTunnels uint32) (int, error)

func (*ApiClient) UpdateRole added in v0.12.0

func (c *ApiClient) UpdateRole(roleId string, roleName string, permissions []uint16) (int, error)

func (*ApiClient) UpdateSpace

func (c *ApiClient) UpdateSpace(space *model.Space) (int, error)

func (*ApiClient) UpdateTemplate

func (c *ApiClient) UpdateTemplate(templateId string, name string, job string, description string, volumes string, groups []string, withTerminal bool, withVSCodeTunnel bool, withCodeServer bool, withSSH bool, computeUnits uint32, storageUnits uint32, scheduleEnabled bool, schedule *[]TemplateDetailsDay) (int, error)

func (*ApiClient) UpdateTemplateVar

func (c *ApiClient) UpdateTemplateVar(templateVarId string, name string, location string, local bool, value string, protected bool, restricted bool) (int, error)

func (*ApiClient) UpdateUser

func (c *ApiClient) UpdateUser(user *model.User) error

func (*ApiClient) UpdateVolume

func (c *ApiClient) UpdateVolume(volumeId string, name string, definition string) (int, error)

func (*ApiClient) UseSessionCookie

func (c *ApiClient) UseSessionCookie(useCookie bool) *ApiClient

func (*ApiClient) WhoAmI

func (c *ApiClient) WhoAmI() (*model.User, error)

type AuditLogEntry added in v0.12.9

type AuditLogEntry struct {
	Id         int64                  `json:"audit_log_id"`
	Actor      string                 `json:"actor"`
	ActorType  string                 `json:"actor_type"`
	Event      string                 `json:"event"`
	When       time.Time              `json:"when"`
	Details    string                 `json:"details"`
	Properties map[string]interface{} `json:"properties"`
}

type AuditLogs added in v0.12.9

type AuditLogs struct {
	Count int             `json:"count"`
	Items []AuditLogEntry `json:"items"`
}

type AuthLoginRequest

type AuthLoginRequest struct {
	Password string `json:"password"`
	Email    string `json:"email"`
}

type AuthLoginResponse

type AuthLoginResponse struct {
	Status bool   `json:"status"`
	Token  string `json:"token"`
}

type AuthLogoutResponse

type AuthLogoutResponse struct {
	Status bool `json:"status"`
}

type CreateSpaceRequest

type CreateSpaceRequest = SpaceRequest

type CreateSpaceResponse

type CreateSpaceResponse struct {
	Status  bool   `json:"status"`
	SpaceID string `json:"space_id"`
}

type CreateTokenRequest

type CreateTokenRequest struct {
	Name string `json:"name"`
}

type CreateTokenResponse

type CreateTokenResponse struct {
	Status  bool   `json:"status"`
	TokenID string `json:"token_id"`
}

type CreateUserRequest

type CreateUserRequest = userRequest

type CreateUserResponse

type CreateUserResponse struct {
	Status bool   `json:"status"`
	UserId string `json:"user_id"`
}

type GroupInfo

type GroupInfo struct {
	Id           string `json:"group_id"`
	Name         string `json:"name"`
	MaxSpaces    uint32 `json:"max_spaces"`
	ComputeUnits uint32 `json:"compute_units"`
	StorageUnits uint32 `json:"storage_units"`
	MaxTunnels   uint32 `json:"max_tunnels"`
}

type GroupInfoList

type GroupInfoList struct {
	Count  int         `json:"count"`
	Groups []GroupInfo `json:"groups"`
}

type GroupResponse

type GroupResponse struct {
	Status bool   `json:"status"`
	Id     string `json:"group_id"`
}

type PermissionInfo added in v0.12.0

type PermissionInfo struct {
	Id   int    `json:"id"`
	Name string `json:"name"`
}

type PermissionInfoList added in v0.12.0

type PermissionInfoList struct {
	Count       int              `json:"count"`
	Permissions []PermissionInfo `json:"permissions"`
}

type PingResponse

type PingResponse struct {
	Status  bool   `json:"status"`
	Version string `json:"version"`
}

type RoleDetails added in v0.12.0

type RoleDetails struct {
	Id          string   `json:"role_id"`
	Name        string   `json:"name"`
	Permissions []uint16 `json:"permissions"`
}

type RoleInfo added in v0.12.0

type RoleInfo struct {
	Id   string `json:"role_id"`
	Name string `json:"name"`
}

type RoleInfoList added in v0.12.0

type RoleInfoList struct {
	Count int        `json:"count"`
	Roles []RoleInfo `json:"roles"`
}

type RoleResponse added in v0.12.0

type RoleResponse struct {
	Status bool   `json:"status"`
	Id     string `json:"role_id"`
}

type SpaceDefinition

type SpaceDefinition struct {
	UserId     string                       `json:"user_id"`
	TemplateId string                       `json:"template_id"`
	Name       string                       `json:"name"`
	Shell      string                       `json:"shell"`
	Location   string                       `json:"location"`
	AltNames   []string                     `json:"alt_names"`
	IsDeployed bool                         `json:"is_deployed"`
	IsPending  bool                         `json:"is_pending"`
	IsDeleting bool                         `json:"is_deleting"`
	VolumeData map[string]model.SpaceVolume `json:"volume_data"`
}

type SpaceInfo

type SpaceInfo struct {
	Id             string `json:"space_id"`
	Name           string `json:"name"`
	TemplateName   string `json:"template_name"`
	TemplateId     string `json:"template_id"`
	Location       string `json:"location"`
	Username       string `json:"username"`
	UserId         string `json:"user_id"`
	LocalContainer bool   `json:"local_container"`
	IsManual       bool   `json:"is_manual"`
}

type SpaceInfoList

type SpaceInfoList struct {
	Count  int         `json:"count"`
	Spaces []SpaceInfo `json:"spaces"`
}

type SpaceRequest

type SpaceRequest struct {
	Name       string   `json:"name"`
	TemplateId string   `json:"template_id"`
	Shell      string   `json:"shell"`
	UserId     string   `json:"user_id"`
	AltNames   []string `json:"alt_names"`
	Location   string   `json:"location"`
}

type SpaceServiceState

type SpaceServiceState struct {
	Name            string            `json:"name"`
	Location        string            `json:"location"`
	HasCodeServer   bool              `json:"has_code_server"`
	HasSSH          bool              `json:"has_ssh"`
	HasHttpVNC      bool              `json:"has_http_vnc"`
	HasTerminal     bool              `json:"has_terminal"`
	HasState        bool              `json:"has_state"`
	IsDeployed      bool              `json:"is_deployed"`
	IsPending       bool              `json:"is_pending"`
	IsDeleting      bool              `json:"is_deleting"`
	TcpPorts        map[string]string `json:"tcp_ports"`
	HttpPorts       map[string]string `json:"http_ports"`
	UpdateAvailable bool              `json:"update_available"`
	IsRemote        bool              `json:"is_remote"`
	HasVSCodeTunnel bool              `json:"has_vscode_tunnel"`
	VSCodeTunnel    string            `json:"vscode_tunnel_name"`
}

type StartVolumeResponse

type StartVolumeResponse struct {
	Status   bool   `json:"status"`
	Location string `json:"location"`
}

type TemplateCreateRequest added in v0.11.0

type TemplateCreateRequest struct {
	Name             string               `json:"name"`
	Job              string               `json:"job"`
	Description      string               `json:"description"`
	Volumes          string               `json:"volumes"`
	Groups           []string             `json:"groups"`
	LocalContainer   bool                 `json:"local_container"`
	IsManual         bool                 `json:"is_manual"`
	WithTerminal     bool                 `json:"with_terminal"`
	WithVSCodeTunnel bool                 `json:"with_vscode_tunnel"`
	WithCodeServer   bool                 `json:"with_code_server"`
	WithSSH          bool                 `json:"with_ssh"`
	ScheduleEnabled  bool                 `json:"schedule_enabled"`
	Schedule         []TemplateDetailsDay `json:"schedule"`
	ComputeUnits     uint32               `json:"compute_units"`
	StorageUnits     uint32               `json:"storage_units"`
}

type TemplateCreateResponse

type TemplateCreateResponse struct {
	Status bool   `json:"status"`
	Id     string `json:"template_id"`
}

type TemplateDetails

type TemplateDetails struct {
	Name             string               `json:"name"`
	Job              string               `json:"job"`
	Description      string               `json:"description"`
	Volumes          string               `json:"volumes"`
	Usage            int                  `json:"usage"`
	Hash             string               `json:"hash"`
	Deployed         int                  `json:"deployed"`
	Groups           []string             `json:"groups"`
	LocalContainer   bool                 `json:"local_container"`
	IsManual         bool                 `json:"is_manual"`
	WithTerminal     bool                 `json:"with_terminal"`
	WithVSCodeTunnel bool                 `json:"with_vscode_tunnel"`
	WithCodeServer   bool                 `json:"with_code_server"`
	WithSSH          bool                 `json:"with_ssh"`
	ComputeUnits     uint32               `json:"compute_units"`
	StorageUnits     uint32               `json:"storage_units"`
	ScheduleEnabled  bool                 `json:"schedule_enabled"`
	Schedule         []TemplateDetailsDay `json:"schedule"`
}

type TemplateDetailsDay added in v0.12.0

type TemplateDetailsDay struct {
	Enabled bool   `json:"enabled"`
	From    string `json:"from"`
	To      string `json:"to"`
}

type TemplateInfo

type TemplateInfo struct {
	Id              string               `json:"template_id"`
	Name            string               `json:"name"`
	Description     string               `json:"description"`
	Usage           int                  `json:"usage"`
	Deployed        int                  `json:"deployed"`
	Groups          []string             `json:"groups"`
	LocalContainer  bool                 `json:"local_container"`
	IsManual        bool                 `json:"is_manual"`
	ScheduleEnabled bool                 `json:"schedule_enabled"`
	ComputeUnits    uint32               `json:"compute_units"`
	StorageUnits    uint32               `json:"storage_units"`
	Schedule        []TemplateDetailsDay `json:"schedule"`
}

type TemplateList

type TemplateList struct {
	Count     int            `json:"count"`
	Templates []TemplateInfo `json:"templates"`
}

type TemplateUpdateRequest added in v0.11.0

type TemplateUpdateRequest struct {
	Name             string               `json:"name"`
	Job              string               `json:"job"`
	Description      string               `json:"description"`
	Volumes          string               `json:"volumes"`
	Groups           []string             `json:"groups"`
	WithTerminal     bool                 `json:"with_terminal"`
	WithVSCodeTunnel bool                 `json:"with_vscode_tunnel"`
	WithCodeServer   bool                 `json:"with_code_server"`
	WithSSH          bool                 `json:"with_ssh"`
	ScheduleEnabled  bool                 `json:"schedule_enabled"`
	Schedule         []TemplateDetailsDay `json:"schedule"`
	ComputeUnits     uint32               `json:"compute_units"`
	StorageUnits     uint32               `json:"storage_units"`
}

type TemplateVar

type TemplateVar struct {
	Id         string `json:"templatevar_id"`
	Name       string `json:"name"`
	Location   string `json:"location"`
	Local      bool   `json:"local"`
	Protected  bool   `json:"protected"`
	Restricted bool   `json:"restricted"`
}

type TemplateVarCreateResponse

type TemplateVarCreateResponse struct {
	Status bool   `json:"status"`
	Id     string `json:"templatevar_id"`
}

type TemplateVarList

type TemplateVarList struct {
	Count       int           `json:"count"`
	TemplateVar []TemplateVar `json:"variables"`
}

type TemplateVarValue

type TemplateVarValue struct {
	Name       string `json:"name"`
	Location   string `json:"location"`
	Local      bool   `json:"local"`
	Value      string `json:"value"`
	Protected  bool   `json:"protected"`
	Restricted bool   `json:"restricted"`
}

type TokenInfo

type TokenInfo struct {
	Id           string    `json:"token_id"`
	Name         string    `json:"name"`
	ExpiresAfter time.Time `json:"expires_at"`
}

type TunnelInfo added in v0.12.7

type TunnelInfo struct {
	Name    string `json:"name"`
	Address string `json:"address"`
}

type UpdateSpaceRequest

type UpdateSpaceRequest = SpaceRequest

type UpdateUserRequest

type UpdateUserRequest = userRequest

type UserGroupRequest

type UserGroupRequest struct {
	Name         string `json:"name"`
	MaxSpaces    uint32 `json:"max_spaces"`
	ComputeUnits uint32 `json:"compute_units"`
	StorageUnits uint32 `json:"storage_units"`
	MaxTunnels   uint32 `json:"max_tunnels"`
}

type UserInfo

type UserInfo struct {
	Id                             string     `json:"user_id"`
	Username                       string     `json:"username"`
	Email                          string     `json:"email"`
	Roles                          []string   `json:"roles"`
	Groups                         []string   `json:"groups"`
	Active                         bool       `json:"active"`
	MaxSpaces                      uint32     `json:"max_spaces"`
	ComputeUnits                   uint32     `json:"compute_units"`
	StorageUnits                   uint32     `json:"storage_units"`
	MaxTunnels                     uint32     `json:"max_tunnels"`
	Current                        bool       `json:"current"`
	LastLoginAt                    *time.Time `json:"last_login_at"`
	NumberSpaces                   int        `json:"number_spaces"`
	NumberSpacesDeployed           int        `json:"number_spaces_deployed"`
	NumberSpacesDeployedInLocation int        `json:"number_spaces_deployed_in_location"`
	UsedComputeUnits               uint32     `json:"used_compute_units"`
	UsedStorageUnits               uint32     `json:"used_storage_units"`
}

type UserInfoList

type UserInfoList struct {
	Count int        `json:"count"`
	Users []UserInfo `json:"users"`
}

type UserQuota added in v0.12.0

type UserQuota struct {
	MaxSpaces            uint32 `json:"max_spaces"`
	ComputeUnits         uint32 `json:"compute_units"`
	StorageUnits         uint32 `json:"storage_units"`
	MaxTunnels           uint32 `json:"max_tunnels"`
	NumberSpaces         int    `json:"number_spaces"`
	NumberSpacesDeployed int    `json:"number_spaces_deployed"`
	UsedComputeUnits     uint32 `json:"used_compute_units"`
	UsedStorageUnits     uint32 `json:"used_storage_units"`
	UsedTunnels          uint32 `json:"used_tunnels"`
}

type UserResponse

type UserResponse struct {
	Id              string     `json:"user_id"`
	Username        string     `json:"username"`
	Email           string     `json:"email"`
	ServicePassword string     `json:"service_password"`
	Roles           []string   `json:"roles"`
	Groups          []string   `json:"groups"`
	Active          bool       `json:"active"`
	MaxSpaces       uint32     `json:"max_spaces"`
	ComputeUnits    uint32     `json:"compute_units"`
	StorageUnits    uint32     `json:"storage_units"`
	MaxTunnels      uint32     `json:"max_tunnels"`
	SSHPublicKey    string     `json:"ssh_public_key"`
	GitHubUsername  string     `json:"github_username"`
	PreferredShell  string     `json:"preferred_shell"`
	Timezone        string     `json:"timezone"`
	Current         bool       `json:"current"`
	LastLoginAt     *time.Time `json:"last_login_at"`
	CreatedAt       time.Time  `json:"created_at"`
	UpdatedAt       time.Time  `json:"updated_at"`
}

type UserRoleRequest added in v0.12.0

type UserRoleRequest struct {
	Name        string   `json:"name"`
	Permissions []uint16 `json:"permissions"`
}

type VolumeCreateRequest added in v0.11.0

type VolumeCreateRequest struct {
	Name           string `json:"name"`
	Definition     string `json:"definition"`
	LocalContainer bool   `json:"local_container"`
}

type VolumeCreateResponse

type VolumeCreateResponse struct {
	Status   bool   `json:"status"`
	VolumeId string `json:"volume_id"`
}

type VolumeDefinition

type VolumeDefinition struct {
	Name           string `json:"name"`
	Definition     string `json:"definition"`
	Location       string `json:"location"`
	Active         bool   `json:"active"`
	LocalContainer bool   `json:"local_container"`
}

type VolumeInfo

type VolumeInfo struct {
	Id             string `json:"volume_id"`
	Name           string `json:"name"`
	Active         bool   `json:"active"`
	Location       string `json:"location"`
	LocalContainer bool   `json:"local_container"`
}

type VolumeInfoList

type VolumeInfoList struct {
	Count   int          `json:"count"`
	Volumes []VolumeInfo `json:"volumes"`
}

type VolumeStartRequest

type VolumeStartRequest = VolumeStartStopRequest

type VolumeStartResponse

type VolumeStartResponse = VolumeStartStopResponse

type VolumeStartStopRequest

type VolumeStartStopRequest struct {
	Location string `json:"location"`
}

type VolumeStartStopResponse

type VolumeStartStopResponse struct {
	Name       string                 `json:"name"`
	Definition string                 `json:"definition"`
	Location   string                 `json:"location"`
	Variables  map[string]interface{} `json:"variables"`
}

type VolumeStopRequest

type VolumeStopRequest = VolumeStartStopRequest

type VolumeStopResponse

type VolumeStopResponse = VolumeStartStopResponse

type VolumeUpdateRequest added in v0.11.0

type VolumeUpdateRequest struct {
	Name       string `json:"name"`
	Definition string `json:"definition"`
}

Jump to

Keyboard shortcuts

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