types.go 2.8 KB

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