diff --git a/api/types.go b/api/types.go index 2490a84..5474e3e 100644 --- a/api/types.go +++ b/api/types.go @@ -8,17 +8,17 @@ import "github.com/docker/libnetwork/types" // networkResource is the body of the "get network" http response message type networkResource struct { - Name string - ID string - Type string - Endpoints []*endpointResource + Name string `json:"name"` + ID string `json:"id"` + Type string `json:"type"` + Endpoints []*endpointResource `json:"endpoints"` } // endpointResource is the body of the "get endpoint" http response message type endpointResource struct { - Name string - ID string - Network string + Name string `json:"name"` + ID string `json:"id"` + Network string `json:"network"` } /*********** @@ -27,41 +27,41 @@ type endpointResource struct { // networkCreate is the expected body of the "create network" http request message type networkCreate struct { - Name string - NetworkType string - Options map[string]interface{} + Name string `json:"name"` + NetworkType string `json:"network_type"` + Options map[string]interface{} `json:"options"` } // endpointCreate represents the body of the "create endpoint" http request message type endpointCreate struct { - Name string - ExposedPorts []types.TransportPort - PortMapping []types.PortBinding + Name string `json:"name"` + ExposedPorts []types.TransportPort `json:"exposed_ports"` + PortMapping []types.PortBinding `json:"port_mapping"` } // endpointJoin represents the expected body of the "join endpoint" or "leave endpoint" http request messages type endpointJoin struct { - ContainerID string - HostName string - DomainName string - HostsPath string - ResolvConfPath string - DNS []string - ExtraHosts []endpointExtraHost - ParentUpdates []endpointParentUpdate - UseDefaultSandbox bool + ContainerID string `json:"container_id"` + HostName string `json:"host_name"` + DomainName string `json:"domain_name"` + HostsPath string `json:"hosts_path"` + ResolvConfPath string `json:"resolv_conf_path"` + DNS []string `json:"dns"` + ExtraHosts []endpointExtraHost `json:"extra_hosts"` + ParentUpdates []endpointParentUpdate `json:"parent_updates"` + UseDefaultSandbox bool `json:"use_default_sandbox"` } // EndpointExtraHost represents the extra host object type endpointExtraHost struct { - Name string - Address string + Name string `json:"name"` + Address string `json:"address"` } // EndpointParentUpdate is the object carrying the information about the // endpoint parent that needs to be updated type endpointParentUpdate struct { - EndpointID string - Name string - Address string + EndpointID string `json:"endpoint_id"` + Name string `json:"name"` + Address string `json:"address"` } diff --git a/client/types.go b/client/types.go index 972ed43..b5a175a 100644 --- a/client/types.go +++ b/client/types.go @@ -8,17 +8,17 @@ import "github.com/docker/libnetwork/types" // networkResource is the body of the "get network" http response message type networkResource struct { - Name string - ID string - Type string - Endpoints []*endpointResource + Name string `json:"name"` + ID string `json:"id"` + Type string `json:"type"` + Endpoints []*endpointResource `json:"endpoints"` } // endpointResource is the body of the "get endpoint" http response message type endpointResource struct { - Name string - ID string - Network string + Name string `json:"name"` + ID string `json:"id"` + Network string `json:"network"` } /*********** @@ -27,42 +27,42 @@ type endpointResource struct { // networkCreate is the expected body of the "create network" http request message type networkCreate struct { - Name string - NetworkType string - Options map[string]interface{} + Name string `json:"name"` + NetworkType string `json:"network_type"` + Options map[string]interface{} `json:"options"` } // endpointCreate represents the body of the "create endpoint" http request message type endpointCreate struct { - Name string - NetworkID string - ExposedPorts []types.TransportPort - PortMapping []types.PortBinding + Name string `json:"name"` + NetworkID string `json:"network_id"` + ExposedPorts []types.TransportPort `json:"exposed_ports"` + PortMapping []types.PortBinding `json:"port_mapping"` } // endpointJoin represents the expected body of the "join endpoint" or "leave endpoint" http request messages type endpointJoin struct { - ContainerID string - HostName string - DomainName string - HostsPath string - ResolvConfPath string - DNS []string - ExtraHosts []endpointExtraHost - ParentUpdates []endpointParentUpdate - UseDefaultSandbox bool + ContainerID string `json:"container_id"` + HostName string `json:"host_name"` + DomainName string `json:"domain_name"` + HostsPath string `json:"hosts_path"` + ResolvConfPath string `json:"resolv_conf_path"` + DNS []string `json:"dns"` + ExtraHosts []endpointExtraHost `json:"extra_hosts"` + ParentUpdates []endpointParentUpdate `json:"parent_updates"` + UseDefaultSandbox bool `json:"use_default_sandbox"` } // EndpointExtraHost represents the extra host object type endpointExtraHost struct { - Name string - Address string + Name string `json:"name"` + Address string `json:"address"` } // EndpointParentUpdate is the object carrying the information about the // endpoint parent that needs to be updated type endpointParentUpdate struct { - EndpointID string - Name string - Address string + EndpointID string `json:"endpoint_id"` + Name string `json:"name"` + Address string `json:"address"` }