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 |
|---|---|
Optional<BlobDescriptor> |
checkBlob(DescriptorDigest blobDigest) |
static RegistryClient.Factory |
factory(EventHandlers eventHandlers,
String serverUrl,
String imageName)
Creates a new
RegistryClient.Factory for building a RegistryClient. |
static RegistryClient.Factory |
factory(EventHandlers eventHandlers,
String serverUrl,
String imageName,
String sourceImageName) |
Optional<RegistryAuthenticator> |
getRegistryAuthenticator() |
Blob |
pullBlob(DescriptorDigest blobDigest,
Consumer<Long> blobSizeListener,
Consumer<Long> writtenByteCountListener)
Gets the BLOB referenced by
blobDigest. |
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,
String sourceRepository,
Consumer<Long> writtenByteCountListener)
Pushes the BLOB.
|
DescriptorDigest |
pushManifest(BuildableManifestTemplate manifestTemplate,
String imageTag)
Pushes the image manifest for a specific tag.
|
public static RegistryClient.Factory factory(EventHandlers eventHandlers, String serverUrl, String imageName)
RegistryClient.Factory for building a RegistryClient.eventHandlers - the event handlers used for dispatching log eventsserverUrl - the server URL for the registry (for example, gcr.io)imageName - the image/repository name (also known as, namespace)RegistryClient.Factorypublic static RegistryClient.Factory factory(EventHandlers eventHandlers, String serverUrl, String imageName, String sourceImageName)
public Optional<RegistryAuthenticator> getRegistryAuthenticator() throws IOException, RegistryException
RegistryAuthenticator to authenticate pulls/pushes with the registry, or
Optional.empty() 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 predefined subclasses; see: ManifestPuller.handleResponse(Response)IOException - if communicating with the endpoint failsRegistryException - if communicating with the endpoint failspublic ManifestTemplate pullManifest(String imageTag) throws IOException, RegistryException
IOExceptionRegistryExceptionpublic DescriptorDigest 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 failspublic Optional<BlobDescriptor> checkBlob(DescriptorDigest blobDigest) throws IOException, RegistryException
blobDigest - the blob digest to check forBlobDescriptor if the BLOB exists on the registry, or Optional.empty() if it doesn'tIOException - if communicating with the endpoint failsRegistryException - if communicating with the endpoint failspublic Blob pullBlob(DescriptorDigest blobDigest, Consumer<Long> blobSizeListener, Consumer<Long> writtenByteCountListener)
blobDigest. Note that the BLOB is only pulled when it is
written out.blobDigest - the digest of the BLOB to downloadblobSizeListener - callback to receive the total size of the BLOb to pullwrittenByteCountListener - listens on byte count written to an output stream during the
pullBlobpublic boolean pushBlob(DescriptorDigest blobDigest, Blob blob, @Nullable String sourceRepository, Consumer<Long> writtenByteCountListener) throws 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 pushwrittenByteCountListener - listens on byte count written to the registry during the 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 © 2019. All rights reserved.