Replace the hand-rolled Network, Summary and Inspect struct types in
api/types/network with types generated from the Swagger definition.
Disable the generation of all unwanted marshalers and unmarshalers.
Signed-off-by: Cory Snider <csnider@mirantis.com>
| ... | ... |
@@ -2439,10 +2439,13 @@ definitions: |
| 2439 | 2439 |
Name of the network. |
| 2440 | 2440 |
type: "string" |
| 2441 | 2441 |
example: "my_network" |
| 2442 |
+ x-omitempty: false |
|
| 2442 | 2443 |
Id: |
| 2443 | 2444 |
description: | |
| 2444 | 2445 |
ID that uniquely identifies a network on a single machine. |
| 2445 | 2446 |
type: "string" |
| 2447 |
+ x-go-name: "ID" |
|
| 2448 |
+ x-omitempty: false |
|
| 2446 | 2449 |
example: "7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99" |
| 2447 | 2450 |
Created: |
| 2448 | 2451 |
description: | |
| ... | ... |
@@ -2450,36 +2453,53 @@ definitions: |
| 2450 | 2450 |
[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. |
| 2451 | 2451 |
type: "string" |
| 2452 | 2452 |
format: "dateTime" |
| 2453 |
+ x-omitempty: false |
|
| 2454 |
+ x-go-type: |
|
| 2455 |
+ type: Time |
|
| 2456 |
+ import: |
|
| 2457 |
+ package: time |
|
| 2458 |
+ hints: |
|
| 2459 |
+ nullable: false |
|
| 2453 | 2460 |
example: "2016-10-19T04:33:30.360899459Z" |
| 2454 | 2461 |
Scope: |
| 2455 | 2462 |
description: | |
| 2456 | 2463 |
The level at which the network exists (e.g. `swarm` for cluster-wide |
| 2457 | 2464 |
or `local` for machine level) |
| 2458 | 2465 |
type: "string" |
| 2466 |
+ x-omitempty: false |
|
| 2459 | 2467 |
example: "local" |
| 2460 | 2468 |
Driver: |
| 2461 | 2469 |
description: | |
| 2462 | 2470 |
The name of the driver used to create the network (e.g. `bridge`, |
| 2463 | 2471 |
`overlay`). |
| 2464 | 2472 |
type: "string" |
| 2473 |
+ x-omitempty: false |
|
| 2465 | 2474 |
example: "overlay" |
| 2466 | 2475 |
EnableIPv4: |
| 2467 | 2476 |
description: | |
| 2468 | 2477 |
Whether the network was created with IPv4 enabled. |
| 2469 | 2478 |
type: "boolean" |
| 2479 |
+ x-omitempty: false |
|
| 2470 | 2480 |
example: true |
| 2471 | 2481 |
EnableIPv6: |
| 2472 | 2482 |
description: | |
| 2473 | 2483 |
Whether the network was created with IPv6 enabled. |
| 2474 | 2484 |
type: "boolean" |
| 2485 |
+ x-omitempty: false |
|
| 2475 | 2486 |
example: false |
| 2476 | 2487 |
IPAM: |
| 2488 |
+ description: | |
|
| 2489 |
+ The network's IP Address Management. |
|
| 2477 | 2490 |
$ref: "#/definitions/IPAM" |
| 2491 |
+ x-nullable: false |
|
| 2492 |
+ x-omitempty: false |
|
| 2478 | 2493 |
Internal: |
| 2479 | 2494 |
description: | |
| 2480 | 2495 |
Whether the network is created to only allow internal networking |
| 2481 | 2496 |
connectivity. |
| 2482 | 2497 |
type: "boolean" |
| 2498 |
+ x-nullable: false |
|
| 2499 |
+ x-omitempty: false |
|
| 2483 | 2500 |
default: false |
| 2484 | 2501 |
example: false |
| 2485 | 2502 |
Attachable: |
| ... | ... |
@@ -2487,16 +2507,22 @@ definitions: |
| 2487 | 2487 |
Whether a global / swarm scope network is manually attachable by regular |
| 2488 | 2488 |
containers from workers in swarm mode. |
| 2489 | 2489 |
type: "boolean" |
| 2490 |
+ x-nullable: false |
|
| 2491 |
+ x-omitempty: false |
|
| 2490 | 2492 |
default: false |
| 2491 | 2493 |
example: false |
| 2492 | 2494 |
Ingress: |
| 2493 | 2495 |
description: | |
| 2494 | 2496 |
Whether the network is providing the routing-mesh for the swarm cluster. |
| 2495 | 2497 |
type: "boolean" |
| 2498 |
+ x-nullable: false |
|
| 2499 |
+ x-omitempty: false |
|
| 2496 | 2500 |
default: false |
| 2497 | 2501 |
example: false |
| 2498 | 2502 |
ConfigFrom: |
| 2499 | 2503 |
$ref: "#/definitions/ConfigReference" |
| 2504 |
+ x-nullable: false |
|
| 2505 |
+ x-omitempty: false |
|
| 2500 | 2506 |
ConfigOnly: |
| 2501 | 2507 |
description: | |
| 2502 | 2508 |
Whether the network is a config-only network. Config-only networks are |
| ... | ... |
@@ -2504,24 +2530,14 @@ definitions: |
| 2504 | 2504 |
networks. Config-only networks cannot be used directly to run containers |
| 2505 | 2505 |
or services. |
| 2506 | 2506 |
type: "boolean" |
| 2507 |
+ x-omitempty: false |
|
| 2508 |
+ x-nullable: false |
|
| 2507 | 2509 |
default: false |
| 2508 |
- Containers: |
|
| 2509 |
- description: | |
|
| 2510 |
- Contains endpoints attached to the network. |
|
| 2511 |
- type: "object" |
|
| 2512 |
- additionalProperties: |
|
| 2513 |
- $ref: "#/definitions/NetworkContainer" |
|
| 2514 |
- example: |
|
| 2515 |
- 19a4d5d687db25203351ed79d478946f861258f018fe384f229f2efa4b23513c: |
|
| 2516 |
- Name: "test" |
|
| 2517 |
- EndpointID: "628cadb8bcb92de107b2a1e516cbffe463e321f548feb37697cce00ad694f21a" |
|
| 2518 |
- MacAddress: "02:42:ac:13:00:02" |
|
| 2519 |
- IPv4Address: "172.19.0.2/16" |
|
| 2520 |
- IPv6Address: "" |
|
| 2521 | 2510 |
Options: |
| 2522 | 2511 |
description: | |
| 2523 | 2512 |
Network-specific options uses when creating the network. |
| 2524 | 2513 |
type: "object" |
| 2514 |
+ x-omitempty: false |
|
| 2525 | 2515 |
additionalProperties: |
| 2526 | 2516 |
type: "string" |
| 2527 | 2517 |
example: |
| ... | ... |
@@ -2532,8 +2548,10 @@ definitions: |
| 2532 | 2532 |
com.docker.network.bridge.name: "docker0" |
| 2533 | 2533 |
com.docker.network.driver.mtu: "1500" |
| 2534 | 2534 |
Labels: |
| 2535 |
- description: "User-defined key/value metadata." |
|
| 2535 |
+ description: | |
|
| 2536 |
+ Metadata specific to the network being created. |
|
| 2536 | 2537 |
type: "object" |
| 2538 |
+ x-omitempty: false |
|
| 2537 | 2539 |
additionalProperties: |
| 2538 | 2540 |
type: "string" |
| 2539 | 2541 |
example: |
| ... | ... |
@@ -2544,12 +2562,53 @@ definitions: |
| 2544 | 2544 |
List of peer nodes for an overlay network. This field is only present |
| 2545 | 2545 |
for overlay networks, and omitted for other network types. |
| 2546 | 2546 |
type: "array" |
| 2547 |
+ x-omitempty: true |
|
| 2547 | 2548 |
items: |
| 2548 | 2549 |
$ref: "#/definitions/PeerInfo" |
| 2549 |
- x-nullable: true |
|
| 2550 |
- # TODO: Add Services (only present when "verbose" is set). |
|
| 2550 |
+ |
|
| 2551 |
+ NetworkSummary: |
|
| 2552 |
+ description: "Network list response item" |
|
| 2553 |
+ x-go-name: Summary |
|
| 2554 |
+ type: "object" |
|
| 2555 |
+ allOf: |
|
| 2556 |
+ - $ref: "#/definitions/Network" |
|
| 2557 |
+ |
|
| 2558 |
+ NetworkInspect: |
|
| 2559 |
+ description: 'The body of the "get network" http response message.' |
|
| 2560 |
+ x-go-name: Inspect |
|
| 2561 |
+ type: "object" |
|
| 2562 |
+ allOf: |
|
| 2563 |
+ - $ref: "#/definitions/Network" |
|
| 2564 |
+ properties: |
|
| 2565 |
+ Containers: |
|
| 2566 |
+ description: | |
|
| 2567 |
+ Contains endpoints attached to the network. |
|
| 2568 |
+ type: "object" |
|
| 2569 |
+ x-omitempty: false |
|
| 2570 |
+ additionalProperties: |
|
| 2571 |
+ $ref: "#/definitions/EndpointResource" |
|
| 2572 |
+ example: |
|
| 2573 |
+ 19a4d5d687db25203351ed79d478946f861258f018fe384f229f2efa4b23513c: |
|
| 2574 |
+ Name: "test" |
|
| 2575 |
+ EndpointID: "628cadb8bcb92de107b2a1e516cbffe463e321f548feb37697cce00ad694f21a" |
|
| 2576 |
+ MacAddress: "02:42:ac:13:00:02" |
|
| 2577 |
+ IPv4Address: "172.19.0.2/16" |
|
| 2578 |
+ IPv6Address: "" |
|
| 2579 |
+ Services: |
|
| 2580 |
+ description: | |
|
| 2581 |
+ List of services using the network. This field is only present for |
|
| 2582 |
+ swarm scope networks, and omitted for local scope networks. |
|
| 2583 |
+ type: "object" |
|
| 2584 |
+ x-omitempty: true |
|
| 2585 |
+ additionalProperties: |
|
| 2586 |
+ x-go-type: |
|
| 2587 |
+ type: ServiceInfo |
|
| 2588 |
+ hints: |
|
| 2589 |
+ nullable: false |
|
| 2551 | 2590 |
|
| 2552 | 2591 |
ConfigReference: |
| 2592 |
+ x-nullable: false |
|
| 2593 |
+ x-omitempty: false |
|
| 2553 | 2594 |
description: | |
| 2554 | 2595 |
The config-only network source to provide the configuration for |
| 2555 | 2596 |
this network. |
| ... | ... |
@@ -2565,6 +2624,8 @@ definitions: |
| 2565 | 2565 |
|
| 2566 | 2566 |
IPAM: |
| 2567 | 2567 |
type: "object" |
| 2568 |
+ x-nullable: false |
|
| 2569 |
+ x-omitempty: false |
|
| 2568 | 2570 |
properties: |
| 2569 | 2571 |
Driver: |
| 2570 | 2572 |
description: "Name of the IPAM driver to use." |
| ... | ... |
@@ -2606,7 +2667,7 @@ definitions: |
| 2606 | 2606 |
additionalProperties: |
| 2607 | 2607 |
type: "string" |
| 2608 | 2608 |
|
| 2609 |
- NetworkContainer: |
|
| 2609 |
+ EndpointResource: |
|
| 2610 | 2610 |
type: "object" |
| 2611 | 2611 |
properties: |
| 2612 | 2612 |
Name: |
| ... | ... |
@@ -2629,6 +2690,7 @@ definitions: |
| 2629 | 2629 |
description: | |
| 2630 | 2630 |
PeerInfo represents one peer of an overlay network. |
| 2631 | 2631 |
type: "object" |
| 2632 |
+ x-nullable: false |
|
| 2632 | 2633 |
properties: |
| 2633 | 2634 |
Name: |
| 2634 | 2635 |
description: |
| ... | ... |
@@ -11036,7 +11098,7 @@ paths: |
| 11036 | 11036 |
schema: |
| 11037 | 11037 |
type: "array" |
| 11038 | 11038 |
items: |
| 11039 |
- $ref: "#/definitions/Network" |
|
| 11039 |
+ $ref: "#/definitions/NetworkSummary" |
|
| 11040 | 11040 |
examples: |
| 11041 | 11041 |
application/json: |
| 11042 | 11042 |
- Name: "bridge" |
| ... | ... |
@@ -11127,7 +11189,7 @@ paths: |
| 11127 | 11127 |
200: |
| 11128 | 11128 |
description: "No error" |
| 11129 | 11129 |
schema: |
| 11130 |
- $ref: "#/definitions/Network" |
|
| 11130 |
+ $ref: "#/definitions/NetworkInspect" |
|
| 11131 | 11131 |
404: |
| 11132 | 11132 |
description: "Network not found" |
| 11133 | 11133 |
schema: |
| ... | ... |
@@ -74,7 +74,7 @@ |
| 74 | 74 |
{{- end }}
|
| 75 | 75 |
{{ template "mapOrSliceGetter" . }}
|
| 76 | 76 |
{{- end }}
|
| 77 |
- {{ template "schemaSerializer" . }}
|
|
| 77 |
+ {{/* {{ template "schemaSerializer" . }} */}}
|
|
| 78 | 78 |
{{- end }}
|
| 79 | 79 |
{{- if and .IncludeValidator (not .IsSuperAlias) (not .IsEmbedded) }}{{/* aliased types type A = B do not redefine methods */}}
|
| 80 | 80 |
{{- if and (not (or .IsInterface .IsStream)) (or .Required .HasValidations .HasBaseType) }}
|
| ... | ... |
@@ -111,7 +111,7 @@ func ({{.ReceiverName}} {{ if or .IsTuple .IsComplexObject .IsAdditionalProperti
|
| 111 | 111 |
{{- end }}
|
| 112 | 112 |
{{- end }}
|
| 113 | 113 |
{{- if .WantsMarshalBinary }}
|
| 114 |
- {{ template "marshalBinarySerializer" . }}
|
|
| 114 |
+ {{/* {{ template "marshalBinarySerializer" . }} */}}
|
|
| 115 | 115 |
{{- end }}
|
| 116 | 116 |
{{- end }}
|
| 117 | 117 |
{{- define "mapOrSliceGetter" }}{{/* signature for AdditionalProperties and AdditionalItems getter funcs */}}
|
| ... | ... |
@@ -3,7 +3,8 @@ |
| 3 | 3 |
// {{ template "docstring" . }}
|
| 4 | 4 |
{{- template "propertyValidationDocString" .}}
|
| 5 | 5 |
{{- end}}
|
| 6 |
-{{ pascalize .Name}} {{ template "schemaType" . }} {{ .PrintTags }}
|
|
| 6 |
+{{- /* Work around bug where "IPv4" and "IPv6" specifically get mangled to "IPV4" and "IPV6", respectively. */}}
|
|
| 7 |
+{{ pascalize .Name | replace "IPV4" "IPv4" | replace "IPV6" "IPv6" }} {{ template "schemaType" . }} {{ .PrintTags }}
|
|
| 7 | 8 |
{{ end }}
|
| 8 | 9 |
|
| 9 | 10 |
{{- define "tuplefield" }}
|
| 10 | 11 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,23 @@ |
| 0 |
+// Code generated by go-swagger; DO NOT EDIT. |
|
| 1 |
+ |
|
| 2 |
+package network |
|
| 3 |
+ |
|
| 4 |
+// This file was generated by the swagger tool. |
|
| 5 |
+// Editing this file might prove futile when you re-run the swagger generate command |
|
| 6 |
+ |
|
| 7 |
+// Inspect The body of the "get network" http response message. |
|
| 8 |
+// |
|
| 9 |
+// swagger:model Inspect |
|
| 10 |
+type Inspect struct {
|
|
| 11 |
+ Network |
|
| 12 |
+ |
|
| 13 |
+ // Contains endpoints attached to the network. |
|
| 14 |
+ // |
|
| 15 |
+ // Example: {"19a4d5d687db25203351ed79d478946f861258f018fe384f229f2efa4b23513c":{"EndpointID":"628cadb8bcb92de107b2a1e516cbffe463e321f548feb37697cce00ad694f21a","IPv4Address":"172.19.0.2/16","IPv6Address":"","MacAddress":"02:42:ac:13:00:02","Name":"test"}}
|
|
| 16 |
+ Containers map[string]EndpointResource `json:"Containers"` |
|
| 17 |
+ |
|
| 18 |
+ // List of services using the network. This field is only present for |
|
| 19 |
+ // swarm scope networks, and omitted for local scope networks. |
|
| 20 |
+ // |
|
| 21 |
+ Services map[string]ServiceInfo `json:"Services,omitempty"` |
|
| 22 |
+} |
| ... | ... |
@@ -1,125 +1,100 @@ |
| 1 |
+// Code generated by go-swagger; DO NOT EDIT. |
|
| 2 |
+ |
|
| 1 | 3 |
package network |
| 2 | 4 |
|
| 5 |
+// This file was generated by the swagger tool. |
|
| 6 |
+// Editing this file might prove futile when you re-run the swagger generate command |
|
| 7 |
+ |
|
| 3 | 8 |
import ( |
| 4 |
- "time" |
|
| 9 |
+ timeext "time" |
|
| 5 | 10 |
) |
| 6 | 11 |
|
| 7 |
-const ( |
|
| 8 |
- // NetworkDefault is a platform-independent alias to choose the platform-specific default network stack. |
|
| 9 |
- NetworkDefault = "default" |
|
| 10 |
- // NetworkHost is the name of the predefined network used when the NetworkMode host is selected (only available on Linux) |
|
| 11 |
- NetworkHost = "host" |
|
| 12 |
- // NetworkNone is the name of the predefined network used when the NetworkMode none is selected (available on both Linux and Windows) |
|
| 13 |
- NetworkNone = "none" |
|
| 14 |
- // NetworkBridge is the name of the default network on Linux |
|
| 15 |
- NetworkBridge = "bridge" |
|
| 16 |
- // NetworkNat is the name of the default network on Windows |
|
| 17 |
- NetworkNat = "nat" |
|
| 18 |
-) |
|
| 12 |
+// Network network |
|
| 13 |
+// |
|
| 14 |
+// swagger:model Network |
|
| 15 |
+type Network struct {
|
|
| 19 | 16 |
|
| 20 |
-// CreateRequest is the request message sent to the server for network create call. |
|
| 21 |
-type CreateRequest struct {
|
|
| 22 |
- Name string // Name is the requested name of the network. |
|
| 23 |
- Driver string // Driver is the driver-name used to create the network (e.g. `bridge`, `overlay`) |
|
| 24 |
- Scope string // Scope describes the level at which the network exists (e.g. `swarm` for cluster-wide or `local` for machine level). |
|
| 25 |
- EnableIPv4 *bool `json:",omitempty"` // EnableIPv4 represents whether to enable IPv4. |
|
| 26 |
- EnableIPv6 *bool `json:",omitempty"` // EnableIPv6 represents whether to enable IPv6. |
|
| 27 |
- IPAM *IPAM // IPAM is the network's IP Address Management. |
|
| 28 |
- Internal bool // Internal represents if the network is used internal only. |
|
| 29 |
- Attachable bool // Attachable represents if the global scope is manually attachable by regular containers from workers in swarm mode. |
|
| 30 |
- Ingress bool // Ingress indicates the network is providing the routing-mesh for the swarm cluster. |
|
| 31 |
- ConfigOnly bool // ConfigOnly creates a config-only network. Config-only 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. |
|
| 32 |
- ConfigFrom *ConfigReference // ConfigFrom specifies the source which will provide the configuration for this network. The specified network must be a config-only network; see [CreateOptions.ConfigOnly]. |
|
| 33 |
- Options map[string]string // Options specifies the network-specific options to use for when creating the network. |
|
| 34 |
- Labels map[string]string // Labels holds metadata specific to the network being created. |
|
| 35 |
- |
|
| 36 |
- // Deprecated: CheckDuplicate is deprecated since API v1.44, but it defaults to true when sent by the client |
|
| 37 |
- // package to older daemons. |
|
| 38 |
- CheckDuplicate *bool `json:",omitempty"` |
|
| 39 |
-} |
|
| 17 |
+ // Name of the network. |
|
| 18 |
+ // |
|
| 19 |
+ // Example: my_network |
|
| 20 |
+ Name string `json:"Name"` |
|
| 40 | 21 |
|
| 41 |
-type Network struct {
|
|
| 42 |
- Name string // Name is the name of the network |
|
| 43 |
- ID string `json:"Id"` // ID uniquely identifies a network on a single machine |
|
| 44 |
- Created time.Time // Created is the time the network created |
|
| 45 |
- Scope string // Scope describes the level at which the network exists (e.g. `swarm` for cluster-wide or `local` for machine level) |
|
| 46 |
- Driver string // Driver is the Driver name used to create the network (e.g. `bridge`, `overlay`) |
|
| 47 |
- EnableIPv4 bool // EnableIPv4 represents whether IPv4 is enabled |
|
| 48 |
- EnableIPv6 bool // EnableIPv6 represents whether IPv6 is enabled |
|
| 49 |
- IPAM IPAM // IPAM is the network's IP Address Management |
|
| 50 |
- Internal bool // Internal represents if the network is used internal only |
|
| 51 |
- Attachable bool // Attachable represents if the global scope is manually attachable by regular containers from workers in swarm mode. |
|
| 52 |
- Ingress bool // Ingress indicates the network is providing the routing-mesh for the swarm cluster. |
|
| 53 |
- ConfigFrom ConfigReference // ConfigFrom specifies the source which will provide the configuration for this network. |
|
| 54 |
- ConfigOnly bool // 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 |
- Options map[string]string // Options holds the network specific options to use for when creating the network |
|
| 56 |
- Labels map[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 |
-} |
|
| 22 |
+ // ID that uniquely identifies a network on a single machine. |
|
| 23 |
+ // |
|
| 24 |
+ // Example: 7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99 |
|
| 25 |
+ ID string `json:"Id"` |
|
| 59 | 26 |
|
| 60 |
-// Inspect is the body of the "get network" http response message. |
|
| 61 |
-type Inspect struct {
|
|
| 62 |
- Network |
|
| 63 |
- Containers map[string]EndpointResource // Containers contains endpoints belonging to the network |
|
| 64 |
- Services map[string]ServiceInfo `json:",omitempty"` |
|
| 65 |
-} |
|
| 27 |
+ // Date and time at which the network was created in |
|
| 28 |
+ // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. |
|
| 29 |
+ // |
|
| 30 |
+ // Example: 2016-10-19T04:33:30.360899459Z |
|
| 31 |
+ Created timeext.Time `json:"Created"` |
|
| 66 | 32 |
|
| 67 |
-// Summary is used as response when listing networks. |
|
| 68 |
-type Summary struct {
|
|
| 69 |
- Network |
|
| 70 |
-} |
|
| 33 |
+ // The level at which the network exists (e.g. `swarm` for cluster-wide |
|
| 34 |
+ // or `local` for machine level) |
|
| 35 |
+ // |
|
| 36 |
+ // Example: local |
|
| 37 |
+ Scope string `json:"Scope"` |
|
| 71 | 38 |
|
| 72 |
-// Address represents an IP address |
|
| 73 |
-type Address struct {
|
|
| 74 |
- Addr string |
|
| 75 |
- PrefixLen int |
|
| 76 |
-} |
|
| 39 |
+ // The name of the driver used to create the network (e.g. `bridge`, |
|
| 40 |
+ // `overlay`). |
|
| 41 |
+ // |
|
| 42 |
+ // Example: overlay |
|
| 43 |
+ Driver string `json:"Driver"` |
|
| 77 | 44 |
|
| 78 |
-// PeerInfo represents one peer of an overlay network |
|
| 79 |
-type PeerInfo struct {
|
|
| 80 |
- Name string |
|
| 81 |
- IP string |
|
| 82 |
-} |
|
| 45 |
+ // Whether the network was created with IPv4 enabled. |
|
| 46 |
+ // |
|
| 47 |
+ // Example: true |
|
| 48 |
+ EnableIPv4 bool `json:"EnableIPv4"` |
|
| 83 | 49 |
|
| 84 |
-// Task carries the information about one backend task |
|
| 85 |
-type Task struct {
|
|
| 86 |
- Name string |
|
| 87 |
- EndpointID string |
|
| 88 |
- EndpointIP string |
|
| 89 |
- Info map[string]string |
|
| 90 |
-} |
|
| 50 |
+ // Whether the network was created with IPv6 enabled. |
|
| 51 |
+ // |
|
| 52 |
+ // Example: false |
|
| 53 |
+ EnableIPv6 bool `json:"EnableIPv6"` |
|
| 91 | 54 |
|
| 92 |
-// ServiceInfo represents service parameters with the list of service's tasks |
|
| 93 |
-type ServiceInfo struct {
|
|
| 94 |
- VIP string |
|
| 95 |
- Ports []string |
|
| 96 |
- LocalLBIndex int |
|
| 97 |
- Tasks []Task |
|
| 98 |
-} |
|
| 55 |
+ // The network's IP Address Management. |
|
| 56 |
+ // |
|
| 57 |
+ IPAM IPAM `json:"IPAM"` |
|
| 99 | 58 |
|
| 100 |
-// EndpointResource contains network resources allocated and used for a |
|
| 101 |
-// container in a network. |
|
| 102 |
-type EndpointResource struct {
|
|
| 103 |
- Name string |
|
| 104 |
- EndpointID string |
|
| 105 |
- MacAddress string |
|
| 106 |
- IPv4Address string |
|
| 107 |
- IPv6Address string |
|
| 108 |
-} |
|
| 59 |
+ // Whether the network is created to only allow internal networking |
|
| 60 |
+ // connectivity. |
|
| 61 |
+ // |
|
| 62 |
+ // Example: false |
|
| 63 |
+ Internal bool `json:"Internal"` |
|
| 109 | 64 |
|
| 110 |
-// NetworkingConfig represents the container's networking configuration for each of its interfaces |
|
| 111 |
-// Carries the networking configs specified in the `docker run` and `docker network connect` commands |
|
| 112 |
-type NetworkingConfig struct {
|
|
| 113 |
- EndpointsConfig map[string]*EndpointSettings // Endpoint configs for each connecting network |
|
| 114 |
-} |
|
| 65 |
+ // Whether a global / swarm scope network is manually attachable by regular |
|
| 66 |
+ // containers from workers in swarm mode. |
|
| 67 |
+ // |
|
| 68 |
+ // Example: false |
|
| 69 |
+ Attachable bool `json:"Attachable"` |
|
| 115 | 70 |
|
| 116 |
-// ConfigReference specifies the source which provides a network's configuration |
|
| 117 |
-type ConfigReference struct {
|
|
| 118 |
- Network string |
|
| 119 |
-} |
|
| 71 |
+ // Whether the network is providing the routing-mesh for the swarm cluster. |
|
| 72 |
+ // |
|
| 73 |
+ // Example: false |
|
| 74 |
+ Ingress bool `json:"Ingress"` |
|
| 75 |
+ |
|
| 76 |
+ // config from |
|
| 77 |
+ ConfigFrom ConfigReference `json:"ConfigFrom"` |
|
| 78 |
+ |
|
| 79 |
+ // Whether the network is a config-only network. Config-only networks are |
|
| 80 |
+ // placeholder networks for network configurations to be used by other |
|
| 81 |
+ // networks. Config-only networks cannot be used directly to run containers |
|
| 82 |
+ // or services. |
|
| 83 |
+ // |
|
| 84 |
+ ConfigOnly bool `json:"ConfigOnly"` |
|
| 85 |
+ |
|
| 86 |
+ // Network-specific options uses when creating the network. |
|
| 87 |
+ // |
|
| 88 |
+ // Example: {"com.docker.network.bridge.default_bridge":"true","com.docker.network.bridge.enable_icc":"true","com.docker.network.bridge.enable_ip_masquerade":"true","com.docker.network.bridge.host_binding_ipv4":"0.0.0.0","com.docker.network.bridge.name":"docker0","com.docker.network.driver.mtu":"1500"}
|
|
| 89 |
+ Options map[string]string `json:"Options"` |
|
| 90 |
+ |
|
| 91 |
+ // Metadata specific to the network being created. |
|
| 92 |
+ // |
|
| 93 |
+ // Example: {"com.example.some-label":"some-value","com.example.some-other-label":"some-other-value"}
|
|
| 94 |
+ Labels map[string]string `json:"Labels"` |
|
| 120 | 95 |
|
| 121 |
-// PruneReport contains the response for Engine API: |
|
| 122 |
-// POST "/networks/prune" |
|
| 123 |
-type PruneReport struct {
|
|
| 124 |
- NetworksDeleted []string |
|
| 96 |
+ // List of peer nodes for an overlay network. This field is only present |
|
| 97 |
+ // for overlay networks, and omitted for other network types. |
|
| 98 |
+ // |
|
| 99 |
+ Peers []PeerInfo `json:"Peers,omitempty"` |
|
| 125 | 100 |
} |
| 126 | 101 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,90 @@ |
| 0 |
+package network |
|
| 1 |
+ |
|
| 2 |
+const ( |
|
| 3 |
+ // NetworkDefault is a platform-independent alias to choose the platform-specific default network stack. |
|
| 4 |
+ NetworkDefault = "default" |
|
| 5 |
+ // NetworkHost is the name of the predefined network used when the NetworkMode host is selected (only available on Linux) |
|
| 6 |
+ NetworkHost = "host" |
|
| 7 |
+ // NetworkNone is the name of the predefined network used when the NetworkMode none is selected (available on both Linux and Windows) |
|
| 8 |
+ NetworkNone = "none" |
|
| 9 |
+ // NetworkBridge is the name of the default network on Linux |
|
| 10 |
+ NetworkBridge = "bridge" |
|
| 11 |
+ // NetworkNat is the name of the default network on Windows |
|
| 12 |
+ NetworkNat = "nat" |
|
| 13 |
+) |
|
| 14 |
+ |
|
| 15 |
+// CreateRequest is the request message sent to the server for network create call. |
|
| 16 |
+type CreateRequest struct {
|
|
| 17 |
+ Name string // Name is the requested name of the network. |
|
| 18 |
+ Driver string // Driver is the driver-name used to create the network (e.g. `bridge`, `overlay`) |
|
| 19 |
+ Scope string // Scope describes the level at which the network exists (e.g. `swarm` for cluster-wide or `local` for machine level). |
|
| 20 |
+ EnableIPv4 *bool `json:",omitempty"` // EnableIPv4 represents whether to enable IPv4. |
|
| 21 |
+ EnableIPv6 *bool `json:",omitempty"` // EnableIPv6 represents whether to enable IPv6. |
|
| 22 |
+ IPAM *IPAM // IPAM is the network's IP Address Management. |
|
| 23 |
+ Internal bool // Internal represents if the network is used internal only. |
|
| 24 |
+ Attachable bool // Attachable represents if the global scope is manually attachable by regular containers from workers in swarm mode. |
|
| 25 |
+ Ingress bool // Ingress indicates the network is providing the routing-mesh for the swarm cluster. |
|
| 26 |
+ ConfigOnly bool // ConfigOnly creates a config-only network. Config-only 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. |
|
| 27 |
+ ConfigFrom *ConfigReference // ConfigFrom specifies the source which will provide the configuration for this network. The specified network must be a config-only network; see [CreateOptions.ConfigOnly]. |
|
| 28 |
+ Options map[string]string // Options specifies the network-specific options to use for when creating the network. |
|
| 29 |
+ Labels map[string]string // Labels holds metadata specific to the network being created. |
|
| 30 |
+ |
|
| 31 |
+ // Deprecated: CheckDuplicate is deprecated since API v1.44, but it defaults to true when sent by the client |
|
| 32 |
+ // package to older daemons. |
|
| 33 |
+ CheckDuplicate *bool `json:",omitempty"` |
|
| 34 |
+} |
|
| 35 |
+ |
|
| 36 |
+// Address represents an IP address |
|
| 37 |
+type Address struct {
|
|
| 38 |
+ Addr string |
|
| 39 |
+ PrefixLen int |
|
| 40 |
+} |
|
| 41 |
+ |
|
| 42 |
+// PeerInfo represents one peer of an overlay network |
|
| 43 |
+type PeerInfo struct {
|
|
| 44 |
+ Name string |
|
| 45 |
+ IP string |
|
| 46 |
+} |
|
| 47 |
+ |
|
| 48 |
+// Task carries the information about one backend task |
|
| 49 |
+type Task struct {
|
|
| 50 |
+ Name string |
|
| 51 |
+ EndpointID string |
|
| 52 |
+ EndpointIP string |
|
| 53 |
+ Info map[string]string |
|
| 54 |
+} |
|
| 55 |
+ |
|
| 56 |
+// ServiceInfo represents service parameters with the list of service's tasks |
|
| 57 |
+type ServiceInfo struct {
|
|
| 58 |
+ VIP string |
|
| 59 |
+ Ports []string |
|
| 60 |
+ LocalLBIndex int |
|
| 61 |
+ Tasks []Task |
|
| 62 |
+} |
|
| 63 |
+ |
|
| 64 |
+// EndpointResource contains network resources allocated and used for a |
|
| 65 |
+// container in a network. |
|
| 66 |
+type EndpointResource struct {
|
|
| 67 |
+ Name string |
|
| 68 |
+ EndpointID string |
|
| 69 |
+ MacAddress string |
|
| 70 |
+ IPv4Address string |
|
| 71 |
+ IPv6Address string |
|
| 72 |
+} |
|
| 73 |
+ |
|
| 74 |
+// NetworkingConfig represents the container's networking configuration for each of its interfaces |
|
| 75 |
+// Carries the networking configs specified in the `docker run` and `docker network connect` commands |
|
| 76 |
+type NetworkingConfig struct {
|
|
| 77 |
+ EndpointsConfig map[string]*EndpointSettings // Endpoint configs for each connecting network |
|
| 78 |
+} |
|
| 79 |
+ |
|
| 80 |
+// ConfigReference specifies the source which provides a network's configuration |
|
| 81 |
+type ConfigReference struct {
|
|
| 82 |
+ Network string |
|
| 83 |
+} |
|
| 84 |
+ |
|
| 85 |
+// PruneReport contains the response for Engine API: |
|
| 86 |
+// POST "/networks/prune" |
|
| 87 |
+type PruneReport struct {
|
|
| 88 |
+ NetworksDeleted []string |
|
| 89 |
+} |
| 0 | 90 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,13 @@ |
| 0 |
+// Code generated by go-swagger; DO NOT EDIT. |
|
| 1 |
+ |
|
| 2 |
+package network |
|
| 3 |
+ |
|
| 4 |
+// This file was generated by the swagger tool. |
|
| 5 |
+// Editing this file might prove futile when you re-run the swagger generate command |
|
| 6 |
+ |
|
| 7 |
+// Summary Network list response item |
|
| 8 |
+// |
|
| 9 |
+// swagger:model Summary |
|
| 10 |
+type Summary struct {
|
|
| 11 |
+ Network |
|
| 12 |
+} |
| ... | ... |
@@ -5,11 +5,13 @@ set -eu |
| 5 | 5 |
|
| 6 | 6 |
generate_model() {
|
| 7 | 7 |
local package="$1" |
| 8 |
+ shift |
|
| 8 | 9 |
mapfile |
| 9 | 10 |
swagger generate model --spec=api/swagger.yaml \ |
| 10 | 11 |
--target=api --model-package="$package" \ |
| 11 | 12 |
--config-file=api/swagger-gen.yaml \ |
| 12 | 13 |
--template-dir=api/templates --allow-template-override \ |
| 14 |
+ "$@" \ |
|
| 13 | 15 |
$(printf -- '--name=%s ' "${MAPFILE[@]}")
|
| 14 | 16 |
} |
| 15 | 17 |
|
| ... | ... |
@@ -58,8 +60,11 @@ EOT |
| 58 | 58 |
# TODO: Restore when go-swagger is updated |
| 59 | 59 |
# See https://github.com/moby/moby/pull/47526#discussion_r1551800022 |
| 60 | 60 |
|
| 61 |
-generate_model types/network <<- 'EOT' |
|
| 61 |
+generate_model types/network --keep-spec-order <<- 'EOT' |
|
| 62 |
+ Network |
|
| 62 | 63 |
NetworkCreateResponse |
| 64 |
+ NetworkInspect |
|
| 65 |
+ NetworkSummary |
|
| 63 | 66 |
EOT |
| 64 | 67 |
|
| 65 | 68 |
generate_model types/plugin <<- 'EOT' |
| 66 | 69 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,23 @@ |
| 0 |
+// Code generated by go-swagger; DO NOT EDIT. |
|
| 1 |
+ |
|
| 2 |
+package network |
|
| 3 |
+ |
|
| 4 |
+// This file was generated by the swagger tool. |
|
| 5 |
+// Editing this file might prove futile when you re-run the swagger generate command |
|
| 6 |
+ |
|
| 7 |
+// Inspect The body of the "get network" http response message. |
|
| 8 |
+// |
|
| 9 |
+// swagger:model Inspect |
|
| 10 |
+type Inspect struct {
|
|
| 11 |
+ Network |
|
| 12 |
+ |
|
| 13 |
+ // Contains endpoints attached to the network. |
|
| 14 |
+ // |
|
| 15 |
+ // Example: {"19a4d5d687db25203351ed79d478946f861258f018fe384f229f2efa4b23513c":{"EndpointID":"628cadb8bcb92de107b2a1e516cbffe463e321f548feb37697cce00ad694f21a","IPv4Address":"172.19.0.2/16","IPv6Address":"","MacAddress":"02:42:ac:13:00:02","Name":"test"}}
|
|
| 16 |
+ Containers map[string]EndpointResource `json:"Containers"` |
|
| 17 |
+ |
|
| 18 |
+ // List of services using the network. This field is only present for |
|
| 19 |
+ // swarm scope networks, and omitted for local scope networks. |
|
| 20 |
+ // |
|
| 21 |
+ Services map[string]ServiceInfo `json:"Services,omitempty"` |
|
| 22 |
+} |
| ... | ... |
@@ -1,125 +1,100 @@ |
| 1 |
+// Code generated by go-swagger; DO NOT EDIT. |
|
| 2 |
+ |
|
| 1 | 3 |
package network |
| 2 | 4 |
|
| 5 |
+// This file was generated by the swagger tool. |
|
| 6 |
+// Editing this file might prove futile when you re-run the swagger generate command |
|
| 7 |
+ |
|
| 3 | 8 |
import ( |
| 4 |
- "time" |
|
| 9 |
+ timeext "time" |
|
| 5 | 10 |
) |
| 6 | 11 |
|
| 7 |
-const ( |
|
| 8 |
- // NetworkDefault is a platform-independent alias to choose the platform-specific default network stack. |
|
| 9 |
- NetworkDefault = "default" |
|
| 10 |
- // NetworkHost is the name of the predefined network used when the NetworkMode host is selected (only available on Linux) |
|
| 11 |
- NetworkHost = "host" |
|
| 12 |
- // NetworkNone is the name of the predefined network used when the NetworkMode none is selected (available on both Linux and Windows) |
|
| 13 |
- NetworkNone = "none" |
|
| 14 |
- // NetworkBridge is the name of the default network on Linux |
|
| 15 |
- NetworkBridge = "bridge" |
|
| 16 |
- // NetworkNat is the name of the default network on Windows |
|
| 17 |
- NetworkNat = "nat" |
|
| 18 |
-) |
|
| 12 |
+// Network network |
|
| 13 |
+// |
|
| 14 |
+// swagger:model Network |
|
| 15 |
+type Network struct {
|
|
| 19 | 16 |
|
| 20 |
-// CreateRequest is the request message sent to the server for network create call. |
|
| 21 |
-type CreateRequest struct {
|
|
| 22 |
- Name string // Name is the requested name of the network. |
|
| 23 |
- Driver string // Driver is the driver-name used to create the network (e.g. `bridge`, `overlay`) |
|
| 24 |
- Scope string // Scope describes the level at which the network exists (e.g. `swarm` for cluster-wide or `local` for machine level). |
|
| 25 |
- EnableIPv4 *bool `json:",omitempty"` // EnableIPv4 represents whether to enable IPv4. |
|
| 26 |
- EnableIPv6 *bool `json:",omitempty"` // EnableIPv6 represents whether to enable IPv6. |
|
| 27 |
- IPAM *IPAM // IPAM is the network's IP Address Management. |
|
| 28 |
- Internal bool // Internal represents if the network is used internal only. |
|
| 29 |
- Attachable bool // Attachable represents if the global scope is manually attachable by regular containers from workers in swarm mode. |
|
| 30 |
- Ingress bool // Ingress indicates the network is providing the routing-mesh for the swarm cluster. |
|
| 31 |
- ConfigOnly bool // ConfigOnly creates a config-only network. Config-only 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. |
|
| 32 |
- ConfigFrom *ConfigReference // ConfigFrom specifies the source which will provide the configuration for this network. The specified network must be a config-only network; see [CreateOptions.ConfigOnly]. |
|
| 33 |
- Options map[string]string // Options specifies the network-specific options to use for when creating the network. |
|
| 34 |
- Labels map[string]string // Labels holds metadata specific to the network being created. |
|
| 35 |
- |
|
| 36 |
- // Deprecated: CheckDuplicate is deprecated since API v1.44, but it defaults to true when sent by the client |
|
| 37 |
- // package to older daemons. |
|
| 38 |
- CheckDuplicate *bool `json:",omitempty"` |
|
| 39 |
-} |
|
| 17 |
+ // Name of the network. |
|
| 18 |
+ // |
|
| 19 |
+ // Example: my_network |
|
| 20 |
+ Name string `json:"Name"` |
|
| 40 | 21 |
|
| 41 |
-type Network struct {
|
|
| 42 |
- Name string // Name is the name of the network |
|
| 43 |
- ID string `json:"Id"` // ID uniquely identifies a network on a single machine |
|
| 44 |
- Created time.Time // Created is the time the network created |
|
| 45 |
- Scope string // Scope describes the level at which the network exists (e.g. `swarm` for cluster-wide or `local` for machine level) |
|
| 46 |
- Driver string // Driver is the Driver name used to create the network (e.g. `bridge`, `overlay`) |
|
| 47 |
- EnableIPv4 bool // EnableIPv4 represents whether IPv4 is enabled |
|
| 48 |
- EnableIPv6 bool // EnableIPv6 represents whether IPv6 is enabled |
|
| 49 |
- IPAM IPAM // IPAM is the network's IP Address Management |
|
| 50 |
- Internal bool // Internal represents if the network is used internal only |
|
| 51 |
- Attachable bool // Attachable represents if the global scope is manually attachable by regular containers from workers in swarm mode. |
|
| 52 |
- Ingress bool // Ingress indicates the network is providing the routing-mesh for the swarm cluster. |
|
| 53 |
- ConfigFrom ConfigReference // ConfigFrom specifies the source which will provide the configuration for this network. |
|
| 54 |
- ConfigOnly bool // 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 |
- Options map[string]string // Options holds the network specific options to use for when creating the network |
|
| 56 |
- Labels map[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 |
-} |
|
| 22 |
+ // ID that uniquely identifies a network on a single machine. |
|
| 23 |
+ // |
|
| 24 |
+ // Example: 7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99 |
|
| 25 |
+ ID string `json:"Id"` |
|
| 59 | 26 |
|
| 60 |
-// Inspect is the body of the "get network" http response message. |
|
| 61 |
-type Inspect struct {
|
|
| 62 |
- Network |
|
| 63 |
- Containers map[string]EndpointResource // Containers contains endpoints belonging to the network |
|
| 64 |
- Services map[string]ServiceInfo `json:",omitempty"` |
|
| 65 |
-} |
|
| 27 |
+ // Date and time at which the network was created in |
|
| 28 |
+ // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds. |
|
| 29 |
+ // |
|
| 30 |
+ // Example: 2016-10-19T04:33:30.360899459Z |
|
| 31 |
+ Created timeext.Time `json:"Created"` |
|
| 66 | 32 |
|
| 67 |
-// Summary is used as response when listing networks. |
|
| 68 |
-type Summary struct {
|
|
| 69 |
- Network |
|
| 70 |
-} |
|
| 33 |
+ // The level at which the network exists (e.g. `swarm` for cluster-wide |
|
| 34 |
+ // or `local` for machine level) |
|
| 35 |
+ // |
|
| 36 |
+ // Example: local |
|
| 37 |
+ Scope string `json:"Scope"` |
|
| 71 | 38 |
|
| 72 |
-// Address represents an IP address |
|
| 73 |
-type Address struct {
|
|
| 74 |
- Addr string |
|
| 75 |
- PrefixLen int |
|
| 76 |
-} |
|
| 39 |
+ // The name of the driver used to create the network (e.g. `bridge`, |
|
| 40 |
+ // `overlay`). |
|
| 41 |
+ // |
|
| 42 |
+ // Example: overlay |
|
| 43 |
+ Driver string `json:"Driver"` |
|
| 77 | 44 |
|
| 78 |
-// PeerInfo represents one peer of an overlay network |
|
| 79 |
-type PeerInfo struct {
|
|
| 80 |
- Name string |
|
| 81 |
- IP string |
|
| 82 |
-} |
|
| 45 |
+ // Whether the network was created with IPv4 enabled. |
|
| 46 |
+ // |
|
| 47 |
+ // Example: true |
|
| 48 |
+ EnableIPv4 bool `json:"EnableIPv4"` |
|
| 83 | 49 |
|
| 84 |
-// Task carries the information about one backend task |
|
| 85 |
-type Task struct {
|
|
| 86 |
- Name string |
|
| 87 |
- EndpointID string |
|
| 88 |
- EndpointIP string |
|
| 89 |
- Info map[string]string |
|
| 90 |
-} |
|
| 50 |
+ // Whether the network was created with IPv6 enabled. |
|
| 51 |
+ // |
|
| 52 |
+ // Example: false |
|
| 53 |
+ EnableIPv6 bool `json:"EnableIPv6"` |
|
| 91 | 54 |
|
| 92 |
-// ServiceInfo represents service parameters with the list of service's tasks |
|
| 93 |
-type ServiceInfo struct {
|
|
| 94 |
- VIP string |
|
| 95 |
- Ports []string |
|
| 96 |
- LocalLBIndex int |
|
| 97 |
- Tasks []Task |
|
| 98 |
-} |
|
| 55 |
+ // The network's IP Address Management. |
|
| 56 |
+ // |
|
| 57 |
+ IPAM IPAM `json:"IPAM"` |
|
| 99 | 58 |
|
| 100 |
-// EndpointResource contains network resources allocated and used for a |
|
| 101 |
-// container in a network. |
|
| 102 |
-type EndpointResource struct {
|
|
| 103 |
- Name string |
|
| 104 |
- EndpointID string |
|
| 105 |
- MacAddress string |
|
| 106 |
- IPv4Address string |
|
| 107 |
- IPv6Address string |
|
| 108 |
-} |
|
| 59 |
+ // Whether the network is created to only allow internal networking |
|
| 60 |
+ // connectivity. |
|
| 61 |
+ // |
|
| 62 |
+ // Example: false |
|
| 63 |
+ Internal bool `json:"Internal"` |
|
| 109 | 64 |
|
| 110 |
-// NetworkingConfig represents the container's networking configuration for each of its interfaces |
|
| 111 |
-// Carries the networking configs specified in the `docker run` and `docker network connect` commands |
|
| 112 |
-type NetworkingConfig struct {
|
|
| 113 |
- EndpointsConfig map[string]*EndpointSettings // Endpoint configs for each connecting network |
|
| 114 |
-} |
|
| 65 |
+ // Whether a global / swarm scope network is manually attachable by regular |
|
| 66 |
+ // containers from workers in swarm mode. |
|
| 67 |
+ // |
|
| 68 |
+ // Example: false |
|
| 69 |
+ Attachable bool `json:"Attachable"` |
|
| 115 | 70 |
|
| 116 |
-// ConfigReference specifies the source which provides a network's configuration |
|
| 117 |
-type ConfigReference struct {
|
|
| 118 |
- Network string |
|
| 119 |
-} |
|
| 71 |
+ // Whether the network is providing the routing-mesh for the swarm cluster. |
|
| 72 |
+ // |
|
| 73 |
+ // Example: false |
|
| 74 |
+ Ingress bool `json:"Ingress"` |
|
| 75 |
+ |
|
| 76 |
+ // config from |
|
| 77 |
+ ConfigFrom ConfigReference `json:"ConfigFrom"` |
|
| 78 |
+ |
|
| 79 |
+ // Whether the network is a config-only network. Config-only networks are |
|
| 80 |
+ // placeholder networks for network configurations to be used by other |
|
| 81 |
+ // networks. Config-only networks cannot be used directly to run containers |
|
| 82 |
+ // or services. |
|
| 83 |
+ // |
|
| 84 |
+ ConfigOnly bool `json:"ConfigOnly"` |
|
| 85 |
+ |
|
| 86 |
+ // Network-specific options uses when creating the network. |
|
| 87 |
+ // |
|
| 88 |
+ // Example: {"com.docker.network.bridge.default_bridge":"true","com.docker.network.bridge.enable_icc":"true","com.docker.network.bridge.enable_ip_masquerade":"true","com.docker.network.bridge.host_binding_ipv4":"0.0.0.0","com.docker.network.bridge.name":"docker0","com.docker.network.driver.mtu":"1500"}
|
|
| 89 |
+ Options map[string]string `json:"Options"` |
|
| 90 |
+ |
|
| 91 |
+ // Metadata specific to the network being created. |
|
| 92 |
+ // |
|
| 93 |
+ // Example: {"com.example.some-label":"some-value","com.example.some-other-label":"some-other-value"}
|
|
| 94 |
+ Labels map[string]string `json:"Labels"` |
|
| 120 | 95 |
|
| 121 |
-// PruneReport contains the response for Engine API: |
|
| 122 |
-// POST "/networks/prune" |
|
| 123 |
-type PruneReport struct {
|
|
| 124 |
- NetworksDeleted []string |
|
| 96 |
+ // List of peer nodes for an overlay network. This field is only present |
|
| 97 |
+ // for overlay networks, and omitted for other network types. |
|
| 98 |
+ // |
|
| 99 |
+ Peers []PeerInfo `json:"Peers,omitempty"` |
|
| 125 | 100 |
} |
| 126 | 101 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,90 @@ |
| 0 |
+package network |
|
| 1 |
+ |
|
| 2 |
+const ( |
|
| 3 |
+ // NetworkDefault is a platform-independent alias to choose the platform-specific default network stack. |
|
| 4 |
+ NetworkDefault = "default" |
|
| 5 |
+ // NetworkHost is the name of the predefined network used when the NetworkMode host is selected (only available on Linux) |
|
| 6 |
+ NetworkHost = "host" |
|
| 7 |
+ // NetworkNone is the name of the predefined network used when the NetworkMode none is selected (available on both Linux and Windows) |
|
| 8 |
+ NetworkNone = "none" |
|
| 9 |
+ // NetworkBridge is the name of the default network on Linux |
|
| 10 |
+ NetworkBridge = "bridge" |
|
| 11 |
+ // NetworkNat is the name of the default network on Windows |
|
| 12 |
+ NetworkNat = "nat" |
|
| 13 |
+) |
|
| 14 |
+ |
|
| 15 |
+// CreateRequest is the request message sent to the server for network create call. |
|
| 16 |
+type CreateRequest struct {
|
|
| 17 |
+ Name string // Name is the requested name of the network. |
|
| 18 |
+ Driver string // Driver is the driver-name used to create the network (e.g. `bridge`, `overlay`) |
|
| 19 |
+ Scope string // Scope describes the level at which the network exists (e.g. `swarm` for cluster-wide or `local` for machine level). |
|
| 20 |
+ EnableIPv4 *bool `json:",omitempty"` // EnableIPv4 represents whether to enable IPv4. |
|
| 21 |
+ EnableIPv6 *bool `json:",omitempty"` // EnableIPv6 represents whether to enable IPv6. |
|
| 22 |
+ IPAM *IPAM // IPAM is the network's IP Address Management. |
|
| 23 |
+ Internal bool // Internal represents if the network is used internal only. |
|
| 24 |
+ Attachable bool // Attachable represents if the global scope is manually attachable by regular containers from workers in swarm mode. |
|
| 25 |
+ Ingress bool // Ingress indicates the network is providing the routing-mesh for the swarm cluster. |
|
| 26 |
+ ConfigOnly bool // ConfigOnly creates a config-only network. Config-only 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. |
|
| 27 |
+ ConfigFrom *ConfigReference // ConfigFrom specifies the source which will provide the configuration for this network. The specified network must be a config-only network; see [CreateOptions.ConfigOnly]. |
|
| 28 |
+ Options map[string]string // Options specifies the network-specific options to use for when creating the network. |
|
| 29 |
+ Labels map[string]string // Labels holds metadata specific to the network being created. |
|
| 30 |
+ |
|
| 31 |
+ // Deprecated: CheckDuplicate is deprecated since API v1.44, but it defaults to true when sent by the client |
|
| 32 |
+ // package to older daemons. |
|
| 33 |
+ CheckDuplicate *bool `json:",omitempty"` |
|
| 34 |
+} |
|
| 35 |
+ |
|
| 36 |
+// Address represents an IP address |
|
| 37 |
+type Address struct {
|
|
| 38 |
+ Addr string |
|
| 39 |
+ PrefixLen int |
|
| 40 |
+} |
|
| 41 |
+ |
|
| 42 |
+// PeerInfo represents one peer of an overlay network |
|
| 43 |
+type PeerInfo struct {
|
|
| 44 |
+ Name string |
|
| 45 |
+ IP string |
|
| 46 |
+} |
|
| 47 |
+ |
|
| 48 |
+// Task carries the information about one backend task |
|
| 49 |
+type Task struct {
|
|
| 50 |
+ Name string |
|
| 51 |
+ EndpointID string |
|
| 52 |
+ EndpointIP string |
|
| 53 |
+ Info map[string]string |
|
| 54 |
+} |
|
| 55 |
+ |
|
| 56 |
+// ServiceInfo represents service parameters with the list of service's tasks |
|
| 57 |
+type ServiceInfo struct {
|
|
| 58 |
+ VIP string |
|
| 59 |
+ Ports []string |
|
| 60 |
+ LocalLBIndex int |
|
| 61 |
+ Tasks []Task |
|
| 62 |
+} |
|
| 63 |
+ |
|
| 64 |
+// EndpointResource contains network resources allocated and used for a |
|
| 65 |
+// container in a network. |
|
| 66 |
+type EndpointResource struct {
|
|
| 67 |
+ Name string |
|
| 68 |
+ EndpointID string |
|
| 69 |
+ MacAddress string |
|
| 70 |
+ IPv4Address string |
|
| 71 |
+ IPv6Address string |
|
| 72 |
+} |
|
| 73 |
+ |
|
| 74 |
+// NetworkingConfig represents the container's networking configuration for each of its interfaces |
|
| 75 |
+// Carries the networking configs specified in the `docker run` and `docker network connect` commands |
|
| 76 |
+type NetworkingConfig struct {
|
|
| 77 |
+ EndpointsConfig map[string]*EndpointSettings // Endpoint configs for each connecting network |
|
| 78 |
+} |
|
| 79 |
+ |
|
| 80 |
+// ConfigReference specifies the source which provides a network's configuration |
|
| 81 |
+type ConfigReference struct {
|
|
| 82 |
+ Network string |
|
| 83 |
+} |
|
| 84 |
+ |
|
| 85 |
+// PruneReport contains the response for Engine API: |
|
| 86 |
+// POST "/networks/prune" |
|
| 87 |
+type PruneReport struct {
|
|
| 88 |
+ NetworksDeleted []string |
|
| 89 |
+} |
| 0 | 90 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,13 @@ |
| 0 |
+// Code generated by go-swagger; DO NOT EDIT. |
|
| 1 |
+ |
|
| 2 |
+package network |
|
| 3 |
+ |
|
| 4 |
+// This file was generated by the swagger tool. |
|
| 5 |
+// Editing this file might prove futile when you re-run the swagger generate command |
|
| 6 |
+ |
|
| 7 |
+// Summary Network list response item |
|
| 8 |
+// |
|
| 9 |
+// swagger:model Summary |
|
| 10 |
+type Summary struct {
|
|
| 11 |
+ Network |
|
| 12 |
+} |