public final class ContainerRegistryClient extends Object
getArtifact
and getRepository
that can be used to perform operations on repository and artifacts.
Instantiating a synchronous Container Registry client
ContainerRegistryClient
registryAsyncClient = newContainerRegistryClientBuilder
() .endpoint(endpoint) .credential(credential) .buildClient();
Instantiating a synchronous Container Registry client with custom pipeline
HttpPipeline
pipeline = newHttpPipelineBuilder
() .policies(/* add policies */) .build();ContainerRegistryClient
registryAsyncClient = newContainerRegistryClientBuilder
() .pipeline(pipeline) .endpoint(endpoint) .credential(credential) .buildClient();
View this
for additional ways to construct the client.
ContainerRegistryClientBuilder
Modifier and Type | Method and Description |
---|---|
void |
deleteRepository(String repositoryName)
Delete the repository identified by
repositoryName . |
com.azure.core.http.rest.Response<Void> |
deleteRepositoryWithResponse(String repositoryName,
com.azure.core.util.Context context)
Delete the repository identified by
repositoryName . |
RegistryArtifact |
getArtifact(String repositoryName,
String digest)
Creates a new instance of
RegistryArtifact object for the specified artifact. |
String |
getEndpoint()
This method returns the complete registry endpoint.
|
ContainerRepository |
getRepository(String repositoryName)
Creates a new instance of
ContainerRepository 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.
|
public String getEndpoint()
public com.azure.core.http.rest.PagedIterable<String> listRepositoryNames()
List the repository names in the registry.
client.listRepositoryNames().stream().forEach(name -> {
System
.out.printf("Repository Name:%s,", name);
});
com.azure.core.exception.ClientAuthenticationException
- thrown if the client credentials do not have access to perform this operation.public com.azure.core.http.rest.PagedIterable<String> listRepositoryNames(com.azure.core.util.Context context)
List the repository names in the registry.
client.listRepositoryNames(Context
.NONE).stream().forEach(name -> {System
.out.printf("Repository Name:%s,", name); });
context
- The context to associate with this operation.com.azure.core.exception.ClientAuthenticationException
- thrown if the client credentials do not have access to perform this operation.public void deleteRepository(String repositoryName)
repositoryName
.
Delete a repository in the registry.
client.deleteRepository(repositoryName);
repositoryName
- Name of the repository (including the namespace).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 empty.public com.azure.core.http.rest.Response<Void> deleteRepositoryWithResponse(String repositoryName, com.azure.core.util.Context context)
repositoryName
.
Delete a repository in the registry.
client.deleteRepositoryWithResponse(repositoryName, Context
.NONE);
repositoryName
- Name of the repository (including the namespace).context
- The context to associate with this operation.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 empty.public ContainerRepository getRepository(String repositoryName)
ContainerRepository
object for the specified repository.
Create a ContainerRegistry helper instance.
ContainerRepository
repository = client.getRepository(repositoryName);ContainerRepositoryProperties
properties = repository.getProperties();System
.out.println(properties.getName());
repositoryName
- Name of the repository to reference.ContainerRepository
for the desired repository.NullPointerException
- if repositoryName
is null.IllegalArgumentException
- if repositoryName
is empty.public RegistryArtifact getArtifact(String repositoryName, String digest)
RegistryArtifact
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());
repositoryName
- Name of the repository to reference.digest
- Either a tag or digest that uniquely identifies the artifact.RegistryArtifact
object for the desired repository.NullPointerException
- if repositoryName
or digest
is null.IllegalArgumentException
- if repositoryName
or digest
is empty.Copyright © 2021 Microsoft Corporation. All rights reserved.