github.com/portworx/docker@v1.12.1/volume/drivers/proxy.go (about)

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