types.go 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. package client
  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. Services []*serviceResource `json:"services"`
  12. }
  13. // serviceResource is the body of the "get service" http response message
  14. type serviceResource 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. Options map[string]interface{} `json:"options"`
  33. }
  34. // serviceCreate represents the body of the "publish service" http request message
  35. type serviceCreate struct {
  36. Name string `json:"name"`
  37. Network string `json:"network_name"`
  38. ExposedPorts []types.TransportPort `json:"exposed_ports"`
  39. PortMapping []types.PortBinding `json:"port_mapping"`
  40. }
  41. // serviceAttach represents the expected body of the "attach/detach sandbox to/from service" http request messages
  42. type serviceAttach struct {
  43. SandboxID string `json:"sandbox_id"`
  44. }
  45. type sandboxCreate struct {
  46. ContainerID string `json:"container_id"`
  47. HostName string `json:"host_name"`
  48. DomainName string `json:"domain_name"`
  49. HostsPath string `json:"hosts_path"`
  50. ResolvConfPath string `json:"resolv_conf_path"`
  51. DNS []string `json:"dns"`
  52. ExtraHosts []extraHost `json:"extra_hosts"`
  53. UseDefaultSandbox bool `json:"use_default_sandbox"`
  54. }
  55. // extraHost represents the extra host object
  56. type extraHost struct {
  57. Name string `json:"name"`
  58. Address string `json:"address"`
  59. }
  60. // sandboxParentUpdate is the object carrying the information about the
  61. // sanbox parent that needs to be updated
  62. type sandboxParentUpdate struct {
  63. ContainerID string `json:"container_id"`
  64. Name string `json:"name"`
  65. Address string `json:"address"`
  66. }