types.go 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. 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. // endpointCreate represents the body of the "create endpoint" http request message
  44. type endpointCreate struct {
  45. Name string `json:"name"`
  46. MyAliases []string `json:"my_aliases"`
  47. }
  48. // sandboxCreate is the expected body of the "create sandbox" 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. UseExternalKey bool `json:"use_external_key"`
  59. ExposedPorts []types.TransportPort `json:"exposed_ports"`
  60. PortMapping []types.PortBinding `json:"port_mapping"`
  61. }
  62. // endpointJoin represents the expected body of the "join endpoint" or "leave endpoint" http request messages
  63. type endpointJoin struct {
  64. SandboxID string `json:"sandbox_id"`
  65. Aliases []string `json:"aliases"`
  66. }
  67. // servicePublish represents the body of the "publish service" http request message
  68. type servicePublish struct {
  69. Name string `json:"name"`
  70. MyAliases []string `json:"my_aliases"`
  71. Network string `json:"network_name"`
  72. }
  73. // serviceDelete represents the body of the "unpublish service" http request message
  74. type serviceDelete struct {
  75. Name string `json:"name"`
  76. Force bool `json:"force"`
  77. }
  78. // extraHost represents the extra host object
  79. type extraHost struct {
  80. Name string `json:"name"`
  81. Address string `json:"address"`
  82. }