Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
| ... | ... |
@@ -131,8 +131,8 @@ type NetworkAPIClient interface {
|
| 131 | 131 |
NetworkConnect(ctx context.Context, network, container string, config *network.EndpointSettings) error |
| 132 | 132 |
NetworkCreate(ctx context.Context, name string, options network.CreateOptions) (network.CreateResponse, error) |
| 133 | 133 |
NetworkDisconnect(ctx context.Context, network, container string, force bool) error |
| 134 |
- NetworkInspect(ctx context.Context, network string, options InspectOptions) (network.Inspect, error) |
|
| 135 |
- NetworkInspectWithRaw(ctx context.Context, network string, options InspectOptions) (network.Inspect, []byte, error) |
|
| 134 |
+ NetworkInspect(ctx context.Context, network string, options NetworkInspectOptions) (network.Inspect, error) |
|
| 135 |
+ NetworkInspectWithRaw(ctx context.Context, network string, options NetworkInspectOptions) (network.Inspect, []byte, error) |
|
| 136 | 136 |
NetworkList(ctx context.Context, options NetworkListOptions) ([]network.Summary, error) |
| 137 | 137 |
NetworkRemove(ctx context.Context, network string) error |
| 138 | 138 |
NetworksPrune(ctx context.Context, pruneFilter filters.Args) (network.PruneReport, error) |
| ... | ... |
@@ -11,13 +11,13 @@ import ( |
| 11 | 11 |
) |
| 12 | 12 |
|
| 13 | 13 |
// NetworkInspect returns the information for a specific network configured in the docker host. |
| 14 |
-func (cli *Client) NetworkInspect(ctx context.Context, networkID string, options InspectOptions) (network.Inspect, error) {
|
|
| 14 |
+func (cli *Client) NetworkInspect(ctx context.Context, networkID string, options NetworkInspectOptions) (network.Inspect, error) {
|
|
| 15 | 15 |
networkResource, _, err := cli.NetworkInspectWithRaw(ctx, networkID, options) |
| 16 | 16 |
return networkResource, err |
| 17 | 17 |
} |
| 18 | 18 |
|
| 19 | 19 |
// NetworkInspectWithRaw returns the information for a specific network configured in the docker host and its raw representation. |
| 20 |
-func (cli *Client) NetworkInspectWithRaw(ctx context.Context, networkID string, options InspectOptions) (network.Inspect, []byte, error) {
|
|
| 20 |
+func (cli *Client) NetworkInspectWithRaw(ctx context.Context, networkID string, options NetworkInspectOptions) (network.Inspect, []byte, error) {
|
|
| 21 | 21 |
networkID, err := trimID("network", networkID)
|
| 22 | 22 |
if err != nil {
|
| 23 | 23 |
return network.Inspect{}, nil, err
|
| ... | ... |
@@ -68,39 +68,39 @@ func TestNetworkInspect(t *testing.T) {
|
| 68 | 68 |
|
| 69 | 69 |
t.Run("empty ID", func(t *testing.T) {
|
| 70 | 70 |
// verify that the client does not create a request if the network-ID/name is empty. |
| 71 |
- _, err := client.NetworkInspect(context.Background(), "", InspectOptions{})
|
|
| 71 |
+ _, err := client.NetworkInspect(context.Background(), "", NetworkInspectOptions{})
|
|
| 72 | 72 |
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument)) |
| 73 | 73 |
assert.Check(t, is.ErrorContains(err, "value is empty")) |
| 74 | 74 |
|
| 75 |
- _, err = client.NetworkInspect(context.Background(), " ", InspectOptions{})
|
|
| 75 |
+ _, err = client.NetworkInspect(context.Background(), " ", NetworkInspectOptions{})
|
|
| 76 | 76 |
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument)) |
| 77 | 77 |
assert.Check(t, is.ErrorContains(err, "value is empty")) |
| 78 | 78 |
}) |
| 79 | 79 |
t.Run("no options", func(t *testing.T) {
|
| 80 |
- r, err := client.NetworkInspect(context.Background(), "network_id", InspectOptions{})
|
|
| 80 |
+ r, err := client.NetworkInspect(context.Background(), "network_id", NetworkInspectOptions{})
|
|
| 81 | 81 |
assert.NilError(t, err) |
| 82 | 82 |
assert.Check(t, is.Equal(r.Name, "mynetwork")) |
| 83 | 83 |
}) |
| 84 | 84 |
t.Run("verbose", func(t *testing.T) {
|
| 85 |
- r, err := client.NetworkInspect(context.Background(), "network_id", InspectOptions{Verbose: true})
|
|
| 85 |
+ r, err := client.NetworkInspect(context.Background(), "network_id", NetworkInspectOptions{Verbose: true})
|
|
| 86 | 86 |
assert.NilError(t, err) |
| 87 | 87 |
assert.Check(t, is.Equal(r.Name, "mynetwork")) |
| 88 | 88 |
_, ok := r.Services["web"] |
| 89 | 89 |
assert.Check(t, ok, "expected service `web` missing in the verbose output") |
| 90 | 90 |
}) |
| 91 | 91 |
t.Run("global scope", func(t *testing.T) {
|
| 92 |
- _, err := client.NetworkInspect(context.Background(), "network_id", InspectOptions{Scope: "global"})
|
|
| 92 |
+ _, err := client.NetworkInspect(context.Background(), "network_id", NetworkInspectOptions{Scope: "global"})
|
|
| 93 | 93 |
assert.Check(t, is.ErrorContains(err, "Error: No such network: network_id")) |
| 94 | 94 |
assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound)) |
| 95 | 95 |
}) |
| 96 | 96 |
t.Run("unknown network", func(t *testing.T) {
|
| 97 |
- _, err := client.NetworkInspect(context.Background(), "unknown", InspectOptions{})
|
|
| 97 |
+ _, err := client.NetworkInspect(context.Background(), "unknown", NetworkInspectOptions{})
|
|
| 98 | 98 |
assert.Check(t, is.ErrorContains(err, "Error: No such network: unknown")) |
| 99 | 99 |
assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound)) |
| 100 | 100 |
}) |
| 101 | 101 |
t.Run("server error", func(t *testing.T) {
|
| 102 | 102 |
// Just testing that an internal server error is converted correctly by the client |
| 103 |
- _, err := client.NetworkInspect(context.Background(), "test-500-response", InspectOptions{})
|
|
| 103 |
+ _, err := client.NetworkInspect(context.Background(), "test-500-response", NetworkInspectOptions{})
|
|
| 104 | 104 |
assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal)) |
| 105 | 105 |
}) |
| 106 | 106 |
} |
| ... | ... |
@@ -1026,11 +1026,11 @@ func (s *DockerSwarmSuite) TestAPINetworkInspectWithScope(c *testing.T) {
|
| 1026 | 1026 |
resp, err := apiclient.NetworkCreate(ctx, name, network.CreateOptions{Driver: "overlay"})
|
| 1027 | 1027 |
assert.NilError(c, err) |
| 1028 | 1028 |
|
| 1029 |
- nw, err := apiclient.NetworkInspect(ctx, name, client.InspectOptions{})
|
|
| 1029 |
+ nw, err := apiclient.NetworkInspect(ctx, name, client.NetworkInspectOptions{})
|
|
| 1030 | 1030 |
assert.NilError(c, err) |
| 1031 | 1031 |
assert.Check(c, is.Equal("swarm", nw.Scope))
|
| 1032 | 1032 |
assert.Check(c, is.Equal(resp.ID, nw.ID)) |
| 1033 | 1033 |
|
| 1034 |
- _, err = apiclient.NetworkInspect(ctx, name, client.InspectOptions{Scope: "local"})
|
|
| 1034 |
+ _, err = apiclient.NetworkInspect(ctx, name, client.NetworkInspectOptions{Scope: "local"})
|
|
| 1035 | 1035 |
assert.Check(c, is.ErrorType(err, cerrdefs.IsNotFound)) |
| 1036 | 1036 |
} |
| ... | ... |
@@ -153,7 +153,7 @@ func TestDaemonHostGatewayIP(t *testing.T) {
|
| 153 | 153 |
assert.NilError(t, err) |
| 154 | 154 |
assert.Assert(t, is.Len(res.Stderr(), 0)) |
| 155 | 155 |
assert.Equal(t, 0, res.ExitCode) |
| 156 |
- inspect, err := c.NetworkInspect(ctx, "bridge", client.InspectOptions{})
|
|
| 156 |
+ inspect, err := c.NetworkInspect(ctx, "bridge", client.NetworkInspectOptions{})
|
|
| 157 | 157 |
assert.NilError(t, err) |
| 158 | 158 |
assert.Check(t, is.Contains(res.Stdout(), inspect.IPAM.Config[0].Gateway)) |
| 159 | 159 |
c.ContainerRemove(ctx, cID, containertypes.RemoveOptions{Force: true})
|
| ... | ... |
@@ -419,7 +419,7 @@ func testDefaultBridgeIPAM(ctx context.Context, t *testing.T, tc defaultBridgeIP |
| 419 | 419 |
c := d.NewClientT(t) |
| 420 | 420 |
defer c.Close() |
| 421 | 421 |
|
| 422 |
- insp, err := c.NetworkInspect(ctx, network.NetworkBridge, client.InspectOptions{})
|
|
| 422 |
+ insp, err := c.NetworkInspect(ctx, network.NetworkBridge, client.NetworkInspectOptions{})
|
|
| 423 | 423 |
assert.NilError(t, err) |
| 424 | 424 |
expIPAMConfig := slices.Clone(tc.expIPAMConfig) |
| 425 | 425 |
for i := range expIPAMConfig {
|
| ... | ... |
@@ -10,7 +10,7 @@ import ( |
| 10 | 10 |
// IsRemoved verifies the network is removed. |
| 11 | 11 |
func IsRemoved(ctx context.Context, apiClient client.NetworkAPIClient, networkID string) func(log poll.LogT) poll.Result {
|
| 12 | 12 |
return func(log poll.LogT) poll.Result {
|
| 13 |
- _, err := apiClient.NetworkInspect(ctx, networkID, client.InspectOptions{})
|
|
| 13 |
+ _, err := apiClient.NetworkInspect(ctx, networkID, client.NetworkInspectOptions{})
|
|
| 14 | 14 |
if err == nil {
|
| 15 | 15 |
return poll.Continue("waiting for network %s to be removed", networkID)
|
| 16 | 16 |
} |
| ... | ... |
@@ -65,7 +65,7 @@ func TestCreateWithIPv6DefaultsToULAPrefix(t *testing.T) {
|
| 65 | 65 |
network.CreateNoError(ctx, t, apiClient, nwName, network.WithIPv6()) |
| 66 | 66 |
defer network.RemoveNoError(ctx, t, apiClient, nwName) |
| 67 | 67 |
|
| 68 |
- nw, err := apiClient.NetworkInspect(ctx, "testnetula", client.InspectOptions{})
|
|
| 68 |
+ nw, err := apiClient.NetworkInspect(ctx, "testnetula", client.NetworkInspectOptions{})
|
|
| 69 | 69 |
assert.NilError(t, err) |
| 70 | 70 |
|
| 71 | 71 |
for _, ipam := range nw.IPAM.Config {
|
| ... | ... |
@@ -92,7 +92,7 @@ func TestCreateWithIPv6WithoutEnableIPv6Flag(t *testing.T) {
|
| 92 | 92 |
network.CreateNoError(ctx, t, apiClient, nwName) |
| 93 | 93 |
defer network.RemoveNoError(ctx, t, apiClient, nwName) |
| 94 | 94 |
|
| 95 |
- nw, err := apiClient.NetworkInspect(ctx, "testnetula", client.InspectOptions{})
|
|
| 95 |
+ nw, err := apiClient.NetworkInspect(ctx, "testnetula", client.NetworkInspectOptions{})
|
|
| 96 | 96 |
assert.NilError(t, err) |
| 97 | 97 |
|
| 98 | 98 |
for _, ipam := range nw.IPAM.Config {
|
| ... | ... |
@@ -137,7 +137,7 @@ func TestDefaultIPvOptOverride(t *testing.T) {
|
| 137 | 137 |
network.CreateNoError(ctx, t, c, netName, nopts...) |
| 138 | 138 |
defer network.RemoveNoError(ctx, t, c, netName) |
| 139 | 139 |
|
| 140 |
- insp, err := c.NetworkInspect(ctx, netName, client.InspectOptions{})
|
|
| 140 |
+ insp, err := c.NetworkInspect(ctx, netName, client.NetworkInspectOptions{})
|
|
| 141 | 141 |
assert.NilError(t, err) |
| 142 | 142 |
t.Log("override4", override4, "override6", override6, "->", insp.Options)
|
| 143 | 143 |
|
| ... | ... |
@@ -41,33 +41,33 @@ func TestInspectNetwork(t *testing.T) {
|
| 41 | 41 |
tests := []struct {
|
| 42 | 42 |
name string |
| 43 | 43 |
network string |
| 44 |
- opts client.InspectOptions |
|
| 44 |
+ opts client.NetworkInspectOptions |
|
| 45 | 45 |
}{
|
| 46 | 46 |
{
|
| 47 | 47 |
name: "full network id", |
| 48 | 48 |
network: overlayID, |
| 49 |
- opts: client.InspectOptions{
|
|
| 49 |
+ opts: client.NetworkInspectOptions{
|
|
| 50 | 50 |
Verbose: true, |
| 51 | 51 |
}, |
| 52 | 52 |
}, |
| 53 | 53 |
{
|
| 54 | 54 |
name: "partial network id", |
| 55 | 55 |
network: overlayID[0:11], |
| 56 |
- opts: client.InspectOptions{
|
|
| 56 |
+ opts: client.NetworkInspectOptions{
|
|
| 57 | 57 |
Verbose: true, |
| 58 | 58 |
}, |
| 59 | 59 |
}, |
| 60 | 60 |
{
|
| 61 | 61 |
name: "network name", |
| 62 | 62 |
network: networkName, |
| 63 |
- opts: client.InspectOptions{
|
|
| 63 |
+ opts: client.NetworkInspectOptions{
|
|
| 64 | 64 |
Verbose: true, |
| 65 | 65 |
}, |
| 66 | 66 |
}, |
| 67 | 67 |
{
|
| 68 | 68 |
name: "network name and swarm scope", |
| 69 | 69 |
network: networkName, |
| 70 |
- opts: client.InspectOptions{
|
|
| 70 |
+ opts: client.NetworkInspectOptions{
|
|
| 71 | 71 |
Verbose: true, |
| 72 | 72 |
Scope: "swarm", |
| 73 | 73 |
}, |
| ... | ... |
@@ -89,7 +89,7 @@ func TestHostIPv4BridgeLabel(t *testing.T) {
|
| 89 | 89 |
network.WithOption("com.docker.network.bridge.name", bridgeName),
|
| 90 | 90 |
) |
| 91 | 91 |
defer network.RemoveNoError(ctx, t, c, bridgeName) |
| 92 |
- out, err := c.NetworkInspect(ctx, bridgeName, client.InspectOptions{Verbose: true})
|
|
| 92 |
+ out, err := c.NetworkInspect(ctx, bridgeName, client.NetworkInspectOptions{Verbose: true})
|
|
| 93 | 93 |
assert.NilError(t, err) |
| 94 | 94 |
assert.Assert(t, len(out.IPAM.Config) > 0) |
| 95 | 95 |
// Make sure the SNAT rule exists |
| ... | ... |
@@ -45,7 +45,7 @@ func TestDaemonRestartWithLiveRestore(t *testing.T) {
|
| 45 | 45 |
defer c.Close() |
| 46 | 46 |
|
| 47 | 47 |
// Verify bridge network's subnet |
| 48 |
- out, err := c.NetworkInspect(ctx, "bridge", client.InspectOptions{})
|
|
| 48 |
+ out, err := c.NetworkInspect(ctx, "bridge", client.NetworkInspectOptions{})
|
|
| 49 | 49 |
assert.NilError(t, err) |
| 50 | 50 |
subnet := out.IPAM.Config[0].Subnet |
| 51 | 51 |
|
| ... | ... |
@@ -55,7 +55,7 @@ func TestDaemonRestartWithLiveRestore(t *testing.T) {
|
| 55 | 55 |
"--default-address-pool", "base=175.33.0.0/16,size=24", |
| 56 | 56 |
) |
| 57 | 57 |
|
| 58 |
- out1, err := c.NetworkInspect(ctx, "bridge", client.InspectOptions{})
|
|
| 58 |
+ out1, err := c.NetworkInspect(ctx, "bridge", client.NetworkInspectOptions{})
|
|
| 59 | 59 |
assert.NilError(t, err) |
| 60 | 60 |
// Make sure docker0 doesn't get override with new IP in live restore case |
| 61 | 61 |
assert.Equal(t, out1.IPAM.Config[0].Subnet, subnet) |
| ... | ... |
@@ -82,7 +82,7 @@ func TestDaemonDefaultNetworkPools(t *testing.T) {
|
| 82 | 82 |
defer c.Close() |
| 83 | 83 |
|
| 84 | 84 |
// Verify bridge network's subnet |
| 85 |
- out, err := c.NetworkInspect(ctx, "bridge", client.InspectOptions{})
|
|
| 85 |
+ out, err := c.NetworkInspect(ctx, "bridge", client.NetworkInspectOptions{})
|
|
| 86 | 86 |
assert.NilError(t, err) |
| 87 | 87 |
assert.Equal(t, out.IPAM.Config[0].Subnet, "175.30.0.0/16") |
| 88 | 88 |
|
| ... | ... |
@@ -92,7 +92,7 @@ func TestDaemonDefaultNetworkPools(t *testing.T) {
|
| 92 | 92 |
network.WithDriver("bridge"),
|
| 93 | 93 |
) |
| 94 | 94 |
defer network.RemoveNoError(ctx, t, c, name) |
| 95 |
- out, err = c.NetworkInspect(ctx, name, client.InspectOptions{})
|
|
| 95 |
+ out, err = c.NetworkInspect(ctx, name, client.NetworkInspectOptions{})
|
|
| 96 | 96 |
assert.NilError(t, err) |
| 97 | 97 |
assert.Check(t, is.Equal(out.IPAM.Config[0].Subnet, "175.33.0.0/24")) |
| 98 | 98 |
|
| ... | ... |
@@ -102,7 +102,7 @@ func TestDaemonDefaultNetworkPools(t *testing.T) {
|
| 102 | 102 |
network.WithDriver("bridge"),
|
| 103 | 103 |
) |
| 104 | 104 |
defer network.RemoveNoError(ctx, t, c, name) |
| 105 |
- out, err = c.NetworkInspect(ctx, name, client.InspectOptions{})
|
|
| 105 |
+ out, err = c.NetworkInspect(ctx, name, client.NetworkInspectOptions{})
|
|
| 106 | 106 |
assert.NilError(t, err) |
| 107 | 107 |
assert.Check(t, is.Equal(out.IPAM.Config[0].Subnet, "175.33.1.0/24")) |
| 108 | 108 |
} |
| ... | ... |
@@ -127,7 +127,7 @@ func TestDaemonRestartWithExistingNetwork(t *testing.T) {
|
| 127 | 127 |
defer network.RemoveNoError(ctx, t, c, name) |
| 128 | 128 |
|
| 129 | 129 |
// Verify bridge network's subnet |
| 130 |
- out, err := c.NetworkInspect(ctx, name, client.InspectOptions{})
|
|
| 130 |
+ out, err := c.NetworkInspect(ctx, name, client.NetworkInspectOptions{})
|
|
| 131 | 131 |
assert.NilError(t, err) |
| 132 | 132 |
networkip := out.IPAM.Config[0].Subnet |
| 133 | 133 |
|
| ... | ... |
@@ -137,7 +137,7 @@ func TestDaemonRestartWithExistingNetwork(t *testing.T) {
|
| 137 | 137 |
"--default-address-pool", "base=175.33.0.0/16,size=24") |
| 138 | 138 |
defer delInterface(ctx, t, "docker0") |
| 139 | 139 |
|
| 140 |
- out1, err := c.NetworkInspect(ctx, name, client.InspectOptions{})
|
|
| 140 |
+ out1, err := c.NetworkInspect(ctx, name, client.NetworkInspectOptions{})
|
|
| 141 | 141 |
assert.NilError(t, err) |
| 142 | 142 |
assert.Equal(t, out1.IPAM.Config[0].Subnet, networkip) |
| 143 | 143 |
} |
| ... | ... |
@@ -163,7 +163,7 @@ func TestDaemonRestartWithExistingNetworkWithDefaultPoolRange(t *testing.T) {
|
| 163 | 163 |
defer network.RemoveNoError(ctx, t, c, name) |
| 164 | 164 |
|
| 165 | 165 |
// Verify bridge network's subnet |
| 166 |
- out, err := c.NetworkInspect(ctx, name, client.InspectOptions{})
|
|
| 166 |
+ out, err := c.NetworkInspect(ctx, name, client.NetworkInspectOptions{})
|
|
| 167 | 167 |
assert.NilError(t, err) |
| 168 | 168 |
networkip := out.IPAM.Config[0].Subnet |
| 169 | 169 |
|
| ... | ... |
@@ -173,7 +173,7 @@ func TestDaemonRestartWithExistingNetworkWithDefaultPoolRange(t *testing.T) {
|
| 173 | 173 |
network.WithDriver("bridge"),
|
| 174 | 174 |
) |
| 175 | 175 |
defer network.RemoveNoError(ctx, t, c, name) |
| 176 |
- out, err = c.NetworkInspect(ctx, name, client.InspectOptions{})
|
|
| 176 |
+ out, err = c.NetworkInspect(ctx, name, client.NetworkInspectOptions{})
|
|
| 177 | 177 |
assert.NilError(t, err) |
| 178 | 178 |
networkip2 := out.IPAM.Config[0].Subnet |
| 179 | 179 |
|
| ... | ... |
@@ -190,7 +190,7 @@ func TestDaemonRestartWithExistingNetworkWithDefaultPoolRange(t *testing.T) {
|
| 190 | 190 |
network.WithDriver("bridge"),
|
| 191 | 191 |
) |
| 192 | 192 |
defer network.RemoveNoError(ctx, t, c, name) |
| 193 |
- out1, err := c.NetworkInspect(ctx, name, client.InspectOptions{})
|
|
| 193 |
+ out1, err := c.NetworkInspect(ctx, name, client.NetworkInspectOptions{})
|
|
| 194 | 194 |
assert.NilError(t, err) |
| 195 | 195 |
|
| 196 | 196 |
assert.Check(t, out1.IPAM.Config[0].Subnet != networkip) |
| ... | ... |
@@ -217,7 +217,7 @@ func TestDaemonWithBipAndDefaultNetworkPool(t *testing.T) {
|
| 217 | 217 |
defer c.Close() |
| 218 | 218 |
|
| 219 | 219 |
// Verify bridge network's subnet |
| 220 |
- out, err := c.NetworkInspect(ctx, "bridge", client.InspectOptions{})
|
|
| 220 |
+ out, err := c.NetworkInspect(ctx, "bridge", client.NetworkInspectOptions{})
|
|
| 221 | 221 |
assert.NilError(t, err) |
| 222 | 222 |
// Make sure BIP IP doesn't get override with new default address pool . |
| 223 | 223 |
assert.Equal(t, out.IPAM.Config[0].Subnet, "172.60.0.0/16") |
| ... | ... |
@@ -297,7 +297,7 @@ func TestServiceRemoveKeepsIngressNetwork(t *testing.T) {
|
| 297 | 297 |
|
| 298 | 298 |
// Ensure that "ingress" is not removed or corrupted |
| 299 | 299 |
time.Sleep(10 * time.Second) |
| 300 |
- netInfo, err := c.NetworkInspect(ctx, ingressNet, client.InspectOptions{
|
|
| 300 |
+ netInfo, err := c.NetworkInspect(ctx, ingressNet, client.NetworkInspectOptions{
|
|
| 301 | 301 |
Verbose: true, |
| 302 | 302 |
Scope: "swarm", |
| 303 | 303 |
}) |
| ... | ... |
@@ -311,7 +311,7 @@ func TestServiceRemoveKeepsIngressNetwork(t *testing.T) {
|
| 311 | 311 |
//nolint:unused // for some reason, the "unused" linter marks this function as "unused" |
| 312 | 312 |
func swarmIngressReady(ctx context.Context, apiClient client.NetworkAPIClient) func(log poll.LogT) poll.Result {
|
| 313 | 313 |
return func(log poll.LogT) poll.Result {
|
| 314 |
- netInfo, err := apiClient.NetworkInspect(ctx, ingressNet, client.InspectOptions{
|
|
| 314 |
+ netInfo, err := apiClient.NetworkInspect(ctx, ingressNet, client.NetworkInspectOptions{
|
|
| 315 | 315 |
Verbose: true, |
| 316 | 316 |
Scope: "swarm", |
| 317 | 317 |
}) |
| ... | ... |
@@ -443,7 +443,7 @@ func TestServiceWithDefaultAddressPoolInit(t *testing.T) {
|
| 443 | 443 |
_, _, err := cli.ServiceInspectWithRaw(ctx, serviceID, swarmtypes.ServiceInspectOptions{})
|
| 444 | 444 |
assert.NilError(t, err) |
| 445 | 445 |
|
| 446 |
- out, err := cli.NetworkInspect(ctx, overlayID, client.InspectOptions{Verbose: true})
|
|
| 446 |
+ out, err := cli.NetworkInspect(ctx, overlayID, client.NetworkInspectOptions{Verbose: true})
|
|
| 447 | 447 |
assert.NilError(t, err) |
| 448 | 448 |
t.Logf("%s: NetworkInspect: %+v", t.Name(), out)
|
| 449 | 449 |
assert.Assert(t, len(out.IPAM.Config) > 0) |
| ... | ... |
@@ -454,7 +454,7 @@ func TestServiceWithDefaultAddressPoolInit(t *testing.T) {
|
| 454 | 454 |
assert.Equal(t, out.IPAM.Config[0].Subnet, "20.20.1.0/24") |
| 455 | 455 |
|
| 456 | 456 |
// Also inspect ingress network and make sure its in the same subnet |
| 457 |
- out, err = cli.NetworkInspect(ctx, "ingress", client.InspectOptions{Verbose: true})
|
|
| 457 |
+ out, err = cli.NetworkInspect(ctx, "ingress", client.NetworkInspectOptions{Verbose: true})
|
|
| 458 | 458 |
assert.NilError(t, err) |
| 459 | 459 |
assert.Assert(t, len(out.IPAM.Config) > 0) |
| 460 | 460 |
assert.Equal(t, out.IPAM.Config[0].Subnet, "20.20.0.0/24") |
| ... | ... |
@@ -584,7 +584,7 @@ func TestAccessToPublishedPort(t *testing.T) {
|
| 584 | 584 |
// Use the default bridge addresses as host addresses (like "host-gateway", but |
| 585 | 585 |
// there's no way to tell wget to prefer ipv4/ipv6 transport, so just use the |
| 586 | 586 |
// addresses directly). |
| 587 |
- insp, err := c.NetworkInspect(ctx, "bridge", client.InspectOptions{})
|
|
| 587 |
+ insp, err := c.NetworkInspect(ctx, "bridge", client.NetworkInspectOptions{})
|
|
| 588 | 588 |
assert.NilError(t, err) |
| 589 | 589 |
for _, ipamCfg := range insp.IPAM.Config {
|
| 590 | 590 |
ipv := "ipv4" |
| ... | ... |
@@ -1821,7 +1821,7 @@ func TestNetworkInspectGateway(t *testing.T) {
|
| 1821 | 1821 |
assert.NilError(t, err) |
| 1822 | 1822 |
defer network.RemoveNoError(ctx, t, c, netName) |
| 1823 | 1823 |
|
| 1824 |
- insp, err := c.NetworkInspect(ctx, nid, client.InspectOptions{})
|
|
| 1824 |
+ insp, err := c.NetworkInspect(ctx, nid, client.NetworkInspectOptions{})
|
|
| 1825 | 1825 |
assert.NilError(t, err) |
| 1826 | 1826 |
for _, ipamCfg := range insp.IPAM.Config {
|
| 1827 | 1827 |
_, err := netip.ParseAddr(ipamCfg.Gateway) |
| ... | ... |
@@ -221,7 +221,7 @@ func TestServiceUpdateNetwork(t *testing.T) {
|
| 221 | 221 |
|
| 222 | 222 |
poll.WaitOn(t, swarm.RunningTasksCount(ctx, cli, serviceID, instances), swarm.ServicePoll) |
| 223 | 223 |
service := getService(ctx, t, cli, serviceID) |
| 224 |
- netInfo, err := cli.NetworkInspect(ctx, testNet, client.InspectOptions{
|
|
| 224 |
+ netInfo, err := cli.NetworkInspect(ctx, testNet, client.NetworkInspectOptions{
|
|
| 225 | 225 |
Verbose: true, |
| 226 | 226 |
Scope: "swarm", |
| 227 | 227 |
}) |
| ... | ... |
@@ -234,7 +234,7 @@ func TestServiceUpdateNetwork(t *testing.T) {
|
| 234 | 234 |
assert.NilError(t, err) |
| 235 | 235 |
poll.WaitOn(t, serviceIsUpdated(ctx, cli, serviceID), swarm.ServicePoll) |
| 236 | 236 |
|
| 237 |
- netInfo, err = cli.NetworkInspect(ctx, testNet, client.InspectOptions{
|
|
| 237 |
+ netInfo, err = cli.NetworkInspect(ctx, testNet, client.NetworkInspectOptions{
|
|
| 238 | 238 |
Verbose: true, |
| 239 | 239 |
Scope: "swarm", |
| 240 | 240 |
}) |
| ... | ... |
@@ -131,8 +131,8 @@ type NetworkAPIClient interface {
|
| 131 | 131 |
NetworkConnect(ctx context.Context, network, container string, config *network.EndpointSettings) error |
| 132 | 132 |
NetworkCreate(ctx context.Context, name string, options network.CreateOptions) (network.CreateResponse, error) |
| 133 | 133 |
NetworkDisconnect(ctx context.Context, network, container string, force bool) error |
| 134 |
- NetworkInspect(ctx context.Context, network string, options InspectOptions) (network.Inspect, error) |
|
| 135 |
- NetworkInspectWithRaw(ctx context.Context, network string, options InspectOptions) (network.Inspect, []byte, error) |
|
| 134 |
+ NetworkInspect(ctx context.Context, network string, options NetworkInspectOptions) (network.Inspect, error) |
|
| 135 |
+ NetworkInspectWithRaw(ctx context.Context, network string, options NetworkInspectOptions) (network.Inspect, []byte, error) |
|
| 136 | 136 |
NetworkList(ctx context.Context, options NetworkListOptions) ([]network.Summary, error) |
| 137 | 137 |
NetworkRemove(ctx context.Context, network string) error |
| 138 | 138 |
NetworksPrune(ctx context.Context, pruneFilter filters.Args) (network.PruneReport, error) |
| ... | ... |
@@ -11,13 +11,13 @@ import ( |
| 11 | 11 |
) |
| 12 | 12 |
|
| 13 | 13 |
// NetworkInspect returns the information for a specific network configured in the docker host. |
| 14 |
-func (cli *Client) NetworkInspect(ctx context.Context, networkID string, options InspectOptions) (network.Inspect, error) {
|
|
| 14 |
+func (cli *Client) NetworkInspect(ctx context.Context, networkID string, options NetworkInspectOptions) (network.Inspect, error) {
|
|
| 15 | 15 |
networkResource, _, err := cli.NetworkInspectWithRaw(ctx, networkID, options) |
| 16 | 16 |
return networkResource, err |
| 17 | 17 |
} |
| 18 | 18 |
|
| 19 | 19 |
// NetworkInspectWithRaw returns the information for a specific network configured in the docker host and its raw representation. |
| 20 |
-func (cli *Client) NetworkInspectWithRaw(ctx context.Context, networkID string, options InspectOptions) (network.Inspect, []byte, error) {
|
|
| 20 |
+func (cli *Client) NetworkInspectWithRaw(ctx context.Context, networkID string, options NetworkInspectOptions) (network.Inspect, []byte, error) {
|
|
| 21 | 21 |
networkID, err := trimID("network", networkID)
|
| 22 | 22 |
if err != nil {
|
| 23 | 23 |
return network.Inspect{}, nil, err
|