api_params.go 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. package docker
  2. import "encoding/json"
  3. type APIHistory struct {
  4. ID string `json:"Id"`
  5. Tags []string `json:",omitempty"`
  6. Created int64
  7. CreatedBy string `json:",omitempty"`
  8. }
  9. type APIImages struct {
  10. Repository string `json:",omitempty"`
  11. Tag string `json:",omitempty"`
  12. ID string `json:"Id"`
  13. Created int64
  14. Size int64
  15. VirtualSize int64
  16. }
  17. type APIInfo struct {
  18. Debug bool
  19. Containers int
  20. Images int
  21. NFd int `json:",omitempty"`
  22. NGoroutines int `json:",omitempty"`
  23. MemoryLimit bool `json:",omitempty"`
  24. SwapLimit bool `json:",omitempty"`
  25. IPv4Forwarding bool `json:",omitempty"`
  26. LXCVersion string `json:",omitempty"`
  27. NEventsListener int `json:",omitempty"`
  28. KernelVersion string `json:",omitempty"`
  29. IndexServerAddress string `json:",omitempty"`
  30. }
  31. type APITop struct {
  32. Titles []string
  33. Processes [][]string
  34. }
  35. type APIRmi struct {
  36. Deleted string `json:",omitempty"`
  37. Untagged string `json:",omitempty"`
  38. }
  39. type APIContainers struct {
  40. ID string `json:"Id"`
  41. Image string
  42. Command string
  43. Created int64
  44. Status string
  45. Ports []APIPort
  46. SizeRw int64
  47. SizeRootFs int64
  48. }
  49. func (self *APIContainers) ToLegacy() APIContainersOld {
  50. return APIContainersOld{
  51. ID: self.ID,
  52. Image: self.Image,
  53. Command: self.Command,
  54. Created: self.Created,
  55. Status: self.Status,
  56. Ports: displayablePorts(self.Ports),
  57. SizeRw: self.SizeRw,
  58. SizeRootFs: self.SizeRootFs,
  59. }
  60. }
  61. type APIContainersOld struct {
  62. ID string `json:"Id"`
  63. Image string
  64. Command string
  65. Created int64
  66. Status string
  67. Ports string
  68. SizeRw int64
  69. SizeRootFs int64
  70. }
  71. type APISearch struct {
  72. Name string
  73. Description string
  74. }
  75. type APIID struct {
  76. ID string `json:"Id"`
  77. }
  78. type APIRun struct {
  79. ID string `json:"Id"`
  80. Warnings []string `json:",omitempty"`
  81. }
  82. type APIPort struct {
  83. PrivatePort int64
  84. PublicPort int64
  85. Type string
  86. }
  87. func (port *APIPort) MarshalJSON() ([]byte, error) {
  88. return json.Marshal(map[string]interface{}{
  89. "PrivatePort": port.PrivatePort,
  90. "PublicPort": port.PublicPort,
  91. "Type": port.Type,
  92. })
  93. }
  94. type APIVersion struct {
  95. Version string
  96. GitCommit string `json:",omitempty"`
  97. GoVersion string `json:",omitempty"`
  98. }
  99. type APIWait struct {
  100. StatusCode int
  101. }
  102. type APIAuth struct {
  103. Status string
  104. }
  105. type APIImageConfig struct {
  106. ID string `json:"Id"`
  107. *Config
  108. }
  109. type APICopy struct {
  110. Resource string
  111. HostPath string
  112. }