Class ContainerRegistryClient
java.lang.Object
com.azure.containers.containerregistry.ContainerRegistryClient
This class provides a client that exposes operations to managing container images and artifacts.
synchronously. It exposes methods directly performed on the registry like listing the catalog.
as well as helper types like
getArtifact
and getRepository
that can be used to perform operations on repository and artifacts.
Instantiating a synchronous Container Registry client
ContainerRegistryClient registryAsyncClient = new ContainerRegistryClientBuilder() .endpoint(endpoint) .audience(ContainerRegistryAudience.AZURE_RESOURCE_MANAGER_PUBLIC_CLOUD) .credential(credential) .buildClient();
Instantiating a synchronous Container Registry client with custom pipeline
HttpPipeline pipeline = new HttpPipelineBuilder() .policies(/* add policies */) .build(); ContainerRegistryClient registryAsyncClient = new ContainerRegistryClientBuilder() .pipeline(pipeline) .endpoint(endpoint) .audience(ContainerRegistryAudience.AZURE_RESOURCE_MANAGER_PUBLIC_CLOUD) .credential(credential) .buildClient();
View this
for additional ways to construct the client.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
deleteRepository
(String repositoryName) Delete the repository identified byrepositoryName
.deleteRepositoryWithResponse
(String repositoryName, Context context) Delete the repository identified byrepositoryName
.getArtifact
(String repositoryName, String tagOrDigest) Creates a new instance ofRegistryArtifact
object for the specified artifact.This method returns the complete registry endpoint.getRepository
(String repositoryName) Creates a new instance ofContainerRepository
object for the specified repository.List all the repository names in this registry.listRepositoryNames
(Context context) List all the repository names in this registry.
-
Method Details
-
getEndpoint
This method returns the complete registry endpoint.- Returns:
- The registry endpoint including the authority.
-
listRepositoryNames
List all the repository names in this registry.List the repository names in the registry.
client.listRepositoryNames().stream().forEach(name -> { System.out.printf("Repository Name:%s,", name); });
- Returns:
- list of repository names.
- Throws:
ClientAuthenticationException
- thrown if the client credentials do not have access to perform this operation.
-
listRepositoryNames
List all the repository names in this registry.List the repository names in the registry.
client.listRepositoryNames(Context.NONE).stream().forEach(name -> { System.out.printf("Repository Name:%s,", name); });
- Parameters:
context
- The context to associate with this operation.- Returns:
- list of repositories.
- Throws:
ClientAuthenticationException
- thrown if the client credentials do not have access to perform this operation.
-
deleteRepository
Delete the repository identified byrepositoryName
.Delete a repository in the registry.
client.deleteRepository(repositoryName);
- Parameters:
repositoryName
- Name of the repository (including the namespace).- Throws:
ClientAuthenticationException
- thrown if the client's credentials do not have access to modify the namespace.NullPointerException
- thrown if therepositoryName
is null.IllegalArgumentException
- thrown if therepositoryName
is empty.
-
deleteRepositoryWithResponse
Delete the repository identified byrepositoryName
.Delete a repository in the registry.
client.deleteRepositoryWithResponse(repositoryName, Context.NONE);
- Parameters:
repositoryName
- Name of the repository (including the namespace).context
- The context to associate with this operation.- Returns:
- Completion response.
- Throws:
ClientAuthenticationException
- thrown if the client's credentials do not have access to modify the namespace.NullPointerException
- thrown if therepositoryName
is null.IllegalArgumentException
- thrown if therepositoryName
is empty.
-
getRepository
Creates a new instance ofContainerRepository
object for the specified repository.Create a ContainerRegistry helper instance.
ContainerRepository repository = client.getRepository(repositoryName); ContainerRepositoryProperties properties = repository.getProperties(); System.out.println(properties.getName());
- Parameters:
repositoryName
- Name of the repository to reference.- Returns:
- A new
ContainerRepository
for the desired repository. - Throws:
NullPointerException
- ifrepositoryName
is null.IllegalArgumentException
- ifrepositoryName
is empty.
-
getArtifact
Creates a new instance ofRegistryArtifact
object for the specified artifact.Create a RegistryArtifact helper instance.
RegistryArtifact registryArtifact = client.getArtifact(repositoryName, tagOrDigest); ArtifactManifestProperties properties = registryArtifact.getManifestProperties(); System.out.println(properties.getDigest());
- Parameters:
repositoryName
- Name of the repository to reference.tagOrDigest
- Either a tag or digest that uniquely identifies the artifact.- Returns:
- A new
RegistryArtifact
object for the desired repository. - Throws:
NullPointerException
- ifrepositoryName
ortagOrDigest
is null.IllegalArgumentException
- ifrepositoryName
ortagOrDigest
is empty.
-