Documentation
¶
Index ¶
- func FindExternalNode(store ExternalNodeStore, name string) (*nodev1.ExternalNode, error)
- func GetAnyWorkspaceByIDOrNameInActiveOrgErr(storeQ GetWorkspaceByNameOrIDErrStore, workspaceNameOrID string) (*entity.Workspace, error)
- func GetClassIDString(classID string) string
- func GetInstanceNames(args []string) ([]string, error)
- func GetInstanceNamesWithPipeInfo(args []string) ([]string, bool)
- func GetInstanceString(w entity.Workspace) string
- func GetUserWorkspaceByNameOrIDErr(storeQ GetWorkspaceByNameOrIDErrStore, workspaceNameOrID string) (*entity.Workspace, error)
- func IsStdinPiped() bool
- func IsStdoutPiped() bool
- func OpenPort(store ExternalNodeStore, nodeID string, portNumber int32, ...) (*nodev1.Port, error)
- func PollUntil(s *spinner.Spinner, wsid string, state string, ...) error
- func ResolveNodeSSHEntry(userID string, node *nodev1.ExternalNode) *ssh.ExternalNodeSSHEntry
- func StartWorkspaceIfStopped(t *terminal.Terminal, s *spinner.Spinner, tstore WorkspaceStartStore, ...) error
- func WaitForSSHToBeAvailable(sshAlias string, s *spinner.Spinner) error
- type ExternalNodeSSHInfo
- type ExternalNodeStore
- type GetWorkspaceByNameOrIDErrStore
- type MakeWorkspaceWithMetaStore
- type WorkspaceOrNode
- type WorkspaceOrNodeResolver
- type WorkspacePollingStore
- type WorkspaceStartStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindExternalNode ¶ added in v0.6.318
func FindExternalNode(store ExternalNodeStore, name string) (*nodev1.ExternalNode, error)
FindExternalNode searches for an external node by name in the user's active organization. Returns (nil, nil) if no matching node is found.
func GetAnyWorkspaceByIDOrNameInActiveOrgErr ¶ added in v0.6.76
func GetAnyWorkspaceByIDOrNameInActiveOrgErr(storeQ GetWorkspaceByNameOrIDErrStore, workspaceNameOrID string) (*entity.Workspace, error)
func GetClassIDString ¶ added in v0.6.209
func GetInstanceNames ¶ added in v0.6.317
GetInstanceNames gets instance names from args or stdin (supports piping) Returns error if no names are provided
func GetInstanceNamesWithPipeInfo ¶ added in v0.6.317
GetInstanceNamesWithPipeInfo gets instance names from args or stdin and returns whether stdin was piped. Useful when you need to know if input came from a pipe vs args.
func GetInstanceString ¶ added in v0.6.209
func GetUserWorkspaceByNameOrIDErr ¶ added in v0.6.66
func GetUserWorkspaceByNameOrIDErr(storeQ GetWorkspaceByNameOrIDErrStore, workspaceNameOrID string) (*entity.Workspace, error)
func IsStdinPiped ¶ added in v0.6.317
func IsStdinPiped() bool
IsStdinPiped returns true if stdin is being piped from another command
func IsStdoutPiped ¶ added in v0.6.317
func IsStdoutPiped() bool
IsStdoutPiped returns true if stdout is being piped to another command Enables command chaining like: brev ls | grep RUNNING | brev stop
func OpenPort ¶ added in v0.6.318
func OpenPort(store ExternalNodeStore, nodeID string, portNumber int32, protocol nodev1.PortProtocol) (*nodev1.Port, error)
OpenPort calls the OpenPort RPC to open a port on an external node via netbird. This must be called before attempting to connect to a non-SSH port on a node.
func PollUntil ¶ added in v0.6.317
func PollUntil(s *spinner.Spinner, wsid string, state string, pollingStore WorkspacePollingStore, waitMsg string, timeout time.Duration) error
PollUntil polls the workspace status until it matches the desired state or times out
func ResolveNodeSSHEntry ¶ added in v0.6.318
func ResolveNodeSSHEntry(userID string, node *nodev1.ExternalNode) *ssh.ExternalNodeSSHEntry
ResolveNodeSSHEntry is a pure data function that extracts the SSH config entry for a given user from a node. Returns nil if the user has no access or the node has no SSH port. This is the single source of truth for node→SSHEntry conversion, used by both ResolveExternalNodeSSH (for commands) and refresh (for SSH config generation).
Types ¶
type ExternalNodeSSHInfo ¶ added in v0.6.318
type ExternalNodeSSHInfo struct {
Node *nodev1.ExternalNode
LinuxUser string
Hostname string
Port int32
}
ExternalNodeSSHInfo holds resolved SSH connection details for an external node.
func ResolveExternalNodeSSH ¶ added in v0.6.318
func ResolveExternalNodeSSH(store ExternalNodeStore, node *nodev1.ExternalNode) (*ExternalNodeSSHInfo, error)
ResolveExternalNodeSSH resolves the SSH connection details for an external node by finding the current user's SSH access and the node's SSH port.
func (*ExternalNodeSSHInfo) HomePath ¶ added in v0.6.318
func (info *ExternalNodeSSHInfo) HomePath() string
HomePath returns the home directory path for the linux user.
func (*ExternalNodeSSHInfo) SSHAlias ¶ added in v0.6.318
func (info *ExternalNodeSSHInfo) SSHAlias() string
SSHAlias returns a sanitized node name suitable for use as an SSH config Host alias.
func (*ExternalNodeSSHInfo) SSHTarget ¶ added in v0.6.318
func (info *ExternalNodeSSHInfo) SSHTarget() string
SSHTarget returns the "user@host" string for direct SSH.
type ExternalNodeStore ¶ added in v0.6.318
type ExternalNodeStore interface {
GetActiveOrganizationOrDefault() (*entity.Organization, error)
GetAccessToken() (string, error)
GetCurrentUser() (*entity.User, error)
}
ExternalNodeStore is the minimal interface needed for external node lookup and SSH resolution.
type MakeWorkspaceWithMetaStore ¶
type MakeWorkspaceWithMetaStore interface {
GetWorkspaceMetaData(workspaceID string) (*entity.WorkspaceMetaData, error)
}
type WorkspaceOrNode ¶ added in v0.6.318
type WorkspaceOrNode struct {
Workspace *entity.Workspace
Node *nodev1.ExternalNode
}
WorkspaceOrNode is returned by ResolveWorkspaceOrNode. Exactly one field is non-nil.
func ResolveWorkspaceOrNode ¶ added in v0.6.318
func ResolveWorkspaceOrNode(store WorkspaceOrNodeResolver, nameOrID string, ) (*WorkspaceOrNode, error)
ResolveWorkspaceOrNode looks up a workspace first; if not found, falls back to external nodes. The store must satisfy both GetWorkspaceByNameOrIDErrStore and ExternalNodeStore.
type WorkspaceOrNodeResolver ¶ added in v0.6.318
type WorkspaceOrNodeResolver interface {
GetWorkspaceByNameOrIDErrStore
ExternalNodeStore
}
type WorkspacePollingStore ¶ added in v0.6.317
type WorkspacePollingStore interface {
GetWorkspace(workspaceID string) (*entity.Workspace, error)
}
WorkspacePollingStore is the minimal interface needed for polling workspace state
type WorkspaceStartStore ¶ added in v0.6.317
type WorkspaceStartStore interface {
GetWorkspaceByNameOrIDErrStore
WorkspacePollingStore
StartWorkspace(workspaceID string) (*entity.Workspace, error)
}
WorkspaceStartStore is the interface needed for starting stopped workspaces