Add volume API/CLI

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
Brian Goff
2015-08-26 13:37:52 -04:00
parent 7ef08f39ed
commit b3b7eb2723
49 changed files with 1455 additions and 394 deletions
+12 -3
View File
@@ -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)
+1 -2
View File
@@ -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