mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
api/types/container: rename Port to PortMapping
It better describes its purpose, and allows "Port" to be used for other purposes (e.g. to replace "nat.Port"). Signed-off-by: Sebastiaan van Stijn <github@gone.nl> Co-authored-by: Austin Vazquez <austin.vazquez@docker.com>
This commit is contained in:
committed by
Austin Vazquez
parent
606519a171
commit
82ba7fef17
@@ -173,9 +173,10 @@ tags:
|
||||
x-displayName: "System"
|
||||
|
||||
definitions:
|
||||
Port:
|
||||
PortSummary:
|
||||
type: "object"
|
||||
description: "An open port on a container"
|
||||
description: |
|
||||
Describes a port-mapping between the container and the host.
|
||||
required: [PrivatePort, Type]
|
||||
properties:
|
||||
IP:
|
||||
@@ -5204,7 +5205,7 @@ definitions:
|
||||
Port-mappings for the container.
|
||||
type: "array"
|
||||
items:
|
||||
$ref: "#/definitions/Port"
|
||||
$ref: "#/definitions/PortSummary"
|
||||
SizeRw:
|
||||
description: |-
|
||||
The size of files that have been created or changed by this container.
|
||||
|
||||
@@ -173,9 +173,10 @@ tags:
|
||||
x-displayName: "System"
|
||||
|
||||
definitions:
|
||||
Port:
|
||||
PortSummary:
|
||||
type: "object"
|
||||
description: "An open port on a container"
|
||||
description: |
|
||||
Describes a port-mapping between the container and the host.
|
||||
required: [PrivatePort, Type]
|
||||
properties:
|
||||
IP:
|
||||
@@ -5204,7 +5205,7 @@ definitions:
|
||||
Port-mappings for the container.
|
||||
type: "array"
|
||||
items:
|
||||
$ref: "#/definitions/Port"
|
||||
$ref: "#/definitions/PortSummary"
|
||||
SizeRw:
|
||||
description: |-
|
||||
The size of files that have been created or changed by this container.
|
||||
|
||||
@@ -104,7 +104,7 @@ type Summary struct {
|
||||
ImageManifestDescriptor *ocispec.Descriptor `json:"ImageManifestDescriptor,omitempty"`
|
||||
Command string
|
||||
Created int64
|
||||
Ports []Port
|
||||
Ports []PortSummary
|
||||
SizeRw int64 `json:",omitempty"`
|
||||
SizeRootFs int64 `json:",omitempty"`
|
||||
Labels map[string]string
|
||||
|
||||
@@ -5,11 +5,12 @@ package container
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// Port An open port on a container
|
||||
// PortSummary Describes a port-mapping between the container and the host.
|
||||
//
|
||||
// Example: {"PrivatePort":8080,"PublicPort":80,"Type":"tcp"}
|
||||
//
|
||||
// swagger:model Port
|
||||
type Port struct {
|
||||
// swagger:model PortSummary
|
||||
type PortSummary struct {
|
||||
|
||||
// Host IP address that the container's port is mapped to
|
||||
IP string `json:"IP,omitempty"`
|
||||
@@ -309,7 +309,7 @@ func (v *View) transform(ctr *Container) *Snapshot {
|
||||
ID: ctr.ID,
|
||||
Names: v.getNames(ctr.ID),
|
||||
ImageID: ctr.ImageID.String(),
|
||||
Ports: []container.Port{},
|
||||
Ports: []container.PortSummary{},
|
||||
Mounts: ctr.GetMountPoints(),
|
||||
State: ctr.State.StateString(),
|
||||
Status: ctr.State.String(),
|
||||
@@ -366,7 +366,7 @@ func (v *View) transform(ctr *Container) *Snapshot {
|
||||
snapshot.Command = ctr.Path
|
||||
}
|
||||
|
||||
snapshot.Ports = []container.Port{}
|
||||
snapshot.Ports = []container.PortSummary{}
|
||||
networks := make(map[string]*network.EndpointSettings)
|
||||
if ctr.NetworkSettings != nil {
|
||||
for name, netw := range ctr.NetworkSettings.Networks {
|
||||
@@ -400,7 +400,7 @@ func (v *View) transform(ctr *Container) *Snapshot {
|
||||
continue
|
||||
}
|
||||
if len(bindings) == 0 {
|
||||
snapshot.Ports = append(snapshot.Ports, container.Port{
|
||||
snapshot.Ports = append(snapshot.Ports, container.PortSummary{
|
||||
PrivatePort: uint16(p),
|
||||
Type: proto,
|
||||
})
|
||||
@@ -412,7 +412,7 @@ func (v *View) transform(ctr *Container) *Snapshot {
|
||||
log.G(context.TODO()).WithError(err).Warn("invalid host port map")
|
||||
continue
|
||||
}
|
||||
snapshot.Ports = append(snapshot.Ports, container.Port{
|
||||
snapshot.Ports = append(snapshot.Ports, container.PortSummary{
|
||||
PrivatePort: uint16(p),
|
||||
PublicPort: uint16(h),
|
||||
Type: proto,
|
||||
|
||||
@@ -30,7 +30,7 @@ swagger generate model -f api/swagger.yaml \
|
||||
-n ContainerWaitExitError \
|
||||
-n ChangeType \
|
||||
-n FilesystemChange \
|
||||
-n Port
|
||||
-n PortSummary
|
||||
|
||||
swagger generate model -f api/swagger.yaml \
|
||||
-t api -m types/image -C api/swagger-gen.yaml \
|
||||
|
||||
7
vendor/github.com/moby/moby/api/swagger.yaml
generated
vendored
7
vendor/github.com/moby/moby/api/swagger.yaml
generated
vendored
@@ -173,9 +173,10 @@ tags:
|
||||
x-displayName: "System"
|
||||
|
||||
definitions:
|
||||
Port:
|
||||
PortSummary:
|
||||
type: "object"
|
||||
description: "An open port on a container"
|
||||
description: |
|
||||
Describes a port-mapping between the container and the host.
|
||||
required: [PrivatePort, Type]
|
||||
properties:
|
||||
IP:
|
||||
@@ -5204,7 +5205,7 @@ definitions:
|
||||
Port-mappings for the container.
|
||||
type: "array"
|
||||
items:
|
||||
$ref: "#/definitions/Port"
|
||||
$ref: "#/definitions/PortSummary"
|
||||
SizeRw:
|
||||
description: |-
|
||||
The size of files that have been created or changed by this container.
|
||||
|
||||
2
vendor/github.com/moby/moby/api/types/container/container.go
generated
vendored
2
vendor/github.com/moby/moby/api/types/container/container.go
generated
vendored
@@ -104,7 +104,7 @@ type Summary struct {
|
||||
ImageManifestDescriptor *ocispec.Descriptor `json:"ImageManifestDescriptor,omitempty"`
|
||||
Command string
|
||||
Created int64
|
||||
Ports []Port
|
||||
Ports []PortSummary
|
||||
SizeRw int64 `json:",omitempty"`
|
||||
SizeRootFs int64 `json:",omitempty"`
|
||||
Labels map[string]string
|
||||
|
||||
@@ -5,11 +5,12 @@ package container
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
// Port An open port on a container
|
||||
// PortSummary Describes a port-mapping between the container and the host.
|
||||
//
|
||||
// Example: {"PrivatePort":8080,"PublicPort":80,"Type":"tcp"}
|
||||
//
|
||||
// swagger:model Port
|
||||
type Port struct {
|
||||
// swagger:model PortSummary
|
||||
type PortSummary struct {
|
||||
|
||||
// Host IP address that the container's port is mapped to
|
||||
IP string `json:"IP,omitempty"`
|
||||
Reference in New Issue
Block a user