diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-01-16 21:10:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-16 21:10:53 +0100 |
commit | 74b89da27c5da20ddcbff5ea3689795ad2b720f5 (patch) | |
tree | 0a4516323bc9dd5bedf4ef75595892dcf7a27b63 /libpod/oci.go | |
parent | 79fbe7252e35b086e168c55c32b6c7b8e83496bc (diff) | |
parent | ac47e80b07ddc1e56e7c4fd6b0deca9f3bdc5f54 (diff) | |
download | podman-74b89da27c5da20ddcbff5ea3689795ad2b720f5.tar.gz podman-74b89da27c5da20ddcbff5ea3689795ad2b720f5.tar.bz2 podman-74b89da27c5da20ddcbff5ea3689795ad2b720f5.zip |
Merge pull request #4837 from mheon/rework_attach
Add an API for Attach over HTTP API
Diffstat (limited to 'libpod/oci.go')
-rw-r--r-- | libpod/oci.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/libpod/oci.go b/libpod/oci.go index 05a2f37db..2ea61851f 100644 --- a/libpod/oci.go +++ b/libpod/oci.go @@ -1,6 +1,9 @@ package libpod import ( + "bufio" + "net" + "k8s.io/client-go/tools/remotecommand" ) @@ -47,6 +50,23 @@ type OCIRuntime interface { // UnpauseContainer unpauses the given container. UnpauseContainer(ctr *Container) error + // HTTPAttach performs an attach intended to be transported over HTTP. + // For terminal attach, the container's output will be directly streamed + // to output; otherwise, STDOUT and STDERR will be multiplexed, with + // a header prepended as follows: 1-byte STREAM (0, 1, 2 for STDIN, + // STDOUT, STDERR), 3 null (0x00) bytes, 4-byte big endian length. + // If a cancel channel is provided, it can be used to asyncronously + // termninate the attach session. Detach keys, if given, will also cause + // the attach session to be terminated if provided via the STDIN + // channel. If they are not provided, the default detach keys will be + // used instead. Detach keys of "" will disable detaching via keyboard. + // The streams parameter may be passed for containers that did not + // create a terminal and will determine which streams to forward to the + // client. + HTTPAttach(ctr *Container, httpConn net.Conn, httpBuf *bufio.ReadWriter, streams *HTTPAttachStreams, detachKeys *string, cancel <-chan bool) error + // AttachResize resizes the terminal in use by the given container. + AttachResize(ctr *Container, newSize remotecommand.TerminalSize) error + // ExecContainer executes a command in a running container. // Returns an int (exit code), error channel (errors from attach), and // error (errors that occurred attempting to start the exec session). @@ -130,3 +150,12 @@ type ExecOptions struct { // detach from the container. DetachKeys string } + +// HTTPAttachStreams informs the HTTPAttach endpoint which of the container's +// standard streams should be streamed to the client. If this is passed, at +// least one of the streams must be set to true. +type HTTPAttachStreams struct { + Stdin bool + Stdout bool + Stderr bool +} |