mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #237 from kunalkushwaha/json-tagged-struct
API struct tagged to produce proper output when marshalled #217
This commit is contained in:
commit
927b19fa4b
2 changed files with 55 additions and 55 deletions
|
@ -8,17 +8,17 @@ import "github.com/docker/libnetwork/types"
|
||||||
|
|
||||||
// networkResource is the body of the "get network" http response message
|
// networkResource is the body of the "get network" http response message
|
||||||
type networkResource struct {
|
type networkResource struct {
|
||||||
Name string
|
Name string `json:"name"`
|
||||||
ID string
|
ID string `json:"id"`
|
||||||
Type string
|
Type string `json:"type"`
|
||||||
Endpoints []*endpointResource
|
Endpoints []*endpointResource `json:"endpoints"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// endpointResource is the body of the "get endpoint" http response message
|
// endpointResource is the body of the "get endpoint" http response message
|
||||||
type endpointResource struct {
|
type endpointResource struct {
|
||||||
Name string
|
Name string `json:"name"`
|
||||||
ID string
|
ID string `json:"id"`
|
||||||
Network string
|
Network string `json:"network"`
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********
|
/***********
|
||||||
|
@ -27,41 +27,41 @@ type endpointResource struct {
|
||||||
|
|
||||||
// networkCreate is the expected body of the "create network" http request message
|
// networkCreate is the expected body of the "create network" http request message
|
||||||
type networkCreate struct {
|
type networkCreate struct {
|
||||||
Name string
|
Name string `json:"name"`
|
||||||
NetworkType string
|
NetworkType string `json:"network_type"`
|
||||||
Options map[string]interface{}
|
Options map[string]interface{} `json:"options"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// endpointCreate represents the body of the "create endpoint" http request message
|
// endpointCreate represents the body of the "create endpoint" http request message
|
||||||
type endpointCreate struct {
|
type endpointCreate struct {
|
||||||
Name string
|
Name string `json:"name"`
|
||||||
ExposedPorts []types.TransportPort
|
ExposedPorts []types.TransportPort `json:"exposed_ports"`
|
||||||
PortMapping []types.PortBinding
|
PortMapping []types.PortBinding `json:"port_mapping"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// endpointJoin represents the expected body of the "join endpoint" or "leave endpoint" http request messages
|
// endpointJoin represents the expected body of the "join endpoint" or "leave endpoint" http request messages
|
||||||
type endpointJoin struct {
|
type endpointJoin struct {
|
||||||
ContainerID string
|
ContainerID string `json:"container_id"`
|
||||||
HostName string
|
HostName string `json:"host_name"`
|
||||||
DomainName string
|
DomainName string `json:"domain_name"`
|
||||||
HostsPath string
|
HostsPath string `json:"hosts_path"`
|
||||||
ResolvConfPath string
|
ResolvConfPath string `json:"resolv_conf_path"`
|
||||||
DNS []string
|
DNS []string `json:"dns"`
|
||||||
ExtraHosts []endpointExtraHost
|
ExtraHosts []endpointExtraHost `json:"extra_hosts"`
|
||||||
ParentUpdates []endpointParentUpdate
|
ParentUpdates []endpointParentUpdate `json:"parent_updates"`
|
||||||
UseDefaultSandbox bool
|
UseDefaultSandbox bool `json:"use_default_sandbox"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// EndpointExtraHost represents the extra host object
|
// EndpointExtraHost represents the extra host object
|
||||||
type endpointExtraHost struct {
|
type endpointExtraHost struct {
|
||||||
Name string
|
Name string `json:"name"`
|
||||||
Address string
|
Address string `json:"address"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// EndpointParentUpdate is the object carrying the information about the
|
// EndpointParentUpdate is the object carrying the information about the
|
||||||
// endpoint parent that needs to be updated
|
// endpoint parent that needs to be updated
|
||||||
type endpointParentUpdate struct {
|
type endpointParentUpdate struct {
|
||||||
EndpointID string
|
EndpointID string `json:"endpoint_id"`
|
||||||
Name string
|
Name string `json:"name"`
|
||||||
Address string
|
Address string `json:"address"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,17 +8,17 @@ import "github.com/docker/libnetwork/types"
|
||||||
|
|
||||||
// networkResource is the body of the "get network" http response message
|
// networkResource is the body of the "get network" http response message
|
||||||
type networkResource struct {
|
type networkResource struct {
|
||||||
Name string
|
Name string `json:"name"`
|
||||||
ID string
|
ID string `json:"id"`
|
||||||
Type string
|
Type string `json:"type"`
|
||||||
Endpoints []*endpointResource
|
Endpoints []*endpointResource `json:"endpoints"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// endpointResource is the body of the "get endpoint" http response message
|
// endpointResource is the body of the "get endpoint" http response message
|
||||||
type endpointResource struct {
|
type endpointResource struct {
|
||||||
Name string
|
Name string `json:"name"`
|
||||||
ID string
|
ID string `json:"id"`
|
||||||
Network string
|
Network string `json:"network"`
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********
|
/***********
|
||||||
|
@ -27,42 +27,42 @@ type endpointResource struct {
|
||||||
|
|
||||||
// networkCreate is the expected body of the "create network" http request message
|
// networkCreate is the expected body of the "create network" http request message
|
||||||
type networkCreate struct {
|
type networkCreate struct {
|
||||||
Name string
|
Name string `json:"name"`
|
||||||
NetworkType string
|
NetworkType string `json:"network_type"`
|
||||||
Options map[string]interface{}
|
Options map[string]interface{} `json:"options"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// endpointCreate represents the body of the "create endpoint" http request message
|
// endpointCreate represents the body of the "create endpoint" http request message
|
||||||
type endpointCreate struct {
|
type endpointCreate struct {
|
||||||
Name string
|
Name string `json:"name"`
|
||||||
NetworkID string
|
NetworkID string `json:"network_id"`
|
||||||
ExposedPorts []types.TransportPort
|
ExposedPorts []types.TransportPort `json:"exposed_ports"`
|
||||||
PortMapping []types.PortBinding
|
PortMapping []types.PortBinding `json:"port_mapping"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// endpointJoin represents the expected body of the "join endpoint" or "leave endpoint" http request messages
|
// endpointJoin represents the expected body of the "join endpoint" or "leave endpoint" http request messages
|
||||||
type endpointJoin struct {
|
type endpointJoin struct {
|
||||||
ContainerID string
|
ContainerID string `json:"container_id"`
|
||||||
HostName string
|
HostName string `json:"host_name"`
|
||||||
DomainName string
|
DomainName string `json:"domain_name"`
|
||||||
HostsPath string
|
HostsPath string `json:"hosts_path"`
|
||||||
ResolvConfPath string
|
ResolvConfPath string `json:"resolv_conf_path"`
|
||||||
DNS []string
|
DNS []string `json:"dns"`
|
||||||
ExtraHosts []endpointExtraHost
|
ExtraHosts []endpointExtraHost `json:"extra_hosts"`
|
||||||
ParentUpdates []endpointParentUpdate
|
ParentUpdates []endpointParentUpdate `json:"parent_updates"`
|
||||||
UseDefaultSandbox bool
|
UseDefaultSandbox bool `json:"use_default_sandbox"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// EndpointExtraHost represents the extra host object
|
// EndpointExtraHost represents the extra host object
|
||||||
type endpointExtraHost struct {
|
type endpointExtraHost struct {
|
||||||
Name string
|
Name string `json:"name"`
|
||||||
Address string
|
Address string `json:"address"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// EndpointParentUpdate is the object carrying the information about the
|
// EndpointParentUpdate is the object carrying the information about the
|
||||||
// endpoint parent that needs to be updated
|
// endpoint parent that needs to be updated
|
||||||
type endpointParentUpdate struct {
|
type endpointParentUpdate struct {
|
||||||
EndpointID string
|
EndpointID string `json:"endpoint_id"`
|
||||||
Name string
|
Name string `json:"name"`
|
||||||
Address string
|
Address string `json:"address"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue