remotecommand

package
v1.2.0-alpha.1....-61e7d1e Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2017 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package remotecommand adds support for executing commands in containers, with support for separate stdin, stdout, and stderr streams, as well as TTY.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

type Executor interface {
	// Stream initiates the transport of the standard shell streams. It will transport any
	// non-nil stream to a remote system, and return an error if a problem occurs. If tty
	// is set, the stderr stream is not used (raw TTY manages stdout and stderr over the
	// stdout stream).
	Stream(options StreamOptions) error
}

Executor is an interface for transporting shell-style streams.

type StreamExecutor

type StreamExecutor interface {
	Executor
	httpstream.Dialer
}

StreamExecutor supports the ability to dial an httpstream connection and the ability to run a command line stream protocol over that dialer.

func NewExecutor

func NewExecutor(config *restclient.Config, method string, url *url.URL) (StreamExecutor, error)

NewExecutor connects to the provided server and upgrades the connection to multiplexed bidirectional streams. The current implementation uses SPDY, but this could be replaced with HTTP/2 once it's available, or something else. TODO: the common code between this and portforward could be abstracted.

func NewStreamExecutor

func NewStreamExecutor(upgrader httpstream.UpgradeRoundTripper, fn func(http.RoundTripper) http.RoundTripper, method string, url *url.URL) (StreamExecutor, error)

NewStreamExecutor upgrades the request so that it supports multiplexed bidirectional streams. This method takes a stream upgrader and an optional function that is invoked to wrap the round tripper. This method may be used by clients that are lower level than Kubernetes clients or need to provide their own upgrade round tripper.

type StreamOptions

type StreamOptions struct {
	SupportedProtocols []string
	Stdin              io.Reader
	Stdout             io.Writer
	Stderr             io.Writer
	Tty                bool
	TerminalSizeQueue  term.TerminalSizeQueue
}

StreamOptions holds information pertaining to the current streaming session: supported stream protocols, input/output streams, if the client is requesting a TTY, and a terminal size queue to support terminal resizing.

Jump to

Keyboard shortcuts

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