More descriptive, easier to process container portmappings information in the API

This commit is contained in:
shin-
2013-08-28 00:20:35 +02:00
parent 4a3b039c2a
commit 98018df078
6 changed files with 50 additions and 16 deletions
+14 -2
View File
@@ -1,5 +1,7 @@
package docker
import "encoding/json"
type APIHistory struct {
ID string `json:"Id"`
Tags []string `json:",omitempty"`
@@ -47,7 +49,7 @@ type APIContainers struct {
Command string
Created int64
Status string
Ports string
Ports []APIPort
SizeRw int64
SizeRootFs int64
}
@@ -67,7 +69,17 @@ type APIRun struct {
}
type APIPort struct {
Port string
PrivatePort int64
PublicPort int64
Type string
}
func (port *APIPort) MarshalJSON() ([]byte, error) {
return json.Marshal(map[string]interface{}{
"PrivatePort": port.PrivatePort,
"PublicPort": port.PublicPort,
"Type": port.Type,
})
}
type APIVersion struct {