pub struct Client { /* private fields */ }
Expand description

The OCI client connects to an OCI registry and fetches OCI images.

An OCI registry is a container registry that adheres to the OCI Distribution specification. DockerHub is one example, as are ACR and GCR. This client provides a native Rust implementation for pulling OCI images.

Some OCI registries support completely anonymous access. But most require at least an Oauth2 handshake. Typlically, you will want to create a new client, and then run the auth() method, which will attempt to get a read-only bearer token. From there, pulling images can be done with the pull_* functions.

For true anonymous access, you can skip auth(). This is not recommended unless you are sure that the remote registry does not require Oauth2.

Implementations§

Create a new client with the supplied config

Create a new client with the supplied config

Pull an image and return the bytes

The client will check if it’s already been authenticated and if not will attempt to do.

Push an image and return the uploaded URL of the image

The client will check if it’s already been authenticated and if not will attempt to do.

If a manifest is not provided, the client will attempt to generate it from the provided image and config data.

Returns pullable URL for the image

Perform an OAuth v2 auth request if necessary.

This performs authorization and then stores the token internally to be used on other requests.

Fetch a manifest’s digest from the remote OCI Distribution service.

If the connection has already gone through authentication, this will use the bearer token. Otherwise, this will attempt an anonymous pull.

Will first attempt to read the Docker-Content-Digest header using a HEAD request. If this header is not present, will make a second GET request and return the SHA256 of the response body.

Pull a manifest from the remote OCI Distribution service.

The client will check if it’s already been authenticated and if not will attempt to do.

A Tuple is returned containing the OciImageManifest and the manifest content digest hash.

If a multi-platform Image Index manifest is encountered, a platform-specific Image manifest will be selected using the client’s default platform resolution.

Pull a manifest from the remote OCI Distribution service.

The client will check if it’s already been authenticated and if not will attempt to do.

A Tuple is returned containing the Manifest and the manifest content digest hash.

Pull a manifest and its config from the remote OCI Distribution service.

The client will check if it’s already been authenticated and if not will attempt to do.

A Tuple is returned containing the OciImageManifest, the manifest content digest hash and the contents of the manifests config layer as a String.

Push a manifest list to an OCI registry.

This pushes a manifest list to an OCI registry.

Pull a single layer from an OCI registry.

This pulls the layer for a particular image that is identified by the given digest. The image reference is used to find the repository and the registry, but it is not used to verify that the digest is a layer inside of the image. (The manifest is used for that.)

Stream a single layer from an OCI registry.

This is a streaming version of Client::pull_blob. Returns AsyncRead.

Trait Implementations§

Returns the “default value” for a type. Read more
The type returned in the event of a conversion error.
Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more