types.go 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. package client
  2. import "github.com/docker/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. type ipamConf struct {
  29. PreferredPool string
  30. SubPool string
  31. Gateway string
  32. AuxAddresses map[string]string
  33. }
  34. // networkCreate is the expected body of the "create network" http request message
  35. type networkCreate struct {
  36. Name string `json:"name"`
  37. ID string `json:"id"`
  38. NetworkType string `json:"network_type"`
  39. IPv4Conf []ipamConf `json:"ipv4_configuration"`
  40. DriverOpts map[string]string `json:"driver_opts"`
  41. NetworkOpts map[string]string `json:"network_opts"`
  42. }
  43. // serviceCreate represents the body of the "publish service" http request message
  44. type serviceCreate struct {
  45. Name string `json:"name"`
  46. MyAliases []string `json:"my_aliases"`
  47. Network string `json:"network_name"`
  48. }
  49. // serviceDelete represents the body of the "unpublish service" http request message
  50. type serviceDelete struct {
  51. Name string `json:"name"`
  52. Force bool `json:"force"`
  53. }
  54. // serviceAttach represents the expected body of the "attach/detach sandbox to/from service" http request messages
  55. type serviceAttach struct {
  56. SandboxID string `json:"sandbox_id"`
  57. Aliases []string `json:"aliases"`
  58. }
  59. // SandboxCreate is the body of the "post /sandboxes" http request message
  60. type SandboxCreate struct {
  61. ContainerID string `json:"container_id"`
  62. HostName string `json:"host_name"`
  63. DomainName string `json:"domain_name"`
  64. HostsPath string `json:"hosts_path"`
  65. ResolvConfPath string `json:"resolv_conf_path"`
  66. DNS []string `json:"dns"`
  67. ExtraHosts []extraHost `json:"extra_hosts"`
  68. UseDefaultSandbox bool `json:"use_default_sandbox"`
  69. ExposedPorts []types.TransportPort `json:"exposed_ports"`
  70. PortMapping []types.PortBinding `json:"port_mapping"`
  71. }
  72. // extraHost represents the extra host object
  73. type extraHost struct {
  74. Name string `json:"name"`
  75. Address string `json:"address"`
  76. }