mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-12-03 04:06:14 +00:00
Update go-dockerclient godep.
Adds support for new Docker remote API.
This commit is contained in:
38
Godeps/_workspace/src/github.com/fsouza/go-dockerclient/image.go
generated
vendored
38
Godeps/_workspace/src/github.com/fsouza/go-dockerclient/image.go
generated
vendored
@@ -104,7 +104,6 @@ var (
|
||||
//
|
||||
// See http://goo.gl/HRVN1Z for more details.
|
||||
func (c *Client) ListImages(opts ListImagesOptions) ([]APIImages, error) {
|
||||
// TODO(pedge): what happens if we specify the digest parameter when using API Version <1.18?
|
||||
path := "/images/json?" + queryString(opts)
|
||||
body, _, err := c.do("GET", path, doOptions{})
|
||||
if err != nil {
|
||||
@@ -240,13 +239,17 @@ func (c *Client) PushImage(opts PushImageOptions, auth AuthConfiguration) error
|
||||
if opts.Name == "" {
|
||||
return ErrNoSuchImage
|
||||
}
|
||||
headers, err := headersWithAuth(auth)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
name := opts.Name
|
||||
opts.Name = ""
|
||||
path := "/images/" + name + "/push?" + queryString(&opts)
|
||||
return c.stream("POST", path, streamOptions{
|
||||
setRawTerminal: true,
|
||||
rawJSONStream: opts.RawJSONStream,
|
||||
headers: headersWithAuth(auth),
|
||||
headers: headers,
|
||||
stdout: opts.OutputStream,
|
||||
})
|
||||
}
|
||||
@@ -271,7 +274,10 @@ func (c *Client) PullImage(opts PullImageOptions, auth AuthConfiguration) error
|
||||
return ErrNoSuchImage
|
||||
}
|
||||
|
||||
headers := headersWithAuth(auth)
|
||||
headers, err := headersWithAuth(auth)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return c.createImage(queryString(&opts), headers, nil, opts.OutputStream, opts.RawJSONStream)
|
||||
}
|
||||
|
||||
@@ -387,8 +393,13 @@ type BuildImageOptions struct {
|
||||
Dockerfile string `qs:"dockerfile"`
|
||||
NoCache bool `qs:"nocache"`
|
||||
SuppressOutput bool `qs:"q"`
|
||||
Pull bool `qs:"pull"`
|
||||
RmTmpContainer bool `qs:"rm"`
|
||||
ForceRmTmpContainer bool `qs:"forcerm"`
|
||||
Memory int64 `qs:"memory"`
|
||||
Memswap int64 `qs:"memswap"`
|
||||
CPUShares int64 `qs:"cpushares"`
|
||||
CPUSetCPUs string `qs:"cpusetcpus"`
|
||||
InputStream io.Reader `qs:"-"`
|
||||
OutputStream io.Writer `qs:"-"`
|
||||
RawJSONStream bool `qs:"-"`
|
||||
@@ -401,12 +412,15 @@ type BuildImageOptions struct {
|
||||
// BuildImage builds an image from a tarball's url or a Dockerfile in the input
|
||||
// stream.
|
||||
//
|
||||
// See http://goo.gl/wRsW76 for more details.
|
||||
// See http://goo.gl/7nuGXa for more details.
|
||||
func (c *Client) BuildImage(opts BuildImageOptions) error {
|
||||
if opts.OutputStream == nil {
|
||||
return ErrMissingOutputStream
|
||||
}
|
||||
var headers = headersWithAuth(opts.Auth, opts.AuthConfigs)
|
||||
headers, err := headersWithAuth(opts.Auth, opts.AuthConfigs)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if opts.Remote != "" && opts.Name == "" {
|
||||
opts.Name = opts.Remote
|
||||
@@ -421,7 +435,7 @@ func (c *Client) BuildImage(opts BuildImageOptions) error {
|
||||
return ErrMultipleContexts
|
||||
}
|
||||
var err error
|
||||
if opts.InputStream, err = createTarStream(opts.ContextDir); err != nil {
|
||||
if opts.InputStream, err = createTarStream(opts.ContextDir, opts.Dockerfile); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -469,23 +483,27 @@ func isURL(u string) bool {
|
||||
return p.Scheme == "http" || p.Scheme == "https"
|
||||
}
|
||||
|
||||
func headersWithAuth(auths ...interface{}) map[string]string {
|
||||
func headersWithAuth(auths ...interface{}) (map[string]string, error) {
|
||||
var headers = make(map[string]string)
|
||||
|
||||
for _, auth := range auths {
|
||||
switch auth.(type) {
|
||||
case AuthConfiguration:
|
||||
var buf bytes.Buffer
|
||||
json.NewEncoder(&buf).Encode(auth)
|
||||
if err := json.NewEncoder(&buf).Encode(auth); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
headers["X-Registry-Auth"] = base64.URLEncoding.EncodeToString(buf.Bytes())
|
||||
case AuthConfigurations:
|
||||
var buf bytes.Buffer
|
||||
json.NewEncoder(&buf).Encode(auth)
|
||||
if err := json.NewEncoder(&buf).Encode(auth); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
headers["X-Registry-Config"] = base64.URLEncoding.EncodeToString(buf.Bytes())
|
||||
}
|
||||
}
|
||||
|
||||
return headers
|
||||
return headers, nil
|
||||
}
|
||||
|
||||
// APIImageSearch reflect the result of a search on the dockerHub
|
||||
|
||||
Reference in New Issue
Block a user