Class ContainerRepository
- java.lang.Object
-
- com.azure.containers.containerregistry.ContainerRepository
-
public final class ContainerRepository extends Object
This class provides a helper type that contains all the operations for repositories in Azure Container Registry. Operations allowed by this type are listing, retrieving, deleting, setting writeable properties. These operations are supported on the repository and the respective tags and manifests in it.Instantiating Container Repository helper type.
ContainerRepository repositoryClient = new ContainerRegistryClientBuilder() .endpoint(endpoint) .credential(credential) .audience(ContainerRegistryAudience.AZURE_RESOURCE_MANAGER_PUBLIC_CLOUD) .buildClient().getRepository(repository);
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
delete()
Delete the repository in the Azure Container Registry for the givenrepository
.com.azure.core.http.rest.Response<Void>
deleteWithResponse(com.azure.core.util.Context context)
Delete the repository in the Azure Container Registry for the givenrepository
.RegistryArtifact
getArtifact(String tagOrDigest)
Creates a new instance ofRegistryArtifact
object for the specified artifact.String
getName()
Gets the Azure Container Registry service endpoint for the current instance.ContainerRepositoryProperties
getProperties()
Gets theproperties
associated with the givenrepository
.com.azure.core.http.rest.Response<ContainerRepositoryProperties>
getPropertiesWithResponse(com.azure.core.util.Context context)
Gets theproperties
associated with the givenrepository
.String
getRegistryEndpoint()
Gets the Azure Container Registry name for the current instance.com.azure.core.http.rest.PagedIterable<ArtifactManifestProperties>
listManifestProperties()
Fetches all the artifacts associated with the givenrepository
.com.azure.core.http.rest.PagedIterable<ArtifactManifestProperties>
listManifestProperties(ArtifactManifestOrder order)
Fetches all the artifacts associated with the givenrepository
.com.azure.core.http.rest.PagedIterable<ArtifactManifestProperties>
listManifestProperties(ArtifactManifestOrder order, com.azure.core.util.Context context)
Fetches all the artifacts associated with the givenrepository
.ContainerRepositoryProperties
updateProperties(ContainerRepositoryProperties repositoryProperties)
Update the repository propertiesContainerRepositoryProperties
of the givenrepository
.com.azure.core.http.rest.Response<ContainerRepositoryProperties>
updatePropertiesWithResponse(ContainerRepositoryProperties repositoryProperties, com.azure.core.util.Context context)
Update the settable propertiesContainerRepositoryProperties
of the givenrepository
.
-
-
-
Method Detail
-
getName
public String getName()
Gets the Azure Container Registry service endpoint for the current instance.- Returns:
- The service endpoint for the current instance.
-
getRegistryEndpoint
public String getRegistryEndpoint()
Gets the Azure Container Registry name for the current instance.- Returns:
- Return the registry name.
-
deleteWithResponse
public com.azure.core.http.rest.Response<Void> deleteWithResponse(com.azure.core.util.Context context)
Delete the repository in the Azure Container Registry for the givenrepository
.Code Samples
Delete the repository.
Response<Void> response = client.deleteWithResponse(Context.NONE); System.out.printf("Successfully initiated delete.");
- Parameters:
context
- Additional context that is passed through the Http pipeline during the service call. artifacts that are deleted as part of the repository delete.- Returns:
- A void response for completion.
- Throws:
com.azure.core.exception.ClientAuthenticationException
- thrown if the client does not have access to the repository.com.azure.core.exception.HttpResponseException
- thrown if any other unexpected exception is returned by the service.
-
delete
public void delete()
Delete the repository in the Azure Container Registry for the givenrepository
.Code Samples
Delete the repository.
client.delete(); System.out.printf("Successfully initiated delete.");
- Throws:
com.azure.core.exception.ClientAuthenticationException
- thrown if the client does not have access to the repository.com.azure.core.exception.HttpResponseException
- thrown if any other unexpected exception is returned by the service.
-
getPropertiesWithResponse
public com.azure.core.http.rest.Response<ContainerRepositoryProperties> getPropertiesWithResponse(com.azure.core.util.Context context)
Gets theproperties
associated with the givenrepository
.Code Samples
Get the properties for the given repository.
Response<ContainerRepositoryProperties> response = client.getPropertiesWithResponse(Context.NONE); final ContainerRepositoryProperties properties = response.getValue(); System.out.printf("Name:%s,", properties.getName());
- Parameters:
context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- A REST response with the
properties
associated with the givenrepository
. - Throws:
com.azure.core.exception.ClientAuthenticationException
- thrown if the client does not have access to modify the namespace.com.azure.core.exception.ResourceNotFoundException
- thrown if the repository with the given name was not found.com.azure.core.exception.HttpResponseException
- thrown if any other unexpected exception is returned by the service.
-
getProperties
public ContainerRepositoryProperties getProperties()
Gets theproperties
associated with the givenrepository
.Code Samples
Get the properties for the given repository.
ContainerRepositoryProperties properties = client.getProperties(); System.out.printf("Name:%s,", properties.getName());
- Returns:
- The
properties
associated with the givenrepository
. - Throws:
com.azure.core.exception.ClientAuthenticationException
- thrown if the client does not have access to modify the namespace.com.azure.core.exception.ResourceNotFoundException
- thrown if the repository with the given name was not found.com.azure.core.exception.HttpResponseException
- thrown if any other unexpected exception is returned by the service.
-
getArtifact
public RegistryArtifact getArtifact(String tagOrDigest)
Creates a new instance ofRegistryArtifact
object for the specified artifact.- Parameters:
tagOrDigest
- Either a tag or digest that uniquely identifies the artifact.- Returns:
- A new
RegistryArtifact
object for the desired repository. - Throws:
NullPointerException
- iftagOrDigest
is null.IllegalArgumentException
- iftagOrDigest
is empty.
-
listManifestProperties
public com.azure.core.http.rest.PagedIterable<ArtifactManifestProperties> listManifestProperties()
Fetches all the artifacts associated with the givenrepository
.If you would like to specify the order in which the tags are returned please use the overload that takes in the options parameter
listManifestProperties(ArtifactManifestOrder, Context)
listManifestProperties} No assumptions on the order can be made if no options are provided to the service.Code Samples
Retrieve all artifacts associated with the given repository.
client.listManifestProperties().iterableByPage(10) .forEach(pagedResponse -> { pagedResponse.getValue().stream().forEach( ManifestProperties -> System.out.println(ManifestProperties.getDigest())); });
- Returns:
PagedIterable
of the artifacts for the given repository in the order specified by the options.- Throws:
com.azure.core.exception.ClientAuthenticationException
- thrown if the client's credentials do not have access to modify the namespace.com.azure.core.exception.HttpResponseException
- thrown if any other unexpected exception is returned by the service.
-
listManifestProperties
public com.azure.core.http.rest.PagedIterable<ArtifactManifestProperties> listManifestProperties(ArtifactManifestOrder order)
Fetches all the artifacts associated with the givenrepository
.The method supports options to select the order in which the artifacts are returned by the service. Currently the service supports an ascending or descending order for the last updated time for the artifacts. No assumptions on the order can be made if no options are provided by the service.
Code Samples
Retrieve all artifacts associated with the given repository from the most recently updated to the last.
client.listManifestProperties(ArtifactManifestOrder.LAST_UPDATED_ON_DESCENDING).iterableByPage(10) .forEach(pagedResponse -> { pagedResponse.getValue().stream().forEach( ManifestProperties -> System.out.println(ManifestProperties.getDigest())); });
- Parameters:
order
- the order in which the artifacts are returned by the service.- Returns:
PagedIterable
of the artifacts for the given repository in the order specified by the options.- Throws:
com.azure.core.exception.ClientAuthenticationException
- thrown if the client's credentials do not have access to modify the namespace.com.azure.core.exception.HttpResponseException
- thrown if any other unexpected exception is returned by the service.
-
listManifestProperties
public com.azure.core.http.rest.PagedIterable<ArtifactManifestProperties> listManifestProperties(ArtifactManifestOrder order, com.azure.core.util.Context context)
Fetches all the artifacts associated with the givenrepository
.The method supports options to select the order in which the artifacts are returned by the service. Currently the service supports an ascending or descending order for the last updated time for the artifacts. No assumptions on the order can be made if no options are provided by the service.
Code Samples
Retrieve all artifacts associated with the given repository from the most recently updated to the last.
client.listManifestProperties(ArtifactManifestOrder.LAST_UPDATED_ON_DESCENDING, Context.NONE).iterableByPage(10) .forEach(pagedResponse -> { pagedResponse.getValue().stream().forEach( ManifestProperties -> System.out.println(ManifestProperties.getDigest())); });
- Parameters:
order
- the order in which the artifacts are returned by the service.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
PagedIterable
of the artifacts for the given repository in the order specified by the options.- Throws:
com.azure.core.exception.ClientAuthenticationException
- thrown if the client's credentials do not have access to modify the namespace.com.azure.core.exception.HttpResponseException
- thrown if any other unexpected exception is returned by the service.
-
updatePropertiesWithResponse
public com.azure.core.http.rest.Response<ContainerRepositoryProperties> updatePropertiesWithResponse(ContainerRepositoryProperties repositoryProperties, com.azure.core.util.Context context)
Update the settable propertiesContainerRepositoryProperties
of the givenrepository
. These properties set the update, delete and retrieve options of the repository.Code Samples
Update the writeable properties for the given repository.
ContainerRepositoryProperties properties = getRepositoryProperties(); client.updatePropertiesWithResponse(properties, Context.NONE);
- Parameters:
repositoryProperties
-repository properties
that need to be updated for the repository.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- A REST response with the completion.
- Throws:
com.azure.core.exception.ClientAuthenticationException
- thrown if the client does not have access to the repository.com.azure.core.exception.ResourceNotFoundException
- thrown if the repository with the given name was not found.com.azure.core.exception.HttpResponseException
- thrown if any other unexpected exception is returned by the service.NullPointerException
- thrown if therepositoryProperties
is null.
-
updateProperties
public ContainerRepositoryProperties updateProperties(ContainerRepositoryProperties repositoryProperties)
Update the repository propertiesContainerRepositoryProperties
of the givenrepository
. These properties set the update, delete and retrieve options of the repository.Code Samples
Update the writeable properties for the given repository.
ContainerRepositoryProperties properties = getRepositoryProperties(); client.updateProperties(properties);
- Parameters:
repositoryProperties
-repository properties
that need to be updated for the repository.- Returns:
- The updated
properties
- Throws:
com.azure.core.exception.ClientAuthenticationException
- thrown if the client does not have access to the repository.com.azure.core.exception.ResourceNotFoundException
- thrown if the repository with the given name was not found.com.azure.core.exception.HttpResponseException
- thrown if any other unexpected exception is returned by the service.NullPointerException
- thrown if therepositoryProperties
is null.
-
-