public class RegistryClient extends 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(String serverUrl,
String imageName) |
RegistryAuthenticator |
getRegistryAuthenticator() |
Void |
pullBlob(DescriptorDigest blobDigest,
OutputStream destinationOutputStream)
Downloads the BLOB to a file.
|
ManifestTemplate |
pullManifest(String imageTag) |
<T extends ManifestTemplate> |
pullManifest(String imageTag,
Class<T> manifestTemplateClass)
Pulls the image manifest for a specific tag.
|
boolean |
pushBlob(DescriptorDigest blobDigest,
Blob blob)
Pushes the BLOB, or skips if the BLOB already exists on the registry.
|
void |
pushManifest(BuildableManifestTemplate manifestTemplate,
String imageTag)
Pushes the image manifest for a specific tag.
|
RegistryClient |
setTimer(Timer parentTimer) |
static void |
setUserAgentSuffix(String userAgentSuffix)
Sets a suffix to append to
User-Agent headers. |
public RegistryClient setTimer(Timer parentTimer)
public static RegistryClient.Factory factory(String serverUrl, String imageName)
serverUrl - 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 String userAgentSuffix)
User-Agent headers.userAgentSuffix - the suffix to append@Nullable public RegistryAuthenticator getRegistryAuthenticator() throws IOException, RegistryException
RegistryAuthenticator to authenticate pulls/pushes with the registry, or
null if no token authentication is necessaryIOException - if communicating with the endpoint failsRegistryException - if communicating with the endpoint failspublic <T extends ManifestTemplate> T pullManifest(String imageTag, Class<T> manifestTemplateClass) throws 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 V21ManifestTemplateIOException - if communicating with the endpoint failsRegistryException - if communicating with the endpoint failspublic ManifestTemplate pullManifest(String imageTag) throws IOException, RegistryException
IOExceptionRegistryExceptionpublic void pushManifest(BuildableManifestTemplate manifestTemplate, String imageTag) throws IOException, RegistryException
manifestTemplate - the image manifestimageTag - the tag to push onIOException - if communicating with the endpoint failsRegistryException - if communicating with the endpoint fails@Nullable public BlobDescriptor checkBlob(DescriptorDigest blobDigest) throws IOException, RegistryException
blobDigest - the blob digest to check forBlobDescriptor if the BLOB exists on the registry, or null
if it doesn'tIOException - if communicating with the endpoint failsRegistryException - if communicating with the endpoint failspublic Void pullBlob(DescriptorDigest blobDigest, OutputStream destinationOutputStream) throws RegistryException, 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.IOException - if communicating with the endpoint failsRegistryException - if communicating with the endpoint failspublic boolean pushBlob(DescriptorDigest blobDigest, Blob blob) throws IOException, RegistryException
blobDigest - the digest of the BLOB, used for existence-checkblob - the BLOB to pushtrue if the BLOB already exists on the registry and pushing was skipped; false
if the BLOB was pushedIOException - if communicating with the endpoint failsRegistryException - if communicating with the endpoint failsCopyright © 2018. All rights reserved.