Class ContainerRegistryClient
- java.lang.Object
-
- com.azure.containers.containerregistry.ContainerRegistryClient
-
public final class ContainerRegistryClient extends Object
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 likegetArtifact
andgetRepository
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:
ContainerRegistryClientBuilder
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deleteRepository(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
.RegistryArtifact
getArtifact(String repositoryName, String tagOrDigest)
Creates a new instance ofRegistryArtifact
object for the specified artifact.String
getEndpoint()
This method returns the complete registry endpoint.ContainerRepository
getRepository(String repositoryName)
Creates a new instance ofContainerRepository
object for the specified repository.com.azure.core.http.rest.PagedIterable<String>
listRepositoryNames()
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 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.PagedIterable<String> 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
public void deleteRepository(String repositoryName)
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 therepositoryName
is null.IllegalArgumentException
- thrown if therepositoryName
is 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 therepositoryName
is null.IllegalArgumentException
- thrown if therepositoryName
is empty.
-
getRepository
public ContainerRepository getRepository(String repositoryName)
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
public RegistryArtifact getArtifact(String repositoryName, String tagOrDigest)
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.
-
-