update list containers
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
package network
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"floares/config"
|
||||
"log"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Inspect struct {
|
||||
Name string `json:"Name"`
|
||||
Id string `json:"Id"`
|
||||
Created time.Time `json:"Created"`
|
||||
Scope string `json:"Scope"`
|
||||
Driver string `json:"Driver"`
|
||||
EnableIPv6 bool `json:"EnableIPv6"`
|
||||
IPAM struct {
|
||||
Driver string `json:"Driver"`
|
||||
Options struct {
|
||||
Driver string `json:"driver"`
|
||||
} `json:"Options"`
|
||||
Config []struct {
|
||||
Subnet string `json:"Subnet"`
|
||||
Gateway string `json:"Gateway"`
|
||||
} `json:"Config"`
|
||||
} `json:"IPAM"`
|
||||
Internal bool `json:"Internal"`
|
||||
Attachable bool `json:"Attachable"`
|
||||
Ingress bool `json:"Ingress"`
|
||||
ConfigFrom struct {
|
||||
Network string `json:"Network"`
|
||||
} `json:"ConfigFrom"`
|
||||
ConfigOnly bool `json:"ConfigOnly"`
|
||||
Containers struct {
|
||||
C8E63Bfb95Cf391126C4B7A13327Cd781Af0Dd080B858Cdb7A2B26B4304E02C struct {
|
||||
Name string `json:"Name"`
|
||||
EndpointID string `json:"EndpointID"`
|
||||
MacAddress string `json:"MacAddress"`
|
||||
IPv4Address string `json:"IPv4Address"`
|
||||
IPv6Address string `json:"IPv6Address"`
|
||||
} `json:"9c8e63bfb95cf391126c4b7a13327cd781af0dd080b858cdb7a2b26b4304e02c"`
|
||||
} `json:"Containers"`
|
||||
Options struct {
|
||||
} `json:"Options"`
|
||||
Labels struct {
|
||||
} `json:"Labels"`
|
||||
}
|
||||
|
||||
func GetInspect(ns string) (net Inspect) {
|
||||
req, _ := http.NewRequest("GET", config.Entrypoint+"/networks/"+ns, nil)
|
||||
res, err := http.DefaultClient.Do(req)
|
||||
if err != nil {
|
||||
log.Println("request for network list error:", err)
|
||||
return
|
||||
}
|
||||
err = json.NewDecoder(res.Body).Decode(&net)
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user