Godep update github.com/samalba/dockerclient.

Signed-off-by: Dong Chen <dongluo.chen@docker.com>
This commit is contained in:
Dong Chen 2015-12-03 10:28:48 -08:00
parent ed0b11e506
commit 9df95842a9
6 changed files with 45 additions and 11 deletions

2
Godeps/Godeps.json generated
View File

@ -125,7 +125,7 @@
},
{
"ImportPath": "github.com/samalba/dockerclient",
"Rev": "9433689e5c6bec5ac2ffa8debf721e88abfb6285"
"Rev": "9445e25ed06943cf2828bce5a92391d768513d21"
},
{
"ImportPath": "github.com/samuel/go-zookeeper/zk",

View File

@ -335,6 +335,29 @@ func (client *DockerClient) ExecResize(id string, width, height int) error {
return nil
}
func (client *DockerClient) AttachContainer(id string, options *AttachOptions) (io.ReadCloser, error) {
v := url.Values{}
if options != nil {
if options.Logs {
v.Set("logs", "1")
}
if options.Stream {
v.Set("stream", "1")
}
if options.Stdin {
v.Set("stdin", "1")
}
if options.Stdout {
v.Set("stdout", "1")
}
if options.Stderr {
v.Set("stderr", "1")
}
}
uri := fmt.Sprintf("/%s/containers/%s/attach?%s", APIVersion, id, v.Encode())
return client.doStreamRequest("POST", uri, nil, nil)
}
func (client *DockerClient) StartContainer(id string, config *HostConfig) error {
data, err := json.Marshal(config)
if err != nil {
@ -625,17 +648,9 @@ func (client *DockerClient) InspectImage(id string) (*ImageInfo, error) {
}
func (client *DockerClient) LoadImage(reader io.Reader) error {
data, err := ioutil.ReadAll(reader)
if err != nil {
return err
}
uri := fmt.Sprintf("/%s/images/load", APIVersion)
_, err = client.doRequest("POST", uri, data, nil)
if err != nil {
return err
}
return nil
_, err := client.doStreamRequest("POST", uri, reader, nil)
return err
}
func (client *DockerClient) RemoveContainer(id string, force, volumes bool) error {

View File

@ -20,6 +20,7 @@ type Client interface {
ExecStart(id string, config *ExecConfig) error
ExecResize(id string, width, height int) error
StartContainer(id string, config *HostConfig) error
AttachContainer(id string, options *AttachOptions) (io.ReadCloser, error)
StopContainer(id string, timeout int) error
RestartContainer(id string, timeout int) error
KillContainer(id, signal string) error

View File

@ -50,6 +50,11 @@ func (client *MockClient) ContainerChanges(id string) ([]*dockerclient.Container
return args.Get(0).([]*dockerclient.ContainerChanges), args.Error(1)
}
func (client *MockClient) AttachContainer(id string, options *dockerclient.AttachOptions) (io.ReadCloser, error) {
args := client.Mock.Called(id, options)
return args.Get(0).(io.ReadCloser), args.Error(1)
}
func (client *MockClient) StartContainer(id string, config *dockerclient.HostConfig) error {
args := client.Mock.Called(id, config)
return args.Error(0)

View File

@ -46,6 +46,10 @@ func (client *NopClient) ContainerChanges(id string) ([]*dockerclient.ContainerC
return nil, ErrNoEngine
}
func (client *NopClient) AttachContainer(id string, options *dockerclient.AttachOptions) (io.ReadCloser, error) {
return nil, ErrNoEngine
}
func (client *NopClient) StartContainer(id string, config *dockerclient.HostConfig) error {
return ErrNoEngine
}

View File

@ -112,6 +112,14 @@ type LogOptions struct {
Tail int64
}
type AttachOptions struct {
Logs bool
Stream bool
Stdin bool
Stdout bool
Stderr bool
}
type MonitorEventsFilters struct {
Event string `json:",omitempty"`
Image string `json:",omitempty"`
@ -510,6 +518,7 @@ type NetworkCreate struct {
CheckDuplicate bool
Driver string
IPAM IPAM
Options map[string]string
}
// NetworkCreateResponse is the response message sent by the server for network create call