Documentation
¶
Index ¶
- type APIError
- type Client
- func (c *Client) CreateWorkspace(req WorkspaceCreateRequest) (*WorkspaceCreateResponse, error)
- func (c *Client) DeleteWorkspace(name string, deleteData bool) error
- func (c *Client) GetProfile() (*models.User, error)
- func (c *Client) GetWorkspace(name string) (*models.WorkspaceDetails, error)
- func (c *Client) ListProviders() ([]string, error)
- func (c *Client) ListSessions(username string, all bool) ([]models.SSHSession, error)
- func (c *Client) ListUsers() ([]models.User, error)
- func (c *Client) ListWorkspaces(username string, all bool) ([]models.WorkspaceDetails, error)
- func (c *Client) MonitorWorkspace(monitorURL string) (io.ReadCloser, error)
- func (c *Client) PollToken(state string) (*models.UserToken, error)
- type Option
- type WorkspaceCreateRequest
- type WorkspaceCreateResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
APIError is returned for non-2xx responses and carries the HTTP status code and an optional message from the response body.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an authenticated HTTP client for the k8shell API.
func NewAnonymous ¶
NewAnonymous creates an unauthenticated Client, useful for the browser login flow.
func (*Client) CreateWorkspace ¶
func (c *Client) CreateWorkspace(req WorkspaceCreateRequest) (*WorkspaceCreateResponse, error)
CreateWorkspace submits a workspace creation request and returns the 202 response containing the workspace name, job ID, and SSE monitor URL.
func (*Client) DeleteWorkspace ¶
DeleteWorkspace shuts down the named workspace. When deleteData is true, workspace storage is permanently deleted.
func (*Client) GetProfile ¶
GetProfile returns the profile of the authenticated user.
func (*Client) GetWorkspace ¶
func (c *Client) GetWorkspace(name string) (*models.WorkspaceDetails, error)
GetWorkspace returns the details of the named workspace.
func (*Client) ListProviders ¶
ListProviders returns the names of identity providers that support the OnboardUserWebFlow capability (i.e. browser-based login).
func (*Client) ListSessions ¶
ListSessions returns SSH sessions for the given username, or for the authenticated user when username is empty. When all is true, all sessions (including ended ones) are returned.
func (*Client) ListWorkspaces ¶
ListWorkspaces returns workspaces visible to the authenticated token. When username is non-empty the results are filtered by owner. When all is true, workspaces in all states are included.
func (*Client) MonitorWorkspace ¶
func (c *Client) MonitorWorkspace(monitorURL string) (io.ReadCloser, error)
MonitorWorkspace opens an SSE stream at monitorURL and returns the response body for the caller to consume. monitorURL may be a full URL or a path relative to the client's server. The caller is responsible for closing the returned ReadCloser.
type Option ¶
type Option func(*Client)
Option configures a Client.
type WorkspaceCreateRequest ¶
type WorkspaceCreateRequest struct {
Username string `json:"username"`
Blueprint string `json:"blueprint,omitempty"`
RepoOwner string `json:"repoOwner,omitempty"`
RepoName string `json:"repoName,omitempty"`
RepoRef string `json:"repoRef,omitempty"`
}
WorkspaceCreateRequest is the payload for creating a workspace. Either Blueprint or (RepoOwner + RepoName) must be set.
type WorkspaceCreateResponse ¶
type WorkspaceCreateResponse struct {
Workspace string `json:"workspace"`
JobID string `json:"jobId"`
MonitorURL string `json:"monitorUrl"`
}
WorkspaceCreateResponse is the 202 Accepted body returned by CreateWorkspace.