mirror of
https://github.com/kreuzwerker/terraform-provider-docker.git
synced 2025-12-27 10:09:39 -05:00
Update go-dockerclient
This commit is contained in:
parent
d7038e7560
commit
36fd7383c3
25 changed files with 481 additions and 57 deletions
|
|
@ -26,7 +26,7 @@ func resourceDockerNetworkCreate(d *schema.ResourceData, meta interface{}) error
|
|||
createOpts.Internal = v.(bool)
|
||||
}
|
||||
|
||||
ipamOpts := dc.IPAMOptions{}
|
||||
ipamOpts := &dc.IPAMOptions{}
|
||||
ipamOptsSet := false
|
||||
if v, ok := d.GetOk("ipam_driver"); ok {
|
||||
ipamOpts.Driver = v.(string)
|
||||
|
|
|
|||
4
vendor/github.com/fsouza/go-dockerclient/AUTHORS
generated
vendored
4
vendor/github.com/fsouza/go-dockerclient/AUTHORS
generated
vendored
|
|
@ -55,6 +55,7 @@ Darren Shepherd
|
|||
Dave Choi
|
||||
David Huie
|
||||
Dawn Chen
|
||||
Denis Makogon
|
||||
Derek Petersen
|
||||
Dinesh Subhraveti
|
||||
Drew Wells
|
||||
|
|
@ -80,6 +81,7 @@ Guilherme Rezende
|
|||
Guillermo Álvarez Fernández
|
||||
Harry Zhang
|
||||
He Simei
|
||||
Isaac Schnitzer
|
||||
Ivan Mikushin
|
||||
James Bardin
|
||||
James Nugent
|
||||
|
|
@ -154,6 +156,7 @@ Sam Rijs
|
|||
Sami Wagiaalla
|
||||
Samuel Archambault
|
||||
Samuel Karp
|
||||
Sebastian Borza
|
||||
Seth Jennings
|
||||
Shane Xie
|
||||
Silas Sewell
|
||||
|
|
@ -181,5 +184,6 @@ Vlad Alexandru Ionescu
|
|||
Weitao Zhou
|
||||
Wiliam Souza
|
||||
Ye Yin
|
||||
Yosuke Otosu
|
||||
Yu, Zou
|
||||
Yuriy Bogdanov
|
||||
|
|
|
|||
4
vendor/github.com/fsouza/go-dockerclient/Gopkg.toml
generated
vendored
4
vendor/github.com/fsouza/go-dockerclient/Gopkg.toml
generated
vendored
|
|
@ -18,10 +18,6 @@
|
|||
name = "github.com/gorilla/mux"
|
||||
version = "v1.5.0"
|
||||
|
||||
[[constraint]]
|
||||
name = "golang.org/x/net"
|
||||
branch = "master"
|
||||
|
||||
[[override]]
|
||||
name = "github.com/Nvveen/Gotty"
|
||||
source = "https://github.com/ijc25/Gotty.git"
|
||||
|
|
|
|||
2
vendor/github.com/fsouza/go-dockerclient/LICENSE
generated
vendored
2
vendor/github.com/fsouza/go-dockerclient/LICENSE
generated
vendored
|
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2013-2017, go-dockerclient authors
|
||||
Copyright (c) 2013-2018, go-dockerclient authors
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
2
vendor/github.com/fsouza/go-dockerclient/Makefile
generated
vendored
2
vendor/github.com/fsouza/go-dockerclient/Makefile
generated
vendored
|
|
@ -22,7 +22,7 @@ fmt:
|
|||
gofmt -s -w $$(go list ./... | grep -v vendor)
|
||||
|
||||
fmtcheck:
|
||||
[ -z "$$(gofmt -s -d $$(go list ./... | grep -v vendor) | tee /dev/stderr)" ]
|
||||
[ -z "$$(gofmt -s -d *.go ./testing | tee /dev/stderr)" ]
|
||||
|
||||
testdeps:
|
||||
go get -u github.com/golang/dep/cmd/dep
|
||||
|
|
|
|||
4
vendor/github.com/fsouza/go-dockerclient/appveyor.yml
generated
vendored
4
vendor/github.com/fsouza/go-dockerclient/appveyor.yml
generated
vendored
|
|
@ -5,8 +5,8 @@ clone_folder: c:\gopath\src\github.com\fsouza\go-dockerclient
|
|||
environment:
|
||||
GOPATH: c:\gopath
|
||||
matrix:
|
||||
- GOVERSION: 1.8.5
|
||||
- GOVERSION: 1.9.2
|
||||
- GOVERSION: 1.9.4
|
||||
- GOVERSION: 1.10
|
||||
install:
|
||||
- set PATH=%GOPATH%\bin;c:\go\bin;%PATH%
|
||||
- rmdir c:\go /s /q
|
||||
|
|
|
|||
3
vendor/github.com/fsouza/go-dockerclient/auth.go
generated
vendored
3
vendor/github.com/fsouza/go-dockerclient/auth.go
generated
vendored
|
|
@ -129,6 +129,9 @@ func authConfigs(confs map[string]dockerConfig) (*AuthConfigurations, error) {
|
|||
Configs: make(map[string]AuthConfiguration),
|
||||
}
|
||||
for reg, conf := range confs {
|
||||
if conf.Auth == "" {
|
||||
continue
|
||||
}
|
||||
data, err := base64.StdEncoding.DecodeString(conf.Auth)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
31
vendor/github.com/fsouza/go-dockerclient/client.go
generated
vendored
31
vendor/github.com/fsouza/go-dockerclient/client.go
generated
vendored
|
|
@ -10,6 +10,7 @@ package docker
|
|||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"encoding/json"
|
||||
|
|
@ -34,8 +35,6 @@ import (
|
|||
"github.com/docker/docker/pkg/homedir"
|
||||
"github.com/docker/docker/pkg/jsonmessage"
|
||||
"github.com/docker/docker/pkg/stdcopy"
|
||||
"golang.org/x/net/context"
|
||||
"golang.org/x/net/context/ctxhttp"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
@ -218,10 +217,16 @@ func NewVersionedClient(endpoint string, apiVersionString string) (*Client, erro
|
|||
eventMonitor: new(eventMonitoringState),
|
||||
requestedAPIVersion: requestedAPIVersion,
|
||||
}
|
||||
c.initializeNativeClient()
|
||||
c.initializeNativeClient(defaultTransport)
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// WithTransport replaces underlying HTTP client of Docker Client by accepting
|
||||
// a function that returns pointer to a transport object.
|
||||
func (c *Client) WithTransport(trFunc func() *http.Transport) {
|
||||
c.initializeNativeClient(trFunc)
|
||||
}
|
||||
|
||||
// NewVersionnedTLSClient has been DEPRECATED, please use NewVersionedTLSClient.
|
||||
func NewVersionnedTLSClient(endpoint string, cert, key, ca, apiVersionString string) (*Client, error) {
|
||||
return NewVersionedTLSClient(endpoint, cert, key, ca, apiVersionString)
|
||||
|
|
@ -339,7 +344,7 @@ func NewVersionedTLSClientFromBytes(endpoint string, certPEMBlock, keyPEMBlock,
|
|||
eventMonitor: new(eventMonitoringState),
|
||||
requestedAPIVersion: requestedAPIVersion,
|
||||
}
|
||||
c.initializeNativeClient()
|
||||
c.initializeNativeClient(defaultTransport)
|
||||
return c, nil
|
||||
}
|
||||
|
||||
|
|
@ -469,7 +474,7 @@ func (c *Client) do(method, path string, doOptions doOptions) (*http.Response, e
|
|||
ctx = context.Background()
|
||||
}
|
||||
|
||||
resp, err := ctxhttp.Do(ctx, c.HTTPClient, req)
|
||||
resp, err := c.HTTPClient.Do(req.WithContext(ctx))
|
||||
if err != nil {
|
||||
if strings.Contains(err.Error(), "connection refused") {
|
||||
return nil, ErrConnectionRefused
|
||||
|
|
@ -585,7 +590,7 @@ func (c *Client) stream(method, path string, streamOptions streamOptions) error
|
|||
return chooseError(subCtx, err)
|
||||
}
|
||||
} else {
|
||||
if resp, err = ctxhttp.Do(subCtx, c.HTTPClient, req); err != nil {
|
||||
if resp, err = c.HTTPClient.Do(req.WithContext(subCtx)); err != nil {
|
||||
if strings.Contains(err.Error(), "connection refused") {
|
||||
return ErrConnectionRefused
|
||||
}
|
||||
|
|
@ -909,6 +914,10 @@ func addQueryStringValue(items url.Values, key string, v reflect.Value) {
|
|||
if v.Int() > 0 {
|
||||
items.Add(key, strconv.FormatInt(v.Int(), 10))
|
||||
}
|
||||
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
|
||||
if v.Uint() > 0 {
|
||||
items.Add(key, strconv.FormatUint(v.Uint(), 10))
|
||||
}
|
||||
case reflect.Float32, reflect.Float64:
|
||||
if v.Float() > 0 {
|
||||
items.Add(key, strconv.FormatFloat(v.Float(), 'f', -1, 64))
|
||||
|
|
@ -946,12 +955,20 @@ type Error struct {
|
|||
}
|
||||
|
||||
func newError(resp *http.Response) *Error {
|
||||
type ErrMsg struct {
|
||||
Message string `json:"message"`
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
data, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return &Error{Status: resp.StatusCode, Message: fmt.Sprintf("cannot read body, err: %v", err)}
|
||||
}
|
||||
return &Error{Status: resp.StatusCode, Message: string(data)}
|
||||
var emsg ErrMsg
|
||||
err = json.Unmarshal(data, &emsg)
|
||||
if err != nil {
|
||||
return &Error{Status: resp.StatusCode, Message: string(data)}
|
||||
}
|
||||
return &Error{Status: resp.StatusCode, Message: emsg.Message}
|
||||
}
|
||||
|
||||
func (e *Error) Error() string {
|
||||
|
|
|
|||
13
vendor/github.com/fsouza/go-dockerclient/client_unix.go
generated
vendored
13
vendor/github.com/fsouza/go-dockerclient/client_unix.go
generated
vendored
|
|
@ -9,21 +9,24 @@ package docker
|
|||
import (
|
||||
"context"
|
||||
"net"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// initializeNativeClient initializes the native Unix domain socket client on
|
||||
// Unix-style operating systems
|
||||
func (c *Client) initializeNativeClient() {
|
||||
func (c *Client) initializeNativeClient(trFunc func() *http.Transport) {
|
||||
if c.endpointURL.Scheme != unixProtocol {
|
||||
return
|
||||
}
|
||||
socketPath := c.endpointURL.Path
|
||||
tr := defaultTransport()
|
||||
sockPath := c.endpointURL.Path
|
||||
|
||||
tr := trFunc()
|
||||
|
||||
tr.Dial = func(network, addr string) (net.Conn, error) {
|
||||
return c.Dialer.Dial(unixProtocol, socketPath)
|
||||
return c.Dialer.Dial(unixProtocol, sockPath)
|
||||
}
|
||||
tr.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||
return c.Dialer.Dial(unixProtocol, socketPath)
|
||||
return c.Dialer.Dial(unixProtocol, sockPath)
|
||||
}
|
||||
c.HTTPClient.Transport = tr
|
||||
}
|
||||
|
|
|
|||
5
vendor/github.com/fsouza/go-dockerclient/client_windows.go
generated
vendored
5
vendor/github.com/fsouza/go-dockerclient/client_windows.go
generated
vendored
|
|
@ -9,6 +9,7 @@ package docker
|
|||
import (
|
||||
"context"
|
||||
"net"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/Microsoft/go-winio"
|
||||
|
|
@ -25,7 +26,7 @@ func (p pipeDialer) Dial(network, address string) (net.Conn, error) {
|
|||
}
|
||||
|
||||
// initializeNativeClient initializes the native Named Pipe client for Windows
|
||||
func (c *Client) initializeNativeClient() {
|
||||
func (c *Client) initializeNativeClient(trFunc func() *http.Transport) {
|
||||
if c.endpointURL.Scheme != namedPipeProtocol {
|
||||
return
|
||||
}
|
||||
|
|
@ -34,7 +35,7 @@ func (c *Client) initializeNativeClient() {
|
|||
timeout := namedPipeConnectTimeout
|
||||
return winio.DialPipe(namedPipePath, &timeout)
|
||||
}
|
||||
tr := defaultTransport()
|
||||
tr := trFunc()
|
||||
tr.Dial = dialFunc
|
||||
tr.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||
return dialFunc(network, addr)
|
||||
|
|
|
|||
22
vendor/github.com/fsouza/go-dockerclient/container.go
generated
vendored
22
vendor/github.com/fsouza/go-dockerclient/container.go
generated
vendored
|
|
@ -5,6 +5,7 @@
|
|||
package docker
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
|
@ -15,8 +16,7 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/docker/go-units"
|
||||
"golang.org/x/net/context"
|
||||
units "github.com/docker/go-units"
|
||||
)
|
||||
|
||||
// ErrContainerAlreadyExists is the error returned by CreateContainer when the
|
||||
|
|
@ -300,6 +300,7 @@ type Config struct {
|
|||
ExposedPorts map[Port]struct{} `json:"ExposedPorts,omitempty" yaml:"ExposedPorts,omitempty" toml:"ExposedPorts,omitempty"`
|
||||
PublishService string `json:"PublishService,omitempty" yaml:"PublishService,omitempty" toml:"PublishService,omitempty"`
|
||||
StopSignal string `json:"StopSignal,omitempty" yaml:"StopSignal,omitempty" toml:"StopSignal,omitempty"`
|
||||
StopTimeout int `json:"StopTimeout,omitempty" yaml:"StopTimeout,omitempty" toml:"StopTimeout,omitempty"`
|
||||
Env []string `json:"Env,omitempty" yaml:"Env,omitempty" toml:"Env,omitempty"`
|
||||
Cmd []string `json:"Cmd" yaml:"Cmd" toml:"Cmd"`
|
||||
Healthcheck *HealthConfig `json:"Healthcheck,omitempty" yaml:"Healthcheck,omitempty" toml:"Healthcheck,omitempty"`
|
||||
|
|
@ -752,7 +753,7 @@ type HostConfig struct {
|
|||
MemoryReservation int64 `json:"MemoryReservation,omitempty" yaml:"MemoryReservation,omitempty" toml:"MemoryReservation,omitempty"`
|
||||
KernelMemory int64 `json:"KernelMemory,omitempty" yaml:"KernelMemory,omitempty" toml:"KernelMemory,omitempty"`
|
||||
MemorySwap int64 `json:"MemorySwap,omitempty" yaml:"MemorySwap,omitempty" toml:"MemorySwap,omitempty"`
|
||||
MemorySwappiness int64 `json:"MemorySwappiness" yaml:"MemorySwappiness" toml:"MemorySwappiness"`
|
||||
MemorySwappiness int64 `json:"MemorySwappiness,omitempty" yaml:"MemorySwappiness,omitempty" toml:"MemorySwappiness,omitempty"`
|
||||
CPUShares int64 `json:"CpuShares,omitempty" yaml:"CpuShares,omitempty" toml:"CpuShares,omitempty"`
|
||||
CPUSet string `json:"Cpuset,omitempty" yaml:"Cpuset,omitempty" toml:"Cpuset,omitempty"`
|
||||
CPUSetCPUs string `json:"CpusetCpus,omitempty" yaml:"CpusetCpus,omitempty" toml:"CpusetCpus,omitempty"`
|
||||
|
|
@ -1051,6 +1052,7 @@ type CPUStats struct {
|
|||
UsageInKernelmode uint64 `json:"usage_in_kernelmode,omitempty" yaml:"usage_in_kernelmode,omitempty" toml:"usage_in_kernelmode,omitempty"`
|
||||
} `json:"cpu_usage,omitempty" yaml:"cpu_usage,omitempty" toml:"cpu_usage,omitempty"`
|
||||
SystemCPUUsage uint64 `json:"system_cpu_usage,omitempty" yaml:"system_cpu_usage,omitempty" toml:"system_cpu_usage,omitempty"`
|
||||
OnlineCPUs uint64 `json:"online_cpus,omitempty" yaml:"online_cpus,omitempty" toml:"online_cpus,omitempty"`
|
||||
ThrottlingData struct {
|
||||
Periods uint64 `json:"periods,omitempty"`
|
||||
ThrottledPeriods uint64 `json:"throttled_periods,omitempty"`
|
||||
|
|
@ -1186,10 +1188,18 @@ func (c *Client) KillContainer(opts KillContainerOptions) error {
|
|||
path := "/containers/" + opts.ID + "/kill" + "?" + queryString(opts)
|
||||
resp, err := c.do("POST", path, doOptions{context: opts.Context})
|
||||
if err != nil {
|
||||
if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound {
|
||||
return &NoSuchContainer{ID: opts.ID}
|
||||
e, ok := err.(*Error)
|
||||
if !ok {
|
||||
return err
|
||||
}
|
||||
switch e.Status {
|
||||
case http.StatusNotFound:
|
||||
return &NoSuchContainer{ID: opts.ID}
|
||||
case http.StatusConflict:
|
||||
return &ContainerNotRunning{ID: opts.ID}
|
||||
default:
|
||||
return err
|
||||
}
|
||||
return err
|
||||
}
|
||||
resp.Body.Close()
|
||||
return nil
|
||||
|
|
|
|||
3
vendor/github.com/fsouza/go-dockerclient/exec.go
generated
vendored
3
vendor/github.com/fsouza/go-dockerclient/exec.go
generated
vendored
|
|
@ -5,6 +5,7 @@
|
|||
package docker
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
|
@ -12,8 +13,6 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// Exec is the type representing a `docker exec` instance and containing the
|
||||
|
|
|
|||
3
vendor/github.com/fsouza/go-dockerclient/image.go
generated
vendored
3
vendor/github.com/fsouza/go-dockerclient/image.go
generated
vendored
|
|
@ -6,6 +6,7 @@ package docker
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
|
@ -16,8 +17,6 @@ import (
|
|||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// APIImages represent an image returned in the ListImages call.
|
||||
|
|
|
|||
1
vendor/github.com/fsouza/go-dockerclient/misc.go
generated
vendored
1
vendor/github.com/fsouza/go-dockerclient/misc.go
generated
vendored
|
|
@ -68,6 +68,7 @@ type DockerInfo struct {
|
|||
Architecture string
|
||||
IndexServerAddress string
|
||||
RegistryConfig *ServiceConfig
|
||||
SecurityOptions []string
|
||||
NCPU int
|
||||
MemTotal int64
|
||||
DockerRootDir string
|
||||
|
|
|
|||
5
vendor/github.com/fsouza/go-dockerclient/network.go
generated
vendored
5
vendor/github.com/fsouza/go-dockerclient/network.go
generated
vendored
|
|
@ -5,12 +5,11 @@
|
|||
package docker
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// ErrNetworkAlreadyExists is the error returned by CreateNetwork when the
|
||||
|
|
@ -112,7 +111,7 @@ func (c *Client) NetworkInfo(id string) (*Network, error) {
|
|||
type CreateNetworkOptions struct {
|
||||
Name string `json:"Name" yaml:"Name" toml:"Name"`
|
||||
Driver string `json:"Driver" yaml:"Driver" toml:"Driver"`
|
||||
IPAM IPAMOptions `json:"IPAM" yaml:"IPAM" toml:"IPAM"`
|
||||
IPAM *IPAMOptions `json:"IPAM,omitempty" yaml:"IPAM" toml:"IPAM"`
|
||||
Options map[string]interface{} `json:"Options" yaml:"Options" toml:"Options"`
|
||||
Labels map[string]string `json:"Labels" yaml:"Labels" toml:"Labels"`
|
||||
CheckDuplicate bool `json:"CheckDuplicate" yaml:"CheckDuplicate" toml:"CheckDuplicate"`
|
||||
|
|
|
|||
391
vendor/github.com/fsouza/go-dockerclient/plugin.go
generated
vendored
Normal file
391
vendor/github.com/fsouza/go-dockerclient/plugin.go
generated
vendored
Normal file
|
|
@ -0,0 +1,391 @@
|
|||
// Copyright 2018 go-dockerclient authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package docker
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// PluginPrivilege represents a privilege for a plugin.
|
||||
type PluginPrivilege struct {
|
||||
Name string `json:"Name,omitempty" yaml:"Name,omitempty" toml:"Name,omitempty"`
|
||||
Description string `json:"Description,omitempty" yaml:"Description,omitempty" toml:"Description,omitempty"`
|
||||
Value []string `json:"Value,omitempty" yaml:"Value,omitempty" toml:"Value,omitempty"`
|
||||
}
|
||||
|
||||
// InstallPluginOptions specify parameters to the InstallPlugins function.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
type InstallPluginOptions struct {
|
||||
Remote string
|
||||
Name string
|
||||
Plugins []PluginPrivilege `qs:"-"`
|
||||
|
||||
Auth AuthConfiguration
|
||||
|
||||
Context context.Context
|
||||
}
|
||||
|
||||
// InstallPlugins installs a plugin or returns an error in case of failure.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
func (c *Client) InstallPlugins(opts InstallPluginOptions) error {
|
||||
path := "/plugins/pull?" + queryString(opts)
|
||||
resp, err := c.do("POST", path, doOptions{
|
||||
data: opts.Plugins,
|
||||
context: opts.Context,
|
||||
})
|
||||
defer resp.Body.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// PluginSettings stores plugin settings.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
type PluginSettings struct {
|
||||
Env []string `json:"Env,omitempty" yaml:"Env,omitempty" toml:"Env,omitempty"`
|
||||
Args []string `json:"Args,omitempty" yaml:"Args,omitempty" toml:"Args,omitempty"`
|
||||
Devices []string `json:"Devices,omitempty" yaml:"Devices,omitempty" toml:"Devices,omitempty"`
|
||||
}
|
||||
|
||||
// PluginInterface stores plugin interface.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
type PluginInterface struct {
|
||||
Types []string `json:"Types,omitempty" yaml:"Types,omitempty" toml:"Types,omitempty"`
|
||||
Socket string `json:"Socket,omitempty" yaml:"Socket,omitempty" toml:"Socket,omitempty"`
|
||||
}
|
||||
|
||||
// PluginNetwork stores plugin network type.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
type PluginNetwork struct {
|
||||
Type string `json:"Type,omitempty" yaml:"Type,omitempty" toml:"Type,omitempty"`
|
||||
}
|
||||
|
||||
// PluginLinux stores plugin linux setting.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
type PluginLinux struct {
|
||||
Capabilities []string `json:"Capabilities,omitempty" yaml:"Capabilities,omitempty" toml:"Capabilities,omitempty"`
|
||||
AllowAllDevices bool `json:"AllowAllDevices,omitempty" yaml:"AllowAllDevices,omitempty" toml:"AllowAllDevices,omitempty"`
|
||||
Devices []PluginLinuxDevices `json:"Devices,omitempty" yaml:"Devices,omitempty" toml:"Devices,omitempty"`
|
||||
}
|
||||
|
||||
// PluginLinuxDevices stores plugin linux device setting.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
type PluginLinuxDevices struct {
|
||||
Name string `json:"Name,omitempty" yaml:"Name,omitempty" toml:"Name,omitempty"`
|
||||
Description string `json:"Documentation,omitempty" yaml:"Documentation,omitempty" toml:"Documentation,omitempty"`
|
||||
Settable []string `json:"Settable,omitempty" yaml:"Settable,omitempty" toml:"Settable,omitempty"`
|
||||
Path string `json:"Path,omitempty" yaml:"Path,omitempty" toml:"Path,omitempty"`
|
||||
}
|
||||
|
||||
// PluginEnv stores plugin environment.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
type PluginEnv struct {
|
||||
Name string `json:"Name,omitempty" yaml:"Name,omitempty" toml:"Name,omitempty"`
|
||||
Description string `json:"Description,omitempty" yaml:"Description,omitempty" toml:"Description,omitempty"`
|
||||
Settable []string `json:"Settable,omitempty" yaml:"Settable,omitempty" toml:"Settable,omitempty"`
|
||||
Value string `json:"Value,omitempty" yaml:"Value,omitempty" toml:"Value,omitempty"`
|
||||
}
|
||||
|
||||
// PluginArgs stores plugin arguments.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
type PluginArgs struct {
|
||||
Name string `json:"Name,omitempty" yaml:"Name,omitempty" toml:"Name,omitempty"`
|
||||
Description string `json:"Description,omitempty" yaml:"Description,omitempty" toml:"Description,omitempty"`
|
||||
Settable []string `json:"Settable,omitempty" yaml:"Settable,omitempty" toml:"Settable,omitempty"`
|
||||
Value []string `json:"Value,omitempty" yaml:"Value,omitempty" toml:"Value,omitempty"`
|
||||
}
|
||||
|
||||
// PluginUser stores plugin user.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
type PluginUser struct {
|
||||
UID int32 `json:"UID,omitempty" yaml:"UID,omitempty" toml:"UID,omitempty"`
|
||||
GID int32 `json:"GID,omitempty" yaml:"GID,omitempty" toml:"GID,omitempty"`
|
||||
}
|
||||
|
||||
// PluginConfig stores plugin config.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
type PluginConfig struct {
|
||||
Description string `json:"Description,omitempty" yaml:"Description,omitempty" toml:"Description,omitempty"`
|
||||
Documentation string
|
||||
Interface PluginInterface `json:"Interface,omitempty" yaml:"Interface,omitempty" toml:"Interface,omitempty"`
|
||||
Entrypoint []string `json:"Entrypoint,omitempty" yaml:"Entrypoint,omitempty" toml:"Entrypoint,omitempty"`
|
||||
WorkDir string `json:"WorkDir,omitempty" yaml:"WorkDir,omitempty" toml:"WorkDir,omitempty"`
|
||||
User PluginUser `json:"User,omitempty" yaml:"User,omitempty" toml:"User,omitempty"`
|
||||
Network PluginNetwork `json:"Network,omitempty" yaml:"Network,omitempty" toml:"Network,omitempty"`
|
||||
Linux PluginLinux `json:"Linux,omitempty" yaml:"Linux,omitempty" toml:"Linux,omitempty"`
|
||||
PropagatedMount string `json:"PropagatedMount,omitempty" yaml:"PropagatedMount,omitempty" toml:"PropagatedMount,omitempty"`
|
||||
Mounts []Mount `json:"Mounts,omitempty" yaml:"Mounts,omitempty" toml:"Mounts,omitempty"`
|
||||
Env []PluginEnv `json:"Env,omitempty" yaml:"Env,omitempty" toml:"Env,omitempty"`
|
||||
Args PluginArgs `json:"Args,omitempty" yaml:"Args,omitempty" toml:"Args,omitempty"`
|
||||
}
|
||||
|
||||
// PluginDetail specify results from the ListPlugins function.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
type PluginDetail struct {
|
||||
ID string `json:"Id,omitempty" yaml:"Id,omitempty" toml:"Id,omitempty"`
|
||||
Name string `json:"Name,omitempty" yaml:"Name,omitempty" toml:"Name,omitempty"`
|
||||
Tag string `json:"Tag,omitempty" yaml:"Tag,omitempty" toml:"Tag,omitempty"`
|
||||
Active bool `json:"Active,omitempty" yaml:"Active,omitempty" toml:"Active,omitempty"`
|
||||
Settings PluginSettings `json:"Settings,omitempty" yaml:"Settings,omitempty" toml:"Settings,omitempty"`
|
||||
Config PluginConfig `json:"Config,omitempty" yaml:"Config,omitempty" toml:"Config,omitempty"`
|
||||
}
|
||||
|
||||
// ListPlugins returns pluginDetails or an error.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
func (c *Client) ListPlugins(ctx context.Context) ([]PluginDetail, error) {
|
||||
resp, err := c.do("GET", "/plugins", doOptions{
|
||||
context: ctx,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
pluginDetails := make([]PluginDetail, 0)
|
||||
if err := json.NewDecoder(resp.Body).Decode(&pluginDetails); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return pluginDetails, nil
|
||||
}
|
||||
|
||||
// GetPluginPrivileges returns pulginPrivileges or an error.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
func (c *Client) GetPluginPrivileges(name string, ctx context.Context) ([]PluginPrivilege, error) {
|
||||
resp, err := c.do("GET", "/plugins/privileges?remote="+name, doOptions{
|
||||
context: ctx,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
var pluginPrivileges []PluginPrivilege
|
||||
if err := json.NewDecoder(resp.Body).Decode(&pluginPrivileges); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return pluginPrivileges, nil
|
||||
}
|
||||
|
||||
// InspectPlugins returns a pluginDetail or an error.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
func (c *Client) InspectPlugins(name string, ctx context.Context) (*PluginDetail, error) {
|
||||
resp, err := c.do("GET", "/plugins/"+name+"/json", doOptions{
|
||||
context: ctx,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if err != nil {
|
||||
if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound {
|
||||
return nil, &NoSuchPlugin{ID: name}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
resp.Body.Close()
|
||||
var pluginDetail PluginDetail
|
||||
if err := json.NewDecoder(resp.Body).Decode(&pluginDetail); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &pluginDetail, nil
|
||||
}
|
||||
|
||||
// RemovePluginOptions specify parameters to the RemovePlugin function.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
type RemovePluginOptions struct {
|
||||
// The Name of the plugin.
|
||||
Name string `qs:"-"`
|
||||
|
||||
Force bool `qs:"force"`
|
||||
Context context.Context
|
||||
}
|
||||
|
||||
// RemovePlugin returns a PluginDetail or an error.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
func (c *Client) RemovePlugin(opts RemovePluginOptions) (*PluginDetail, error) {
|
||||
path := "/plugins/" + opts.Name + "?" + queryString(opts)
|
||||
resp, err := c.do("DELETE", path, doOptions{context: opts.Context})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
if err != nil {
|
||||
if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound {
|
||||
return nil, &NoSuchPlugin{ID: opts.Name}
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
resp.Body.Close()
|
||||
var pluginDetail PluginDetail
|
||||
if err := json.NewDecoder(resp.Body).Decode(&pluginDetail); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &pluginDetail, nil
|
||||
}
|
||||
|
||||
// EnablePluginOptions specify parameters to the EnablePlugin function.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
type EnablePluginOptions struct {
|
||||
// The Name of the plugin.
|
||||
Name string `qs:"-"`
|
||||
Timeout int64 `qs:"timeout"`
|
||||
|
||||
Context context.Context
|
||||
}
|
||||
|
||||
// EnablePlugin enables plugin that opts point or returns an error.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
func (c *Client) EnablePlugin(opts EnablePluginOptions) error {
|
||||
path := "/plugins/" + opts.Name + "/enable?" + queryString(opts)
|
||||
resp, err := c.do("POST", path, doOptions{context: opts.Context})
|
||||
defer resp.Body.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
resp.Body.Close()
|
||||
return nil
|
||||
}
|
||||
|
||||
// DisablePluginOptions specify parameters to the DisablePlugin function.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
type DisablePluginOptions struct {
|
||||
// The Name of the plugin.
|
||||
Name string `qs:"-"`
|
||||
|
||||
Context context.Context
|
||||
}
|
||||
|
||||
// DisablePlugin disables plugin that opts point or returns an error.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
func (c *Client) DisablePlugin(opts DisablePluginOptions) error {
|
||||
path := "/plugins/" + opts.Name + "/disable"
|
||||
resp, err := c.do("POST", path, doOptions{context: opts.Context})
|
||||
defer resp.Body.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
resp.Body.Close()
|
||||
return nil
|
||||
}
|
||||
|
||||
// CreatePluginOptions specify parameters to the CreatePlugin function.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
type CreatePluginOptions struct {
|
||||
// The Name of the plugin.
|
||||
Name string `qs:"name"`
|
||||
// Path to tar containing plugin
|
||||
Path string `qs:"-"`
|
||||
|
||||
Context context.Context
|
||||
}
|
||||
|
||||
// CreatePlugin creates plugin that opts point or returns an error.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
func (c *Client) CreatePlugin(opts CreatePluginOptions) (string, error) {
|
||||
path := "/plugins/create?" + queryString(opts)
|
||||
resp, err := c.do("POST", path, doOptions{
|
||||
data: opts.Path,
|
||||
context: opts.Context})
|
||||
defer resp.Body.Close()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
containerNameBytes, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(containerNameBytes), nil
|
||||
}
|
||||
|
||||
// PushPluginOptions specify parameters to PushPlugin function.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
type PushPluginOptions struct {
|
||||
// The Name of the plugin.
|
||||
Name string
|
||||
|
||||
Context context.Context
|
||||
}
|
||||
|
||||
// PushPlugin pushes plugin that opts point or returns an error.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
func (c *Client) PushPlugin(opts PushPluginOptions) error {
|
||||
path := "/plugins/" + opts.Name + "/push"
|
||||
resp, err := c.do("POST", path, doOptions{context: opts.Context})
|
||||
defer resp.Body.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// ConfigurePluginOptions specify parameters to the ConfigurePlugin
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
type ConfigurePluginOptions struct {
|
||||
// The Name of the plugin.
|
||||
Name string `qs:"name"`
|
||||
Envs []string
|
||||
|
||||
Context context.Context
|
||||
}
|
||||
|
||||
// ConfigurePlugin configures plugin that opts point or returns an error.
|
||||
//
|
||||
// See https://goo.gl/C4t7Tz for more details.
|
||||
func (c *Client) ConfigurePlugin(opts ConfigurePluginOptions) error {
|
||||
path := "/plugins/" + opts.Name + "/set"
|
||||
resp, err := c.do("POST", path, doOptions{
|
||||
data: opts.Envs,
|
||||
context: opts.Context,
|
||||
})
|
||||
defer resp.Body.Close()
|
||||
if err != nil {
|
||||
if e, ok := err.(*Error); ok && e.Status == http.StatusNotFound {
|
||||
return &NoSuchPlugin{ID: opts.Name}
|
||||
}
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// NoSuchPlugin is the error returned when a given plugin does not exist.
|
||||
type NoSuchPlugin struct {
|
||||
ID string
|
||||
Err error
|
||||
}
|
||||
|
||||
func (err *NoSuchPlugin) Error() string {
|
||||
if err.Err != nil {
|
||||
return err.Err.Error()
|
||||
}
|
||||
return "No such plugin: " + err.ID
|
||||
}
|
||||
2
vendor/github.com/fsouza/go-dockerclient/swarm.go
generated
vendored
2
vendor/github.com/fsouza/go-dockerclient/swarm.go
generated
vendored
|
|
@ -5,6 +5,7 @@
|
|||
package docker
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"net/http"
|
||||
|
|
@ -12,7 +13,6 @@ import (
|
|||
"strconv"
|
||||
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
|||
2
vendor/github.com/fsouza/go-dockerclient/swarm_configs.go
generated
vendored
2
vendor/github.com/fsouza/go-dockerclient/swarm_configs.go
generated
vendored
|
|
@ -5,13 +5,13 @@
|
|||
package docker
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// NoSuchConfig is the error returned when a given config does not exist.
|
||||
|
|
|
|||
2
vendor/github.com/fsouza/go-dockerclient/swarm_node.go
generated
vendored
2
vendor/github.com/fsouza/go-dockerclient/swarm_node.go
generated
vendored
|
|
@ -5,13 +5,13 @@
|
|||
package docker
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// NoSuchNode is the error returned when a given node does not exist.
|
||||
|
|
|
|||
2
vendor/github.com/fsouza/go-dockerclient/swarm_secrets.go
generated
vendored
2
vendor/github.com/fsouza/go-dockerclient/swarm_secrets.go
generated
vendored
|
|
@ -5,13 +5,13 @@
|
|||
package docker
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// NoSuchSecret is the error returned when a given secret does not exist.
|
||||
|
|
|
|||
17
vendor/github.com/fsouza/go-dockerclient/swarm_service.go
generated
vendored
17
vendor/github.com/fsouza/go-dockerclient/swarm_service.go
generated
vendored
|
|
@ -5,15 +5,13 @@
|
|||
package docker
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// NoSuchService is the error returned when a given service does not exist.
|
||||
|
|
@ -93,10 +91,11 @@ func (c *Client) RemoveService(opts RemoveServiceOptions) error {
|
|||
//
|
||||
// See https://goo.gl/wu3MmS for more details.
|
||||
type UpdateServiceOptions struct {
|
||||
Auth AuthConfiguration `qs:"-"`
|
||||
swarm.ServiceSpec
|
||||
Context context.Context
|
||||
Version uint64
|
||||
Auth AuthConfiguration `qs:"-"`
|
||||
swarm.ServiceSpec `qs:"-"`
|
||||
Context context.Context
|
||||
Version uint64
|
||||
Rollback string
|
||||
}
|
||||
|
||||
// UpdateService updates the service at ID with the options
|
||||
|
|
@ -107,9 +106,7 @@ func (c *Client) UpdateService(id string, opts UpdateServiceOptions) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
params := make(url.Values)
|
||||
params.Set("version", strconv.FormatUint(opts.Version, 10))
|
||||
resp, err := c.do("POST", "/services/"+id+"/update?"+params.Encode(), doOptions{
|
||||
resp, err := c.do("POST", "/services/"+id+"/update?"+queryString(opts), doOptions{
|
||||
headers: headers,
|
||||
data: opts.ServiceSpec,
|
||||
forceJSON: true,
|
||||
|
|
|
|||
2
vendor/github.com/fsouza/go-dockerclient/swarm_task.go
generated
vendored
2
vendor/github.com/fsouza/go-dockerclient/swarm_task.go
generated
vendored
|
|
@ -5,11 +5,11 @@
|
|||
package docker
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"github.com/docker/docker/api/types/swarm"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// NoSuchTask is the error returned when a given task does not exist.
|
||||
|
|
|
|||
5
vendor/github.com/fsouza/go-dockerclient/tar.go
generated
vendored
5
vendor/github.com/fsouza/go-dockerclient/tar.go
generated
vendored
|
|
@ -18,6 +18,11 @@ import (
|
|||
)
|
||||
|
||||
func createTarStream(srcPath, dockerfilePath string) (io.ReadCloser, error) {
|
||||
srcPath, err := filepath.Abs(srcPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
excludes, err := parseDockerignore(srcPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
5
vendor/github.com/fsouza/go-dockerclient/volume.go
generated
vendored
5
vendor/github.com/fsouza/go-dockerclient/volume.go
generated
vendored
|
|
@ -5,11 +5,10 @@
|
|||
package docker
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"net/http"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -131,7 +130,7 @@ func (c *Client) RemoveVolume(name string) error {
|
|||
return ErrVolumeInUse
|
||||
}
|
||||
}
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
return nil
|
||||
|
|
|
|||
6
vendor/vendor.json
vendored
6
vendor/vendor.json
vendored
|
|
@ -425,10 +425,10 @@
|
|||
"revisionTime": "2017-12-21T20:03:56Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "zPr72xFV/wCmMdsyfiq4AVxLWpw=",
|
||||
"checksumSHA1": "Ln312Iryjgy65jln5W4c1dOnlrk=",
|
||||
"path": "github.com/fsouza/go-dockerclient",
|
||||
"revision": "ef22af91edfe4744e8aed4037d032f86eed17444",
|
||||
"revisionTime": "2017-11-04T15:36:32Z"
|
||||
"revision": "7ad31341c6f85e47884a43f7fa57c5981866ae1d",
|
||||
"revisionTime": "2018-02-21T13:01:12Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "1K+xrZ1PBez190iGt5OnMtGdih4=",
|
||||
|
|
|
|||
Loading…
Reference in a new issue