Updated dockerclient to bf3bc17bb (#46)

updated volumes options
This commit is contained in:
Manuel Vogel 2018-03-07 10:19:02 +01:00 committed by GitHub
parent 36fd7383c3
commit da1272279e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 47 additions and 32 deletions

View file

@ -12,7 +12,7 @@
[[constraint]]
name = "github.com/google/go-cmp"
branch = "master"
version = "v0.2.0"
[[constraint]]
name = "github.com/gorilla/mux"

View file

@ -2,24 +2,19 @@
all \
lint \
vet \
fmt \
fmtcheck \
pretest \
test \
integration \
clean
integration
all: test
lint:
@ go get -v github.com/golang/lint/golint
@ go get -v golang.org/x/lint/golint
[ -z "$$(golint . | grep -v 'type name will be used as docker.DockerInfo' | grep -v 'context.Context should be the first' | tee /dev/stderr)" ]
vet:
go vet $$(go list ./... | grep -v vendor)
fmt:
gofmt -s -w $$(go list ./... | grep -v vendor)
go vet ./...
fmtcheck:
[ -z "$$(gofmt -s -d *.go ./testing | tee /dev/stderr)" ]
@ -31,12 +26,9 @@ testdeps:
pretest: testdeps lint vet fmtcheck
gotest:
go test -race $$(go list ./... | grep -v vendor)
go test -race ./...
test: pretest gotest
integration:
go test -tags docker_integration -run TestIntegration -v
clean:
go clean ./...

View file

@ -227,7 +227,9 @@ func (c *Client) WithTransport(trFunc func() *http.Transport) {
c.initializeNativeClient(trFunc)
}
// NewVersionnedTLSClient has been DEPRECATED, please use NewVersionedTLSClient.
// NewVersionnedTLSClient is like NewVersionedClient, but with ann extra n.
//
// Deprecated: Use NewVersionedTLSClient instead.
func NewVersionnedTLSClient(endpoint string, cert, key, ca, apiVersionString string) (*Client, error) {
return NewVersionedTLSClient(endpoint, cert, key, ca, apiVersionString)
}

View file

@ -1287,9 +1287,10 @@ func (c *Client) DownloadFromContainer(id string, opts DownloadFromContainerOpti
})
}
// CopyFromContainerOptions has been DEPRECATED, please use DownloadFromContainerOptions along with DownloadFromContainer.
// CopyFromContainerOptions contains the set of options used for copying
// files from a container.
//
// See https://goo.gl/nWk2YQ for more details.
// Deprecated: Use DownloadFromContainerOptions and DownloadFromContainer instead.
type CopyFromContainerOptions struct {
OutputStream io.Writer `json:"-"`
Container string `json:"-"`
@ -1297,9 +1298,9 @@ type CopyFromContainerOptions struct {
Context context.Context `json:"-"`
}
// CopyFromContainer has been DEPRECATED, please use DownloadFromContainerOptions along with DownloadFromContainer.
// CopyFromContainer copies files from a container.
//
// See https://goo.gl/nWk2YQ for more details.
// Deprecated: Use DownloadFromContainer and DownloadFromContainer instead.
func (c *Client) CopyFromContainer(opts CopyFromContainerOptions) error {
if opts.Container == "" {
return &NoSuchContainer{ID: opts.Container}

View file

@ -21,17 +21,18 @@ var (
// Volume represents a volume.
//
// See https://goo.gl/FZA4BK for more details.
// See https://goo.gl/3wgTsd for more details.
type Volume struct {
Name string `json:"Name" yaml:"Name" toml:"Name"`
Driver string `json:"Driver,omitempty" yaml:"Driver,omitempty" toml:"Driver,omitempty"`
Mountpoint string `json:"Mountpoint,omitempty" yaml:"Mountpoint,omitempty" toml:"Mountpoint,omitempty"`
Labels map[string]string `json:"Labels,omitempty" yaml:"Labels,omitempty" toml:"Labels,omitempty"`
Options map[string]string `json:"Options,omitempty" yaml:"Options,omitempty" toml:"Options,omitempty"`
}
// ListVolumesOptions specify parameters to the ListVolumes function.
//
// See https://goo.gl/FZA4BK for more details.
// See https://goo.gl/3wgTsd for more details.
type ListVolumesOptions struct {
Filters map[string][]string
Context context.Context
@ -39,7 +40,7 @@ type ListVolumesOptions struct {
// ListVolumes returns a list of available volumes in the server.
//
// See https://goo.gl/FZA4BK for more details.
// See https://goo.gl/3wgTsd for more details.
func (c *Client) ListVolumes(opts ListVolumesOptions) ([]Volume, error) {
resp, err := c.do("GET", "/volumes?"+queryString(opts), doOptions{
context: opts.Context,
@ -69,7 +70,7 @@ func (c *Client) ListVolumes(opts ListVolumesOptions) ([]Volume, error) {
// CreateVolumeOptions specify parameters to the CreateVolume function.
//
// See https://goo.gl/pBUbZ9 for more details.
// See https://goo.gl/qEhmEC for more details.
type CreateVolumeOptions struct {
Name string
Driver string
@ -80,7 +81,7 @@ type CreateVolumeOptions struct {
// CreateVolume creates a volume on the server.
//
// See https://goo.gl/pBUbZ9 for more details.
// See https://goo.gl/qEhmEC for more details.
func (c *Client) CreateVolume(opts CreateVolumeOptions) (*Volume, error) {
resp, err := c.do("POST", "/volumes/create", doOptions{
data: opts,
@ -99,7 +100,7 @@ func (c *Client) CreateVolume(opts CreateVolumeOptions) (*Volume, error) {
// InspectVolume returns a volume by its name.
//
// See https://goo.gl/0g9A6i for more details.
// See https://goo.gl/GMjsMc for more details.
func (c *Client) InspectVolume(name string) (*Volume, error) {
resp, err := c.do("GET", "/volumes/"+name, doOptions{})
if err != nil {
@ -118,9 +119,28 @@ func (c *Client) InspectVolume(name string) (*Volume, error) {
// RemoveVolume removes a volume by its name.
//
// See https://goo.gl/79GNQz for more details.
// Deprecated: Use RemoveVolumeWithOptions instead.
func (c *Client) RemoveVolume(name string) error {
resp, err := c.do("DELETE", "/volumes/"+name, doOptions{})
return c.RemoveVolumeWithOptions(RemoveVolumeOptions{Name: name})
}
// RemoveVolumeOptions specify parameters to the RemoveVolumeWithOptions
// function.
//
// See https://goo.gl/nvd6qj for more details.
type RemoveVolumeOptions struct {
Context context.Context
Name string `qs:"-"`
Force bool
}
// RemoveVolumeWithOptions removes a volume by its name and takes extra
// parameters.
//
// See https://goo.gl/nvd6qj for more details.
func (c *Client) RemoveVolumeWithOptions(opts RemoveVolumeOptions) error {
path := "/volumes/" + opts.Name
resp, err := c.do("DELETE", path+"?"+queryString(opts), doOptions{context: opts.Context})
if err != nil {
if e, ok := err.(*Error); ok {
if e.Status == http.StatusNotFound {
@ -138,7 +158,7 @@ func (c *Client) RemoveVolume(name string) error {
// PruneVolumesOptions specify parameters to the PruneVolumes function.
//
// See https://goo.gl/pFN1Hj for more details.
// See https://goo.gl/f9XDem for more details.
type PruneVolumesOptions struct {
Filters map[string][]string
Context context.Context
@ -146,7 +166,7 @@ type PruneVolumesOptions struct {
// PruneVolumesResults specify results from the PruneVolumes function.
//
// See https://goo.gl/pFN1Hj for more details.
// See https://goo.gl/f9XDem for more details.
type PruneVolumesResults struct {
VolumesDeleted []string
SpaceReclaimed int64
@ -154,7 +174,7 @@ type PruneVolumesResults struct {
// PruneVolumes deletes volumes which are unused.
//
// See https://goo.gl/pFN1Hj for more details.
// See https://goo.gl/f9XDem for more details.
func (c *Client) PruneVolumes(opts PruneVolumesOptions) (*PruneVolumesResults, error) {
path := "/volumes/prune?" + queryString(opts)
resp, err := c.do("POST", path, doOptions{context: opts.Context})

6
vendor/vendor.json vendored
View file

@ -425,10 +425,10 @@
"revisionTime": "2017-12-21T20:03:56Z"
},
{
"checksumSHA1": "Ln312Iryjgy65jln5W4c1dOnlrk=",
"checksumSHA1": "LxmlsftDto7ZuwfNmJRdKPah1t8=",
"path": "github.com/fsouza/go-dockerclient",
"revision": "7ad31341c6f85e47884a43f7fa57c5981866ae1d",
"revisionTime": "2018-02-21T13:01:12Z"
"revision": "bf3bc17bb026cbe5e9203374f9a1ce37e521a364",
"revisionTime": "2018-03-03T17:22:32Z"
},
{
"checksumSHA1": "1K+xrZ1PBez190iGt5OnMtGdih4=",