mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
client: refactor InspectOptions to NetworkInspectOptions
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
This commit is contained in:
@@ -131,8 +131,8 @@ type NetworkAPIClient interface {
|
||||
NetworkConnect(ctx context.Context, network, container string, config *network.EndpointSettings) error
|
||||
NetworkCreate(ctx context.Context, name string, options network.CreateOptions) (network.CreateResponse, error)
|
||||
NetworkDisconnect(ctx context.Context, network, container string, force bool) error
|
||||
NetworkInspect(ctx context.Context, network string, options InspectOptions) (network.Inspect, error)
|
||||
NetworkInspectWithRaw(ctx context.Context, network string, options InspectOptions) (network.Inspect, []byte, error)
|
||||
NetworkInspect(ctx context.Context, network string, options NetworkInspectOptions) (network.Inspect, error)
|
||||
NetworkInspectWithRaw(ctx context.Context, network string, options NetworkInspectOptions) (network.Inspect, []byte, error)
|
||||
NetworkList(ctx context.Context, options NetworkListOptions) ([]network.Summary, error)
|
||||
NetworkRemove(ctx context.Context, network string) error
|
||||
NetworksPrune(ctx context.Context, pruneFilter filters.Args) (network.PruneReport, error)
|
||||
|
||||
@@ -11,13 +11,13 @@ import (
|
||||
)
|
||||
|
||||
// NetworkInspect returns the information for a specific network configured in the docker host.
|
||||
func (cli *Client) NetworkInspect(ctx context.Context, networkID string, options InspectOptions) (network.Inspect, error) {
|
||||
func (cli *Client) NetworkInspect(ctx context.Context, networkID string, options NetworkInspectOptions) (network.Inspect, error) {
|
||||
networkResource, _, err := cli.NetworkInspectWithRaw(ctx, networkID, options)
|
||||
return networkResource, err
|
||||
}
|
||||
|
||||
// NetworkInspectWithRaw returns the information for a specific network configured in the docker host and its raw representation.
|
||||
func (cli *Client) NetworkInspectWithRaw(ctx context.Context, networkID string, options InspectOptions) (network.Inspect, []byte, error) {
|
||||
func (cli *Client) NetworkInspectWithRaw(ctx context.Context, networkID string, options NetworkInspectOptions) (network.Inspect, []byte, error) {
|
||||
networkID, err := trimID("network", networkID)
|
||||
if err != nil {
|
||||
return network.Inspect{}, nil, err
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package client
|
||||
|
||||
// InspectOptions holds parameters to inspect network.
|
||||
type InspectOptions struct {
|
||||
// NetworkInspectOptions holds parameters to inspect network.
|
||||
type NetworkInspectOptions struct {
|
||||
Scope string
|
||||
Verbose bool
|
||||
}
|
||||
|
||||
@@ -68,39 +68,39 @@ func TestNetworkInspect(t *testing.T) {
|
||||
|
||||
t.Run("empty ID", func(t *testing.T) {
|
||||
// verify that the client does not create a request if the network-ID/name is empty.
|
||||
_, err := client.NetworkInspect(context.Background(), "", InspectOptions{})
|
||||
_, err := client.NetworkInspect(context.Background(), "", NetworkInspectOptions{})
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
|
||||
assert.Check(t, is.ErrorContains(err, "value is empty"))
|
||||
|
||||
_, err = client.NetworkInspect(context.Background(), " ", InspectOptions{})
|
||||
_, err = client.NetworkInspect(context.Background(), " ", NetworkInspectOptions{})
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
|
||||
assert.Check(t, is.ErrorContains(err, "value is empty"))
|
||||
})
|
||||
t.Run("no options", func(t *testing.T) {
|
||||
r, err := client.NetworkInspect(context.Background(), "network_id", InspectOptions{})
|
||||
r, err := client.NetworkInspect(context.Background(), "network_id", NetworkInspectOptions{})
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.Equal(r.Name, "mynetwork"))
|
||||
})
|
||||
t.Run("verbose", func(t *testing.T) {
|
||||
r, err := client.NetworkInspect(context.Background(), "network_id", InspectOptions{Verbose: true})
|
||||
r, err := client.NetworkInspect(context.Background(), "network_id", NetworkInspectOptions{Verbose: true})
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.Equal(r.Name, "mynetwork"))
|
||||
_, ok := r.Services["web"]
|
||||
assert.Check(t, ok, "expected service `web` missing in the verbose output")
|
||||
})
|
||||
t.Run("global scope", func(t *testing.T) {
|
||||
_, err := client.NetworkInspect(context.Background(), "network_id", InspectOptions{Scope: "global"})
|
||||
_, err := client.NetworkInspect(context.Background(), "network_id", NetworkInspectOptions{Scope: "global"})
|
||||
assert.Check(t, is.ErrorContains(err, "Error: No such network: network_id"))
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
|
||||
})
|
||||
t.Run("unknown network", func(t *testing.T) {
|
||||
_, err := client.NetworkInspect(context.Background(), "unknown", InspectOptions{})
|
||||
_, err := client.NetworkInspect(context.Background(), "unknown", NetworkInspectOptions{})
|
||||
assert.Check(t, is.ErrorContains(err, "Error: No such network: unknown"))
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsNotFound))
|
||||
})
|
||||
t.Run("server error", func(t *testing.T) {
|
||||
// Just testing that an internal server error is converted correctly by the client
|
||||
_, err := client.NetworkInspect(context.Background(), "test-500-response", InspectOptions{})
|
||||
_, err := client.NetworkInspect(context.Background(), "test-500-response", NetworkInspectOptions{})
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1026,11 +1026,11 @@ func (s *DockerSwarmSuite) TestAPINetworkInspectWithScope(c *testing.T) {
|
||||
resp, err := apiclient.NetworkCreate(ctx, name, network.CreateOptions{Driver: "overlay"})
|
||||
assert.NilError(c, err)
|
||||
|
||||
nw, err := apiclient.NetworkInspect(ctx, name, client.InspectOptions{})
|
||||
nw, err := apiclient.NetworkInspect(ctx, name, client.NetworkInspectOptions{})
|
||||
assert.NilError(c, err)
|
||||
assert.Check(c, is.Equal("swarm", nw.Scope))
|
||||
assert.Check(c, is.Equal(resp.ID, nw.ID))
|
||||
|
||||
_, err = apiclient.NetworkInspect(ctx, name, client.InspectOptions{Scope: "local"})
|
||||
_, err = apiclient.NetworkInspect(ctx, name, client.NetworkInspectOptions{Scope: "local"})
|
||||
assert.Check(c, is.ErrorType(err, cerrdefs.IsNotFound))
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ func TestDaemonHostGatewayIP(t *testing.T) {
|
||||
assert.NilError(t, err)
|
||||
assert.Assert(t, is.Len(res.Stderr(), 0))
|
||||
assert.Equal(t, 0, res.ExitCode)
|
||||
inspect, err := c.NetworkInspect(ctx, "bridge", client.InspectOptions{})
|
||||
inspect, err := c.NetworkInspect(ctx, "bridge", client.NetworkInspectOptions{})
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.Contains(res.Stdout(), inspect.IPAM.Config[0].Gateway))
|
||||
c.ContainerRemove(ctx, cID, containertypes.RemoveOptions{Force: true})
|
||||
|
||||
@@ -419,7 +419,7 @@ func testDefaultBridgeIPAM(ctx context.Context, t *testing.T, tc defaultBridgeIP
|
||||
c := d.NewClientT(t)
|
||||
defer c.Close()
|
||||
|
||||
insp, err := c.NetworkInspect(ctx, network.NetworkBridge, client.InspectOptions{})
|
||||
insp, err := c.NetworkInspect(ctx, network.NetworkBridge, client.NetworkInspectOptions{})
|
||||
assert.NilError(t, err)
|
||||
expIPAMConfig := slices.Clone(tc.expIPAMConfig)
|
||||
for i := range expIPAMConfig {
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
// IsRemoved verifies the network is removed.
|
||||
func IsRemoved(ctx context.Context, apiClient client.NetworkAPIClient, networkID string) func(log poll.LogT) poll.Result {
|
||||
return func(log poll.LogT) poll.Result {
|
||||
_, err := apiClient.NetworkInspect(ctx, networkID, client.InspectOptions{})
|
||||
_, err := apiClient.NetworkInspect(ctx, networkID, client.NetworkInspectOptions{})
|
||||
if err == nil {
|
||||
return poll.Continue("waiting for network %s to be removed", networkID)
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ func TestCreateWithIPv6DefaultsToULAPrefix(t *testing.T) {
|
||||
network.CreateNoError(ctx, t, apiClient, nwName, network.WithIPv6())
|
||||
defer network.RemoveNoError(ctx, t, apiClient, nwName)
|
||||
|
||||
nw, err := apiClient.NetworkInspect(ctx, "testnetula", client.InspectOptions{})
|
||||
nw, err := apiClient.NetworkInspect(ctx, "testnetula", client.NetworkInspectOptions{})
|
||||
assert.NilError(t, err)
|
||||
|
||||
for _, ipam := range nw.IPAM.Config {
|
||||
@@ -92,7 +92,7 @@ func TestCreateWithIPv6WithoutEnableIPv6Flag(t *testing.T) {
|
||||
network.CreateNoError(ctx, t, apiClient, nwName)
|
||||
defer network.RemoveNoError(ctx, t, apiClient, nwName)
|
||||
|
||||
nw, err := apiClient.NetworkInspect(ctx, "testnetula", client.InspectOptions{})
|
||||
nw, err := apiClient.NetworkInspect(ctx, "testnetula", client.NetworkInspectOptions{})
|
||||
assert.NilError(t, err)
|
||||
|
||||
for _, ipam := range nw.IPAM.Config {
|
||||
@@ -137,7 +137,7 @@ func TestDefaultIPvOptOverride(t *testing.T) {
|
||||
network.CreateNoError(ctx, t, c, netName, nopts...)
|
||||
defer network.RemoveNoError(ctx, t, c, netName)
|
||||
|
||||
insp, err := c.NetworkInspect(ctx, netName, client.InspectOptions{})
|
||||
insp, err := c.NetworkInspect(ctx, netName, client.NetworkInspectOptions{})
|
||||
assert.NilError(t, err)
|
||||
t.Log("override4", override4, "override6", override6, "->", insp.Options)
|
||||
|
||||
|
||||
@@ -41,33 +41,33 @@ func TestInspectNetwork(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
network string
|
||||
opts client.InspectOptions
|
||||
opts client.NetworkInspectOptions
|
||||
}{
|
||||
{
|
||||
name: "full network id",
|
||||
network: overlayID,
|
||||
opts: client.InspectOptions{
|
||||
opts: client.NetworkInspectOptions{
|
||||
Verbose: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "partial network id",
|
||||
network: overlayID[0:11],
|
||||
opts: client.InspectOptions{
|
||||
opts: client.NetworkInspectOptions{
|
||||
Verbose: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "network name",
|
||||
network: networkName,
|
||||
opts: client.InspectOptions{
|
||||
opts: client.NetworkInspectOptions{
|
||||
Verbose: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "network name and swarm scope",
|
||||
network: networkName,
|
||||
opts: client.InspectOptions{
|
||||
opts: client.NetworkInspectOptions{
|
||||
Verbose: true,
|
||||
Scope: "swarm",
|
||||
},
|
||||
|
||||
@@ -89,7 +89,7 @@ func TestHostIPv4BridgeLabel(t *testing.T) {
|
||||
network.WithOption("com.docker.network.bridge.name", bridgeName),
|
||||
)
|
||||
defer network.RemoveNoError(ctx, t, c, bridgeName)
|
||||
out, err := c.NetworkInspect(ctx, bridgeName, client.InspectOptions{Verbose: true})
|
||||
out, err := c.NetworkInspect(ctx, bridgeName, client.NetworkInspectOptions{Verbose: true})
|
||||
assert.NilError(t, err)
|
||||
assert.Assert(t, len(out.IPAM.Config) > 0)
|
||||
// Make sure the SNAT rule exists
|
||||
|
||||
@@ -45,7 +45,7 @@ func TestDaemonRestartWithLiveRestore(t *testing.T) {
|
||||
defer c.Close()
|
||||
|
||||
// Verify bridge network's subnet
|
||||
out, err := c.NetworkInspect(ctx, "bridge", client.InspectOptions{})
|
||||
out, err := c.NetworkInspect(ctx, "bridge", client.NetworkInspectOptions{})
|
||||
assert.NilError(t, err)
|
||||
subnet := out.IPAM.Config[0].Subnet
|
||||
|
||||
@@ -55,7 +55,7 @@ func TestDaemonRestartWithLiveRestore(t *testing.T) {
|
||||
"--default-address-pool", "base=175.33.0.0/16,size=24",
|
||||
)
|
||||
|
||||
out1, err := c.NetworkInspect(ctx, "bridge", client.InspectOptions{})
|
||||
out1, err := c.NetworkInspect(ctx, "bridge", client.NetworkInspectOptions{})
|
||||
assert.NilError(t, err)
|
||||
// Make sure docker0 doesn't get override with new IP in live restore case
|
||||
assert.Equal(t, out1.IPAM.Config[0].Subnet, subnet)
|
||||
@@ -82,7 +82,7 @@ func TestDaemonDefaultNetworkPools(t *testing.T) {
|
||||
defer c.Close()
|
||||
|
||||
// Verify bridge network's subnet
|
||||
out, err := c.NetworkInspect(ctx, "bridge", client.InspectOptions{})
|
||||
out, err := c.NetworkInspect(ctx, "bridge", client.NetworkInspectOptions{})
|
||||
assert.NilError(t, err)
|
||||
assert.Equal(t, out.IPAM.Config[0].Subnet, "175.30.0.0/16")
|
||||
|
||||
@@ -92,7 +92,7 @@ func TestDaemonDefaultNetworkPools(t *testing.T) {
|
||||
network.WithDriver("bridge"),
|
||||
)
|
||||
defer network.RemoveNoError(ctx, t, c, name)
|
||||
out, err = c.NetworkInspect(ctx, name, client.InspectOptions{})
|
||||
out, err = c.NetworkInspect(ctx, name, client.NetworkInspectOptions{})
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.Equal(out.IPAM.Config[0].Subnet, "175.33.0.0/24"))
|
||||
|
||||
@@ -102,7 +102,7 @@ func TestDaemonDefaultNetworkPools(t *testing.T) {
|
||||
network.WithDriver("bridge"),
|
||||
)
|
||||
defer network.RemoveNoError(ctx, t, c, name)
|
||||
out, err = c.NetworkInspect(ctx, name, client.InspectOptions{})
|
||||
out, err = c.NetworkInspect(ctx, name, client.NetworkInspectOptions{})
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.Equal(out.IPAM.Config[0].Subnet, "175.33.1.0/24"))
|
||||
}
|
||||
@@ -127,7 +127,7 @@ func TestDaemonRestartWithExistingNetwork(t *testing.T) {
|
||||
defer network.RemoveNoError(ctx, t, c, name)
|
||||
|
||||
// Verify bridge network's subnet
|
||||
out, err := c.NetworkInspect(ctx, name, client.InspectOptions{})
|
||||
out, err := c.NetworkInspect(ctx, name, client.NetworkInspectOptions{})
|
||||
assert.NilError(t, err)
|
||||
networkip := out.IPAM.Config[0].Subnet
|
||||
|
||||
@@ -137,7 +137,7 @@ func TestDaemonRestartWithExistingNetwork(t *testing.T) {
|
||||
"--default-address-pool", "base=175.33.0.0/16,size=24")
|
||||
defer delInterface(ctx, t, "docker0")
|
||||
|
||||
out1, err := c.NetworkInspect(ctx, name, client.InspectOptions{})
|
||||
out1, err := c.NetworkInspect(ctx, name, client.NetworkInspectOptions{})
|
||||
assert.NilError(t, err)
|
||||
assert.Equal(t, out1.IPAM.Config[0].Subnet, networkip)
|
||||
}
|
||||
@@ -163,7 +163,7 @@ func TestDaemonRestartWithExistingNetworkWithDefaultPoolRange(t *testing.T) {
|
||||
defer network.RemoveNoError(ctx, t, c, name)
|
||||
|
||||
// Verify bridge network's subnet
|
||||
out, err := c.NetworkInspect(ctx, name, client.InspectOptions{})
|
||||
out, err := c.NetworkInspect(ctx, name, client.NetworkInspectOptions{})
|
||||
assert.NilError(t, err)
|
||||
networkip := out.IPAM.Config[0].Subnet
|
||||
|
||||
@@ -173,7 +173,7 @@ func TestDaemonRestartWithExistingNetworkWithDefaultPoolRange(t *testing.T) {
|
||||
network.WithDriver("bridge"),
|
||||
)
|
||||
defer network.RemoveNoError(ctx, t, c, name)
|
||||
out, err = c.NetworkInspect(ctx, name, client.InspectOptions{})
|
||||
out, err = c.NetworkInspect(ctx, name, client.NetworkInspectOptions{})
|
||||
assert.NilError(t, err)
|
||||
networkip2 := out.IPAM.Config[0].Subnet
|
||||
|
||||
@@ -190,7 +190,7 @@ func TestDaemonRestartWithExistingNetworkWithDefaultPoolRange(t *testing.T) {
|
||||
network.WithDriver("bridge"),
|
||||
)
|
||||
defer network.RemoveNoError(ctx, t, c, name)
|
||||
out1, err := c.NetworkInspect(ctx, name, client.InspectOptions{})
|
||||
out1, err := c.NetworkInspect(ctx, name, client.NetworkInspectOptions{})
|
||||
assert.NilError(t, err)
|
||||
|
||||
assert.Check(t, out1.IPAM.Config[0].Subnet != networkip)
|
||||
@@ -217,7 +217,7 @@ func TestDaemonWithBipAndDefaultNetworkPool(t *testing.T) {
|
||||
defer c.Close()
|
||||
|
||||
// Verify bridge network's subnet
|
||||
out, err := c.NetworkInspect(ctx, "bridge", client.InspectOptions{})
|
||||
out, err := c.NetworkInspect(ctx, "bridge", client.NetworkInspectOptions{})
|
||||
assert.NilError(t, err)
|
||||
// Make sure BIP IP doesn't get override with new default address pool .
|
||||
assert.Equal(t, out.IPAM.Config[0].Subnet, "172.60.0.0/16")
|
||||
@@ -297,7 +297,7 @@ func TestServiceRemoveKeepsIngressNetwork(t *testing.T) {
|
||||
|
||||
// Ensure that "ingress" is not removed or corrupted
|
||||
time.Sleep(10 * time.Second)
|
||||
netInfo, err := c.NetworkInspect(ctx, ingressNet, client.InspectOptions{
|
||||
netInfo, err := c.NetworkInspect(ctx, ingressNet, client.NetworkInspectOptions{
|
||||
Verbose: true,
|
||||
Scope: "swarm",
|
||||
})
|
||||
@@ -311,7 +311,7 @@ func TestServiceRemoveKeepsIngressNetwork(t *testing.T) {
|
||||
//nolint:unused // for some reason, the "unused" linter marks this function as "unused"
|
||||
func swarmIngressReady(ctx context.Context, apiClient client.NetworkAPIClient) func(log poll.LogT) poll.Result {
|
||||
return func(log poll.LogT) poll.Result {
|
||||
netInfo, err := apiClient.NetworkInspect(ctx, ingressNet, client.InspectOptions{
|
||||
netInfo, err := apiClient.NetworkInspect(ctx, ingressNet, client.NetworkInspectOptions{
|
||||
Verbose: true,
|
||||
Scope: "swarm",
|
||||
})
|
||||
@@ -443,7 +443,7 @@ func TestServiceWithDefaultAddressPoolInit(t *testing.T) {
|
||||
_, _, err := cli.ServiceInspectWithRaw(ctx, serviceID, swarmtypes.ServiceInspectOptions{})
|
||||
assert.NilError(t, err)
|
||||
|
||||
out, err := cli.NetworkInspect(ctx, overlayID, client.InspectOptions{Verbose: true})
|
||||
out, err := cli.NetworkInspect(ctx, overlayID, client.NetworkInspectOptions{Verbose: true})
|
||||
assert.NilError(t, err)
|
||||
t.Logf("%s: NetworkInspect: %+v", t.Name(), out)
|
||||
assert.Assert(t, len(out.IPAM.Config) > 0)
|
||||
@@ -454,7 +454,7 @@ func TestServiceWithDefaultAddressPoolInit(t *testing.T) {
|
||||
assert.Equal(t, out.IPAM.Config[0].Subnet, "20.20.1.0/24")
|
||||
|
||||
// Also inspect ingress network and make sure its in the same subnet
|
||||
out, err = cli.NetworkInspect(ctx, "ingress", client.InspectOptions{Verbose: true})
|
||||
out, err = cli.NetworkInspect(ctx, "ingress", client.NetworkInspectOptions{Verbose: true})
|
||||
assert.NilError(t, err)
|
||||
assert.Assert(t, len(out.IPAM.Config) > 0)
|
||||
assert.Equal(t, out.IPAM.Config[0].Subnet, "20.20.0.0/24")
|
||||
|
||||
@@ -584,7 +584,7 @@ func TestAccessToPublishedPort(t *testing.T) {
|
||||
// Use the default bridge addresses as host addresses (like "host-gateway", but
|
||||
// there's no way to tell wget to prefer ipv4/ipv6 transport, so just use the
|
||||
// addresses directly).
|
||||
insp, err := c.NetworkInspect(ctx, "bridge", client.InspectOptions{})
|
||||
insp, err := c.NetworkInspect(ctx, "bridge", client.NetworkInspectOptions{})
|
||||
assert.NilError(t, err)
|
||||
for _, ipamCfg := range insp.IPAM.Config {
|
||||
ipv := "ipv4"
|
||||
@@ -1821,7 +1821,7 @@ func TestNetworkInspectGateway(t *testing.T) {
|
||||
assert.NilError(t, err)
|
||||
defer network.RemoveNoError(ctx, t, c, netName)
|
||||
|
||||
insp, err := c.NetworkInspect(ctx, nid, client.InspectOptions{})
|
||||
insp, err := c.NetworkInspect(ctx, nid, client.NetworkInspectOptions{})
|
||||
assert.NilError(t, err)
|
||||
for _, ipamCfg := range insp.IPAM.Config {
|
||||
_, err := netip.ParseAddr(ipamCfg.Gateway)
|
||||
|
||||
@@ -221,7 +221,7 @@ func TestServiceUpdateNetwork(t *testing.T) {
|
||||
|
||||
poll.WaitOn(t, swarm.RunningTasksCount(ctx, cli, serviceID, instances), swarm.ServicePoll)
|
||||
service := getService(ctx, t, cli, serviceID)
|
||||
netInfo, err := cli.NetworkInspect(ctx, testNet, client.InspectOptions{
|
||||
netInfo, err := cli.NetworkInspect(ctx, testNet, client.NetworkInspectOptions{
|
||||
Verbose: true,
|
||||
Scope: "swarm",
|
||||
})
|
||||
@@ -234,7 +234,7 @@ func TestServiceUpdateNetwork(t *testing.T) {
|
||||
assert.NilError(t, err)
|
||||
poll.WaitOn(t, serviceIsUpdated(ctx, cli, serviceID), swarm.ServicePoll)
|
||||
|
||||
netInfo, err = cli.NetworkInspect(ctx, testNet, client.InspectOptions{
|
||||
netInfo, err = cli.NetworkInspect(ctx, testNet, client.NetworkInspectOptions{
|
||||
Verbose: true,
|
||||
Scope: "swarm",
|
||||
})
|
||||
|
||||
4
vendor/github.com/moby/moby/client/client_interfaces.go
generated
vendored
4
vendor/github.com/moby/moby/client/client_interfaces.go
generated
vendored
@@ -131,8 +131,8 @@ type NetworkAPIClient interface {
|
||||
NetworkConnect(ctx context.Context, network, container string, config *network.EndpointSettings) error
|
||||
NetworkCreate(ctx context.Context, name string, options network.CreateOptions) (network.CreateResponse, error)
|
||||
NetworkDisconnect(ctx context.Context, network, container string, force bool) error
|
||||
NetworkInspect(ctx context.Context, network string, options InspectOptions) (network.Inspect, error)
|
||||
NetworkInspectWithRaw(ctx context.Context, network string, options InspectOptions) (network.Inspect, []byte, error)
|
||||
NetworkInspect(ctx context.Context, network string, options NetworkInspectOptions) (network.Inspect, error)
|
||||
NetworkInspectWithRaw(ctx context.Context, network string, options NetworkInspectOptions) (network.Inspect, []byte, error)
|
||||
NetworkList(ctx context.Context, options NetworkListOptions) ([]network.Summary, error)
|
||||
NetworkRemove(ctx context.Context, network string) error
|
||||
NetworksPrune(ctx context.Context, pruneFilter filters.Args) (network.PruneReport, error)
|
||||
|
||||
4
vendor/github.com/moby/moby/client/network_inspect.go
generated
vendored
4
vendor/github.com/moby/moby/client/network_inspect.go
generated
vendored
@@ -11,13 +11,13 @@ import (
|
||||
)
|
||||
|
||||
// NetworkInspect returns the information for a specific network configured in the docker host.
|
||||
func (cli *Client) NetworkInspect(ctx context.Context, networkID string, options InspectOptions) (network.Inspect, error) {
|
||||
func (cli *Client) NetworkInspect(ctx context.Context, networkID string, options NetworkInspectOptions) (network.Inspect, error) {
|
||||
networkResource, _, err := cli.NetworkInspectWithRaw(ctx, networkID, options)
|
||||
return networkResource, err
|
||||
}
|
||||
|
||||
// NetworkInspectWithRaw returns the information for a specific network configured in the docker host and its raw representation.
|
||||
func (cli *Client) NetworkInspectWithRaw(ctx context.Context, networkID string, options InspectOptions) (network.Inspect, []byte, error) {
|
||||
func (cli *Client) NetworkInspectWithRaw(ctx context.Context, networkID string, options NetworkInspectOptions) (network.Inspect, []byte, error) {
|
||||
networkID, err := trimID("network", networkID)
|
||||
if err != nil {
|
||||
return network.Inspect{}, nil, err
|
||||
|
||||
4
vendor/github.com/moby/moby/client/network_inspect_opts.go
generated
vendored
4
vendor/github.com/moby/moby/client/network_inspect_opts.go
generated
vendored
@@ -1,7 +1,7 @@
|
||||
package client
|
||||
|
||||
// InspectOptions holds parameters to inspect network.
|
||||
type InspectOptions struct {
|
||||
// NetworkInspectOptions holds parameters to inspect network.
|
||||
type NetworkInspectOptions struct {
|
||||
Scope string
|
||||
Verbose bool
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user