types.go 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. /***********
  20. Body types
  21. ************/
  22. // networkCreate is the expected body of the "create network" http request message
  23. type networkCreate struct {
  24. Name string `json:"name"`
  25. NetworkType string `json:"network_type"`
  26. Options map[string]interface{} `json:"options"`
  27. }
  28. // endpointCreate represents the body of the "create endpoint" http request message
  29. type endpointCreate struct {
  30. Name string `json:"name"`
  31. ExposedPorts []types.TransportPort `json:"exposed_ports"`
  32. PortMapping []types.PortBinding `json:"port_mapping"`
  33. }
  34. // endpointJoin represents the expected body of the "join endpoint" or "leave endpoint" http request messages
  35. type endpointJoin struct {
  36. ContainerID string `json:"container_id"`
  37. HostName string `json:"host_name"`
  38. DomainName string `json:"domain_name"`
  39. HostsPath string `json:"hosts_path"`
  40. ResolvConfPath string `json:"resolv_conf_path"`
  41. DNS []string `json:"dns"`
  42. ExtraHosts []endpointExtraHost `json:"extra_hosts"`
  43. ParentUpdates []endpointParentUpdate `json:"parent_updates"`
  44. UseDefaultSandbox bool `json:"use_default_sandbox"`
  45. }
  46. // servicePublish represents the body of the "publish service" http request message
  47. type servicePublish struct {
  48. Name string `json:"name"`
  49. Network string `json:"network"`
  50. ExposedPorts []types.TransportPort `json:"exposed_ports"`
  51. PortMapping []types.PortBinding `json:"port_mapping"`
  52. }
  53. // EndpointExtraHost represents the extra host object
  54. type endpointExtraHost struct {
  55. Name string `json:"name"`
  56. Address string `json:"address"`
  57. }
  58. // EndpointParentUpdate is the object carrying the information about the
  59. // endpoint parent that needs to be updated
  60. type endpointParentUpdate struct {
  61. EndpointID string `json:"endpoint_id"`
  62. Name string `json:"name"`
  63. Address string `json:"address"`
  64. }