github.com/LazyboyChen7/engine@v17.12.1-ce-rc2+incompatible/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+"/json", nil, nil) 15 if err != nil { 16 return nil, nil, wrapResponseError(err, resp, "plugin", name) 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 }