Documentation
¶
Overview ¶
Package ociclient provides an implementation of oci.Interface that uses HTTP to talk to the remote registry.
Index ¶
- func CheckResponse(resp *http.Response, okStatuses ...int) error
- func ErrorFromResponse(resp *http.Response) error
- type Client
- func (c *Client) DeleteBlob(ctx context.Context, repoName string, digest oci.Digest) error
- func (c *Client) DeleteManifest(ctx context.Context, repoName string, digest oci.Digest) error
- func (c *Client) DeleteTag(ctx context.Context, repoName string, tagName string) error
- func (c *Client) Do(req *http.Request, opts *RequestOptions) (*http.Response, error)
- func (c *Client) GetBlob(ctx context.Context, repo string, digest oci.Digest) (oci.BlobReader, error)
- func (c *Client) GetBlobRange(ctx context.Context, repo string, digest oci.Digest, o0, o1 int64) (_ oci.BlobReader, _err error)
- func (c *Client) GetManifest(ctx context.Context, repo string, digest oci.Digest) (oci.BlobReader, error)
- func (c *Client) GetTag(ctx context.Context, repo string, tagName string) (oci.BlobReader, error)
- func (c *Client) MountBlob(ctx context.Context, fromRepo, toRepo string, dig oci.Digest) (oci.Descriptor, error)
- func (c *Client) PushBlob(ctx context.Context, repo string, desc oci.Descriptor, r io.Reader) (_ oci.Descriptor, _err error)
- func (c *Client) PushBlobChunked(ctx context.Context, repo string, chunkSize int) (oci.BlobWriter, error)
- func (c *Client) PushBlobChunkedResume(ctx context.Context, repo string, id string, offset int64, chunkSize int) (oci.BlobWriter, error)
- func (c *Client) PushManifest(ctx context.Context, repo string, contents []byte, mediaType string, ...) (oci.Descriptor, error)
- func (c *Client) Referrers(ctx context.Context, repoName string, digest oci.Digest, ...) iter.Seq2[oci.Descriptor, error]
- func (c *Client) Repositories(ctx context.Context, startAfter string) iter.Seq2[string, error]
- func (c *Client) ResolveBlob(ctx context.Context, repo string, digest oci.Digest) (oci.Descriptor, error)
- func (c *Client) ResolveManifest(ctx context.Context, repo string, digest oci.Digest) (oci.Descriptor, error)
- func (c *Client) ResolveTag(ctx context.Context, repo string, tag string) (oci.Descriptor, error)
- func (c *Client) Tags(ctx context.Context, repoName string, params *oci.TagsParameters) iter.Seq2[string, error]
- type Options
- type RequestOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶ added in v0.0.14
CheckResponse checks that resp has an acceptable status.
If okStatuses is empty, any 2xx response is accepted. Otherwise, only the supplied statuses are accepted. Non-2xx responses are returned as OCI errors. CheckResponse reads but does not close resp.Body when constructing an error.
func ErrorFromResponse ¶ added in v0.0.14
ErrorFromResponse forms an OCI error from an HTTP response.
It reads but does not close resp.Body.
Types ¶
type Client ¶ added in v0.0.14
Client is an OCI registry client that uses HTTP to talk to the remote registry.
func New ¶
New returns a client implementation that uses the OCI HTTP API. A nil opts parameter is equivalent to a pointer to zero Options.
The host specifies the host name to talk to; it may optionally be a host:port pair.
func (*Client) DeleteBlob ¶ added in v0.0.14
DeleteBlob deletes the blob with the given digest from the repository.
func (*Client) DeleteManifest ¶ added in v0.0.14
DeleteManifest deletes the manifest with the given digest from the repository.
func (*Client) DeleteTag ¶ added in v0.0.14
DeleteTag deletes the manifest with the given tag from the repository.
func (*Client) Do ¶ added in v0.0.14
Do performs an HTTP request against the registry.
If req.URL has no scheme or host, Do fills them in from the client's configured registry. It also sets the User-Agent header and, when the request has a body, sets Expect: 100-continue.
Do does not interpret HTTP response statuses. Callers that want OCI error handling can use CheckResponse or ErrorFromResponse. On a nil error, the caller is responsible for closing resp.Body.
func (*Client) GetBlob ¶ added in v0.0.14
func (c *Client) GetBlob(ctx context.Context, repo string, digest oci.Digest) (oci.BlobReader, error)
GetBlob returns the content of the blob with the given digest.
func (*Client) GetBlobRange ¶ added in v0.0.14
func (c *Client) GetBlobRange(ctx context.Context, repo string, digest oci.Digest, o0, o1 int64) (_ oci.BlobReader, _err error)
GetBlobRange is like GetBlob but asks for only the given byte range.
func (*Client) GetManifest ¶ added in v0.0.14
func (c *Client) GetManifest(ctx context.Context, repo string, digest oci.Digest) (oci.BlobReader, error)
GetManifest returns the content of the manifest with the given digest.
func (*Client) GetTag ¶ added in v0.0.14
GetTag returns the content of the manifest with the given tag.
func (*Client) MountBlob ¶ added in v0.0.14
func (c *Client) MountBlob(ctx context.Context, fromRepo, toRepo string, dig oci.Digest) (oci.Descriptor, error)
MountBlob makes a blob from fromRepo available in toRepo without uploading it again.
func (*Client) PushBlob ¶ added in v0.0.14
func (c *Client) PushBlob(ctx context.Context, repo string, desc oci.Descriptor, r io.Reader) (_ oci.Descriptor, _err error)
PushBlob pushes a blob described by desc to the given repository.
func (*Client) PushBlobChunked ¶ added in v0.0.14
func (c *Client) PushBlobChunked(ctx context.Context, repo string, chunkSize int) (oci.BlobWriter, error)
PushBlobChunked starts a chunked blob upload to the given repository.
func (*Client) PushBlobChunkedResume ¶ added in v0.0.14
func (c *Client) PushBlobChunkedResume(ctx context.Context, repo string, id string, offset int64, chunkSize int) (oci.BlobWriter, error)
PushBlobChunkedResume resumes a previous chunked blob upload.
func (*Client) PushManifest ¶ added in v0.0.14
func (c *Client) PushManifest(ctx context.Context, repo string, contents []byte, mediaType string, params *oci.PushManifestParameters) (oci.Descriptor, error)
PushManifest pushes a manifest with the given media type and contents.
func (*Client) Referrers ¶ added in v0.0.14
func (c *Client) Referrers(ctx context.Context, repoName string, digest oci.Digest, params *oci.ReferrersParameters) iter.Seq2[oci.Descriptor, error]
Referrers returns an iterator over manifests that refer to the given digest.
func (*Client) Repositories ¶ added in v0.0.14
Repositories returns an iterator over repositories in the registry.
func (*Client) ResolveBlob ¶ added in v0.0.14
func (c *Client) ResolveBlob(ctx context.Context, repo string, digest oci.Digest) (oci.Descriptor, error)
ResolveBlob returns the descriptor for the blob with the given digest.
func (*Client) ResolveManifest ¶ added in v0.0.14
func (c *Client) ResolveManifest(ctx context.Context, repo string, digest oci.Digest) (oci.Descriptor, error)
ResolveManifest returns the descriptor for the manifest with the given digest.
func (*Client) ResolveTag ¶ added in v0.0.14
ResolveTag returns the descriptor for the manifest with the given tag.
type Options ¶
type Options struct {
// DebugID is used to prefix any log messages printed by the client.
DebugID string
// Transport is used to make HTTP requests. The context passed
// to its RoundTrip method will have an appropriate
// [ociauth.RequestInfo] value added, suitable for consumption
// by the transport created by [ociauth.NewStdTransport]. If
// Transport is nil, [http.DefaultTransport] will be used.
Transport http.RoundTripper
// Insecure specifies whether an http scheme will be used to
// address the host instead of https.
Insecure bool
// Specifies a user agent string to use when making requests. Defaults to "docker/oci"
UserAgent string
}
Options holds configuration for creating a new OCI registry client.
type RequestOptions ¶ added in v0.0.14
type RequestOptions struct {
// Scope is the authorization scope required by the request. It is attached
// to the request context for use by transports created by
// [ociauth.NewStdTransport].
Scope ociauth.Scope
}
RequestOptions holds options for Client.Do.