github.com/ssdev-go/moby@v17.12.1-ce-rc2+incompatible/client/plugin_list.go (about) 1 package client 2 3 import ( 4 "encoding/json" 5 "net/url" 6 7 "github.com/docker/docker/api/types" 8 "github.com/docker/docker/api/types/filters" 9 "golang.org/x/net/context" 10 ) 11 12 // PluginList returns the installed plugins 13 func (cli *Client) PluginList(ctx context.Context, filter filters.Args) (types.PluginsListResponse, error) { 14 var plugins types.PluginsListResponse 15 query := url.Values{} 16 17 if filter.Len() > 0 { 18 filterJSON, err := filters.ToParamWithVersion(cli.version, filter) 19 if err != nil { 20 return plugins, err 21 } 22 query.Set("filters", filterJSON) 23 } 24 resp, err := cli.get(ctx, "/plugins", query, nil) 25 if err != nil { 26 return plugins, wrapResponseError(err, resp, "plugin", "") 27 } 28 29 err = json.NewDecoder(resp.body).Decode(&plugins) 30 ensureReaderClosed(resp) 31 return plugins, err 32 }