github.com/Shopify/docker@v1.13.1/volume/drivers/proxy.go (about)

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