Documentation
¶
Overview ¶
Package registryclient is a small HTTP client for OCI Distribution registries.
Index ¶
- Variables
- type Client
- func (c *Client) BaseURL() string
- func (c *Client) BlobExists(ctx context.Context, name, digest string) (bool, error)
- func (c *Client) Catalog(ctx context.Context) ([]string, error)
- func (c *Client) DeleteManifest(ctx context.Context, name, reference string) error
- func (c *Client) GetBlob(ctx context.Context, name, digest string) (io.ReadCloser, error)
- func (c *Client) GetManifest(ctx context.Context, name, tag string) ([]byte, string, error)
- func (c *Client) HasManifest(ctx context.Context, name, reference string) (bool, error)
- func (c *Client) ListTags(ctx context.Context, name string) ([]string, error)
- func (c *Client) PutBlob(ctx context.Context, name, digest string, body io.Reader, size int64) error
- func (c *Client) PutManifest(ctx context.Context, name, tag string, data []byte, contentType string) error
- type Option
Constants ¶
This section is empty.
Variables ¶
var ErrManifestNotFound = errors.New("registryclient: manifest not found")
ErrManifestNotFound distinguishes 404 from transport errors.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is an HTTP client for OCI Distribution registries.
func New ¶
New creates a client. Empty baseURL defaults to http://127.0.0.1:8080.
func NewFromEnv ¶ added in v0.2.1
NewFromEnv is New with WithCACert auto-applied from EPOCH_CA_CERT when set, so callers don't have to repeat the `if ca := os.Getenv(...)` dance.
func (*Client) BlobExists ¶
BlobExists checks whether a blob with the given digest exists.
func (*Client) DeleteManifest ¶ added in v0.1.7
DeleteManifest removes a manifest. A 404 (already absent) is treated as success.
func (*Client) GetManifest ¶
GetManifest downloads a manifest. Returns ErrManifestNotFound on 404.
func (*Client) HasManifest ¶ added in v0.2.1
HasManifest reports whether (name, reference) exists by wrapping GetManifest and folding ErrManifestNotFound into (false, nil). Other errors propagate.
type Option ¶ added in v0.1.9
Option configures a Client. It returns an error so misconfigured options (e.g. unreadable CA cert) surface to the caller instead of panicking.
func WithCACert ¶ added in v0.1.9
WithCACert loads a PEM-encoded CA certificate file and adds it to the TLS root pool so the client can verify registries using custom CAs.