Class RegistryClient

java.lang.Object
io.jenkins.plugins.jobcacher.oras.RegistryClient

public class RegistryClient extends Object
Registry client wrapping the Registry instance and its configuration.
  • Field Details

    • ARTIFACT_MEDIA_TYPE

      public static final land.oras.ArtifactType ARTIFACT_MEDIA_TYPE
    • CONFIG_MEDIA_TYPE

      public static final String CONFIG_MEDIA_TYPE
      See Also:
    • CONTENT_MEDIA_TYPE

      public static final String CONTENT_MEDIA_TYPE
      See Also:
  • Constructor Details

    • RegistryClient

      public RegistryClient(@NonNull String registryUrl, @NonNull String namespace, @NonNull com.cloudbees.plugins.credentials.common.UsernamePasswordCredentials credentials)
      Create a new registry client.
      Parameters:
      registryUrl - The URL of the registry
      namespace - The namespace to use
      credentials - The credentials to use
    • RegistryClient

      public RegistryClient(@NonNull RegistryClient.RegistryConfig config)
      Create a new registry client.
      Parameters:
      config - The configuration to use
  • Method Details

    • getConfig

      public RegistryClient.RegistryConfig getConfig()
      Get the configuration of the registry.
      Returns:
      The configuration
    • exists

      public boolean exists(String fullName, String path)
      Check if an artifact exists in the registry.
      Parameters:
      fullName - The full name of the artifact
      path - The path of the artifact
      Returns:
      true if the artifact exists, false otherwise
    • delete

      public void delete(String fullName, String path)
      Delete an artifact from the registry.
      Parameters:
      path - The path of the artifact
    • download

      public void download(String fullName, String path, Path target) throws Exception
      Upload an artifact to the registry.
      Parameters:
      fullName - The full name of the artifact
      path - The path of the artifact
      target - The path of the artifact to upload
      Throws:
      Exception - If an error occurs
    • upload

      public void upload(String fullName, String path, Path source) throws Exception
      Upload an artifact to the registry.
      Parameters:
      fullName - The full name of the artifact
      path - The path of the artifact
      source - The path of the artifact to upload
      Throws:
      Exception - If an error occurs
    • testConnection

      public void testConnection() throws Exception
      Test connection to the registry but uploading an artifact and deleting it.
      Throws:
      Exception