types.go 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. // EndpointExtraHost represents the extra host object
  47. type endpointExtraHost struct {
  48. Name string `json:"name"`
  49. Address string `json:"address"`
  50. }
  51. // EndpointParentUpdate is the object carrying the information about the
  52. // endpoint parent that needs to be updated
  53. type endpointParentUpdate struct {
  54. EndpointID string `json:"endpoint_id"`
  55. Name string `json:"name"`
  56. Address string `json:"address"`
  57. }