github.com/kim0/docker@v0.6.2-0.20161130212042-4addda3f07e7/client/plugin_inspect.go (about) 1 package client 2 3 import ( 4 "bytes" 5 "encoding/json" 6 "io/ioutil" 7 8 "github.com/docker/docker/api/types" 9 "golang.org/x/net/context" 10 ) 11 12 // PluginInspectWithRaw inspects an existing plugin 13 func (cli *Client) PluginInspectWithRaw(ctx context.Context, name string) (*types.Plugin, []byte, error) { 14 resp, err := cli.get(ctx, "/plugins/"+name, nil, nil) 15 if err != nil { 16 return nil, nil, err 17 } 18 19 defer ensureReaderClosed(resp) 20 body, err := ioutil.ReadAll(resp.body) 21 if err != nil { 22 return nil, nil, err 23 } 24 var p types.Plugin 25 rdr := bytes.NewReader(body) 26 err = json.NewDecoder(rdr).Decode(&p) 27 return &p, body, err 28 }