Class ContainerRepositoryAsync
- java.lang.Object
-
- com.azure.containers.containerregistry.ContainerRepositoryAsync
-
public final class ContainerRepositoryAsync extends Object
This class provides helper methods for operations on a given repository in Azure Container Registry. Operations included are listing, retrieving, deleting, setting writeable properties.Instantiating an asynchronous Container Repository Helper class
ContainerRepositoryAsync repositoryAsyncClient = new ContainerRegistryClientBuilder() .endpoint(endpoint) .credential(credential) .audience(ContainerRegistryAudience.AZURE_RESOURCE_MANAGER_PUBLIC_CLOUD) .buildAsyncClient() .getRepository(repository);
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Mono<Void>
delete()
Delete the repository in the Azure Container Registry for the givenrepository
.Mono<com.azure.core.http.rest.Response<Void>>
deleteWithResponse()
Delete the repository in the Azure Container Registry for the givenrepository
.RegistryArtifactAsync
getArtifact(String tagOrDigest)
Creates a new instance ofRegistryArtifactAsync
object for the specified artifact.String
getName()
Gets the Azure Container Registry service endpoint for the current instance.Mono<ContainerRepositoryProperties>
getProperties()
Gets theproperties
associated with the givenrepository
.Mono<com.azure.core.http.rest.Response<ContainerRepositoryProperties>>
getPropertiesWithResponse()
Gets theproperties
associated with the givenrepository
.String
getRegistryEndpoint()
Gets the Azure Container Registry name for the current instance.com.azure.core.http.rest.PagedFlux<ArtifactManifestProperties>
listManifestProperties()
Fetches all the artifacts associated with the givenrepository
.com.azure.core.http.rest.PagedFlux<ArtifactManifestProperties>
listManifestProperties(ArtifactManifestOrder order)
Fetches all the artifacts associated with the givenrepository
.Mono<ContainerRepositoryProperties>
updateProperties(ContainerRepositoryProperties repositoryProperties)
Update the repository propertiesContainerRepositoryProperties
of the givenrepository
.Mono<com.azure.core.http.rest.Response<ContainerRepositoryProperties>>
updatePropertiesWithResponse(ContainerRepositoryProperties repositoryProperties)
Update the repository 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 Mono<com.azure.core.http.rest.Response<Void>> deleteWithResponse()
Delete the repository in the Azure Container Registry for the givenrepository
.Code Samples
Delete the repository.
client.deleteWithResponse().subscribe(response -> { System.out.printf("Successfully initiated delete of the repository."); }, error -> { System.out.println("Failed to initiate a delete of the repository."); });
- Returns:
- A REST response containing the result of the repository delete operation. It returns the count of the tags and artifacts that are deleted as part of the repository 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.
-
delete
public Mono<Void> delete()
Delete the repository in the Azure Container Registry for the givenrepository
.Code Samples
Delete the repository.
client.delete().subscribe(response -> { System.out.printf("Successfully initiated delete of the repository."); }, error -> { System.out.println("Failed to initiate a delete of the repository."); });
- Returns:
- It returns the count of the tags and artifacts that are deleted as part of the repository 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.
-
getArtifact
public RegistryArtifactAsync getArtifact(String tagOrDigest)
Creates a new instance ofRegistryArtifactAsync
object for the specified artifact.- Parameters:
tagOrDigest
- Either a tag or digest that uniquely identifies the artifact.- Returns:
- A new
RegistryArtifactAsync
object for the desired repository. - Throws:
NullPointerException
- iftagOrDigest
is null.IllegalArgumentException
- iftagOrDigest
is empty.
-
listManifestProperties
public com.azure.core.http.rest.PagedFlux<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)
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().byPage(10) .subscribe(ManifestPropertiesPagedResponse -> { ManifestPropertiesPagedResponse.getValue().stream().forEach( ManifestProperties -> System.out.println(ManifestProperties.getDigest())); });
- Returns:
PagedFlux
of ManifestProperties for all the artifacts in the given repository.- 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.
-
listManifestProperties
public com.azure.core.http.rest.PagedFlux<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 based on the last updated time for the artifacts. 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 from the most recently updated to the last.
client.listManifestProperties(ArtifactManifestOrder.LAST_UPDATED_ON_DESCENDING).byPage(10) .subscribe(ManifestPropertiesPagedResponse -> { ManifestPropertiesPagedResponse.getValue().stream().forEach( ManifestProperties -> System.out.println(ManifestProperties.getDigest())); });
- Parameters:
order
- The order in which the artifacts are returned by the service.- Returns:
PagedFlux
of the artifacts for the given repository in the order specified by the options.- 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 Mono<com.azure.core.http.rest.Response<ContainerRepositoryProperties>> getPropertiesWithResponse()
Gets theproperties
associated with the givenrepository
.Code Samples
Get the properties for the given repository.
client.getPropertiesWithResponse().subscribe(response -> { final ContainerRepositoryProperties properties = response.getValue(); System.out.printf("Name:%s,", properties.getName()); });
- Returns:
- A REST response with the
properties
associated with the givenrepository
. - Throws:
com.azure.core.exception.ClientAuthenticationException
- thrown if the client 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.
-
getProperties
public Mono<ContainerRepositoryProperties> getProperties()
Gets theproperties
associated with the givenrepository
.Code Samples
Get the properties for the given repository.
client.getProperties().subscribe(response -> { System.out.printf("Name:%s,", response.getName()); });
- Returns:
- The
properties
associated with the givenrepository
. - 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.
-
updatePropertiesWithResponse
public Mono<com.azure.core.http.rest.Response<ContainerRepositoryProperties>> updatePropertiesWithResponse(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.updatePropertiesWithResponse(properties).subscribe();
- Parameters:
repositoryProperties
-repository properties
that need to be updated for the repository.- Returns:
- The updated
repository 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 ifrepositoryProperties
is null.
-
updateProperties
public Mono<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).subscribe();
- Parameters:
repositoryProperties
-writeable properties
that need to be updated for the repository.- Returns:
- 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.
-
-