зеркало из https://github.com/docker/engine-api.git
Merge pull request #29 from mavenugo/netdisconnect
an option to disconnect an endpoint from a network forcefully
This commit is contained in:
Коммит
9a05c21449
|
@ -60,7 +60,7 @@ type APIClient interface {
|
||||||
Info() (types.Info, error)
|
Info() (types.Info, error)
|
||||||
NetworkConnect(networkID, containerID string, config *network.EndpointSettings) error
|
NetworkConnect(networkID, containerID string, config *network.EndpointSettings) error
|
||||||
NetworkCreate(options types.NetworkCreate) (types.NetworkCreateResponse, 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)
|
NetworkInspect(networkID string) (types.NetworkResource, error)
|
||||||
NetworkList(options types.NetworkListOptions) ([]types.NetworkResource, error)
|
NetworkList(options types.NetworkListOptions) ([]types.NetworkResource, error)
|
||||||
NetworkRemove(networkID string) 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.
|
// NetworkDisconnect disconnects a container from an existent network in the docker host.
|
||||||
func (cli *Client) NetworkDisconnect(networkID, containerID string) error {
|
func (cli *Client) NetworkDisconnect(networkID, containerID string, force bool) error {
|
||||||
nc := types.NetworkConnect{Container: containerID}
|
nd := types.NetworkDisconnect{Container: containerID, Force: force}
|
||||||
resp, err := cli.post("/networks/"+networkID+"/disconnect", nil, nc, nil)
|
resp, err := cli.post("/networks/"+networkID+"/disconnect", nil, nd, nil)
|
||||||
ensureReaderClosed(resp)
|
ensureReaderClosed(resp)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -422,4 +422,5 @@ type NetworkConnect struct {
|
||||||
// NetworkDisconnect represents the data to be used to disconnect a container from the network
|
// NetworkDisconnect represents the data to be used to disconnect a container from the network
|
||||||
type NetworkDisconnect struct {
|
type NetworkDisconnect struct {
|
||||||
Container string
|
Container string
|
||||||
|
Force bool
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче