Package land.oras

Class ContainerRef


@NullMarked public final class ContainerRef extends Ref<ContainerRef>
A referer of a container on a Registry.
  • Field Details

    • LOG

      public static final org.slf4j.Logger LOG
      The logger for this class.
  • Method Details

    • getRegistry

      public String getRegistry()
      Create a new container reference
      Returns:
      The new container reference
    • isUnqualified

      public boolean isUnqualified()
      Whether the container reference is unqualified without registry
      Returns:
      True if unqualified
    • getFullRepository

      public String getFullRepository(@Nullable Registry registry)
      Get the full repository name including the namespace if any
      Parameters:
      registry - The registry
      Returns:
      The full repository name
    • getFullRepository

      public String getFullRepository()
      Get the full repository name including the namespace if any
      Returns:
      The full repository name
    • getApiRegistry

      public String getApiRegistry(@Nullable Registry target)
      Get the API registry
      Parameters:
      target - The target registry
      Returns:
      The API registry
    • getApiRegistry

      public String getApiRegistry()
      Get the API registry
      Returns:
      The API registry
    • getNamespace

      public @Nullable String getNamespace()
      Get the namespace
      Returns:
      The namespace
    • getNamespace

      public @Nullable String getNamespace(@Nullable Registry target)
      Get the effective namespace based on given registry traget
      Parameters:
      target - The target registry
      Returns:
      The effective namespace
    • getRepository

      public String getRepository()
      Get the repository
      Specified by:
      getRepository in class Ref<ContainerRef>
      Returns:
      The repository
    • getDigest

      public @Nullable String getDigest()
      Get the digest
      Returns:
      The digest
    • withDigest

      public ContainerRef withDigest(String digest)
      Description copied from class: Ref
      Return the ref with the digest
      Specified by:
      withDigest in class Ref<ContainerRef>
      Parameters:
      digest - The digest
      Returns:
      The ref
    • getAlgorithm

      public SupportedAlgorithm getAlgorithm()
      Description copied from class: Ref
      Get the algorithm
      Specified by:
      getAlgorithm in class Ref<ContainerRef>
      Returns:
      The algorithm
    • getRepositoriesPath

      public String getRepositoriesPath(@Nullable Registry target)
      Return the catalog repositories URL
      Parameters:
      target - The target registry
      Returns:
      The tag URL
    • getRepositoriesPath

      public String getRepositoriesPath()
      Return the catalog repositories URL
      Returns:
      The tag URL
    • getTagsPath

      public String getTagsPath(@Nullable Registry target)
      Return the tag URL
      Parameters:
      target - The target registry
      Returns:
      The tag URL
    • getTagsPath

      public String getTagsPath()
      Return the tag URL
      Returns:
      The tag URL
    • getReferrersPath

      public String getReferrersPath(@Nullable Registry registry, @Nullable ArtifactType artifactType)
      Return the referrers URL for this container referrer
      Parameters:
      artifactType - The optional artifact type
      registry - The optional registry
      Returns:
      The referrers URL
    • getReferrersPath

      public String getReferrersPath(@Nullable ArtifactType artifactType)
      Return the referrers URL for this container referrer
      Parameters:
      artifactType - The optional artifact type
      Returns:
      The referrers URL
    • getManifestsPath

      public String getManifestsPath(@Nullable Registry registry)
      Return the manifests URL
      Parameters:
      registry - The registry
      Returns:
      The manifests URL
    • getManifestsPath

      public String getManifestsPath()
      Return the manifests URL
      Returns:
      The manifests URL
    • getBlobsUploadDigestPath

      public String getBlobsUploadDigestPath(Registry registry)
      Return the blobs upload URL with the digest for single POST upload
      Parameters:
      registry - The registry
      Returns:
      The blobs upload URL
    • getBlobsUploadPath

      public String getBlobsUploadPath(Registry registry)
      Return the blobs upload URL for POST upload to get the upload location
      Parameters:
      registry - The registry
      Returns:
      The blobs upload URL
    • getBlobsPath

      public String getBlobsPath(@Nullable Registry registry)
      Return the blobs URL
      Parameters:
      registry - The registry
      Returns:
      The blobs URL
    • parse

      public static ContainerRef parse(String name)
      Parse the container name into registry, repository and tag.
      Parameters:
      name - The full name of the container to parse with any components.
      Returns:
      The container object with the registry, repository and tag.
    • getEffectiveRegistry

      public String getEffectiveRegistry(Registry target)
      Get the effective registry based on given target This methods will perform HEAD request to determine the first unqualified search registry that contains the container reference if the reference is unqualified, otherwise return the registry of the reference. This only works with Manifests and Index but now direct blob access. See forRegistry(String) so set correct registry when getting blobs outside high level API like Registry.pullArtifact(ContainerRef, Path, boolean).
      Parameters:
      target - The target registry
      Returns:
      The effective registry
    • forRegistry

      public ContainerRef forRegistry(String registry)
      Return a copy of reference for a registry other registry
      Parameters:
      registry - The registry
      Returns:
      The container reference
    • isInsecure

      public boolean isInsecure(Registry registry)
      Check if access to this container reference is insecure by the registry configuration
      Parameters:
      registry - The registry
      Returns:
      True if access to this container reference is insecure, false otherwise
    • isBlocked

      public boolean isBlocked(Registry registry)
      Check if access to this container reference is blocked by the registry configuration
      Parameters:
      registry - The registry
      Returns:
      True if access to this container reference is blocked, false otherwise
    • forTarget

      public ContainerRef forTarget(String target)
      Description copied from class: Ref
      Return a container ref for the target repository
      Specified by:
      forTarget in class Ref<ContainerRef>
      Parameters:
      target - The target repository
      Returns:
      The container ref
    • forTarget

      public ContainerRef forTarget(OCI<ContainerRef> target)
      Description copied from class: Ref
      Return a container ref for the target repository
      Specified by:
      forTarget in class Ref<ContainerRef>
      Parameters:
      target - The target repository
      Returns:
      The container ref
    • getTarget

      public String getTarget(OCI<ContainerRef> target)
      Description copied from class: Ref
      Get the target repository for the ref
      Specified by:
      getTarget in class Ref<ContainerRef>
      Parameters:
      target - The target repository
      Returns:
      The target repository
    • forRegistry

      public ContainerRef forRegistry(Registry registry)
      Return a copy of reference for a registry other registry
      Parameters:
      registry - The registry
      Returns:
      The container reference
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object