java.lang.Object
land.oras.OCI<T>
- Type Parameters:
T- The reference type
public abstract sealed class OCI<T extends Ref<@NonNull T>>
extends Object
permits Registry, OCILayout
Abstract class for OCI operation on remote registry or layout
Commons methods for OCI operations
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionattachArtifact(T ref, ArtifactType artifactType, Annotations annotations, LocalPath... paths) Attach file to an existing manifestfinal ManifestattachArtifact(T ref, ArtifactType artifactType, LocalPath... paths) Attach an artifactcollectLayers(T ref, String contentType, boolean includeAll) Collect layers from the refabstract InputStreamFetch blob and return it as input streamabstract voidFetch blob and save it to fileabstract DescriptorfetchBlobDescriptor(T ref) Fetch blob and return it's descriptorabstract byte[]Get the blob for the given digest.abstract DescriptorgetDescriptor(T ref) Retrieve a descriptorabstract IndexRetrieve an indexabstract ManifestgetManifest(T ref) Retrieve a manifestabstract ReferrersgetReferrers(T ref, @Nullable ArtifactType artifactType) Get the referrers of a containerabstract RepositoriesGet the tags for a refabstract TagsGet the tags for a refprotected booleanisIndexMediaType(String mediaType) Return if a media type is an index media typeprotected booleanisManifestMediaType(String mediaType) Return if a media type is a manifest media typeabstract DescriptorprobeDescriptor(T ref) Probe a descriptor.abstract voidpullArtifact(T ref, Path path, boolean overwrite) Pull an artifactfinal InputStreampullConfig(T ref, Config config) Pull config data or just return the data from config if set inlineabstract ManifestpushArtifact(T ref, ArtifactType artifactType, Annotations annotations, @Nullable Config config, LocalPath... paths) Push an artifactpushArtifact(T ref, ArtifactType artifactType, Annotations annotations, LocalPath... paths) Upload an ORAS artifactpushArtifact(T ref, ArtifactType artifactType, LocalPath... paths) Push an artifactpushArtifact(T ref, LocalPath... paths) Push an artifactabstract LayerPush the blob for the given layerpushBlob(T ref, InputStream input) Push a blob from filePush a blob from fileabstract LayerPush a blob from filefinal ConfigpushConfig(T ref, Config config) Push configabstract IndexPush an indexpushLayers(T ref, boolean withDigest, LocalPath... paths) Push layers to the targetabstract ManifestpushManifest(T ref, Manifest manifest) Push a manifest
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOGThe logger
-
-
Constructor Details
-
OCI
protected OCI()Default constructor
-
-
Method Details
-
pushArtifact
Push an artifact- Parameters:
ref- The refpaths- The paths- Returns:
- The manifest
-
pushArtifact
Push an artifact- Parameters:
ref- The refartifactType- The artifact typepaths- The paths- Returns:
- The manifest
-
pushArtifact
public Manifest pushArtifact(T ref, ArtifactType artifactType, Annotations annotations, LocalPath... paths) Upload an ORAS artifact- Parameters:
ref- The refartifactType- The artifact typeannotations- The annotationspaths- The paths- Returns:
- The manifest
-
pushBlob
Push a blob from file- Parameters:
ref- The refblob- The blob- Returns:
- The layer
-
pushBlob
Push a blob from file- Parameters:
ref- The refinput- The input stream- Returns:
- The layer
-
collectLayers
Collect layers from the ref- Parameters:
ref- The refcontentType- The content typeincludeAll- Include all layers or only the ones with title annotation- Returns:
- The layers
-
pushLayers
Push layers to the target- Parameters:
ref- The refwithDigest- Push with digestpaths- The paths to the files- Returns:
- The layers
-
isIndexMediaType
Return if a media type is an index media type- Parameters:
mediaType- The media type- Returns:
- True if it is a index media type
-
isManifestMediaType
Return if a media type is a manifest media type- Parameters:
mediaType- The media type- Returns:
- True if it is a manifest media type
-
pushConfig
Push config- Parameters:
ref- The refconfig- The config- Returns:
- The config
-
pullConfig
Pull config data or just return the data from config if set inline- Parameters:
ref- The refconfig- The config- Returns:
- The input stream
-
attachArtifact
Attach an artifact- Parameters:
ref- The refartifactType- The artifact typepaths- The paths- Returns:
- The manifest
-
getTags
Get the tags for a ref- Parameters:
ref- The ref- Returns:
- The tags
-
getRepositories
Get the tags for a ref- Returns:
- The repositories
-
pushArtifact
public abstract Manifest pushArtifact(T ref, ArtifactType artifactType, Annotations annotations, @Nullable Config config, LocalPath... paths) Push an artifact- Parameters:
ref- The containerartifactType- The artifact type. Can be nullannotations- The annotationsconfig- The configpaths- The paths- Returns:
- The manifest
-
pullArtifact
Pull an artifact- Parameters:
ref- The reference of the artifactpath- The path to save the artifactoverwrite- Overwrite the artifact if it exists
-
pushManifest
Push a manifest- Parameters:
ref- The refmanifest- The manifest- Returns:
- The location
-
pushIndex
Push an index- Parameters:
ref- The refindex- The index- Returns:
- The index
-
getIndex
Retrieve an index- Parameters:
ref- The ref- Returns:
- The index
-
getManifest
Retrieve a manifest- Parameters:
ref- The ref- Returns:
- The manifest
-
getDescriptor
Retrieve a descriptor- Parameters:
ref- The ref- Returns:
- The descriptor
-
probeDescriptor
Probe a descriptor. Typically used to get digest, size and media type without the content- Parameters:
ref- The ref- Returns:
- The descriptor
-
getBlob
Get the blob for the given digest. Not be suitable for large blobs- Parameters:
ref- The ref- Returns:
- The blob as bytes
-
fetchBlob
Fetch blob and save it to file- Parameters:
ref- The refpath- The path to save the blob
-
fetchBlob
Fetch blob and return it as input stream- Parameters:
ref- The ref- Returns:
- The input stream
-
fetchBlobDescriptor
Fetch blob and return it's descriptor- Parameters:
ref- The ref- Returns:
- The descriptor
-
pushBlob
Push a blob from file- Parameters:
ref- The containerblob- The blobannotations- The annotations- Returns:
- The layer
-
pushBlob
Push the blob for the given layer- Parameters:
ref- The container refdata- The data- Returns:
- The layer
-
getReferrers
Get the referrers of a container- Parameters:
ref- The refartifactType- The optional artifact type- Returns:
- The referrers
-
attachArtifact
public Manifest attachArtifact(T ref, ArtifactType artifactType, Annotations annotations, LocalPath... paths) Attach file to an existing manifest- Parameters:
ref- The refartifactType- The artifact typeannotations- The annotationspaths- The paths- Returns:
- The manifest of the new artifact
-