Merge pull request #29 from mavenugo/netdisconnect

an option to disconnect an endpoint from a network forcefully
This commit is contained in:
Arnaud Porterie 2016-01-11 11:08:13 -08:00
Родитель 7b6d061ba5 d1c2a8739c
Коммит 9a05c21449
3 изменённых файлов: 5 добавлений и 4 удалений

Просмотреть файл

@ -60,7 +60,7 @@ type APIClient interface {
Info() (types.Info, error)
NetworkConnect(networkID, containerID string, config *network.EndpointSettings) error
NetworkCreate(options types.NetworkCreate) (types.NetworkCreateResponse, error)
NetworkDisconnect(networkID, containerID string) error
NetworkDisconnect(networkID, containerID string, force bool) error
NetworkInspect(networkID string) (types.NetworkResource, error)
NetworkList(options types.NetworkListOptions) ([]types.NetworkResource, error)
NetworkRemove(networkID string) error

Просмотреть файл

@ -42,9 +42,9 @@ func (cli *Client) NetworkConnect(networkID, containerID string, config *network
}
// NetworkDisconnect disconnects a container from an existent network in the docker host.
func (cli *Client) NetworkDisconnect(networkID, containerID string) error {
nc := types.NetworkConnect{Container: containerID}
resp, err := cli.post("/networks/"+networkID+"/disconnect", nil, nc, nil)
func (cli *Client) NetworkDisconnect(networkID, containerID string, force bool) error {
nd := types.NetworkDisconnect{Container: containerID, Force: force}
resp, err := cli.post("/networks/"+networkID+"/disconnect", nil, nd, nil)
ensureReaderClosed(resp)
return err
}

Просмотреть файл

@ -422,4 +422,5 @@ type NetworkConnect struct {
// NetworkDisconnect represents the data to be used to disconnect a container from the network
type NetworkDisconnect struct {
Container string
Force bool
}