Class ContainerRegistryAsyncClient


  • public final class ContainerRegistryAsyncClient
    extends Object
    This class provides a client that exposes operations to managing container images and artifacts. 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 directly.

    Instantiating an asynchronous Container Registry client

     ContainerRegistryAsyncClient registryAsyncClient = new ContainerRegistryClientBuilder()
         .endpoint(endpoint)
         .credential(credential)
         .audience(ContainerRegistryAudience.AZURE_RESOURCE_MANAGER_PUBLIC_CLOUD)
         .buildAsyncClient();
     

    Instantiating an asynchronous Container Registry client using a custom pipeline

     HttpPipeline pipeline = new HttpPipelineBuilder()
         .policies(/* add policies */)
         .build();
    
     ContainerRegistryAsyncClient registryAsyncClient = new ContainerRegistryClientBuilder()
         .pipeline(pipeline)
         .endpoint(endpoint)
         .audience(ContainerRegistryAudience.AZURE_RESOURCE_MANAGER_PUBLIC_CLOUD)
         .credential(credential)
         .buildAsyncClient();
     

    View this for additional ways to construct the client.

    See Also:
    ContainerRegistryClientBuilder
    • Method Detail

      • getEndpoint

        public String getEndpoint()
        This method returns the complete registry endpoint.
        Returns:
        The registry endpoint including the authority.
      • listRepositoryNames

        public com.azure.core.http.rest.PagedFlux<String> listRepositoryNames()
        List all the repository names in this registry.

        List repository names in the registry.

         client.listRepositoryNames().subscribe(name -> {
             System.out.printf("Repository Name:%s,", name);
         });
         
        Returns:
        list of repository names.
        Throws:
        com.azure.core.exception.ClientAuthenticationException - thrown if the client's credentials do not have access to modify the namespace.
      • deleteRepositoryWithResponse

        public Mono<com.azure.core.http.rest.Response<Void>> deleteRepositoryWithResponse​(String repositoryName)
        Delete the repository identified by 'repositoryName'.

        Delete a repository in the registry.

         client.deleteRepositoryWithResponse(repositoryName).subscribe(response -> {
             System.out.printf("Successfully initiated delete of the repository.");
         }, error -> {
             System.out.println("Failed to initiate a delete of the repository.");
         });
         
        Parameters:
        repositoryName - Name of the repository (including the namespace).
        Returns:
        the completion.
        Throws:
        com.azure.core.exception.ClientAuthenticationException - thrown if the client's credentials do not have access to modify the namespace.
        NullPointerException - thrown if the repositoryName is null.
        IllegalArgumentException - thrown if the repositoryName is null.
      • deleteRepository

        public Mono<Void> deleteRepository​(String repositoryName)
        Delete the repository identified by repositoryName.

        Delete a repository in the registry.

         client.deleteRepository(repositoryName).subscribe(response -> {
             System.out.printf("Successfully initiated delete of the repository.");
         }, error -> {
             System.out.println("Failed to initiate a delete of the repository.");
         });
         
        Parameters:
        repositoryName - Name of the image (including the namespace).
        Returns:
        the completion stream.
        Throws:
        com.azure.core.exception.ClientAuthenticationException - thrown if the client's credentials do not have access to modify the namespace.
        NullPointerException - thrown if the repositoryName is null.
        IllegalArgumentException - thrown if repositoryName is empty.
      • getRepository

        public ContainerRepositoryAsync getRepository​(String repositoryName)
        Creates a new instance of ContainerRepositoryAsync object for the specified repository.

        Create an instance of ContainerRepositoryAsync helper type

         ContainerRepositoryAsync repositoryAsync = client.getRepository(repositoryName);
         repositoryAsync.getProperties().subscribe(properties -> {
             System.out.println(properties.getName());
         });
         
        Parameters:
        repositoryName - Name of the repository to reference.
        Returns:
        A new ContainerRepositoryAsync for the desired repository.
        Throws:
        NullPointerException - if repositoryName is null.
        IllegalArgumentException - if repositoryName is empty.
      • getArtifact

        public RegistryArtifactAsync getArtifact​(String repositoryName,
                                                 String tagOrDigest)
        Creates a new instance of RegistryArtifactAsync object for the specified artifact.

        Create an instance of RegistryArtifactAsync helper type

         RegistryArtifactAsync registryArtifactAsync = client.getArtifact(repositoryName, tagOrDigest);
         registryArtifactAsync.getManifestProperties().subscribe(properties -> {
             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 RegistryArtifactAsync for the desired repository.
        Throws:
        NullPointerException - if repositoryName or tagOrDigest is null.
        IllegalArgumentException - if repositoryName or tagOrDigest is empty.