Documentation
¶
Overview ¶
Package registrycatalog implements a minimal client for the Docker Registry HTTP API v2's catalog endpoints (_catalog, <name>/tags/list), used to browse repositories and tags in Levelrail's own built-in registry (internal/reconcile/registry) from the app-creation UI. Deliberately scoped to that one registry: see internal/api's RegistryCatalogClient interface doc comment for why an arbitrary external registry's catalog isn't queried the same way.
Index ¶
- Constants
- Variables
- func AllowPrivate() bool
- type Client
- func (c *Client) ListRepositories(ctx context.Context, baseURL, username, password string) ([]string, error)
- func (c *Client) ListTags(ctx context.Context, baseURL, username, password, repository string) ([]string, error)
- func (c *Client) ListTagsAnonymous(ctx context.Context, baseURL, repository string) ([]string, error)
- type RateLimitError
Constants ¶
const AllowPrivateEnv = "APP_REGISTRY_ALLOW_PRIVATE_NETWORKS"
AllowPrivateEnv additionally lets operators use registries on loopback. Private LAN ranges are allowed by default; link-local and metadata addresses are always refused.
Variables ¶
var ErrNotFound = errors.New("registrycatalog: repository not found")
ErrNotFound reports that the registry has no such repository, the v2 API's own signal (a 404 from tags/list) for a name nothing has ever been pushed to, distinct from an unreachable registry or a rejected credential.
Functions ¶
func AllowPrivate ¶
func AllowPrivate() bool
AllowPrivate reports whether AllowPrivateEnv is set to a true value.
Types ¶
type Client ¶
Client queries a Docker Registry HTTP API v2 server's catalog endpoints over Basic Auth.
func NewClient ¶
func NewClient() *Client
NewClient returns a Client with a bounded per-request timeout: every call here is a single small JSON request, not a long-lived stream, the same shape githubapp.NewClient establishes for its own client.
func NewExternalClient ¶
func NewExternalClient() *Client
NewExternalClient is NewClient for operator-supplied registry addresses: dials are guarded against internal targets and redirects are not followed, so the Basic credential never leaves the chosen host.
func (*Client) ListRepositories ¶
func (c *Client) ListRepositories(ctx context.Context, baseURL, username, password string) ([]string, error)
ListRepositories queries GET {baseURL}/v2/_catalog, returning every repository name the registry knows about, sorted for a stable UI order (the wire response's own ordering is unspecified).
func (*Client) ListTags ¶
func (c *Client) ListTags(ctx context.Context, baseURL, username, password, repository string) ([]string, error)
ListTags queries GET {baseURL}/v2/{repository}/tags/list. repository may itself contain slashes (a namespaced name like "org/app"): it is path-escaped per segment, not as a whole, so those slashes still separate real path segments on the wire.
type RateLimitError ¶
RateLimitError reports an upstream 429 together with its Retry-After.
func (*RateLimitError) Error ¶
func (e *RateLimitError) Error() string