Struct oci_wasm::WasmClient
source · pub struct WasmClient { /* private fields */ }Expand description
A light wrapper around the oci-distribution client to add support for the application/wasm type
Implementations§
source§impl WasmClient
impl WasmClient
sourcepub async fn pull(
&self,
image: &Reference,
auth: &RegistryAuth
) -> Result<ImageData>
pub async fn pull( &self, image: &Reference, auth: &RegistryAuth ) -> Result<ImageData>
A convenience wrapper around Client::pull that pulls a wasm component and errors if
there are layers that aren’t wasm
sourcepub async fn pull_manifest_and_config(
&self,
image: &Reference,
auth: &RegistryAuth
) -> Result<(OciImageManifest, WasmConfig, String)>
pub async fn pull_manifest_and_config( &self, image: &Reference, auth: &RegistryAuth ) -> Result<(OciImageManifest, WasmConfig, String)>
A convenience wrapper around Client::pull_manifest_and_config that parses the config as
a WasmConfig type
sourcepub async fn push(
&self,
image: &Reference,
auth: &RegistryAuth,
component_layer: ImageLayer,
config: impl ToConfig,
annotations: Option<HashMap<String, String>>
) -> Result<PushResponse>
pub async fn push( &self, image: &Reference, auth: &RegistryAuth, component_layer: ImageLayer, config: impl ToConfig, annotations: Option<HashMap<String, String>> ) -> Result<PushResponse>
A convenience wrapper around Client::push that pushes a wasm component or module with
the given config and optional annotations for the manifest
Methods from Deref<Target = Client>§
Fetches the available Tags for the given Reference
The client will check if it’s already been authenticated and if not will attempt to do.
sourcepub async fn pull(
&self,
image: &Reference,
auth: &RegistryAuth,
accepted_media_types: Vec<&str>
) -> Result<ImageData, OciDistributionError>
pub async fn pull( &self, image: &Reference, auth: &RegistryAuth, accepted_media_types: Vec<&str> ) -> Result<ImageData, OciDistributionError>
Pull an image and return the bytes
The client will check if it’s already been authenticated and if not will attempt to do.
sourcepub async fn push(
&self,
image_ref: &Reference,
layers: &[ImageLayer],
config: Config,
auth: &RegistryAuth,
manifest: Option<OciImageManifest>
) -> Result<PushResponse, OciDistributionError>
pub async fn push( &self, image_ref: &Reference, layers: &[ImageLayer], config: Config, auth: &RegistryAuth, manifest: Option<OciImageManifest> ) -> Result<PushResponse, OciDistributionError>
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
sourcepub async fn push_blob(
&self,
image_ref: &Reference,
data: &[u8],
digest: &str
) -> Result<String, OciDistributionError>
pub async fn push_blob( &self, image_ref: &Reference, data: &[u8], digest: &str ) -> Result<String, OciDistributionError>
Pushes a blob to the registry
sourcepub async fn auth(
&self,
image: &Reference,
authentication: &RegistryAuth,
operation: RegistryOperation
) -> Result<Option<String>, OciDistributionError>
pub async fn auth( &self, image: &Reference, authentication: &RegistryAuth, operation: RegistryOperation ) -> Result<Option<String>, OciDistributionError>
Perform an OAuth v2 auth request if necessary.
This performs authorization and then stores the token internally to be used on other requests.
sourcepub async fn fetch_manifest_digest(
&self,
image: &Reference,
auth: &RegistryAuth
) -> Result<String, OciDistributionError>
pub async fn fetch_manifest_digest( &self, image: &Reference, auth: &RegistryAuth ) -> Result<String, OciDistributionError>
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.
sourcepub async fn pull_image_manifest(
&self,
image: &Reference,
auth: &RegistryAuth
) -> Result<(OciImageManifest, String), OciDistributionError>
pub async fn pull_image_manifest( &self, image: &Reference, auth: &RegistryAuth ) -> Result<(OciImageManifest, String), OciDistributionError>
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.
sourcepub async fn pull_manifest_raw(
&self,
image: &Reference,
auth: &RegistryAuth,
accepted_media_types: &[&str]
) -> Result<(Vec<u8>, String), OciDistributionError>
pub async fn pull_manifest_raw( &self, image: &Reference, auth: &RegistryAuth, accepted_media_types: &[&str] ) -> Result<(Vec<u8>, String), OciDistributionError>
Pull a manifest from the remote OCI Distribution service without parsing it.
The client will check if it’s already been authenticated and if not will attempt to do.
A Tuple is returned containing raw byte representation of the manifest and the manifest content digest.
sourcepub async fn pull_manifest(
&self,
image: &Reference,
auth: &RegistryAuth
) -> Result<(OciManifest, String), OciDistributionError>
pub async fn pull_manifest( &self, image: &Reference, auth: &RegistryAuth ) -> Result<(OciManifest, String), OciDistributionError>
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.
sourcepub async fn pull_manifest_and_config(
&self,
image: &Reference,
auth: &RegistryAuth
) -> Result<(OciImageManifest, String, String), OciDistributionError>
pub async fn pull_manifest_and_config( &self, image: &Reference, auth: &RegistryAuth ) -> Result<(OciImageManifest, String, String), OciDistributionError>
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.
sourcepub async fn push_manifest_list(
&self,
reference: &Reference,
auth: &RegistryAuth,
manifest: OciImageIndex
) -> Result<String, OciDistributionError>
pub async fn push_manifest_list( &self, reference: &Reference, auth: &RegistryAuth, manifest: OciImageIndex ) -> Result<String, OciDistributionError>
Push a manifest list to an OCI registry.
This pushes a manifest list to an OCI registry.
sourcepub async fn pull_blob<T>(
&self,
image: &Reference,
layer: &OciDescriptor,
out: T
) -> Result<(), OciDistributionError>where
T: AsyncWrite + Unpin,
pub async fn pull_blob<T>(
&self,
image: &Reference,
layer: &OciDescriptor,
out: T
) -> Result<(), OciDistributionError>where
T: AsyncWrite + Unpin,
Pull a single layer from an OCI registry.
This pulls the layer for a particular image that is identified by the given layer descriptor. 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.)
sourcepub async fn pull_blob_stream(
&self,
image: &Reference,
layer: &OciDescriptor
) -> Result<impl Stream<Item = Result<Bytes, Error>>, OciDistributionError>
pub async fn pull_blob_stream( &self, image: &Reference, layer: &OciDescriptor ) -> Result<impl Stream<Item = Result<Bytes, Error>>, OciDistributionError>
Stream a single layer from an OCI registry.
This is a streaming version of Client::pull_blob.
Returns Stream.
sourcepub async fn mount_blob(
&self,
image: &Reference,
source: &Reference,
digest: &str
) -> Result<(), OciDistributionError>
pub async fn mount_blob( &self, image: &Reference, source: &Reference, digest: &str ) -> Result<(), OciDistributionError>
Mounts a blob to the provided reference, from the given source
sourcepub async fn push_manifest(
&self,
image: &Reference,
manifest: &OciManifest
) -> Result<String, OciDistributionError>
pub async fn push_manifest( &self, image: &Reference, manifest: &OciManifest ) -> Result<String, OciDistributionError>
Pushes the manifest for a specified image
Returns pullable manifest URL
sourcepub async fn push_manifest_raw(
&self,
image: &Reference,
body: Vec<u8>,
content_type: HeaderValue
) -> Result<String, OciDistributionError>
pub async fn push_manifest_raw( &self, image: &Reference, body: Vec<u8>, content_type: HeaderValue ) -> Result<String, OciDistributionError>
Pushes the manifest, provided as raw bytes, for a specified image
Returns pullable manifest url