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)
.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)
.credential(credential)
.buildClient();
View this for additional ways to construct the client.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteRepository(String repositoryName) Delete the repository identified byrepositoryName.com.azure.core.http.rest.Response<Void>deleteRepositoryWithResponse(String repositoryName, com.azure.core.util.Context context) Delete the repository identified byrepositoryName.getArtifact(String repositoryName, String tagOrDigest) Creates a new instance ofRegistryArtifactobject for the specified artifact.This method returns the complete registry endpoint.getRepository(String repositoryName) Creates a new instance ofContainerRepositoryobject for the specified repository.com.azure.core.http.rest.PagedIterable<String>List all the repository names in this registry.com.azure.core.http.rest.PagedIterable<String>listRepositoryNames(com.azure.core.util.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:
com.azure.core.exception.ClientAuthenticationException- thrown if the client credentials do not have access to perform this operation.
-
listRepositoryNames
public com.azure.core.http.rest.PagedIterable<String> listRepositoryNames(com.azure.core.util.Context context) 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:
com.azure.core.exception.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:
com.azure.core.exception.ClientAuthenticationException- thrown if the client's credentials do not have access to modify the namespace.NullPointerException- thrown if therepositoryNameis null.IllegalArgumentException- thrown if therepositoryNameis empty.
-
deleteRepositoryWithResponse
public com.azure.core.http.rest.Response<Void> deleteRepositoryWithResponse(String repositoryName, com.azure.core.util.Context context) 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:
com.azure.core.exception.ClientAuthenticationException- thrown if the client's credentials do not have access to modify the namespace.NullPointerException- thrown if therepositoryNameis null.IllegalArgumentException- thrown if therepositoryNameis empty.
-
getRepository
Creates a new instance ofContainerRepositoryobject 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
ContainerRepositoryfor the desired repository. - Throws:
NullPointerException- ifrepositoryNameis null.IllegalArgumentException- ifrepositoryNameis empty.
-
getArtifact
Creates a new instance ofRegistryArtifactobject 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
RegistryArtifactobject for the desired repository. - Throws:
NullPointerException- ifrepositoryNameortagOrDigestis null.IllegalArgumentException- ifrepositoryNameortagOrDigestis empty.
-