Add volume API/CLI
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
parent
01fe6537f1
commit
1858b15498
2 changed files with 13 additions and 5 deletions
|
@ -15,10 +15,19 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
versionMimetype = "application/vnd.docker.plugins.v1+json"
|
||||
versionMimetype = "application/vnd.docker.plugins.v1.1+json"
|
||||
defaultTimeOut = 30
|
||||
)
|
||||
|
||||
type remoteError struct {
|
||||
method string
|
||||
err string
|
||||
}
|
||||
|
||||
func (e *remoteError) Error() string {
|
||||
return fmt.Sprintf("Plugin Error: %s, %s", e.err, e.method)
|
||||
}
|
||||
|
||||
// NewClient creates a new plugin client (http).
|
||||
func NewClient(addr string, tlsConfig tlsconfig.Options) (*Client, error) {
|
||||
tr := &http.Transport{}
|
||||
|
@ -84,9 +93,9 @@ func (c *Client) callWithRetry(serviceMethod string, args interface{}, ret inter
|
|||
if resp.StatusCode != http.StatusOK {
|
||||
remoteErr, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Plugin Error: %s", err)
|
||||
return &remoteError{err.Error(), serviceMethod}
|
||||
}
|
||||
return fmt.Errorf("Plugin Error: %s", remoteErr)
|
||||
return &remoteError{string(remoteErr), serviceMethod}
|
||||
}
|
||||
|
||||
return json.NewDecoder(resp.Body).Decode(&ret)
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
"go/parser"
|
||||
"go/token"
|
||||
"reflect"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var ErrBadReturn = errors.New("found return arg with no name: all args must be named")
|
||||
|
@ -39,7 +38,7 @@ type arg struct {
|
|||
}
|
||||
|
||||
func (a *arg) String() string {
|
||||
return strings.ToLower(a.Name) + " " + strings.ToLower(a.ArgType)
|
||||
return a.Name + " " + a.ArgType
|
||||
}
|
||||
|
||||
// Parses the given file for an interface definition with the given name
|
||||
|
|
Loading…
Reference in a new issue