Struct oci_distribution::Client[][src]

pub struct Client { /* fields omitted */ }

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

impl Client[src]

pub fn new(config: ClientConfig) -> Self[src]

Create a new client with the supplied config

pub fn from_source(config_source: &impl ClientConfigSource) -> Self[src]

Create a new client with the supplied config

pub async fn pull(
    &mut self,
    image: &Reference,
    auth: &RegistryAuth,
    accepted_media_types: Vec<&str>
) -> Result<ImageData>
[src]

Pull an image and return the bytes

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

pub async fn push(
    &mut self,
    image_ref: &Reference,
    image_data: &ImageData,
    config_data: &[u8],
    config_media_type: &str,
    auth: &RegistryAuth,
    image_manifest: Option<OciManifest>
) -> Result<String>
[src]

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

pub async fn fetch_manifest_digest(
    &mut self,
    image: &Reference,
    auth: &RegistryAuth
) -> Result<String>
[src]

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.

Trait Implementations

impl Default for Client[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.