2015-06-10 09:46:54 -04:00
|
|
|
// generated code - DO NOT EDIT
|
|
|
|
|
2018-03-19 17:16:26 -04:00
|
|
|
package drivers // import "github.com/docker/docker/volume/drivers"
|
2015-05-19 16:05:25 -04:00
|
|
|
|
2016-04-11 11:17:52 -04:00
|
|
|
import (
|
|
|
|
"errors"
|
2017-11-08 11:46:46 -05:00
|
|
|
"time"
|
2016-11-22 14:21:34 -05:00
|
|
|
|
2017-11-08 11:46:46 -05:00
|
|
|
"github.com/docker/docker/pkg/plugins"
|
2016-04-11 11:17:52 -04:00
|
|
|
"github.com/docker/docker/volume"
|
|
|
|
)
|
2015-05-22 13:37:00 -04:00
|
|
|
|
2017-11-08 11:46:46 -05:00
|
|
|
const (
|
|
|
|
longTimeout = 2 * time.Minute
|
|
|
|
shortTimeout = 1 * time.Minute
|
|
|
|
)
|
|
|
|
|
2015-06-10 09:46:54 -04:00
|
|
|
type client interface {
|
2017-11-08 11:46:46 -05:00
|
|
|
CallWithOptions(string, interface{}, interface{}, ...func(*plugins.RequestOpts)) error
|
2015-06-10 09:46:54 -04:00
|
|
|
}
|
2015-05-19 16:05:25 -04:00
|
|
|
|
2015-06-10 09:46:54 -04:00
|
|
|
type volumeDriverProxy struct {
|
|
|
|
client
|
2015-05-19 16:05:25 -04:00
|
|
|
}
|
|
|
|
|
2015-06-10 09:46:54 -04:00
|
|
|
type volumeDriverProxyCreateRequest struct {
|
|
|
|
Name string
|
2016-04-09 17:42:24 -04:00
|
|
|
Opts map[string]string
|
2015-05-19 16:05:25 -04:00
|
|
|
}
|
|
|
|
|
2015-06-10 09:46:54 -04:00
|
|
|
type volumeDriverProxyCreateResponse struct {
|
|
|
|
Err string
|
2015-05-19 16:05:25 -04:00
|
|
|
}
|
|
|
|
|
2016-04-09 17:42:24 -04:00
|
|
|
func (pp *volumeDriverProxy) Create(name string, opts map[string]string) (err error) {
|
2015-06-10 09:46:54 -04:00
|
|
|
var (
|
|
|
|
req volumeDriverProxyCreateRequest
|
|
|
|
ret volumeDriverProxyCreateResponse
|
|
|
|
)
|
|
|
|
|
|
|
|
req.Name = name
|
2015-06-12 09:25:32 -04:00
|
|
|
req.Opts = opts
|
2017-11-08 11:46:46 -05:00
|
|
|
|
|
|
|
if err = pp.CallWithOptions("VolumeDriver.Create", req, &ret, plugins.WithRequestTimeout(longTimeout)); err != nil {
|
2015-06-10 09:46:54 -04:00
|
|
|
return
|
2015-05-19 16:05:25 -04:00
|
|
|
}
|
|
|
|
|
2015-06-10 09:46:54 -04:00
|
|
|
if ret.Err != "" {
|
|
|
|
err = errors.New(ret.Err)
|
2015-05-19 16:05:25 -04:00
|
|
|
}
|
2015-06-10 09:46:54 -04:00
|
|
|
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
type volumeDriverProxyRemoveRequest struct {
|
|
|
|
Name string
|
2015-05-19 16:05:25 -04:00
|
|
|
}
|
|
|
|
|
2015-06-10 09:46:54 -04:00
|
|
|
type volumeDriverProxyRemoveResponse struct {
|
|
|
|
Err string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (pp *volumeDriverProxy) Remove(name string) (err error) {
|
|
|
|
var (
|
|
|
|
req volumeDriverProxyRemoveRequest
|
|
|
|
ret volumeDriverProxyRemoveResponse
|
|
|
|
)
|
|
|
|
|
|
|
|
req.Name = name
|
2017-11-08 11:46:46 -05:00
|
|
|
|
|
|
|
if err = pp.CallWithOptions("VolumeDriver.Remove", req, &ret, plugins.WithRequestTimeout(shortTimeout)); err != nil {
|
2015-06-10 09:46:54 -04:00
|
|
|
return
|
2015-05-19 16:05:25 -04:00
|
|
|
}
|
2015-06-10 09:46:54 -04:00
|
|
|
|
|
|
|
if ret.Err != "" {
|
|
|
|
err = errors.New(ret.Err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return
|
2015-05-19 16:05:25 -04:00
|
|
|
}
|
|
|
|
|
2015-06-10 09:46:54 -04:00
|
|
|
type volumeDriverProxyPathRequest struct {
|
|
|
|
Name string
|
|
|
|
}
|
|
|
|
|
|
|
|
type volumeDriverProxyPathResponse struct {
|
|
|
|
Mountpoint string
|
|
|
|
Err string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (pp *volumeDriverProxy) Path(name string) (mountpoint string, err error) {
|
|
|
|
var (
|
|
|
|
req volumeDriverProxyPathRequest
|
|
|
|
ret volumeDriverProxyPathResponse
|
|
|
|
)
|
|
|
|
|
|
|
|
req.Name = name
|
2017-11-08 11:46:46 -05:00
|
|
|
|
|
|
|
if err = pp.CallWithOptions("VolumeDriver.Path", req, &ret, plugins.WithRequestTimeout(shortTimeout)); err != nil {
|
2015-06-10 09:46:54 -04:00
|
|
|
return
|
2015-05-19 16:05:25 -04:00
|
|
|
}
|
2015-06-10 09:46:54 -04:00
|
|
|
|
|
|
|
mountpoint = ret.Mountpoint
|
|
|
|
|
|
|
|
if ret.Err != "" {
|
|
|
|
err = errors.New(ret.Err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
type volumeDriverProxyMountRequest struct {
|
|
|
|
Name string
|
2016-03-07 21:41:44 -05:00
|
|
|
ID string
|
2015-06-10 09:46:54 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
type volumeDriverProxyMountResponse struct {
|
|
|
|
Mountpoint string
|
|
|
|
Err string
|
2015-05-19 16:05:25 -04:00
|
|
|
}
|
|
|
|
|
2016-03-07 21:41:44 -05:00
|
|
|
func (pp *volumeDriverProxy) Mount(name string, id string) (mountpoint string, err error) {
|
2015-06-10 09:46:54 -04:00
|
|
|
var (
|
|
|
|
req volumeDriverProxyMountRequest
|
|
|
|
ret volumeDriverProxyMountResponse
|
|
|
|
)
|
|
|
|
|
|
|
|
req.Name = name
|
2016-03-07 21:41:44 -05:00
|
|
|
req.ID = id
|
2017-11-08 11:46:46 -05:00
|
|
|
|
|
|
|
if err = pp.CallWithOptions("VolumeDriver.Mount", req, &ret, plugins.WithRequestTimeout(longTimeout)); err != nil {
|
2015-06-10 09:46:54 -04:00
|
|
|
return
|
2015-05-22 13:37:00 -04:00
|
|
|
}
|
2015-06-10 09:46:54 -04:00
|
|
|
|
|
|
|
mountpoint = ret.Mountpoint
|
|
|
|
|
|
|
|
if ret.Err != "" {
|
|
|
|
err = errors.New(ret.Err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
type volumeDriverProxyUnmountRequest struct {
|
|
|
|
Name string
|
2016-03-07 21:41:44 -05:00
|
|
|
ID string
|
2015-05-22 13:37:00 -04:00
|
|
|
}
|
|
|
|
|
2015-06-10 09:46:54 -04:00
|
|
|
type volumeDriverProxyUnmountResponse struct {
|
|
|
|
Err string
|
|
|
|
}
|
|
|
|
|
2016-03-07 21:41:44 -05:00
|
|
|
func (pp *volumeDriverProxy) Unmount(name string, id string) (err error) {
|
2015-06-10 09:46:54 -04:00
|
|
|
var (
|
|
|
|
req volumeDriverProxyUnmountRequest
|
|
|
|
ret volumeDriverProxyUnmountResponse
|
|
|
|
)
|
|
|
|
|
|
|
|
req.Name = name
|
2016-03-07 21:41:44 -05:00
|
|
|
req.ID = id
|
2017-11-08 11:46:46 -05:00
|
|
|
|
|
|
|
if err = pp.CallWithOptions("VolumeDriver.Unmount", req, &ret, plugins.WithRequestTimeout(shortTimeout)); err != nil {
|
2015-06-10 09:46:54 -04:00
|
|
|
return
|
2015-05-19 16:05:25 -04:00
|
|
|
}
|
2015-06-10 09:46:54 -04:00
|
|
|
|
|
|
|
if ret.Err != "" {
|
|
|
|
err = errors.New(ret.Err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return
|
2015-05-19 16:05:25 -04:00
|
|
|
}
|
2015-09-23 16:29:14 -04:00
|
|
|
|
|
|
|
type volumeDriverProxyListRequest struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
type volumeDriverProxyListResponse struct {
|
2016-04-09 17:42:24 -04:00
|
|
|
Volumes []*proxyVolume
|
2015-09-23 16:29:14 -04:00
|
|
|
Err string
|
|
|
|
}
|
|
|
|
|
2016-04-09 17:42:24 -04:00
|
|
|
func (pp *volumeDriverProxy) List() (volumes []*proxyVolume, err error) {
|
2015-09-23 16:29:14 -04:00
|
|
|
var (
|
|
|
|
req volumeDriverProxyListRequest
|
|
|
|
ret volumeDriverProxyListResponse
|
|
|
|
)
|
|
|
|
|
2017-11-08 11:46:46 -05:00
|
|
|
if err = pp.CallWithOptions("VolumeDriver.List", req, &ret, plugins.WithRequestTimeout(shortTimeout)); err != nil {
|
2015-09-23 16:29:14 -04:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
volumes = ret.Volumes
|
|
|
|
|
|
|
|
if ret.Err != "" {
|
|
|
|
err = errors.New(ret.Err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
type volumeDriverProxyGetRequest struct {
|
|
|
|
Name string
|
|
|
|
}
|
|
|
|
|
|
|
|
type volumeDriverProxyGetResponse struct {
|
|
|
|
Volume *proxyVolume
|
|
|
|
Err string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (pp *volumeDriverProxy) Get(name string) (volume *proxyVolume, err error) {
|
|
|
|
var (
|
|
|
|
req volumeDriverProxyGetRequest
|
|
|
|
ret volumeDriverProxyGetResponse
|
|
|
|
)
|
|
|
|
|
|
|
|
req.Name = name
|
2017-11-08 11:46:46 -05:00
|
|
|
|
|
|
|
if err = pp.CallWithOptions("VolumeDriver.Get", req, &ret, plugins.WithRequestTimeout(shortTimeout)); err != nil {
|
2015-09-23 16:29:14 -04:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
volume = ret.Volume
|
|
|
|
|
|
|
|
if ret.Err != "" {
|
|
|
|
err = errors.New(ret.Err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return
|
|
|
|
}
|
2016-04-11 11:17:52 -04:00
|
|
|
|
|
|
|
type volumeDriverProxyCapabilitiesRequest struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
type volumeDriverProxyCapabilitiesResponse struct {
|
|
|
|
Capabilities volume.Capability
|
|
|
|
Err string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (pp *volumeDriverProxy) Capabilities() (capabilities volume.Capability, err error) {
|
|
|
|
var (
|
|
|
|
req volumeDriverProxyCapabilitiesRequest
|
|
|
|
ret volumeDriverProxyCapabilitiesResponse
|
|
|
|
)
|
|
|
|
|
2017-11-08 11:46:46 -05:00
|
|
|
if err = pp.CallWithOptions("VolumeDriver.Capabilities", req, &ret, plugins.WithRequestTimeout(shortTimeout)); err != nil {
|
2016-04-11 11:17:52 -04:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
capabilities = ret.Capabilities
|
|
|
|
|
|
|
|
if ret.Err != "" {
|
|
|
|
err = errors.New(ret.Err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return
|
|
|
|
}
|