types.go 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. DriverOpts map[string]string `json:"driver_opts"`
  33. NetworkOpts map[string]string `json:"network_opts"`
  34. }
  35. // endpointCreate represents the body of the "create endpoint" http request message
  36. type endpointCreate struct {
  37. Name string `json:"name"`
  38. MyAliases []string `json:"my_aliases"`
  39. ExposedPorts []types.TransportPort `json:"exposed_ports"`
  40. PortMapping []types.PortBinding `json:"port_mapping"`
  41. }
  42. // sandboxCreate is the expected body of the "create sandbox" http request message
  43. type sandboxCreate struct {
  44. ContainerID string `json:"container_id"`
  45. HostName string `json:"host_name"`
  46. DomainName string `json:"domain_name"`
  47. HostsPath string `json:"hosts_path"`
  48. ResolvConfPath string `json:"resolv_conf_path"`
  49. DNS []string `json:"dns"`
  50. ExtraHosts []extraHost `json:"extra_hosts"`
  51. UseDefaultSandbox bool `json:"use_default_sandbox"`
  52. UseExternalKey bool `json:"use_external_key"`
  53. }
  54. // endpointJoin represents the expected body of the "join endpoint" or "leave endpoint" http request messages
  55. type endpointJoin struct {
  56. SandboxID string `json:"sandbox_id"`
  57. Aliases []string `json:"aliases"`
  58. }
  59. // servicePublish represents the body of the "publish service" http request message
  60. type servicePublish struct {
  61. Name string `json:"name"`
  62. MyAliases []string `json:"my_aliases"`
  63. Network string `json:"network_name"`
  64. ExposedPorts []types.TransportPort `json:"exposed_ports"`
  65. PortMapping []types.PortBinding `json:"port_mapping"`
  66. }
  67. // serviceDelete represents the body of the "unpublish service" http request message
  68. type serviceDelete struct {
  69. Name string `json:"name"`
  70. Force bool `json:"force"`
  71. }
  72. // extraHost represents the extra host object
  73. type extraHost struct {
  74. Name string `json:"name"`
  75. Address string `json:"address"`
  76. }