Documentation
¶
Overview ¶
Package apiclient wraps the k8shell-go SDK client, authenticated with a static personal access token read from the K8SHELL_PAT_TOKEN environment variable rather than a per-workspace identity JWT.
Index ¶
- Constants
- type Client
- func (c *Client) ComposeBlueprint(ctx context.Context, username string, k8shellFile *models.K8shellFile) (*models.Blueprint, error)
- func (c *Client) GetUserProfile(ctx context.Context, username string) (*models.UserProfile, error)
- func (c *Client) ListSessions(ctx context.Context, username, workspace string, limit int, all bool) ([]models.SSHSession, error)
- func (c *Client) ResolveUserCredential(ctx context.Context, username, serviceName, scope string) (*models.UserCredential, error)
- func (c *Client) SetUserPassword(ctx context.Context, username, password, currentPassword string) (*models.User, error)
- func (c *Client) StopWorkspace(ctx context.Context, name string) error
- func (c *Client) TerminateWorkspace(ctx context.Context, name string) error
Constants ¶
const PATTokenEnv = "K8SHELL_PAT_TOKEN" // #nosec G101 -- this is an env var name, not a credential
PATTokenEnv is the environment variable holding the personal access token used to authenticate all outbound API server calls.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps a k8shell-go SDK client authenticated with the PAT from K8SHELL_PAT_TOKEN.
func New ¶
New creates a Client for the given API server address, authenticated with the personal access token from the K8SHELL_PAT_TOKEN environment variable.
func (*Client) ComposeBlueprint ¶
func (c *Client) ComposeBlueprint(ctx context.Context, username string, k8shellFile *models.K8shellFile) (*models.Blueprint, error)
ComposeBlueprint delegates to the underlying SDK client's blueprint composition.
func (*Client) GetUserProfile ¶
GetUserProfile delegates to the underlying SDK client's profile lookup.
func (*Client) ListSessions ¶
func (c *Client) ListSessions(ctx context.Context, username, workspace string, limit int, all bool) ([]models.SSHSession, error)
ListSessions delegates to the underlying SDK client's session listing, reversing the order returned by the API server.
func (*Client) ResolveUserCredential ¶
func (c *Client) ResolveUserCredential(ctx context.Context, username, serviceName, scope string) (*models.UserCredential, error)
ResolveUserCredential delegates to the underlying SDK client's credential resolution.
func (*Client) SetUserPassword ¶
func (c *Client) SetUserPassword(ctx context.Context, username, password, currentPassword string) (*models.User, error)
SetUserPassword delegates to the underlying SDK client's password update. currentPassword is required by the API server when a non-sudo user is changing their own password, and ignored otherwise; pass "" when not needed.
func (*Client) StopWorkspace ¶
StopWorkspace shuts down the named workspace, keeping its persistent storage intact so it can later be resumed with StartWorkspace.