diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-04-14 14:51:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-14 14:51:39 +0200 |
commit | 85c352d8bcffbf1593964e047763947d76d466e3 (patch) | |
tree | baf14f0d0433c0ab2b25dc5ea788e7cb66780c0c /pkg/bindings/images/search.go | |
parent | 004826653f2a8b064af8c1f055b1a402f4060d1c (diff) | |
parent | ff52b7524a8b6db7bb58eeda2b9328730a54c611 (diff) | |
download | podman-85c352d8bcffbf1593964e047763947d76d466e3.tar.gz podman-85c352d8bcffbf1593964e047763947d76d466e3.tar.bz2 podman-85c352d8bcffbf1593964e047763947d76d466e3.zip |
Merge pull request #5709 from vrothberg/v2-search
podmanV2: implement search
Diffstat (limited to 'pkg/bindings/images/search.go')
-rw-r--r-- | pkg/bindings/images/search.go | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/pkg/bindings/images/search.go b/pkg/bindings/images/search.go deleted file mode 100644 index 183ff3d77..000000000 --- a/pkg/bindings/images/search.go +++ /dev/null @@ -1,41 +0,0 @@ -package images - -import ( - "context" - "net/http" - "net/url" - "strconv" - - "github.com/containers/libpod/libpod/image" - "github.com/containers/libpod/pkg/bindings" -) - -// Search looks for the given image (term) in container image registries. The optional limit parameter sets -// a maximum number of results returned. The optional filters parameter allow for more specific image -// searches. -func Search(ctx context.Context, term string, limit *int, filters map[string][]string) ([]image.SearchResult, error) { - var ( - searchResults []image.SearchResult - ) - conn, err := bindings.GetClient(ctx) - if err != nil { - return nil, err - } - params := url.Values{} - params.Set("term", term) - if limit != nil { - params.Set("limit", strconv.Itoa(*limit)) - } - if filters != nil { - stringFilter, err := bindings.FiltersToString(filters) - if err != nil { - return nil, err - } - params.Set("filters", stringFilter) - } - response, err := conn.DoRequest(nil, http.MethodGet, "/images/search", params) - if err != nil { - return searchResults, nil - } - return searchResults, response.Process(&searchResults) -} |