types.go 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. DriverOpts []string `json:"driver_opts"`
  33. NetworkOpts map[string]string `json:"network_opts"`
  34. }
  35. // serviceCreate represents the body of the "publish service" http request message
  36. type serviceCreate struct {
  37. Name string `json:"name"`
  38. MyAliases []string `json:"my_aliases"`
  39. Network string `json:"network_name"`
  40. ExposedPorts []types.TransportPort `json:"exposed_ports"`
  41. PortMapping []types.PortBinding `json:"port_mapping"`
  42. }
  43. // serviceAttach represents the expected body of the "attach/detach sandbox to/from service" http request messages
  44. type serviceAttach struct {
  45. SandboxID string `json:"sandbox_id"`
  46. Aliases []string `json:"aliases"`
  47. }
  48. // SandboxCreate is the body of the "post /sandboxes" http request message
  49. type SandboxCreate struct {
  50. ContainerID string `json:"container_id"`
  51. HostName string `json:"host_name"`
  52. DomainName string `json:"domain_name"`
  53. HostsPath string `json:"hosts_path"`
  54. ResolvConfPath string `json:"resolv_conf_path"`
  55. DNS []string `json:"dns"`
  56. ExtraHosts []extraHost `json:"extra_hosts"`
  57. UseDefaultSandbox bool `json:"use_default_sandbox"`
  58. }
  59. // extraHost represents the extra host object
  60. type extraHost struct {
  61. Name string `json:"name"`
  62. Address string `json:"address"`
  63. }
  64. // sandboxParentUpdate is the object carrying the information about the
  65. // sanbox parent that needs to be updated
  66. type sandboxParentUpdate struct {
  67. ContainerID string `json:"container_id"`
  68. Name string `json:"name"`
  69. Address string `json:"address"`
  70. }