types.go 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. }
  25. /***********
  26. Body types
  27. ************/
  28. // networkCreate is the expected body of the "create network" http request message
  29. type networkCreate struct {
  30. Name string `json:"name"`
  31. NetworkType string `json:"network_type"`
  32. Labels []string `json:"labels"`
  33. }
  34. // endpointCreate represents the body of the "create endpoint" http request message
  35. type endpointCreate struct {
  36. Name string `json:"name"`
  37. ExposedPorts []types.TransportPort `json:"exposed_ports"`
  38. PortMapping []types.PortBinding `json:"port_mapping"`
  39. }
  40. // sandboxCreate is the expected body of the "create sandbox" http request message
  41. type sandboxCreate struct {
  42. ContainerID string `json:"container_id"`
  43. HostName string `json:"host_name"`
  44. DomainName string `json:"domain_name"`
  45. HostsPath string `json:"hosts_path"`
  46. ResolvConfPath string `json:"resolv_conf_path"`
  47. DNS []string `json:"dns"`
  48. ExtraHosts []extraHost `json:"extra_hosts"`
  49. UseDefaultSandbox bool `json:"use_default_sandbox"`
  50. UseExternalKey bool `json:"use_external_key"`
  51. }
  52. // endpointJoin represents the expected body of the "join endpoint" or "leave endpoint" http request messages
  53. type endpointJoin struct {
  54. SandboxID string `json:"sandbox_id"`
  55. }
  56. // servicePublish represents the body of the "publish service" http request message
  57. type servicePublish struct {
  58. Name string `json:"name"`
  59. Network string `json:"network_name"`
  60. ExposedPorts []types.TransportPort `json:"exposed_ports"`
  61. PortMapping []types.PortBinding `json:"port_mapping"`
  62. }
  63. // extraHost represents the extra host object
  64. type extraHost struct {
  65. Name string `json:"name"`
  66. Address string `json:"address"`
  67. }