Documentation
¶
Index ¶
- Constants
- Variables
- func MarkActive(rows []wsapi.WorkSessionAttributes, activeUUID string)
- func Resolve(flagValue string) (string, error)
- func ResolveOrExit(flagValue string) string
- func RunCurrent(ac *client.AlpaconClient) (string, *wsapi.WorkSession, error)
- func RunUnset() error
- func RunUse(ac *client.AlpaconClient, uuid string) (string, error)
- func RunUseSession(ac *client.AlpaconClient, uuid string) (*wsapi.WorkSession, error)
Constants ¶
const WorkSessionEnvVar = "ALPACON_WORK_SESSION"
WorkSessionEnvVar is the environment variable consulted as a fallback when no --work-session flag is given. Resolution order: flag > env var > config.
Variables ¶
var WorkSessionCmd = &cobra.Command{ Use: "work-session", Aliases: []string{"session"}, Short: "Create and manage work sessions", Long: `Create, inspect, and manage work sessions. Work sessions are approval-gated units that authorize access-path operations on Alpacon. Gated operations (require an active WorkSession under interactive auth): websh—'alpacon websh' (browser-based terminal) command—'alpacon exec' (remote command execution) webftp—'alpacon cp' (file transfer) tunnel—'alpacon tunnel' (port forwarding) sudo—'Privilege elevation' on Alpacon web (binding op: pending/approved/active allowed) Bypass: Token auth (API token or Service token) skips the requirement. Lifecycle: pending → approved → active → complete | expired | revoked (pending only → rejected | cancelled) Error codes returned when a session check fails: work_session_required no session selected for this shell work_session_not_active session not active (pending, approved, completed, revoked, or cancelled) work_session_expired session has expired work_session_scope_not_allowed operation not in session scopes work_session_server_not_allowed target server not in session work_session_assignee_mismatch session assigned to another principal work_session_not_usable session is no longer usable Run 'alpacon whoami' to check your WorkSession requirement and active session.`, RunE: func(cmd *cobra.Command, args []string) error { if err := cmd.Help(); err != nil { return err } return errors.New("a subcommand is required. Use 'alpacon work-session ls', 'alpacon work-session create', 'alpacon work-session describe', 'alpacon work-session use', 'alpacon work-session current', 'alpacon work-session activate', 'alpacon work-session complete', 'alpacon work-session extend', 'alpacon work-session update', 'alpacon work-session approve', 'alpacon work-session reject', 'alpacon work-session revoke', 'alpacon work-session cancel', 'alpacon work-session timeline', or 'alpacon work-session recording'. Run 'alpacon work-session --help' for more information") }, }
Functions ¶
func MarkActive ¶
func MarkActive(rows []wsapi.WorkSessionAttributes, activeUUID string)
MarkActive decorates the row whose ID matches activeUUID with a "*" marker in its Active column. No-op when activeUUID is empty or no row matches. Exported for unit testing; safe to call with a nil/empty slice.
func Resolve ¶
Resolve returns the effective work-session UUID using flag > env var > config priority.
func ResolveOrExit ¶ added in v1.7.0
ResolveOrExit resolves the work-session UUID and exits on error.
func RunCurrent ¶
func RunCurrent(ac *client.AlpaconClient) (string, *wsapi.WorkSession, error)
RunCurrent returns the active work-session UUID and its server-side details. Returns ("", nil, nil) when nothing is set, or (uuid, nil, err) if set but unreachable.
func RunUnset ¶
func RunUnset() error
RunUnset clears the active work-session for the current workspace. Idempotent — no error when nothing is set.
func RunUse ¶
func RunUse(ac *client.AlpaconClient, uuid string) (string, error)
RunUse validates the work-session via the server, then stores it in config. Returns the human-readable description on success.
func RunUseSession ¶ added in v1.6.0
func RunUseSession(ac *client.AlpaconClient, uuid string) (*wsapi.WorkSession, error)
RunUseSession validates the work-session via the server, then stores it in config.
Types ¶
This section is empty.
Source Files
¶
- resolve.go
- worksession.go
- worksession_activate.go
- worksession_approve.go
- worksession_cancel.go
- worksession_complete.go
- worksession_create.go
- worksession_current.go
- worksession_describe.go
- worksession_extend.go
- worksession_list.go
- worksession_output.go
- worksession_recording.go
- worksession_reject.go
- worksession_revoke.go
- worksession_timeline.go
- worksession_update.go
- worksession_use.go