types.go 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. package api
  2. import "github.com/docker/libnetwork/types"
  3. /***********
  4. Resources
  5. ************/
  6. // networkResource is the body of the "get network" http response message
  7. type networkResource struct {
  8. Name string `json:"name"`
  9. ID string `json:"id"`
  10. Type string `json:"type"`
  11. Endpoints []*endpointResource `json:"endpoints"`
  12. }
  13. // endpointResource is the body of the "get endpoint" http response message
  14. type endpointResource struct {
  15. Name string `json:"name"`
  16. ID string `json:"id"`
  17. Network string `json:"network"`
  18. }
  19. // sandboxResource is the body of "get service backend" response message
  20. type sandboxResource struct {
  21. ID string `json:"id"`
  22. Key string `json:"key"`
  23. ContainerID string `json:"container_id"`
  24. // will add more fields once labels change is in
  25. }
  26. /***********
  27. Body types
  28. ************/
  29. // networkCreate is the expected body of the "create network" http request message
  30. type networkCreate struct {
  31. Name string `json:"name"`
  32. NetworkType string `json:"network_type"`
  33. Options map[string]interface{} `json:"options"`
  34. }
  35. // endpointCreate represents the body of the "create endpoint" http request message
  36. type endpointCreate struct {
  37. Name string `json:"name"`
  38. ExposedPorts []types.TransportPort `json:"exposed_ports"`
  39. PortMapping []types.PortBinding `json:"port_mapping"`
  40. }
  41. // sandboxCreate is the expected body of the "create sandbox" http request message
  42. type sandboxCreate struct {
  43. ContainerID string `json:"container_id"`
  44. HostName string `json:"host_name"`
  45. DomainName string `json:"domain_name"`
  46. HostsPath string `json:"hosts_path"`
  47. ResolvConfPath string `json:"resolv_conf_path"`
  48. DNS []string `json:"dns"`
  49. ExtraHosts []extraHost `json:"extra_hosts"`
  50. UseDefaultSandbox bool `json:"use_default_sandbox"`
  51. UseExternalKey bool `json:"use_external_key"`
  52. }
  53. // endpointJoin represents the expected body of the "join endpoint" or "leave endpoint" http request messages
  54. type endpointJoin struct {
  55. SandboxID string `json:"sandbox_id"`
  56. }
  57. // servicePublish represents the body of the "publish service" http request message
  58. type servicePublish struct {
  59. Name string `json:"name"`
  60. Network string `json:"network_name"`
  61. ExposedPorts []types.TransportPort `json:"exposed_ports"`
  62. PortMapping []types.PortBinding `json:"port_mapping"`
  63. }
  64. // extraHost represents the extra host object
  65. type extraHost struct {
  66. Name string `json:"name"`
  67. Address string `json:"address"`
  68. }