worksession

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActivateWorkSession

func ActivateWorkSession(ac *client.AlpaconClient, id string) error

func ApproveWorkSession

func ApproveWorkSession(ac *client.AlpaconClient, id string, req WorkSessionApproveRequest) error

func CompleteWorkSession

func CompleteWorkSession(ac *client.AlpaconClient, id string) error

func ExtendWorkSession

func ExtendWorkSession(ac *client.AlpaconClient, id string, req WorkSessionExtendRequest) error

func GetWorkSessionRaw

func GetWorkSessionRaw(ac *client.AlpaconClient, id string) ([]byte, error)

func RejectWorkSession

func RejectWorkSession(ac *client.AlpaconClient, id string) error

func RevokeWorkSession

func RevokeWorkSession(ac *client.AlpaconClient, id string) error

Types

type TimelineAttributes added in v1.4.8

type TimelineAttributes struct {
	Time    string `json:"timestamp" table:"Time"`
	Type    string `json:"type"      table:"Type"`
	Server  string `json:"server"    table:"Server"`
	User    string `json:"user"      table:"User"`
	Details string `json:"details"   table:"Details"`
}

type TimelineItem added in v1.4.8

type TimelineItem struct {
	Type      string  `json:"type"`
	Timestamp *string `json:"timestamp"`
	ID        string  `json:"id"`
	ServerID  *string `json:"server_id"`

	// shared across session-like types (websh_session, tunnel_session, ftp_session)
	Username   string  `json:"username"`
	Groupname  string  `json:"groupname"`
	ClosedAt   *string `json:"closed_at"`
	ClientType string  `json:"client_type"`

	// command
	Shell       string  `json:"shell"`
	Line        string  `json:"line"`
	Success     *bool   `json:"success"`
	Denied      bool    `json:"denied"`
	ElapsedTime float64 `json:"elapsed_time"`

	// tunnel_session
	IsTunnel   bool `json:"is_tunnel"`
	TargetPort *int `json:"target_port"`

	// file_upload / file_download
	Name string `json:"name"`
	Size int64  `json:"size"`

	// sudo_grant
	GrantType string  `json:"grant_type"`
	Status    string  `json:"status"`
	Command   *string `json:"command"`
	OneTime   bool    `json:"one_time"`

	// websh_record
	SessionID    string `json:"session_id"`
	MaskedRecord string `json:"masked_record"`
}

TimelineItem represents a single event in a work session's activity timeline. All event types share this struct; type-specific fields are zero-valued for other types.

func GetWorkSessionTimeline added in v1.4.8

func GetWorkSessionTimeline(ac *client.AlpaconClient, id string, includeRecords bool) ([]TimelineItem, error)

type WorkSession

type WorkSession struct {
	ID            string                `json:"id"`
	Description   string                `json:"description"`
	Status        string                `json:"status"`
	RequesterType string                `json:"requester_type"`
	Scopes        []string              `json:"scopes"`
	Servers       []types.ServerSummary `json:"servers"`
	CreatedBy     *types.UserSummary    `json:"created_by"`
	AssignedUser  *types.UserSummary    `json:"assigned_user"`
	ExpiresAt     time.Time             `json:"expires_at"`
	StartedAt     *time.Time            `json:"started_at"`
	CompletedAt   *time.Time            `json:"completed_at"`
	AddedAt       time.Time             `json:"added_at"`
	UpdatedAt     time.Time             `json:"updated_at"`
}

func GetWorkSession

func GetWorkSession(ac *client.AlpaconClient, id string) (*WorkSession, error)

type WorkSessionApproveRequest

type WorkSessionApproveRequest struct {
	AdjustedScopes  []string `json:"adjusted_scopes,omitempty"`
	AdjustedServers []string `json:"adjusted_servers,omitempty"`
}

type WorkSessionAttributes

type WorkSessionAttributes struct {
	// Active is the active-session marker ("*" for the workspace's active session, empty otherwise).
	// Decorated by cmd/worksession.MarkActive; hidden from JSON output via the "-" tag.
	Active      string `json:"-"           table:"Active"`
	ID          string `json:"id"          table:"ID"`
	Status      string `json:"status"      table:"Status"`
	Scopes      string `json:"scopes"      table:"Scopes"`
	Servers     string `json:"servers"     table:"Servers"`
	ExpiresAt   string `json:"expires_at"  table:"Expires At"`
	Description string `json:"description" table:"Description"`
}

func GetWorkSessionList

func GetWorkSessionList(ac *client.AlpaconClient, status, requesterType string) ([]WorkSessionAttributes, error)

func ProjectAttributes

func ProjectAttributes(ws *WorkSession) WorkSessionAttributes

ProjectAttributes converts a full WorkSession into the WorkSessionAttributes shape used by table outputs (ls, current). Single source of truth for column projection.

type WorkSessionCreateRequest

type WorkSessionCreateRequest struct {
	Description   string   `json:"description"`
	RequesterType string   `json:"requester_type"`
	Scopes        []string `json:"scopes"`
	Servers       []string `json:"servers"`
	ExpiresAt     string   `json:"expires_at"`
}

type WorkSessionExtendRequest

type WorkSessionExtendRequest struct {
	ExpiresAt string `json:"expires_at"`
}

Jump to

Keyboard shortcuts

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