[−][src]Struct oci_distribution::client::Client
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 async fn pull_image<'_, '_>(
&'_ mut self,
image: &'_ Reference
) -> Result<Vec<u8>>[src]
&'_ mut self,
image: &'_ Reference
) -> Result<Vec<u8>>
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 version<'_, '_>(&'_ self, host: &'_ str) -> Result<String>[src]
According to the v2 specification, 200 and 401 error codes MUST return the version. It appears that any other response code should be deemed non-v2.
For this implementation, it will return v2 or an error result. If the error is a
reqwest error, the request itself failed. All other error messages mean that
v2 is not supported.
pub async fn auth<'_, '_, '_>(
&'_ mut self,
image: &'_ Reference,
_secret: Option<&'_ str>
) -> Result<()>[src]
&'_ mut self,
image: &'_ Reference,
_secret: Option<&'_ str>
) -> Result<()>
Perform an OAuth v2 auth request if necessary.
This performs authorization and then stores the token internally to be used on other requests.
pub async fn pull_manifest<'_, '_>(
&'_ self,
image: &'_ Reference
) -> Result<OciManifest>[src]
&'_ self,
image: &'_ Reference
) -> Result<OciManifest>
Pull a manifest 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.
pub async fn pull_layer<'_, '_, '_, T: AsyncWrite + Unpin>(
&'_ self,
image: &'_ Reference,
digest: &'_ str,
__arg3: T
) -> Result<()>[src]
&'_ self,
image: &'_ Reference,
digest: &'_ str,
__arg3: T
) -> Result<()>
Pull a single layer from an OCI registy.
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.)
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,