proxy.go 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. // generated code - DO NOT EDIT
  2. package drivers // import "github.com/docker/docker/volume/drivers"
  3. import (
  4. "errors"
  5. "time"
  6. "github.com/docker/docker/pkg/plugins"
  7. "github.com/docker/docker/volume"
  8. )
  9. const (
  10. longTimeout = 2 * time.Minute
  11. shortTimeout = 1 * time.Minute
  12. )
  13. type client interface {
  14. CallWithOptions(string, interface{}, interface{}, ...func(*plugins.RequestOpts)) error
  15. }
  16. type volumeDriverProxy struct {
  17. client
  18. }
  19. type volumeDriverProxyCreateRequest struct {
  20. Name string
  21. Opts map[string]string
  22. }
  23. type volumeDriverProxyCreateResponse struct {
  24. Err string
  25. }
  26. func (pp *volumeDriverProxy) Create(name string, opts map[string]string) (err error) {
  27. var (
  28. req volumeDriverProxyCreateRequest
  29. ret volumeDriverProxyCreateResponse
  30. )
  31. req.Name = name
  32. req.Opts = opts
  33. if err = pp.CallWithOptions("VolumeDriver.Create", req, &ret, plugins.WithRequestTimeout(longTimeout)); err != nil {
  34. return
  35. }
  36. if ret.Err != "" {
  37. err = errors.New(ret.Err)
  38. }
  39. return
  40. }
  41. type volumeDriverProxyRemoveRequest struct {
  42. Name string
  43. }
  44. type volumeDriverProxyRemoveResponse struct {
  45. Err string
  46. }
  47. func (pp *volumeDriverProxy) Remove(name string) (err error) {
  48. var (
  49. req volumeDriverProxyRemoveRequest
  50. ret volumeDriverProxyRemoveResponse
  51. )
  52. req.Name = name
  53. if err = pp.CallWithOptions("VolumeDriver.Remove", req, &ret, plugins.WithRequestTimeout(shortTimeout)); err != nil {
  54. return
  55. }
  56. if ret.Err != "" {
  57. err = errors.New(ret.Err)
  58. }
  59. return
  60. }
  61. type volumeDriverProxyPathRequest struct {
  62. Name string
  63. }
  64. type volumeDriverProxyPathResponse struct {
  65. Mountpoint string
  66. Err string
  67. }
  68. func (pp *volumeDriverProxy) Path(name string) (mountpoint string, err error) {
  69. var (
  70. req volumeDriverProxyPathRequest
  71. ret volumeDriverProxyPathResponse
  72. )
  73. req.Name = name
  74. if err = pp.CallWithOptions("VolumeDriver.Path", req, &ret, plugins.WithRequestTimeout(shortTimeout)); err != nil {
  75. return
  76. }
  77. mountpoint = ret.Mountpoint
  78. if ret.Err != "" {
  79. err = errors.New(ret.Err)
  80. }
  81. return
  82. }
  83. type volumeDriverProxyMountRequest struct {
  84. Name string
  85. ID string
  86. }
  87. type volumeDriverProxyMountResponse struct {
  88. Mountpoint string
  89. Err string
  90. }
  91. func (pp *volumeDriverProxy) Mount(name string, id string) (mountpoint string, err error) {
  92. var (
  93. req volumeDriverProxyMountRequest
  94. ret volumeDriverProxyMountResponse
  95. )
  96. req.Name = name
  97. req.ID = id
  98. if err = pp.CallWithOptions("VolumeDriver.Mount", req, &ret, plugins.WithRequestTimeout(longTimeout)); err != nil {
  99. return
  100. }
  101. mountpoint = ret.Mountpoint
  102. if ret.Err != "" {
  103. err = errors.New(ret.Err)
  104. }
  105. return
  106. }
  107. type volumeDriverProxyUnmountRequest struct {
  108. Name string
  109. ID string
  110. }
  111. type volumeDriverProxyUnmountResponse struct {
  112. Err string
  113. }
  114. func (pp *volumeDriverProxy) Unmount(name string, id string) (err error) {
  115. var (
  116. req volumeDriverProxyUnmountRequest
  117. ret volumeDriverProxyUnmountResponse
  118. )
  119. req.Name = name
  120. req.ID = id
  121. if err = pp.CallWithOptions("VolumeDriver.Unmount", req, &ret, plugins.WithRequestTimeout(shortTimeout)); err != nil {
  122. return
  123. }
  124. if ret.Err != "" {
  125. err = errors.New(ret.Err)
  126. }
  127. return
  128. }
  129. type volumeDriverProxyListRequest struct{}
  130. type volumeDriverProxyListResponse struct {
  131. Volumes []*proxyVolume
  132. Err string
  133. }
  134. func (pp *volumeDriverProxy) List() (volumes []*proxyVolume, err error) {
  135. var (
  136. req volumeDriverProxyListRequest
  137. ret volumeDriverProxyListResponse
  138. )
  139. if err = pp.CallWithOptions("VolumeDriver.List", req, &ret, plugins.WithRequestTimeout(shortTimeout)); err != nil {
  140. return
  141. }
  142. volumes = ret.Volumes
  143. if ret.Err != "" {
  144. err = errors.New(ret.Err)
  145. }
  146. return
  147. }
  148. type volumeDriverProxyGetRequest struct {
  149. Name string
  150. }
  151. type volumeDriverProxyGetResponse struct {
  152. Volume *proxyVolume
  153. Err string
  154. }
  155. func (pp *volumeDriverProxy) Get(name string) (volume *proxyVolume, err error) {
  156. var (
  157. req volumeDriverProxyGetRequest
  158. ret volumeDriverProxyGetResponse
  159. )
  160. req.Name = name
  161. if err = pp.CallWithOptions("VolumeDriver.Get", req, &ret, plugins.WithRequestTimeout(shortTimeout)); err != nil {
  162. return
  163. }
  164. volume = ret.Volume
  165. if ret.Err != "" {
  166. err = errors.New(ret.Err)
  167. }
  168. return
  169. }
  170. type volumeDriverProxyCapabilitiesRequest struct{}
  171. type volumeDriverProxyCapabilitiesResponse struct {
  172. Capabilities volume.Capability
  173. Err string
  174. }
  175. func (pp *volumeDriverProxy) Capabilities() (capabilities volume.Capability, err error) {
  176. var (
  177. req volumeDriverProxyCapabilitiesRequest
  178. ret volumeDriverProxyCapabilitiesResponse
  179. )
  180. if err = pp.CallWithOptions("VolumeDriver.Capabilities", req, &ret, plugins.WithRequestTimeout(shortTimeout)); err != nil {
  181. return
  182. }
  183. capabilities = ret.Capabilities
  184. if ret.Err != "" {
  185. err = errors.New(ret.Err)
  186. }
  187. return
  188. }