2016-09-05 22:44:19 -04:00
|
|
|
package registry
|
|
|
|
|
2018-12-29 12:09:10 -05:00
|
|
|
import "context"
|
|
|
|
|
2016-09-05 22:44:19 -04:00
|
|
|
type tagsResponse struct {
|
|
|
|
Tags []string `json:"tags"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// Tags returns the tags for a specific repository.
|
2018-12-29 12:09:10 -05:00
|
|
|
func (r *Registry) Tags(ctx context.Context, repository string) ([]string, error) {
|
2016-09-05 22:44:19 -04:00
|
|
|
url := r.url("/v2/%s/tags/list", repository)
|
|
|
|
r.Logf("registry.tags url=%s repository=%s", url, repository)
|
|
|
|
|
|
|
|
var response tagsResponse
|
2018-12-29 12:09:10 -05:00
|
|
|
if _, err := r.getJSON(ctx, url, &response); err != nil {
|
2016-09-05 22:44:19 -04:00
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return response.Tags, nil
|
|
|
|
}
|