Documentation ¶
Index ¶
- func Copy(ctx context.Context, scpArgs []string, port int, destination string) error
- func GetCodespaceConnection(ctx context.Context, progress progressIndicator, apiClient apiClient, ...) (*connection.CodespaceConnection, error)
- func ListenTCP(port int, allInterfaces bool) (*net.TCPListener, int, error)
- func NewRemoteCommand(ctx context.Context, tunnelPort int, destination string, sshArgs ...string) (*exec.Cmd, error)
- func ParseSSHArgs(args []string) (cmdArgs, command []string, err error)
- func PollPostCreateStates(ctx context.Context, progress progressIndicator, apiClient apiClient, ...) (err error)
- func Shell(ctx context.Context, p printer, sshArgs []string, command []string, port int, ...) error
- type PostCreateState
- type PostCreateStateStatus
- type TimeoutError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Copy ¶ added in v2.2.0
Copy runs an scp command over the specified port. scpArgs should contain both scp flags as well as the list of files to copy, with the flags first.
Remote files indicated by a "remote:" prefix are resolved relative to the remote user's home directory, and are subject to shell expansion on the remote host; see https://lwn.net/Articles/835962/.
func GetCodespaceConnection ¶ added in v2.36.0
func GetCodespaceConnection(ctx context.Context, progress progressIndicator, apiClient apiClient, codespace *api.Codespace) (*connection.CodespaceConnection, error)
GetCodespaceConnection waits until a codespace is able to be connected to and initializes a connection to it.
func ListenTCP ¶ added in v2.22.0
ListenTCP starts a localhost tcp listener on 127.0.0.1 (unless allInterfaces is true) and returns the listener and bound port
func NewRemoteCommand ¶
func NewRemoteCommand(ctx context.Context, tunnelPort int, destination string, sshArgs ...string) (*exec.Cmd, error)
NewRemoteCommand returns an exec.Cmd that will securely run a shell command on the remote machine.
func ParseSSHArgs ¶ added in v2.43.0
ParseSSHArgs parses the given array of arguments into two distinct slices of flags and command. The ssh command syntax is: ssh [flags] user@host command [args...] There is no way to specify the user@host destination as a flag. Unfortunately, that means we need to know which user-provided words are SSH flags and which are command arguments so that we can place them before or after the destination, and that means we need to know all the flags and their arities.
func PollPostCreateStates ¶
func PollPostCreateStates(ctx context.Context, progress progressIndicator, apiClient apiClient, codespace *api.Codespace, poller func([]PostCreateState)) (err error)
PollPostCreateStates watches for state changes in a codespace, and calls the supplied poller for each batch of state changes. It runs until it encounters an error, including cancellation of the context.
func Shell ¶
func Shell( ctx context.Context, p printer, sshArgs []string, command []string, port int, destination string, printConnDetails bool, ) error
Shell runs an interactive secure shell over an existing port-forwarding session. It runs until the shell is terminated (including by cancellation of the context).
Types ¶
type PostCreateState ¶
type PostCreateState struct { Name string `json:"name"` Status PostCreateStateStatus `json:"status"` }
PostCreateState is a combination of a state and status value that is captured during codespace creation.
type PostCreateStateStatus ¶
type PostCreateStateStatus string
PostCreateStateStatus is a string value representing the different statuses a state can have.
const ( PostCreateStateRunning PostCreateStateStatus = "running" PostCreateStateSuccess PostCreateStateStatus = "succeeded" PostCreateStateFailed PostCreateStateStatus = "failed" )
func (PostCreateStateStatus) String ¶
func (p PostCreateStateStatus) String() string
type TimeoutError ¶ added in v2.33.0
type TimeoutError struct {
// contains filtered or unexported fields
}
func (*TimeoutError) Error ¶ added in v2.33.0
func (e *TimeoutError) Error() string