Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit bfea818

Browse files
authored
Merge pull request #142 from carmark/rename
rename fip operation to attach/detach
2 parents 9fc8257 + 51f5e44 commit bfea818

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

api/client/fip.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -70,30 +70,30 @@ func (cli *DockerCli) CmdFipRelease(args ...string) error {
7070
return nil
7171
}
7272

73-
// CmdFipAssociate connects a container to a floating IP
73+
// CmdFipAttach connects a container to a floating IP
7474
//
75-
// Usage: docker fip associate [OPTIONS] <FIP> <CONTAINER>
76-
func (cli *DockerCli) CmdFipAssociate(args ...string) error {
77-
cmd := Cli.Subcmd("fip associate", []string{"FIP CONTAINER"}, "Connects a container to a floating IP", false)
75+
// Usage: docker fip attach [OPTIONS] <FIP> <CONTAINER>
76+
func (cli *DockerCli) CmdFipAttach(args ...string) error {
77+
cmd := Cli.Subcmd("fip attach", []string{"FIP CONTAINER"}, "Connects a container to a floating IP", false)
7878
cmd.Require(flag.Min, 2)
7979
if err := cmd.ParseFlags(args, true); err != nil {
8080
return err
8181
}
82-
return cli.client.FipAssociate(context.Background(), cmd.Arg(0), cmd.Arg(1))
82+
return cli.client.FipAttach(context.Background(), cmd.Arg(0), cmd.Arg(1))
8383
}
8484

85-
// CmdFipDisassociate disconnects a container from a floating IP
85+
// CmdFipDetach disconnects a container from a floating IP
8686
//
87-
// Usage: docker fip disassociate <CONTAINER>
88-
func (cli *DockerCli) CmdFipDisassociate(args ...string) error {
89-
cmd := Cli.Subcmd("fip disassociate", []string{"CONTAINER"}, "Disconnects container from a floating IP", false)
87+
// Usage: docker fip detach <CONTAINER>
88+
func (cli *DockerCli) CmdFipDetach(args ...string) error {
89+
cmd := Cli.Subcmd("fip detach", []string{"CONTAINER"}, "Disconnects container from a floating IP", false)
9090
//force := cmd.Bool([]string{"f", "-force"}, false, "Force the container to disconnect from a floating IP")
9191
cmd.Require(flag.Exact, 1)
9292
if err := cmd.ParseFlags(args, true); err != nil {
9393
return err
9494
}
9595

96-
ip, err := cli.client.FipDisassociate(context.Background(), cmd.Arg(0))
96+
ip, err := cli.client.FipDetach(context.Background(), cmd.Arg(0))
9797
if err != nil {
9898
return err
9999
}
@@ -147,8 +147,8 @@ func (cli *DockerCli) CmdFipLs(args ...string) error {
147147
func fipUsage() string {
148148
fipCommands := [][]string{
149149
{"allocate", "Allocate a or some IPs"},
150-
{"associate", "Associate floating IP to container"},
151-
{"disassociate", "Disassociate floating IP from conainer"},
150+
{"attach", "Attach floating IP to container"},
151+
{"detach", "Detach floating IP from conainer"},
152152
{"ls", "List all floating IPs"},
153153
{"release", "Release a floating IP"},
154154
}
@@ -163,15 +163,15 @@ func fipUsage() string {
163163
return help
164164
}
165165

166-
// Allocate and associate a fip
166+
// Allocate and attach a fip
167167
func (cli *DockerCli) associateNewFip(ctx context.Context, contID string) (string, error) {
168168
fips, err := cli.client.FipAllocate(ctx, "1")
169169
if err != nil {
170170
return "", err
171171
}
172172

173173
for _, ip := range fips {
174-
err = cli.client.FipAssociate(ctx, ip, contID)
174+
err = cli.client.FipAttach(ctx, ip, contID)
175175
if err != nil {
176176
go func() {
177177
cli.client.FipRelease(ctx, ip)
@@ -189,9 +189,9 @@ func (cli *DockerCli) releaseFip(ctx context.Context, ip string) error {
189189
return cli.client.FipRelease(ctx, ip)
190190
}
191191

192-
// Disassociate and release a fip
192+
// Detach and release a fip
193193
func (cli *DockerCli) releaseContainerFip(ctx context.Context, contID string) error {
194-
ip, err := cli.client.FipDisassociate(ctx, contID)
194+
ip, err := cli.client.FipDetach(ctx, contID)
195195
if err != nil {
196196
return err
197197
}

vendor/src/github.com/docker/engine-api/client/fip.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,22 @@ func (cli *Client) FipRelease(ctx context.Context, ip string) error {
3333
return nil
3434
}
3535

36-
func (cli *Client) FipAssociate(ctx context.Context, ip, container string) error {
36+
func (cli *Client) FipAttach(ctx context.Context, ip, container string) error {
3737
var v = url.Values{}
3838
v.Set("ip", ip)
3939
v.Set("container", container)
40-
_, err := cli.post(ctx, "/fips/associate", v, nil, nil)
40+
_, err := cli.post(ctx, "/fips/attach", v, nil, nil)
4141
if err != nil {
4242
return err
4343
}
4444
return nil
4545
}
4646

47-
func (cli *Client) FipDisassociate(ctx context.Context, container string) (string, error) {
47+
func (cli *Client) FipDetach(ctx context.Context, container string) (string, error) {
4848
var result string
4949
var v = url.Values{}
5050
v.Set("container", container)
51-
resp, err := cli.post(ctx, "/fips/deassociate", v, nil, nil)
51+
resp, err := cli.post(ctx, "/fips/detach", v, nil, nil)
5252
if err != nil {
5353
return "", err
5454
}

vendor/src/github.com/docker/engine-api/client/interface.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ type APIClient interface {
8888
SnapshotRemove(ctx context.Context, id string) error
8989
FipAllocate(ctx context.Context, count string) ([]string, error)
9090
FipRelease(ctx context.Context, ip string) error
91-
FipAssociate(ctx context.Context, ip, container string) error
92-
FipDisassociate(ctx context.Context, container string) (string, error)
91+
FipAttach(ctx context.Context, ip, container string) error
92+
FipDetach(ctx context.Context, container string) (string, error)
9393
FipList(ctx context.Context, opts types.NetworkListOptions) ([]map[string]string, error)
9494

9595
ComposeUp(project string, services []string, c *config.ServiceConfigs, vc map[string]*config.VolumeConfig, nc map[string]*config.NetworkConfig, forcerecreate, norecreate bool) (io.ReadCloser, error)

0 commit comments

Comments
 (0)