You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While the network Summary and Inspect types have been aliases in Go's
type system, in practice there is a difference: the Containers and
Services fields are only populated when inspecting a network. Split out
the common fields into a base network.Network struct which is embedded
in the network.Summary and network.Inspect types.
Signed-off-by: Cory Snider <csnider@mirantis.com>
Copy file name to clipboardExpand all lines: api/types/network/network.go
+24-20Lines changed: 24 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -38,32 +38,36 @@ type CreateRequest struct {
38
38
CheckDuplicate*bool`json:",omitempty"`
39
39
}
40
40
41
+
typeNetworkstruct {
42
+
Namestring// Name is the name of the network
43
+
IDstring`json:"Id"`// ID uniquely identifies a network on a single machine
44
+
Created time.Time// Created is the time the network created
45
+
Scopestring// Scope describes the level at which the network exists (e.g. `swarm` for cluster-wide or `local` for machine level)
46
+
Driverstring// Driver is the Driver name used to create the network (e.g. `bridge`, `overlay`)
47
+
EnableIPv4bool// EnableIPv4 represents whether IPv4 is enabled
48
+
EnableIPv6bool// EnableIPv6 represents whether IPv6 is enabled
49
+
IPAMIPAM// IPAM is the network's IP Address Management
50
+
Internalbool// Internal represents if the network is used internal only
51
+
Attachablebool// Attachable represents if the global scope is manually attachable by regular containers from workers in swarm mode.
52
+
Ingressbool// Ingress indicates the network is providing the routing-mesh for the swarm cluster.
53
+
ConfigFromConfigReference// ConfigFrom specifies the source which will provide the configuration for this network.
54
+
ConfigOnlybool// ConfigOnly networks are place-holder networks for network configurations to be used by other networks. ConfigOnly networks cannot be used directly to run containers or services.
55
+
Optionsmap[string]string// Options holds the network specific options to use for when creating the network
56
+
Labelsmap[string]string// Labels holds metadata specific to the network being created
57
+
Peers []PeerInfo`json:",omitempty"`// List of peer nodes for an overlay network
58
+
}
59
+
41
60
// Inspect is the body of the "get network" http response message.
42
61
typeInspectstruct {
43
-
Namestring// Name is the name of the network
44
-
IDstring`json:"Id"`// ID uniquely identifies a network on a single machine
45
-
Created time.Time// Created is the time the network created
46
-
Scopestring// Scope describes the level at which the network exists (e.g. `swarm` for cluster-wide or `local` for machine level)
47
-
Driverstring// Driver is the Driver name used to create the network (e.g. `bridge`, `overlay`)
48
-
EnableIPv4bool// EnableIPv4 represents whether IPv4 is enabled
49
-
EnableIPv6bool// EnableIPv6 represents whether IPv6 is enabled
50
-
IPAMIPAM// IPAM is the network's IP Address Management
51
-
Internalbool// Internal represents if the network is used internal only
52
-
Attachablebool// Attachable represents if the global scope is manually attachable by regular containers from workers in swarm mode.
53
-
Ingressbool// Ingress indicates the network is providing the routing-mesh for the swarm cluster.
54
-
ConfigFromConfigReference// ConfigFrom specifies the source which will provide the configuration for this network.
55
-
ConfigOnlybool// ConfigOnly networks are place-holder networks for network configurations to be used by other networks. ConfigOnly networks cannot be used directly to run containers or services.
62
+
Network
56
63
Containersmap[string]EndpointResource// Containers contains endpoints belonging to the network
57
-
Optionsmap[string]string// Options holds the network specific options to use for when creating the network
58
-
Labelsmap[string]string// Labels holds metadata specific to the network being created
59
-
Peers []PeerInfo`json:",omitempty"`// List of peer nodes for an overlay network
60
64
Servicesmap[string]ServiceInfo`json:",omitempty"`
61
65
}
62
66
63
-
// Summary is used as response when listing networks. It currently is an alias
64
-
// for [Inspect], but may diverge in the future, as not all information may
65
-
// be included when listing networks.
66
-
typeSummary=Inspect
67
+
// Summary is used as response when listing networks.
0 commit comments