mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Add a new type to use for building filter predicates for API requests, replacing "./api/types/filters".Args in the client. Remove the now unused api/types/filters package. Signed-off-by: Cory Snider <csnider@mirantis.com>
26 lines
539 B
Go
26 lines
539 B
Go
package client
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"net/url"
|
|
|
|
"github.com/moby/moby/api/types/plugin"
|
|
)
|
|
|
|
// PluginList returns the installed plugins
|
|
func (cli *Client) PluginList(ctx context.Context, filter Filters) (plugin.ListResponse, error) {
|
|
var plugins plugin.ListResponse
|
|
query := url.Values{}
|
|
|
|
filter.updateURLValues(query)
|
|
resp, err := cli.get(ctx, "/plugins", query, nil)
|
|
defer ensureReaderClosed(resp)
|
|
if err != nil {
|
|
return plugins, err
|
|
}
|
|
|
|
err = json.NewDecoder(resp.Body).Decode(&plugins)
|
|
return plugins, err
|
|
}
|