Struct oci_distribution::Client [−][src]
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]
&mut self,
image: &Reference,
auth: &RegistryAuth,
accepted_media_types: Vec<&str>
) -> Result<ImageData>
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]
&mut self,
image_ref: &Reference,
image_data: &ImageData,
config_data: &[u8],
config_media_type: &str,
auth: &RegistryAuth,
image_manifest: Option<OciManifest>
) -> Result<String>
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]
&mut self,
image: &Reference,
auth: &RegistryAuth
) -> Result<String>
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
Auto Trait Implementations
impl !RefUnwindSafe for Client
[src]
impl Send for Client
[src]
impl Sync for Client
[src]
impl Unpin for Client
[src]
impl !UnwindSafe for Client
[src]
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,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub 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>,