This moves the `Port` type to the container package, and
deprecates the old location.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,23 @@ |
| 0 |
+package container |
|
| 1 |
+ |
|
| 2 |
+// This file was generated by the swagger tool. |
|
| 3 |
+// Editing this file might prove futile when you re-run the swagger generate command |
|
| 4 |
+ |
|
| 5 |
+// Port An open port on a container |
|
| 6 |
+// swagger:model Port |
|
| 7 |
+type Port struct {
|
|
| 8 |
+ |
|
| 9 |
+ // Host IP address that the container's port is mapped to |
|
| 10 |
+ IP string `json:"IP,omitempty"` |
|
| 11 |
+ |
|
| 12 |
+ // Port on the container |
|
| 13 |
+ // Required: true |
|
| 14 |
+ PrivatePort uint16 `json:"PrivatePort"` |
|
| 15 |
+ |
|
| 16 |
+ // Port exposed on the host |
|
| 17 |
+ PublicPort uint16 `json:"PublicPort,omitempty"` |
|
| 18 |
+ |
|
| 19 |
+ // type |
|
| 20 |
+ // Required: true |
|
| 21 |
+ Type string `json:"Type"` |
|
| 22 |
+} |
| 0 | 23 |
deleted file mode 100644 |
| ... | ... |
@@ -1,23 +0,0 @@ |
| 1 |
-package types |
|
| 2 |
- |
|
| 3 |
-// This file was generated by the swagger tool. |
|
| 4 |
-// Editing this file might prove futile when you re-run the swagger generate command |
|
| 5 |
- |
|
| 6 |
-// Port An open port on a container |
|
| 7 |
-// swagger:model Port |
|
| 8 |
-type Port struct {
|
|
| 9 |
- |
|
| 10 |
- // Host IP address that the container's port is mapped to |
|
| 11 |
- IP string `json:"IP,omitempty"` |
|
| 12 |
- |
|
| 13 |
- // Port on the container |
|
| 14 |
- // Required: true |
|
| 15 |
- PrivatePort uint16 `json:"PrivatePort"` |
|
| 16 |
- |
|
| 17 |
- // Port exposed on the host |
|
| 18 |
- PublicPort uint16 `json:"PublicPort,omitempty"` |
|
| 19 |
- |
|
| 20 |
- // type |
|
| 21 |
- // Required: true |
|
| 22 |
- Type string `json:"Type"` |
|
| 23 |
-} |
| ... | ... |
@@ -255,3 +255,8 @@ type HealthcheckResult = container.HealthcheckResult |
| 255 | 255 |
// |
| 256 | 256 |
// Deprecated: use [container.MountPoint]. |
| 257 | 257 |
type MountPoint = container.MountPoint |
| 258 |
+ |
|
| 259 |
+// Port An open port on a container |
|
| 260 |
+// |
|
| 261 |
+// Deprecated: use [container.Port]. |
|
| 262 |
+type Port = container.Port |
| ... | ... |
@@ -310,7 +310,7 @@ func (v *View) transform(ctr *Container) *Snapshot {
|
| 310 | 310 |
ID: ctr.ID, |
| 311 | 311 |
Names: v.getNames(ctr.ID), |
| 312 | 312 |
ImageID: ctr.ImageID.String(), |
| 313 |
- Ports: []types.Port{},
|
|
| 313 |
+ Ports: []container.Port{},
|
|
| 314 | 314 |
Mounts: ctr.GetMountPoints(), |
| 315 | 315 |
State: ctr.State.StateString(), |
| 316 | 316 |
Status: ctr.State.String(), |
| ... | ... |
@@ -366,7 +366,7 @@ func (v *View) transform(ctr *Container) *Snapshot {
|
| 366 | 366 |
snapshot.Command = ctr.Path |
| 367 | 367 |
} |
| 368 | 368 |
|
| 369 |
- snapshot.Ports = []types.Port{}
|
|
| 369 |
+ snapshot.Ports = []container.Port{}
|
|
| 370 | 370 |
networks := make(map[string]*network.EndpointSettings) |
| 371 | 371 |
if ctr.NetworkSettings != nil {
|
| 372 | 372 |
for name, netw := range ctr.NetworkSettings.Networks {
|
| ... | ... |
@@ -398,7 +398,7 @@ func (v *View) transform(ctr *Container) *Snapshot {
|
| 398 | 398 |
continue |
| 399 | 399 |
} |
| 400 | 400 |
if len(bindings) == 0 {
|
| 401 |
- snapshot.Ports = append(snapshot.Ports, types.Port{
|
|
| 401 |
+ snapshot.Ports = append(snapshot.Ports, container.Port{
|
|
| 402 | 402 |
PrivatePort: uint16(p), |
| 403 | 403 |
Type: port.Proto(), |
| 404 | 404 |
}) |
| ... | ... |
@@ -410,7 +410,7 @@ func (v *View) transform(ctr *Container) *Snapshot {
|
| 410 | 410 |
log.G(context.TODO()).WithError(err).Warn("invalid host port map")
|
| 411 | 411 |
continue |
| 412 | 412 |
} |
| 413 |
- snapshot.Ports = append(snapshot.Ports, types.Port{
|
|
| 413 |
+ snapshot.Ports = append(snapshot.Ports, container.Port{
|
|
| 414 | 414 |
PrivatePort: uint16(p), |
| 415 | 415 |
PublicPort: uint16(h), |
| 416 | 416 |
Type: port.Proto(), |
| ... | ... |
@@ -10,8 +10,7 @@ swagger generate model -f api/swagger.yaml \ |
| 10 | 10 |
-n PluginDevice \ |
| 11 | 11 |
-n PluginMount \ |
| 12 | 12 |
-n PluginEnv \ |
| 13 |
- -n PluginInterfaceType \ |
|
| 14 |
- -n Port |
|
| 13 |
+ -n PluginInterfaceType |
|
| 15 | 14 |
|
| 16 | 15 |
swagger generate model -f api/swagger.yaml \ |
| 17 | 16 |
-t api -m types/container --skip-validator -C api/swagger-gen.yaml \ |
| ... | ... |
@@ -19,7 +18,8 @@ swagger generate model -f api/swagger.yaml \ |
| 19 | 19 |
-n ContainerWaitResponse \ |
| 20 | 20 |
-n ContainerWaitExitError \ |
| 21 | 21 |
-n ChangeType \ |
| 22 |
- -n FilesystemChange |
|
| 22 |
+ -n FilesystemChange \ |
|
| 23 |
+ -n Port |
|
| 23 | 24 |
|
| 24 | 25 |
swagger generate model -f api/swagger.yaml \ |
| 25 | 26 |
-t api -m types/image --skip-validator -C api/swagger-gen.yaml \ |