public class RegistryClient
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
RegistryClient.Factory
Factory for creating
RegistryClients. |
| Modifier and Type | Method and Description |
|---|---|
BlobDescriptor |
checkBlob(DescriptorDigest blobDigest) |
static RegistryClient.Factory |
factory(JibLogger buildLogger,
java.lang.String serverUrl,
java.lang.String imageName)
Creates a new
RegistryClient.Factory for building a RegistryClient. |
RegistryAuthenticator |
getRegistryAuthenticator() |
java.lang.Void |
pullBlob(DescriptorDigest blobDigest,
java.io.OutputStream destinationOutputStream)
Downloads the BLOB to a file.
|
ManifestTemplate |
pullManifest(java.lang.String imageTag) |
<T extends ManifestTemplate> |
pullManifest(java.lang.String imageTag,
java.lang.Class<T> manifestTemplateClass)
Pulls the image manifest for a specific tag.
|
boolean |
pushBlob(DescriptorDigest blobDigest,
Blob blob,
java.lang.String sourceRepository)
Pushes the BLOB.
|
void |
pushManifest(BuildableManifestTemplate manifestTemplate,
java.lang.String imageTag)
Pushes the image manifest for a specific tag.
|
RegistryClient |
setTimer(Timer parentTimer) |
static void |
setUserAgentSuffix(java.lang.String userAgentSuffix)
Sets a suffix to append to
User-Agent headers. |
public RegistryClient setTimer(Timer parentTimer)
public static RegistryClient.Factory factory(JibLogger buildLogger, java.lang.String serverUrl, java.lang.String imageName)
RegistryClient.Factory for building a RegistryClient.buildLogger - the build logger used for printing messagesserverUrl - the server URL for the registry (for example, gcr.io)imageName - the image/repository name (also known as, namespace)RegistryClient.Factorypublic static void setUserAgentSuffix(@Nullable
java.lang.String userAgentSuffix)
User-Agent headers.userAgentSuffix - the suffix to append@Nullable public RegistryAuthenticator getRegistryAuthenticator() throws java.io.IOException, RegistryException
RegistryAuthenticator to authenticate pulls/pushes with the registry, or
null if no token authentication is necessaryjava.io.IOException - if communicating with the endpoint failsRegistryException - if communicating with the endpoint failspublic <T extends ManifestTemplate> T pullManifest(java.lang.String imageTag, java.lang.Class<T> manifestTemplateClass) throws java.io.IOException, RegistryException
T - child type of ManifestTemplateimageTag - the tag to pull onmanifestTemplateClass - the specific version of manifest template to pull, or ManifestTemplate to pull either V22ManifestTemplate or V21ManifestTemplatejava.io.IOException - if communicating with the endpoint failsRegistryException - if communicating with the endpoint failspublic ManifestTemplate pullManifest(java.lang.String imageTag) throws java.io.IOException, RegistryException
java.io.IOExceptionRegistryExceptionpublic void pushManifest(BuildableManifestTemplate manifestTemplate, java.lang.String imageTag) throws java.io.IOException, RegistryException
manifestTemplate - the image manifestimageTag - the tag to push onjava.io.IOException - if communicating with the endpoint failsRegistryException - if communicating with the endpoint fails@Nullable public BlobDescriptor checkBlob(DescriptorDigest blobDigest) throws java.io.IOException, RegistryException
blobDigest - the blob digest to check forBlobDescriptor if the BLOB exists on the registry, or null
if it doesn'tjava.io.IOException - if communicating with the endpoint failsRegistryException - if communicating with the endpoint failspublic java.lang.Void pullBlob(DescriptorDigest blobDigest, java.io.OutputStream destinationOutputStream) throws RegistryException, java.io.IOException
blobDigest - the digest of the BLOB to downloaddestinationOutputStream - the OutputStream to write the BLOB toBlob backed by the file at destPath. The file at destPath
must exist for Blob to be valid.java.io.IOException - if communicating with the endpoint failsRegistryException - if communicating with the endpoint failspublic boolean pushBlob(DescriptorDigest blobDigest, Blob blob, @Nullable java.lang.String sourceRepository) throws java.io.IOException, RegistryException
sourceRepository is provided then the remote registry may skip
if the BLOB already exists on the registry.blobDigest - the digest of the BLOB, used for existence-checkblob - the BLOB to pushsourceRepository - if pushing to the same registry then the source image, or null
otherwise; used to optimize the BLOB pushtrue if the BLOB already exists on the registry and pushing was skipped; false
if the BLOB was pushedjava.io.IOException - if communicating with the endpoint failsRegistryException - if communicating with the endpoint fails