docker

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2016 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Activate

func Activate(w http.ResponseWriter, r *http.Request)

Activate activates the plugin.

func Capabilities

func Capabilities(w http.ResponseWriter, r *http.Request)

Capabilities is the API response for docker capabilities requests.

func Deactivate

func Deactivate(w http.ResponseWriter, r *http.Request)

Deactivate deactivates the plugin.

func NewVolplugin

func NewVolplugin() api.Volplugin

NewVolplugin initializes the docker api interface for volplugin.

Types

type Response

type Response struct {
	Mountpoint string
	Err        string
}

Response is taken from struct Response in https://github.com/calavera/docker-volume-api/blob/master/api.go#L33

type Volplugin

type Volplugin struct{}

Volplugin implements the docker volumes API via the interfaces in api/interfaces.go.

func (*Volplugin) HTTPError

func (v *Volplugin) HTTPError(w http.ResponseWriter, err error)

HTTPError returns a 200 status to docker with an error struct. It returns 500 if marshalling failed.

func (*Volplugin) ReadCreate

func (v *Volplugin) ReadCreate(r *http.Request) (*config.VolumeRequest, error)

ReadCreate reads a create request from docker and parses it into a policy/volume.

func (*Volplugin) ReadGet

func (v *Volplugin) ReadGet(r *http.Request) (string, error)

ReadGet reads requests for the various Get endpoints (which all do the same thing)

func (*Volplugin) ReadMount

func (v *Volplugin) ReadMount(r *http.Request) (*api.Volume, error)

ReadMount reads a mount request and returns the name of the volume to mount.

NOTE: this is the same for both path and mount and unmount. The docker implementation provides us with no other information.

func (*Volplugin) ReadPath

func (v *Volplugin) ReadPath(r *http.Request) (string, error)

ReadPath reads a path request.

func (*Volplugin) Router

func (v *Volplugin) Router(a *api.API) *mux.Router

Router returns a docker-compatible HTTP gorilla/mux router. If the debug global is set, handlers will be wrapped in a request logger.

func (*Volplugin) WriteCreate

func (v *Volplugin) WriteCreate(volConfig *config.Volume, w http.ResponseWriter) error

WriteCreate writes the response to a create request back to docker.

func (*Volplugin) WriteGet

func (v *Volplugin) WriteGet(name, mountpoint string, w http.ResponseWriter) error

WriteGet writes an appropriate response to Get calls.

func (*Volplugin) WriteList

func (v *Volplugin) WriteList(volumes []string, w http.ResponseWriter) error

WriteList writes out a list of volume names to the requesting docker.

func (*Volplugin) WriteMount

func (v *Volplugin) WriteMount(mountPoint string, w http.ResponseWriter) error

WriteMount writes the mountpoint as a reply to a mount request.

func (*Volplugin) WritePath

func (v *Volplugin) WritePath(mountpoint string, w http.ResponseWriter) error

WritePath writes an appropriate response to Path calls.

type Volume

type Volume struct {
	Name       string
	Mountpoint string
}

Volume represents the docker 'Volume' entity used in get and list

type VolumeCreateRequest

type VolumeCreateRequest struct {
	Name string
	Opts map[string]string
}

VolumeCreateRequest is taken from struct Request in https://github.com/calavera/docker-volume-api/blob/master/api.go#L27

type VolumeGetRequest

type VolumeGetRequest struct {
	Name string
}

VolumeGetRequest is taken from this struct in https://github.com/docker/docker/blob/master/volume/drivers/proxy.go#L187

type VolumeGetResponse

type VolumeGetResponse struct {
	Volume Volume
	Err    string
}

VolumeGetResponse is taken from struct volumeDriverProxyGetResponse in https://github.com/docker/docker/blob/master/volume/drivers/proxy.go#L191

type VolumeList

type VolumeList struct {
	Volumes []Volume
	Err     string
}

VolumeList is taken from struct volumeDriverProxyListResponse in https://github.com/docker/docker/blob/master/volume/drivers/proxy.go#L163

Jump to

Keyboard shortcuts

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