forked from toolshed/abra
refactor: migrate JSON function to new package
We now use it to help read remote docker registries also.
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"github.com/docker/distribution/reference"
|
||||
"fmt"
|
||||
|
||||
"coopcloud.tech/abra/web"
|
||||
)
|
||||
|
||||
type Tag struct {
|
||||
@ -13,7 +15,13 @@ type Tags []Tag
|
||||
|
||||
var registryURL = "https://registry.hub.docker.com/v1/repositories/%s/tags"
|
||||
|
||||
func ReadRegistryTags(image reference.Named, target interface{}) ([]string, error) {
|
||||
// tagsUrl := fmt.Sprintf(registryURL, image.Name())
|
||||
return nil, nil
|
||||
func GetRegistryTags(image string) (Tags, error) {
|
||||
var tags Tags
|
||||
|
||||
tagsUrl := fmt.Sprintf(registryURL, image)
|
||||
if err := web.ReadJSON(tagsUrl, &tags); err != nil {
|
||||
return tags, err
|
||||
}
|
||||
|
||||
return tags, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user