Class RegistryArtifact
- java.lang.Object
-
- com.azure.containers.containerregistry.RegistryArtifact
-
public final class RegistryArtifact extends Object
This class provides a helper type that contains all the operations for artifacts in a given repository.Instantiating Registry Artifact
RegistryArtifact registryArtifact = new ContainerRegistryClientBuilder() .endpoint(endpoint) .credential(credential) .audience(ContainerRegistryAudience.AZURE_RESOURCE_MANAGER_PUBLIC_CLOUD) .buildClient().getArtifact(repository, digest);
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
delete()
Deletes the registry artifact with the digest and repository associated with the instance.void
deleteTag(String tag)
Deletes the tag with the matching tag name for the givenrepository
.com.azure.core.http.rest.Response<Void>
deleteTagWithResponse(String tag, com.azure.core.util.Context context)
Deletes the tag with the matching tag name for the givenrepository
.com.azure.core.http.rest.Response<Void>
deleteWithResponse(com.azure.core.util.Context context)
Deletes the registry artifact with the digest and repository associated with the instance.String
getFullyQualifiedReference()
Gets the fully qualified reference for the current instance.ArtifactManifestProperties
getManifestProperties()
Gets theproperties
associated with an artifact in givenrepository
.com.azure.core.http.rest.Response<ArtifactManifestProperties>
getManifestPropertiesWithResponse(com.azure.core.util.Context context)
Gets theproperties
associated with an artifact in givenrepository
.String
getRegistryEndpoint()
Gets the Azure Container Registry service endpoint for the current instance.String
getRepositoryName()
Gets the repository name for the current instance.ArtifactTagProperties
getTagProperties(String tag)
Gets the tag properties associated with a given tag in therepository
.com.azure.core.http.rest.Response<ArtifactTagProperties>
getTagPropertiesWithResponse(String tag, com.azure.core.util.Context context)
Gets the tag properties associated with a given tag in therepository
.com.azure.core.http.rest.PagedIterable<ArtifactTagProperties>
listTagProperties()
Fetches all the tags associated with the givenrepository
.com.azure.core.http.rest.PagedIterable<ArtifactTagProperties>
listTagProperties(ArtifactTagOrder order)
Fetches all the tags associated with the givenrepository
.com.azure.core.http.rest.PagedIterable<ArtifactTagProperties>
listTagProperties(ArtifactTagOrder order, com.azure.core.util.Context context)
Fetches all the tags associated with the givenrepository
.ArtifactManifestProperties
updateManifestProperties(ArtifactManifestProperties manifestProperties)
Update the writeable propertiesArtifactTagProperties
of the artifact with the givendigest
.com.azure.core.http.rest.Response<ArtifactManifestProperties>
updateManifestPropertiesWithResponse(ArtifactManifestProperties manifestProperties, com.azure.core.util.Context context)
Update the propertiesArtifactTagProperties
of the artifact with the givendigest
.ArtifactTagProperties
updateTagProperties(String tag, ArtifactTagProperties tagProperties)
Update the propertiesArtifactTagProperties
of the giventag
.com.azure.core.http.rest.Response<ArtifactTagProperties>
updateTagPropertiesWithResponse(String tag, ArtifactTagProperties tagProperties, com.azure.core.util.Context context)
Update the propertiesArtifactTagProperties
of the given tag inrepository
.
-
-
-
Method Detail
-
getRegistryEndpoint
public String getRegistryEndpoint()
Gets the Azure Container Registry service endpoint for the current instance.- Returns:
- The service endpoint for the current instance.
-
getRepositoryName
public String getRepositoryName()
Gets the repository name for the current instance. Gets the repository name for the current instance.- Returns:
- Name of the repository for the current instance.
-
getFullyQualifiedReference
public String getFullyQualifiedReference()
Gets the fully qualified reference for the current instance.- Returns:
- Fully qualified reference of the current instance.
-
deleteWithResponse
public com.azure.core.http.rest.Response<Void> deleteWithResponse(com.azure.core.util.Context context)
Deletes the registry artifact with the digest and repository associated with the instance.Code Samples
Delete the registry artifact.
client.deleteWithResponse(Context.NONE);
- Parameters:
context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- A REST response containing the result of the service call.
- 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()
Deletes the registry artifact with the digest and repository associated with the instance.Code Samples
Delete the registry artifact.
client.delete();
- Throws:
com.azure.core.exception.ClientAuthenticationException
- thrown if the client does not have access to modify the namespace.com.azure.core.exception.HttpResponseException
- thrown if any other unexpected exception is returned by the service.
-
deleteTagWithResponse
public com.azure.core.http.rest.Response<Void> deleteTagWithResponse(String tag, com.azure.core.util.Context context)
Deletes the tag with the matching tag name for the givenrepository
.Code Samples
Delete the tag for the given repository.
String tag = getTag(); client.deleteTagWithResponse(tag, Context.NONE);
- Parameters:
tag
- The name of the tag that needs to be deleted.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- A REST response containing the result of the service call.
- Throws:
com.azure.core.exception.ClientAuthenticationException
- thrown if the client does not have access to modify the namespace.NullPointerException
- thrown iftag
is null.IllegalArgumentException
- thrown iftag
is empty.com.azure.core.exception.HttpResponseException
- thrown if any other unexpected exception is returned by the service.
-
deleteTag
public void deleteTag(String tag)
Deletes the tag with the matching tag name for the givenrepository
.Code Samples
Delete the tag for the given repository.
String tag = getTag(); client.deleteTag(tag);
- Parameters:
tag
- The name of the tag that needs to be deleted.- Throws:
com.azure.core.exception.ClientAuthenticationException
- thrown if the client does not have access to modify the namespace.NullPointerException
- thrown iftag
is null.IllegalArgumentException
- throws iftag
is empty.com.azure.core.exception.HttpResponseException
- thrown if any other unexpected exception is returned by the service.
-
getManifestPropertiesWithResponse
public com.azure.core.http.rest.Response<ArtifactManifestProperties> getManifestPropertiesWithResponse(com.azure.core.util.Context context)
Gets theproperties
associated with an artifact in givenrepository
.This method can take in both a digest as well as a tag.
In case a tag is provided it calls the service to get the digest associated with the given tag.Code Samples
Get the properties for the given repository.
Response<ArtifactManifestProperties> response = client.getManifestPropertiesWithResponse( Context.NONE); final ArtifactManifestProperties properties = response.getValue(); System.out.printf("Digest:%s,", properties.getDigest());
- Parameters:
context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- A REST response containing
properties
associated with the givenDigest
. - Throws:
com.azure.core.exception.ClientAuthenticationException
- thrown if the client's credentials do not have access to modify the namespace.com.azure.core.exception.ResourceNotFoundException
- thrown if the given digest was not found.com.azure.core.exception.HttpResponseException
- thrown if any other unexpected exception is returned by the service.
-
getManifestProperties
public ArtifactManifestProperties getManifestProperties()
Gets theproperties
associated with an artifact in givenrepository
.This method can take in both a digest as well as a tag.
In case a tag is provided it calls the service to get the digest associated with the given tag.Code Samples
Get the registry artifact properties for a given tag or digest.
ArtifactManifestProperties properties = client.getManifestProperties(); System.out.printf("Digest:%s,", properties.getDigest());
- Returns:
- The
properties
associated with the givenDigest
. - Throws:
com.azure.core.exception.ClientAuthenticationException
- thrown if the client's credentials do not have access to modify the namespace.com.azure.core.exception.ResourceNotFoundException
- thrown if the given digest was not found.com.azure.core.exception.HttpResponseException
- thrown if any other unexpected exception is returned by the service.
-
getTagPropertiesWithResponse
public com.azure.core.http.rest.Response<ArtifactTagProperties> getTagPropertiesWithResponse(String tag, com.azure.core.util.Context context)
Gets the tag properties associated with a given tag in therepository
.Code Samples
Retrieve the properties associated with the given tag.
String tag = getTag(); Response<ArtifactTagProperties> response = client.getTagPropertiesWithResponse(tag, Context.NONE); final ArtifactTagProperties properties = response.getValue(); System.out.printf("Digest:%s,", properties.getDigest());
- Parameters:
tag
- name of the tag.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- A REST response with the
properties
associated with the given tag. - 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 given tag was not found.NullPointerException
- thrown iftag
is null.IllegalArgumentException
- throws iftag
is empty.com.azure.core.exception.HttpResponseException
- thrown if any other unexpected exception is returned by the service.
-
getTagProperties
public ArtifactTagProperties getTagProperties(String tag)
Gets the tag properties associated with a given tag in therepository
.Code Samples
Retrieve the properties associated with the given tag.
String tag = getTag(); ArtifactTagProperties properties = client.getTagProperties(tag); System.out.printf("Digest:%s,", properties.getDigest());
- Parameters:
tag
- name of the tag.- Returns:
- The
properties
associated with the given tag. - 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 given tag was not found.NullPointerException
- thrown iftag
is null.IllegalArgumentException
- throws iftag
is empty.com.azure.core.exception.HttpResponseException
- thrown if any other unexpected exception is returned by the service.
-
listTagProperties
public com.azure.core.http.rest.PagedIterable<ArtifactTagProperties> listTagProperties()
Fetches all the tags 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
listTagProperties(ArtifactTagOrder, Context)
listTagProperties} No assumptions on the order can be made if no options are provided to the service.Code Samples
Retrieve all the tags associated with the given repository.
client.listTagProperties().iterableByPage(10).forEach(pagedResponse -> { pagedResponse.getValue().stream().forEach( tagProperties -> System.out.println(tagProperties.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 does not have access to the repository.com.azure.core.exception.HttpResponseException
- thrown if any other unexpected exception is returned by the service.
-
listTagProperties
public com.azure.core.http.rest.PagedIterable<ArtifactTagProperties> listTagProperties(ArtifactTagOrder order)
Fetches all the tags associated with the givenrepository
.The method supports options to select the order in which the tags are returned by the service. Currently the service supports an ascending or descending order based on the last updated time of the tag. No assumptions on the order can be made if no options are provided to the service.
Code Samples
Retrieve all the tags associated with the given repository from the most recently updated to the last.
client.listTagProperties(ArtifactTagOrder.LAST_UPDATED_ON_DESCENDING) .iterableByPage(10) .forEach(pagedResponse -> { pagedResponse.getValue() .stream() .forEach(tagProperties -> System.out.println(tagProperties.getDigest())); });
- Parameters:
order
- The order in which the tags should be 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 does not have access to the repository.com.azure.core.exception.HttpResponseException
- thrown if any other unexpected exception is returned by the service.
-
listTagProperties
public com.azure.core.http.rest.PagedIterable<ArtifactTagProperties> listTagProperties(ArtifactTagOrder order, com.azure.core.util.Context context)
Fetches all the tags associated with the givenrepository
.The method supports options to select the order in which the tags are returned by the service. Currently the service supports an ascending or descending order based on the last updated time of the tag. No assumptions on the order can be made if no options are provided to the service.
Code Samples
Retrieve all the tags associated with the given repository from the most recently updated to the last.
client.listTagProperties(ArtifactTagOrder.LAST_UPDATED_ON_DESCENDING, Context.NONE) .iterableByPage(10) .forEach(pagedResponse -> { pagedResponse.getValue() .stream() .forEach(tagProperties -> System.out.println(tagProperties.getDigest())); });
- Parameters:
order
- The order in which the tags should be 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 does not have access to the repository.com.azure.core.exception.HttpResponseException
- thrown if any other unexpected exception is returned by the service.
-
updateTagPropertiesWithResponse
public com.azure.core.http.rest.Response<ArtifactTagProperties> updateTagPropertiesWithResponse(String tag, ArtifactTagProperties tagProperties, com.azure.core.util.Context context)
Update the propertiesArtifactTagProperties
of the given tag inrepository
. These properties set whether the given tag can be updated, deleted and retrieved.Code Samples
Update the writeable properties of a given tag.
ArtifactTagProperties properties = getArtifactTagProperties(); String tag = getTag(); client.updateTagPropertiesWithResponse(tag, properties, Context.NONE);
- Parameters:
tag
- Name of the tag.tagProperties
-tagProperties
to be set.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- A REST response for the completion.
- Throws:
com.azure.core.exception.ClientAuthenticationException
- thrown if the client does not have access to repository.com.azure.core.exception.ResourceNotFoundException
- thrown if the giventag
was not found.NullPointerException
- thrown iftag
ortagProperties
is null.IllegalArgumentException
- thrown iftag
ortagProperties
is empty.com.azure.core.exception.HttpResponseException
- thrown if any other unexpected exception is returned by the service.
-
updateTagProperties
public ArtifactTagProperties updateTagProperties(String tag, ArtifactTagProperties tagProperties)
Update the propertiesArtifactTagProperties
of the giventag
. These properties set whether the given tag can be updated, deleted and retrieved.Code Samples
Update the writeable properties of a given tag.
ArtifactTagProperties properties = getArtifactTagProperties(); String tag = getTag(); client.updateTagProperties(tag, properties);
- Parameters:
tag
- Name of the tag.tagProperties
-tagProperties
to be set.- Returns:
- The updated
properties
- Throws:
com.azure.core.exception.ClientAuthenticationException
- thrown if the client does not have access to repository.com.azure.core.exception.ResourceNotFoundException
- thrown if the giventag
was not found.NullPointerException
- thrown iftag
ortagProperties
is null.IllegalArgumentException
- thrown iftag
ortagProperties
is empty.com.azure.core.exception.HttpResponseException
- thrown if any other unexpected exception is returned by the service.
-
updateManifestPropertiesWithResponse
public com.azure.core.http.rest.Response<ArtifactManifestProperties> updateManifestPropertiesWithResponse(ArtifactManifestProperties manifestProperties, com.azure.core.util.Context context)
Update the propertiesArtifactTagProperties
of the artifact with the givendigest
. These properties set whether the given manifest can be updated, deleted and retrieved.Code Samples
Update the writeable properties of a given artifact.
ArtifactManifestProperties properties = getArtifactManifestProperties(); client.updateManifestPropertiesWithResponse(properties, Context.NONE);
- Parameters:
manifestProperties
-tagProperties
to be set.context
- Additional context that is passed through the Http pipeline during the service call.- Returns:
- A REST response for the completion.
- Throws:
com.azure.core.exception.ClientAuthenticationException
- thrown if the client does not have access to repository.NullPointerException
- thrown if themanifestProperties
is null.com.azure.core.exception.ResourceNotFoundException
- thrown if the givendigest
was not found.
-
updateManifestProperties
public ArtifactManifestProperties updateManifestProperties(ArtifactManifestProperties manifestProperties)
Update the writeable propertiesArtifactTagProperties
of the artifact with the givendigest
. These properties set whether the given manifest can be updated, deleted and retrieved.Code Samples
Update the writeable properties of a given manifest.
ArtifactManifestProperties properties = getArtifactManifestProperties(); client.updateManifestProperties(properties);
- Parameters:
manifestProperties
-manifestProperties
to be set.- Returns:
- The updated
properties
- Throws:
com.azure.core.exception.ClientAuthenticationException
- thrown if the client does not have access to repository.com.azure.core.exception.ResourceNotFoundException
- thrown if the givendigest
was not found.NullPointerException
- thrown if themanifestProperties
is null.
-
-