diff --git a/sdk/containerregistry/azure-containers-containerregistry/README.md b/sdk/containerregistry/azure-containers-containerregistry/README.md index 4e647517a5f4f..282bd39e7a037 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/README.md +++ b/sdk/containerregistry/azure-containers-containerregistry/README.md @@ -5,9 +5,9 @@ Azure Container Registry allows you to store and manage container images and art Use the client library for Azure Container Registry to: - List images or artifacts in a registry +- Upload, download, and delete images and artifacts, repositories and tags - Obtain metadata for images and artifacts, repositories and tags - Set read/write/delete properties on registry items -- Delete images and artifacts, repositories and tags [Source code][source_code] | [Package (Maven)][package] | [Product documentation][product_docs] | [Samples][samples] @@ -110,7 +110,7 @@ registryClient To authenticate with a registry in a [National Cloud](https://docs.microsoft.com/azure/active-directory/develop/authentication-national-cloud), you will need to make the following additions to your client configuration: - Set the `authorityHost` in the credential builder following [Identity client library documentation](https://learn.microsoft.com/java/api/overview/azure/identity-readme) -- If ACR access token authentication is disabled for yourcontainer Registry resource, you need to configure the audience on the Container Registry client builder. +- If ACR access token authentication is disabled for your container Registry resource, you need to configure the audience on the Container Registry client builder. ```java readme-sample-armTokenChina ContainerRegistryClient registryClient = new ContainerRegistryClientBuilder() @@ -126,9 +126,10 @@ registryClient ``` #### Anonymous access support + If the builder is instantiated without any credentials, the SDK creates the service client for the anonymous pull mode. The user must use this setting on a registry that has been enabled for anonymous pull. -In this mode, the user can only call listRepositoryNames method and its overload. All the other calls will fail. +In this mode, the user can only call `listRepositoryNames` method and its overload. All the other calls will fail. For more information please read [Anonymous Pull Access](https://docs.microsoft.com/azure/container-registry/container-registry-faq#how-do-i-enable-anonymous-pull-access) ```java readme-sample-createAnonymousAccessClient @@ -203,7 +204,6 @@ image.updateTagProperties( .setDeleteEnabled(false)); ``` - #### Delete Images ```java readme-sample-deleteImages @@ -270,10 +270,12 @@ To upload a full image, we need to upload individual layers and configuration. A which describes an image or artifact and assign it a tag. ```java readme-sample-uploadImage -BinaryData configContent = BinaryData.fromObject(Collections.singletonMap("hello", "world")); +BinaryData configContent = BinaryData + .fromObject(Collections.singletonMap("hello", "world")); UploadRegistryBlobResult configUploadResult = contentClient.uploadBlob(configContent); -System.out.printf("Uploaded config: digest - %s, size - %s\n", configUploadResult.getDigest(), configContent.getLength()); +System.out.printf("Uploaded config: digest - %s, size - %s\n", configUploadResult.getDigest(), + configContent.getLength()); OciDescriptor configDescriptor = new OciDescriptor() .setMediaType("application/vnd.unknown.config.v1+json") @@ -282,7 +284,8 @@ OciDescriptor configDescriptor = new OciDescriptor() BinaryData layerContent = BinaryData.fromString("Hello Azure Container Registry"); UploadRegistryBlobResult layerUploadResult = contentClient.uploadBlob(layerContent); -System.out.printf("Uploaded layer: digest - %s, size - %s\n", layerUploadResult.getDigest(), layerContent.getLength()); +System.out.printf("Uploaded layer: digest - %s, size - %s\n", layerUploadResult.getDigest(), + layerContent.getLength()); OciImageManifest manifest = new OciImageManifest() .setConfiguration(configDescriptor) diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryAsyncClient.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryAsyncClient.java index 586cf706d5335..32fb65f675a73 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryAsyncClient.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryAsyncClient.java @@ -25,12 +25,21 @@ import static com.azure.core.util.FluxUtil.withContext; /** - * This class provides a client that exposes operations to managing container images and artifacts. - * It exposes methods directly performed on the registry like listing the catalog. - * as well as helper types like {@link #getArtifact(String, String) getArtifact} and {@link #getRepository(String) getRepository} - * that can be used to perform operations on repository and artifacts directly. + *
This class provides a client that works with repositories in Azure Container Registry. + * It allows to list and delete repositories within the registry or obtain an instance of {@link ContainerRepositoryAsync} + * or {@link RegistryArtifactAsync} that can be used to perform operations on the repository or artifact.
* - *Instantiating an asynchronous Container Registry client
+ *In order to interact with the Container Registry service you'll need to create an instance of + * ContainerRegistryAsyncClient.
+ * + *To create the client and communicate with the service, you'll need to use AAD authentication via + * Azure Identity
. + * + *Sample: Construct Container Registry Async Client
+ * + *The following code sample demonstrates the creation of a Container Registry Async Client.
* * *@@ -41,23 +50,17 @@ ** * - *
Instantiating an asynchronous Container Registry client using a custom pipeline
- * - *- * HttpPipeline pipeline = new HttpPipelineBuilder() - * .policies(/* add policies */) - * .build(); + *- * + *Note: For synchronous sample, refer to + * {@link com.azure.containers.containerregistry.ContainerRegistryClient}.
* - * ContainerRegistryAsyncClient registryAsyncClient = new ContainerRegistryClientBuilder() - * .pipeline(pipeline) - * .endpoint(endpoint) - * .credential(credential) - * .buildAsyncClient(); - *
View {@link ContainerRegistryClientBuilder} for additional ways to construct the client.
* - *View {@link ContainerRegistryClientBuilder this} for additional ways to construct the client.
+ *The Container Registry Async Client allows to list and delete repositories and obtain instances of repository and + * artifact client. See methods below to explore all capabilities this client provides.
+ + *View {@link ContainerRegistryClientBuilder} for additional ways to construct the client.
* + * @see com.azure.containers.containerregistry * @see ContainerRegistryClientBuilder */ @ServiceClient(builder = ContainerRegistryClientBuilder.class, isAsync = true) @@ -77,8 +80,9 @@ public final class ContainerRegistryAsyncClient { } /** - * This method returns the complete registry endpoint. - * @return The registry endpoint including the authority. + * Gets the service endpoint. + * + * @return The service endpoint for the Azure Container Registry instance. */ public String getEndpoint() { return this.endpoint; @@ -87,7 +91,7 @@ public String getEndpoint() { /** * List all the repository names in this registry. * - *List repository names in the registry.
+ *List repository names in the registry
* * *@@ -98,7 +102,7 @@ public String getEndpoint() { * * * @return list of repository names. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFluxlistRepositoryNames() { @@ -125,9 +129,9 @@ private Mono > listRepositoryNamesNextSinglePageAsync(Strin } /** - * Delete the repository identified by 'repositoryName'. + * Delete the repository with provided {@code repositoryName}. * - * Delete a repository in the registry.
+ *Delete a repository in the registry
* * *@@ -139,11 +143,11 @@ private Mono* * - * @param repositoryName Name of the repository (including the namespace). + * @param repositoryName Name of the repository. * @return the completion. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to delete the repository. * @throws NullPointerException thrown if the {@code repositoryName} is null. - * @throws IllegalArgumentException thrown if the {@code repositoryName} is null. + * @throws IllegalArgumentException thrown if the {@code repositoryName} is empty. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> listRepositoryNamesNextSinglePageAsync(Strin * > deleteRepositoryWithResponse(String repositoryName) { @@ -165,9 +169,9 @@ private Mono > deleteRepositoryWithResponse(String repositoryName, } /** - * Delete the repository identified by {@code repositoryName}. + * Delete the repository with provided {@code repositoryName}. * - * Delete a repository in the registry.
+ *Delete a repository in the registry
* ** client.deleteRepository(repositoryName).subscribe(response -> { @@ -178,9 +182,9 @@ private Mono* * - * @param repositoryName Name of the image (including the namespace). - * @return the completion stream. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @param repositoryName Name of the repository. + * @return the completion. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to delete the repository. * @throws NullPointerException thrown if the {@code repositoryName} is null. * @throws IllegalArgumentException thrown if {@code repositoryName} is empty. */ @@ -196,7 +200,7 @@ private Mono> deleteRepositoryWithResponse(String repositoryName, * deleteRepository(String repositoryName, Context context) { /** * Creates a new instance of {@link ContainerRepositoryAsync} object for the specified repository. * - * Create an instance of ContainerRepositoryAsync helper type
+ *Get an instance of {@link ContainerRepositoryAsync}
* ** ContainerRepositoryAsync repositoryAsync = client.getRepository(repositoryName); @@ -207,7 +211,7 @@ private MonodeleteRepository(String repositoryName, Context context) { * * * @param repositoryName Name of the repository to reference. - * @return A new {@link ContainerRepositoryAsync} for the desired repository. + * @return A new {@link ContainerRepositoryAsync} for the requested repository. * @throws NullPointerException if {@code repositoryName} is null. * @throws IllegalArgumentException if {@code repositoryName} is empty. */ @@ -218,7 +222,7 @@ public ContainerRepositoryAsync getRepository(String repositoryName) { /** * Creates a new instance of {@link RegistryArtifactAsync} object for the specified artifact. * - * Create an instance of RegistryArtifactAsync helper type
+ *Get an instance of {@link RegistryArtifactAsync}
* ** RegistryArtifactAsync registryArtifactAsync = client.getArtifact(repositoryName, tagOrDigest); @@ -228,11 +232,11 @@ public ContainerRepositoryAsync getRepository(String repositoryName) { ** * - * @param repositoryName Name of the repository to reference. + * @param repositoryName Name of the repository containing the artifact. * @param tagOrDigest Either a tag or digest that uniquely identifies the artifact. - * @return A new {@link RegistryArtifactAsync RegistryArtifactAsync} for the desired repository. - * @throws NullPointerException if {@code repositoryName} or {@code tagOrDigest} is null. - * @throws IllegalArgumentException if {@code repositoryName} or {@code tagOrDigest} is empty. + * @return A new {@link RegistryArtifactAsync RegistryArtifactAsync} for the requested artifact. + * @throws NullPointerException if {@code repositoryName} or {@code tagOrDigest} are null. + * @throws IllegalArgumentException if {@code repositoryName} or {@code tagOrDigest} are empty. */ public RegistryArtifactAsync getArtifact(String repositoryName, String tagOrDigest) { return new RegistryArtifactAsync(repositoryName, tagOrDigest, httpPipeline, endpoint, apiVersion); diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryClient.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryClient.java index 9ce9bf4192322..17f00c74fafb3 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryClient.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryClient.java @@ -23,12 +23,23 @@ import static com.azure.containers.containerregistry.implementation.UtilsImpl.mapAcrErrorsException; /** - * 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 like {@link #getArtifact(String, String) getArtifact} and {@link #getRepository(String) getRepository} - * that can be used to perform operations on repository and artifacts. + *This class provides a client that works with repositories in Azure Container Registry. + * It allows to list and delete repositories within the registry or obtain an instance of {@link ContainerRepository} + * or {@link RegistryArtifact} that can be used to perform operations on the repository or artifact.
+ * + *Getting Started
+ * + *In order to interact with the Container Registry service you'll need to create an instance of + * {@link com.azure.containers.containerregistry.ContainerRegistryClient}.
+ * + *To create one of the client and communicate with the service, you'll need to use AAD authentication via + * Azure Identity
. + * + *Sample: Construct Container Registry Client
+ * + *The following code sample demonstrates the creation of a + * {@link com.azure.containers.containerregistry.ContainerRegistryClient}.
* - *Instantiating a synchronous Container Registry client
* ** ContainerRegistryClient registryAsyncClient = new ContainerRegistryClientBuilder() @@ -38,23 +49,15 @@ ** * - *Instantiating a synchronous Container Registry client with custom pipeline
- * - *- * HttpPipeline pipeline = new HttpPipelineBuilder() - * .policies(/* add policies */) - * .build(); + *- * + *Note: For asynchronous sample, refer to + * {@link com.azure.containers.containerregistry.ContainerRegistryAsyncClient}.
* - * ContainerRegistryClient registryAsyncClient = new ContainerRegistryClientBuilder() - * .pipeline(pipeline) - * .endpoint(endpoint) - * .credential(credential) - * .buildClient(); - *View {@link ContainerRegistryClientBuilder} for additional ways to construct the client.
* - *View {@link ContainerRegistryClientBuilder this} for additional ways to construct the client.
+ *The Container Registry Client allows to list and delete repositories and obtain instances of repository and + * artifact client. See methods below to explore all capabilities this client provides.
* + * @see com.azure.containers.containerregistry * @see ContainerRegistryClientBuilder */ @ServiceClient(builder = ContainerRegistryClientBuilder.class) @@ -74,8 +77,9 @@ public final class ContainerRegistryClient { } /** - * This method returns the complete registry endpoint. - * @return The registry endpoint including the authority. + * Gets the service endpoint. + * + * @return The service endpoint for the Azure Container Registry instance. */ public String getEndpoint() { return this.endpoint; @@ -84,7 +88,7 @@ public String getEndpoint() { /** * List all the repository names in this registry. * - *List the repository names in the registry.
+ *List the repository names in the registry
* * *@@ -105,7 +109,7 @@ public PagedIterablelistRepositoryNames() { /** * List all the repository names in this registry. * - * List the repository names in the registry.
+ *List the repository names in the registry
* ** client.listRepositoryNames(Context.NONE).stream().forEach(name -> { @@ -145,11 +149,10 @@ private PagedResponselistRepositoryNamesNextSinglePageSync(String nextL } } - /** - * Delete the repository identified by {@code repositoryName}. + * Delete the repository with provided {@code repositoryName}. * - * Delete a repository in the registry.
+ *Delete a repository in the registry
* ** client.deleteRepository(repositoryName); @@ -157,7 +160,7 @@ private PagedResponselistRepositoryNamesNextSinglePageSync(String nextL * * * @param repositoryName Name of the repository (including the namespace). - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to delete the repository. * @throws NullPointerException thrown if the {@code repositoryName} is null. * @throws IllegalArgumentException thrown if the {@code repositoryName} is empty. */ @@ -167,9 +170,9 @@ public void deleteRepository(String repositoryName) { } /** - * Delete the repository identified by {@code repositoryName}. + * Delete the repository with provided {@code repositoryName}. * - * Delete a repository in the registry.
+ *Delete a repository in the registry
* ** client.deleteRepositoryWithResponse(repositoryName, Context.NONE); @@ -179,7 +182,7 @@ public void deleteRepository(String repositoryName) { * @param repositoryName Name of the repository (including the namespace). * @param context The context to associate with this operation. * @return Completion response. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to delete the repository. * @throws NullPointerException thrown if the {@code repositoryName} is null. * @throws IllegalArgumentException thrown if the {@code repositoryName} is empty. */ @@ -202,7 +205,7 @@ public ResponsedeleteRepositoryWithResponse(String repositoryName, Contex /** * Creates a new instance of {@link ContainerRepository} object for the specified repository. * - * Create a ContainerRegistry helper instance.
+ *Get an instance of {@link ContainerRepository}
* ** ContainerRepository repository = client.getRepository(repositoryName); @@ -212,7 +215,7 @@ public ResponsedeleteRepositoryWithResponse(String repositoryName, Contex * * * @param repositoryName Name of the repository to reference. - * @return A new {@link ContainerRepository} for the desired repository. + * @return A new {@link ContainerRepository} for the requested repository. * @throws NullPointerException if {@code repositoryName} is null. * @throws IllegalArgumentException if {@code repositoryName} is empty. */ @@ -223,7 +226,7 @@ public ContainerRepository getRepository(String repositoryName) { /** * Creates a new instance of {@link RegistryArtifact} object for the specified artifact. * - * Create a RegistryArtifact helper instance.
+ *Get an instance of {@link RegistryArtifact}
* ** RegistryArtifact registryArtifact = client.getArtifact(repositoryName, tagOrDigest); @@ -232,9 +235,9 @@ public ContainerRepository getRepository(String repositoryName) { ** * - * @param repositoryName Name of the repository to reference. + * @param repositoryName Name of the repository. * @param tagOrDigest Either a tag or digest that uniquely identifies the artifact. - * @return A new {@link RegistryArtifact} object for the desired repository. + * @return A new {@link RegistryArtifact} object for the requested artifact. * @throws NullPointerException if {@code repositoryName} or {@code tagOrDigest} is null. * @throws IllegalArgumentException if {@code repositoryName} or {@code tagOrDigest} is empty. */ diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryClientBuilder.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryClientBuilder.java index 8acb7028b3cd5..adfed0c09343e 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryClientBuilder.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryClientBuilder.java @@ -33,13 +33,15 @@ import static com.azure.containers.containerregistry.implementation.UtilsImpl.createTracer; /** - * This class provides a fluent builder API to help aid the configuration and instantiation of {@link - * ContainerRegistryClient ContainerRegistryClients} and {@link ContainerRegistryAsyncClient ContainerRegistryAsyncClients}, call {@link - * #buildClient() buildClient} and {@link #buildAsyncClient() buildAsyncClient} respectively to construct an instance of - * the desired client. + *Fluent builder for instantiating a {@link ContainerRegistryClient} and {@link ContainerRegistryAsyncClient}. which are used to + * list and delete repositories and artifacts, obtain metadata and configure read/write permissions.
+ * + *The client needs the service endpoint of the Azure Container Registry and Azure access credentials to use for authentication. * - *
The client needs the service endpoint of the Azure Container Registry, Audience for ACR that you want to target and Azure access credentials to use for authentication. *
Instantiating an asynchronous Container Registry client
+ * + *
+ * * ** ContainerRegistryAsyncClient registryAsyncClient = new ContainerRegistryClientBuilder() @@ -50,6 +52,9 @@ * * *Instantiating a synchronous Container Registry client
+ * + *
+ * * ** ContainerRegistryClient registryAsyncClient = new ContainerRegistryClientBuilder() @@ -70,6 +75,9 @@ * For more information please see Azure Container Registry Authentication . * *Instantiating an asynchronous Container Registry client using a custom pipeline
+ * + *
+ * * ** HttpPipeline pipeline = new HttpPipelineBuilder() @@ -85,6 +93,9 @@ * * *Instantiating a synchronous Container Registry client with custom pipeline
+ * + *
+ * * ** HttpPipeline pipeline = new HttpPipelineBuilder() @@ -99,7 +110,21 @@ ** * + *Azure Container Registry could be configured for anonymous access
+ * + *Instantiating an asynchronous Container Registry client for anonymous access
* + *
+ * + * + *+ * ContainerRegistryAsyncClient registryClient = new ContainerRegistryClientBuilder() + * .endpoint(endpoint) + * .buildAsyncClient(); + *+ * + * + * @see com.azure.containers.containerregistry * @see ContainerRegistryAsyncClient * @see ContainerRegistryClient */ @@ -133,6 +158,12 @@ public final class ContainerRegistryClientBuilder implements private ContainerRegistryServiceVersion version; private ContainerRegistryAudience audience; + /** + * Creates a new instance of {@link ContainerRegistryClientBuilder}. + */ + public ContainerRegistryClientBuilder() { + } + /** * Sets the service endpoint for the Azure Container Registry instance. * diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryContentAsyncClient.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryContentAsyncClient.java index 0e5aa71f9f9ce..97a6f6e76d35b 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryContentAsyncClient.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryContentAsyncClient.java @@ -61,11 +61,41 @@ import static com.azure.core.util.FluxUtil.withContext; /** - * This class provides a client that exposes operations to push and pull images into container registry. - * It exposes methods that upload, download and delete artifacts from the registry i.e. images and manifests. + *This class provides a client that can upload, download, and delete artifacts in Azure Container Registry repository. + * It uses docker v2 REST APIs supported by Azure Container Registry.
* - *View {@link ContainerRegistryContentClientBuilder this} for additional ways to construct the client.
+ *Getting Started
* + *In order to interact with the Container Registry service you'll need to create an instance of + * Container Registry Content Async Client.
+ * + *To create the client and communicate with the service, you'll need to use AAD authentication via + * Azure Identity
. + * + *Sample: Construct Container Registry Content Async Client
+ * + *The following code sample demonstrates the creation of a Container Registry Content Client.
+ * + * + *+ * DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build(); + * ContainerRegistryContentAsyncClient contentClient = new ContainerRegistryContentClientBuilder() + * .endpoint(endpoint) + * .credential(credential) + * .repositoryName(repository) + * .buildAsyncClient(); + *+ * + * + *Note: For synchronous sample, refer to + * {@link com.azure.containers.containerregistry.ContainerRegistryContentClient}.
+ * + *View {@link ContainerRegistryContentClientBuilder} for additional ways to construct the client.
+ * + *Container Registry Content Async Client allows to upload and download registry artifacts. See methods below to + * explore all capabilities this client provides.
+ * + * @see com.azure.containers.containerregistry * @see ContainerRegistryContentClientBuilder */ @ServiceClient(builder = ContainerRegistryContentClientBuilder.class, isAsync = true) @@ -87,27 +117,27 @@ public final class ContainerRegistryContentAsyncClient { } /** - * This method returns the registry's repository on which operations are being performed. + * Gets the current repository name. * - * @return The name of the repository + * @return The repository name. */ public String getRepositoryName() { return this.repositoryName; } /** - * This method returns the complete registry endpoint. + * Gets the Azure Container Registry service endpoint. * - * @return The registry endpoint including the authority. + * @return The service endpoint. */ public String getEndpoint() { return this.endpoint; } /** - * Upload the Oci manifest to the repository. + * Upload the OCI manifest to the repository. * - *Code Samples:
+ *Upload an OCI manifest
* * *@@ -123,7 +153,7 @@ public String getEndpoint() { * @param manifest The {@link OciImageManifest} that needs to be uploaded. * @param tag Tag to apply on uploaded manifest. If {@code null} is passed, no tags will be applied. * @return upload result. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws NullPointerException thrown if the {@code manifest} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -139,7 +169,7 @@ public MonosetManifest(OciImageManifest manifest, String tag /** * Uploads a manifest to the repository. * - * Code Samples:
+ *Upload a manifest
* * *@@ -155,7 +185,7 @@ public MonosetManifest(OciImageManifest manifest, String tag * @see Oci Manifest Specification * @param options The options for the upload manifest operation. * @return The rest response containing the upload result. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws NullPointerException thrown if the {@code data} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -170,7 +200,7 @@ public Mono > setManifestWithResponse(SetManifestOpti /** * Uploads a blob to the repository. * - * Code Samples:
+ *Upload a blob from {@link BinaryData content}
* * *@@ -183,6 +213,8 @@ public Mono* * + *> setManifestWithResponse(SetManifestOpti * Upload a blob from file
+ * * ** contentClient.uploadBlob(BinaryData.fromFile(Paths.get("artifact.tar.gz"), CHUNK_SIZE)) @@ -192,6 +224,8 @@ public Mono* * + *> setManifestWithResponse(SetManifestOpti * Error handling
+ * * ** layerContent @@ -207,9 +241,8 @@ public Mono* * - *> setManifestWithResponse(SetManifestOpti * - * Note: - *
+ *Note:
+ * * Content may be uploaded in chunks of up to 4MB size. Chunk size depends on the passed {@link BinaryData} content. * When {@link BinaryData} is created using {@link BinaryData#fromFlux(Flux, Long, boolean)}, it may be uploaded in * chunks matching individual {@link ByteBuffer} in the {@link Flux} and up to 4MB size. @@ -218,7 +251,7 @@ public Mono> setManifestWithResponse(SetManifestOpti * * @param content The blob content that needs to be uploaded. * @return The operation result. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws NullPointerException thrown if the {@code data} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -233,7 +266,7 @@ public Mono uploadBlob(BinaryData content) { /** * Download the manifest identified by the given tag or digest. * - * Code Samples:
+ *Download manifest
* * *@@ -255,7 +288,7 @@ public MonouploadBlob(BinaryData content) { * * @param tagOrDigest Manifest reference which can be tag or digest. * @return The manifest identified by the given tag or digest. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws NullPointerException thrown if the {@code tagOrDigest} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -266,7 +299,7 @@ public Mono getManifest(String tagOrDigest) { /** * Download the manifest identified by the given tag or digest. * - * Code Samples:
+ *Download manifest
* * *@@ -287,7 +320,7 @@ public Mono* * + *getManifest(String tagOrDigest) { * * @param tagOrDigest Manifest reference which can be tag or digest. * @return The response for the manifest identified by the given tag or digest. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws NullPointerException thrown if the {@code tagOrDigest} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -299,7 +332,7 @@ public Mono > getManifestWithResponse(String tagOrDig * Download the blob identified by the given digest. * Content is downloaded in chunks of 4MB size each. * - * Code Samples:
+ *Download blob to file
* * Write content to synchronous channel, for example {@link java.nio.channels.FileChannel}: * @@ -316,6 +349,8 @@ public Mono> getManifestWithResponse(String tagOrDig * Download blob as a stream
+ * * Write content to asynchronous byte channel, for example {@link java.nio.channels.AsynchronousSocketChannel}: * * @@ -333,7 +368,7 @@ public Mono> getManifestWithResponse(String tagOrDig * * @param digest The digest for the given image layer. * @return The image identified by the given digest. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws NullPointerException thrown if the {@code digest} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -343,9 +378,9 @@ public Mono downloadStream(String digest) { } /** - * Delete the image identified by the given digest + * Delete blob identified by the given digest * - * Code Samples:
+ *Delete artifact
* * *@@ -357,7 +392,7 @@ public MonodownloadStream(String digest) { * * @param digest The digest for the given image layer. * @return The completion signal. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws NullPointerException thrown if the {@code digest} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -366,11 +401,11 @@ public Mono deleteBlob(String digest) { } /** - * Delete the image identified by the given digest + * Delete blob identified by the given digest * * @param digest The digest for the given image layer. * @return The REST response for the completion. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws NullPointerException thrown if the {@code digest} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -381,7 +416,7 @@ public Mono > deleteBlobWithResponse(String digest) { /** * Delete the manifest identified by the given digest. * - * Code Samples:
+ *Delete manifest
* * *@@ -393,7 +428,7 @@ public Mono> deleteBlobWithResponse(String digest) { * * @param digest The digest of the manifest. * @return The completion. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws NullPointerException thrown if the {@code digest} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -406,7 +441,7 @@ public Mono deleteManifest(String digest) { * * @param digest The digest of the manifest. * @return The REST response for completion. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws NullPointerException thrown if the {@code digest} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryContentClient.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryContentClient.java index d9a2c2f597fbf..a204f4e580854 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryContentClient.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryContentClient.java @@ -61,11 +61,40 @@ import static com.azure.core.util.CoreUtils.bytesToHexString; /** - * This class provides a client that exposes operations to push and pull images into container registry. - * It exposes methods that upload, download and delete artifacts from the registry i.e. images and manifests. + * This class provides a client that can upload, download, and delete artifacts in Azure Container Registry repository.
* - *View {@link ContainerRegistryContentClientBuilder this} for additional ways to construct the client.
+ *Getting Started
* + *In order to interact with the Container Registry service you'll need to create an instance of + * Container Registry Content Client.
+ * + *To create the client and communicate with the service, you'll need to use AAD authentication via + * Azure Identity
. + * + *Sample: Construct Container Registry Content Client
+ * + *The following code sample demonstrates the creation of a Container Registry Content Client.
+ * + * + *+ * DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build(); + * ContainerRegistryContentClient contentClient = new ContainerRegistryContentClientBuilder() + * .endpoint(endpoint) + * .credential(credential) + * .repositoryName(repository) + * .buildClient(); + *+ * + * + *Note: For asynchronous sample, refer to + * {@link com.azure.containers.containerregistry.ContainerRegistryContentAsyncClient}.
+ * + *View {@link ContainerRegistryContentClientBuilder} for additional ways to construct the client.
+ * + *Container Registry Content Client allows to upload and download registry artifacts. See methods below to + * explore all capabilities this client provides.
+ * + * @see com.azure.containers.containerregistry * @see ContainerRegistryContentClientBuilder */ @ServiceClient(builder = ContainerRegistryContentClientBuilder.class) @@ -88,18 +117,18 @@ public final class ContainerRegistryContentClient { } /** - * This method returns the registry's repository on which operations are being performed. + * Gets the current repository name. * - * @return The name of the repository + * @return The repository name. */ public String getRepositoryName() { return repositoryName; } /** - * This method returns the complete registry endpoint. + * Gets the Azure Container Registry service endpoint. * - * @return The registry endpoint including the authority. + * @return The service endpoint. */ public String getEndpoint() { return endpoint; @@ -108,7 +137,7 @@ public String getEndpoint() { /** * Upload the OCI manifest to the repository. * - *Code Samples:
+ *Upload an OCI manifest
* * *@@ -121,7 +150,7 @@ public String getEndpoint() { * @param manifest The {@link OciImageManifest} that needs to be updated. * @param tag Tag to apply on uploaded manifest. If {@code null} is passed, no tags will be applied. * @return upload result. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws NullPointerException thrown if the {@code manifest} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -133,7 +162,7 @@ public SetManifestResult setManifest(OciImageManifest manifest, String tag) { /** * Uploads a manifest to the repository. * - *Code Samples:
+ *Upload a manifest
* * *@@ -147,7 +176,7 @@ public SetManifestResult setManifest(OciImageManifest manifest, String tag) { * @param options The options for the upload manifest operation. * @param context Additional context that is passed through the Http pipeline during the service call. * @return The rest response containing the upload result. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws NullPointerException thrown if the {@code data} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -159,7 +188,7 @@ public ResponsesetManifestWithResponse(SetManifestOptions op /** * Uploads a blob to the repository in chunks of 4MB. * - * Code Samples
+ *Upload a blob from {@link BinaryData content}
* * *@@ -170,6 +199,8 @@ public Response* * + *setManifestWithResponse(SetManifestOptions op * Error handling
+ * * ** BinaryData configContent = BinaryData.fromObject(Collections.singletonMap("hello", "world")); @@ -193,7 +224,7 @@ public ResponsesetManifestWithResponse(SetManifestOptions op * * @param content The blob content. The content may be loaded into memory depending on how {@link BinaryData} is created. * @return The upload response. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws NullPointerException thrown if the {@code data} is {@code null}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -204,7 +235,7 @@ public UploadRegistryBlobResult uploadBlob(BinaryData content) { /** * Uploads a blob to the repository in chunks of 4MB. * - * Code Samples
+ *Upload blob from file
* * *@@ -218,7 +249,7 @@ public UploadRegistryBlobResult uploadBlob(BinaryData content) { * @param content The blob content. * @param context Additional context that is passed through the Http pipeline during the service call. * @return The upload response. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws NullPointerException thrown if the {@code stream} is {@code null}. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -240,9 +271,7 @@ public UploadRegistryBlobResult uploadBlob(BinaryData content, Context context) /** * Download the manifest identified by the given tag or digest. * - *Code Samples:
- * - * Download manifest with tag: + *Download manifest by tag
* * *@@ -256,7 +285,7 @@ public UploadRegistryBlobResult uploadBlob(BinaryData content, Context context) ** * - * Download manifest with digest: + *Download manifest by digest
* * *@@ -267,7 +296,7 @@ public UploadRegistryBlobResult uploadBlob(BinaryData content, Context context) * * @param tagOrDigest Manifest tag or digest. * @return The manifest identified by the given tag or digest. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws NullPointerException thrown if the {@code tagOrDigest} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -278,7 +307,7 @@ public GetManifestResult getManifest(String tagOrDigest) { /** * Download the manifest of custom type identified by the given tag or digest. * - *Code Samples:
+ *Download manifest
* * *@@ -292,7 +321,7 @@ public GetManifestResult getManifest(String tagOrDigest) { * @param tagOrDigest Manifest reference which can be tag or digest. * @param context Additional context that is passed through the Http pipeline during the service call. * @return The response for the manifest identified by the given tag or digest. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws NullPointerException thrown if the {@code tagOrDigest} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -309,9 +338,9 @@ public ResponsegetManifestWithResponse(String tagOrDigest, C } /** - * Download the blob identified by the given digest. + * Download the blob identified by the given digest. * - * Code Samples:
+ *Download blob
* * *@@ -323,7 +352,7 @@ public ResponsegetManifestWithResponse(String tagOrDigest, C * * @param digest The digest for the given image layer. * @param channel The channel to write content to. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws NullPointerException thrown if the {@code digest} is null. * @throws ServiceResponseException thrown if content hash does not match requested digest. */ @@ -339,7 +368,7 @@ public void downloadStream(String digest, WritableByteChannel channel) { * @param channel The channel to write content to. * @param context Additional context that is passed through the Http pipeline during the service call. * - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws NullPointerException thrown if the {@code digest} is null. * @throws ServiceResponseException thrown if content hash does not match requested digest. */ @@ -349,9 +378,9 @@ public void downloadStream(String digest, WritableByteChannel channel, Context c } /** - * Delete the image identified by the given digest + * Delete the blob identified by the given digest * - * Code Samples:
+ *Delete blob
* * *@@ -365,7 +394,7 @@ public void downloadStream(String digest, WritableByteChannel channel, Context c * * * @param digest The digest for the given image layer. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws NullPointerException thrown if the {@code digest} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -374,12 +403,12 @@ public void deleteBlob(String digest) { } /** - * Delete the image identified by the given digest + * Delete the blob identified by the given digest * - * @param digest The digest for the given image layer. + * @param digest The digest for the given blob. * @param context Additional context that is passed through the Http pipeline during the service call. * @return The REST response for the completion. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws NullPointerException thrown if the {@code digest} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -404,7 +433,7 @@ public ResponsedeleteBlobWithResponse(String digest, Context context) { /** * Delete the manifest identified by the given digest. * - * Code Samples:
+ *Delete manifest
* * *@@ -414,7 +443,7 @@ public ResponsedeleteBlobWithResponse(String digest, Context context) { * * * @param digest The digest of the manifest. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws NullPointerException thrown if the {@code digest} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -428,7 +457,7 @@ public void deleteManifest(String digest) { * @param digest The digest of the manifest. * @param context Additional context that is passed through the Http pipeline during the service call. * @return The REST response for completion. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws NullPointerException thrown if the {@code digest} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryContentClientBuilder.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryContentClientBuilder.java index f411ebef07c1b..26947b0b77932 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryContentClientBuilder.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryContentClientBuilder.java @@ -24,8 +24,7 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.tracing.Tracer; -import java.net.MalformedURLException; -import java.net.URL; +import java.net.URI; import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -33,21 +32,56 @@ import static com.azure.containers.containerregistry.implementation.UtilsImpl.createTracer; /** - * This class provides a fluent builder API to help aid the configuration and instantiation of {@link - * ContainerRegistryContentClient ContainerRegistryContentClients} and {@link ContainerRegistryContentAsyncClient ContainerRegistryContentAsyncClients}, call {@link - * #buildClient() buildClient} and {@link #buildAsyncClient() buildAsyncClient} respectively to construct an instance of - * the desired client. + * Fluent builder for instantiating a {@link ContainerRegistryContentClient} and {@link ContainerRegistryContentAsyncClient}. which are used to + * upload, download, or delete images and artifacts in Azure Container Registry.
* - *Another way to construct the client is using a {@link HttpPipeline}. The pipeline gives the client an - * authenticated way to communicate with the service but it doesn't contain the service endpoint. Set the pipeline with - * {@link #pipeline(HttpPipeline) this} and set the service endpoint with {@link #endpoint(String) this}. Using a - * pipeline requires additional setup but allows for finer control on how the {@link ContainerRegistryContentClient} and {@link - * ContainerRegistryContentAsyncClient} is built.
- *The service does not directly support AAD credentials and as a result the clients internally depend on a policy that converts - * the AAD credentials to the Azure Container Registry specific service credentials. In case you use your own pipeline, you - * would need to provide implementation for this policy as well. - * For more information please see Azure Container Registry Authentication .
+ *The client needs the service endpoint of the Azure Container Registry, access credential, and the repository name.
* + *Instantiating an asynchronous Container Registry Content client
+ *
+ * + * + *+ * DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build(); + * ContainerRegistryContentAsyncClient contentClient = new ContainerRegistryContentClientBuilder() + * .endpoint(endpoint) + * .credential(credential) + * .repositoryName(repository) + * .buildAsyncClient(); + *+ * + * + *Instantiating a synchronous Container Registry Content client
+ *
+ * + * + *+ * DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build(); + * ContainerRegistryContentClient contentClient = new ContainerRegistryContentClientBuilder() + * .endpoint(endpoint) + * .credential(credential) + * .repositoryName(repository) + * .buildClient(); + *+ * + * + *Azure Container Registry could be configured for anonymous access + * allowing to pull artifacts without authentication.
+ * + *Instantiating a synchronous Container Registry Content client without credential
+ *
+ * + * + *+ * ContainerRegistryContentClient contentClient = new ContainerRegistryContentClientBuilder() + * .endpoint(endpoint) + * .repositoryName(repository) + * .buildClient(); + *+ * + * + * @see ContainerRegistryContentAsyncClient + * @see ContainerRegistryContentClient */ @ServiceClientBuilder( serviceClients = { @@ -76,6 +110,12 @@ public final class ContainerRegistryContentClientBuilder implements private ContainerRegistryAudience audience; private String repositoryName; + /** + * Creates a new instance of {@link ContainerRegistryContentClientBuilder} + */ + public ContainerRegistryContentClientBuilder() { + } + /** * Sets the service endpoint for the Azure Container Registry instance. * @@ -86,12 +126,12 @@ public final class ContainerRegistryContentClientBuilder implements @Override public ContainerRegistryContentClientBuilder endpoint(String endpoint) { try { - new URL(endpoint); - } catch (MalformedURLException ex) { - throw LOGGER.logExceptionAsWarning(new IllegalArgumentException("'endpoint' must be a valid URL", ex)); + URI url = URI.create(endpoint); + this.endpoint = url.toASCIIString(); + } catch (IllegalArgumentException ex) { + throw LOGGER.logExceptionAsWarning(ex); } - this.endpoint = endpoint; return this; } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRepository.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRepository.java index f048bece0784d..bd2d35d54f5d4 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRepository.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRepository.java @@ -33,11 +33,11 @@ import static com.azure.containers.containerregistry.implementation.UtilsImpl.mapAcrErrorsException; /** - * 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. + *This class provides a client that works with a specific repository in Azure Container Registry. + * It allows to get and update repository properties and delete repository.
* - *Instantiating Container Repository helper type.
+ *Instantiating {@link ContainerRepository}
+ *
* * *@@ -48,9 +48,10 @@ ** * - *View {@link ContainerRegistryClientBuilder this} for additional ways to construct the client.
+ *View {@link ContainerRegistryClientBuilder} for additional ways to construct the client.
* * @see ContainerRegistryClientBuilder + * @see ContainerRegistryClient */ @ServiceClient(builder = ContainerRegistryClientBuilder.class) public final class ContainerRepository { @@ -93,31 +94,28 @@ public final class ContainerRepository { } } - /** - * Gets the Azure Container Registry service endpoint for the current instance. + * Gets the current repository name. * - * @return The service endpoint for the current instance. + * @return The repository name. */ public String getName() { return this.repositoryName; } /** - * Gets the Azure Container Registry name for the current instance. + * Gets the Azure Container Registry service endpoint. * - * @return Return the registry name. + * @return The service endpoint. */ public String getRegistryEndpoint() { return this.endpoint; } /** - * Delete the repository in the Azure Container Registry for the given {@link #getName() repository}. - * - *Code Samples
+ * Delete the current repository. * - *Delete the repository.
+ *Delete the repository
* * *@@ -129,7 +127,7 @@ public String getRegistryEndpoint() { * @param context Additional context that is passed through the Http pipeline during the service call. artifacts * that are deleted as part of the repository delete. * @return A void response for completion. - * @throws ClientAuthenticationException thrown if the client does not have access to the repository. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -144,11 +142,9 @@ public ResponsedeleteWithResponse(Context context) { } /** - * Delete the repository in the Azure Container Registry for the given {@link #getName() repository}. + * Delete the current repository. * - * Code Samples
- * - *Delete the repository.
+ *Delete the repository
* * *@@ -157,7 +153,7 @@ public Response* * - * @throws ClientAuthenticationException thrown if the client does not have access to the repository. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -166,12 +162,9 @@ public void delete() { } /** - * Gets the {@link ContainerRepositoryProperties properties} associated with the given {@link #getName() - * repository}. + * Gets the {@link ContainerRepositoryProperties properties} associated with the current repository. * - *deleteWithResponse(Context context) { * Code Samples
- * - *Get the properties for the given repository.
+ *Get the properties for the current repository
* * *@@ -184,7 +177,7 @@ public void delete() { * @param context Additional context that is passed through the Http pipeline during the service call. * @return A REST response with the {@link ContainerRepositoryProperties properties} associated with the given * {@link #getName() repository}. - * @throws ClientAuthenticationException thrown if the client does not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. * @throws ResourceNotFoundException thrown if the repository with the given name was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @@ -198,12 +191,9 @@ public ResponsegetPropertiesWithResponse(Context } /** - * Gets the {@link ContainerRepositoryProperties properties} associated with the given {@link #getName() - * repository}. + * Gets the {@link ContainerRepositoryProperties properties} associated with the current repository. * - * Code Samples
- * - *Get the properties for the given repository.
+ *Get the properties for the current repository
* * *@@ -214,7 +204,7 @@ public ResponsegetPropertiesWithResponse(Context * * @return The {@link ContainerRepositoryProperties properties} associated with the given {@link #getName() * repository}. - * @throws ClientAuthenticationException thrown if the client does not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. * @throws ResourceNotFoundException thrown if the repository with the given name was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @@ -236,17 +226,14 @@ public RegistryArtifact getArtifact(String tagOrDigest) { } /** - * Fetches all the artifacts associated with the given {@link #getName() repository}. + * Fetches all manifest properties associated with artifacts in the current repository. * - * If you would like to specify the order in which the tags are returned please - * use the overload that takes in the options parameter {@link #listManifestProperties(ArtifactManifestOrder, - * Context)} listManifestProperties} No assumptions on the order can be made if no options are provided to the - * service. + *
If you would like to specify the order in which the properties are returned please + * use the overload that takes in the options parameter {@link #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.
+ *Retrieve all manifest properties associated with the current repository
* * *@@ -259,8 +246,7 @@ public RegistryArtifact getArtifact(String tagOrDigest) { * * * @return {@link PagedIterable} of the artifacts for the given repository in the order specified by the options. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the - * namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -269,16 +255,13 @@ public PagedIterablelistManifestProperties() { } /** - * Fetches all the artifacts associated with the given {@link #getName() repository }. + * Fetches all manifest properties associated with artifacts in the current repository. * - * 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
+ *The method supports options to select the order in which the manifest properties 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.
* - *Retrieve all artifacts associated with the given repository from the most recently updated to the last.
+ *List all artifacts within current repository ordered by update time
* * *@@ -292,8 +275,7 @@ public PagedIterablelistManifestProperties() { * * @param order the order in which the artifacts are returned by the service. * @return {@link PagedIterable} of the artifacts for the given repository in the order specified by the options. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the - * namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -302,16 +284,13 @@ public PagedIterable listManifestProperties(Artifact } /** - * Fetches all the artifacts associated with the given {@link #getName() repository }. - * - * 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. - *
+ * Fetches all manifest properties associated with artifacts in the current repository. * - *Code Samples
+ *The method supports options to select the order in which the manifest properties 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.
* - *Retrieve all artifacts associated with the given repository from the most recently updated to the last.
+ *List all artifacts within current repository ordered by update time
* * *@@ -326,8 +305,7 @@ public PagedIterablelistManifestProperties(Artifact * @param order the order in which the artifacts are returned by the service. * @param context Additional context that is passed through the Http pipeline during the service call. * @return {@link PagedIterable} of the artifacts for the given repository in the order specified by the options. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the - * namespace. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -371,12 +349,10 @@ private PagedResponse listManifestPropertiesNextSing } /** - * Update the settable properties {@link ContainerRepositoryProperties} of the given {@link #getName() repository}. + * Update the repository properties {@link ContainerRepositoryProperties} of the current repository. * These properties set the update, delete and retrieve options of the repository. * - * Code Samples
- * - *Update the writeable properties for the given repository.
+ *Update the writeable properties for the current repository
* * *@@ -389,7 +365,7 @@ private PagedResponselistManifestPropertiesNextSing * for the repository. * @param context Additional context that is passed through the Http pipeline during the service call. * @return A REST response with the completion. - * @throws ClientAuthenticationException thrown if the client does not have access to the repository. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. * @throws ResourceNotFoundException thrown if the repository with the given name was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. * @throws NullPointerException thrown if the {@code repositoryProperties} is null. @@ -400,12 +376,10 @@ public Response updatePropertiesWithResponse(Cont } /** - * Update the repository properties {@link ContainerRepositoryProperties} of the given {@link #getName() - * repository}. These properties set the update, delete and retrieve options of the repository. - * - * Code Samples
+ * Update the repository properties {@link ContainerRepositoryProperties} of the current repository. + * These properties set the update, delete and retrieve options of the repository. * - *Update the writeable properties for the given repository.
+ *Update the writeable properties for the current repository
* * *@@ -417,7 +391,7 @@ public ResponseupdatePropertiesWithResponse(Cont * @param repositoryProperties {@link ContainerRepositoryProperties repository properties} that need to be updated * for the repository. * @return The updated {@link ContainerRepositoryProperties properties } - * @throws ClientAuthenticationException thrown if the client does not have access to the repository. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. * @throws ResourceNotFoundException thrown if the repository with the given name was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. * @throws NullPointerException thrown if the {@code repositoryProperties} is null. diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRepositoryAsync.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRepositoryAsync.java index 73246f9433fbd..d49153bb5971a 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRepositoryAsync.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRepositoryAsync.java @@ -35,10 +35,11 @@ import static com.azure.core.util.FluxUtil.withContext; /** - * This class provides helper methods for operations on a given repository in Azure Container Registry. - * Operations included are listing, retrieving, deleting, setting writeable properties. + * This class provides a client that works with a specific repository in Azure Container Registry. + * It allows to get and update repository properties and delete repository.
* - *Instantiating an asynchronous Container Repository Helper class
+ *Instantiating an asynchronous {@link ContainerRepositoryAsync}
+ *
* * *@@ -50,6 +51,10 @@ ** * + *View {@link ContainerRegistryClientBuilder} for additional ways to construct the client.
+ * + * @see ContainerRegistryClientBuilder + * @see ContainerRegistryAsyncClient */ @ServiceClient(builder = ContainerRegistryClientBuilder.class, isAsync = true) public final class ContainerRepositoryAsync { @@ -62,7 +67,7 @@ public final class ContainerRepositoryAsync { private final String registryLoginServer; /** - * Creates a ContainerRepositoryAsyncClient that sends requests to the given repository in the container registry service at {@code endpoint}. + * Creates a ContainerRepositoryAsyncClient that sends requests to the current repository in the container registry service at {@code endpoint}. * Each service call goes through the {@code pipeline}. * @param repositoryName The name of the repository on which the service operations are performed. * @param endpoint The URL string for the Azure Container Registry service. @@ -91,27 +96,27 @@ public final class ContainerRepositoryAsync { } /** - * Gets the Azure Container Registry service endpoint for the current instance. - * @return The service endpoint for the current instance. + * Gets the current repository name. + * + * @return The repository name. */ public String getName() { return this.repositoryName; } /** - * Gets the Azure Container Registry name for the current instance. - * @return Return the registry name. + * Gets the Azure Container Registry service endpoint. + * + * @return The service endpoint. */ public String getRegistryEndpoint() { return this.endpoint; } /** - * Delete the repository in the Azure Container Registry for the given {@link #getName() repository}. + * Delete the current repository. * - *Code Samples
- * - *Delete the repository.
+ *Delete the repository
* * *@@ -140,11 +145,9 @@ private Mono> deleteWithResponse(Context context) { } /** - * Delete the repository in the Azure Container Registry for the given {@link #getName() repository}. - * - * Code Samples
+ * Delete the current repository. * - *Delete the repository.
+ *Delete the repository
* * *@@ -178,16 +181,14 @@ public RegistryArtifactAsync getArtifact(String tagOrDigest) { } /** - * Fetches all the artifacts associated with the given {@link #getName() repository}. + * Fetches all manifest properties associated with artifacts in the current repository. * - *If you would like to specify the order in which the tags are returned please + *
If you would like to specify the order in which the properties are returned please * use the overload that takes in the options parameter {@link #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.
+ *Retrieve all manifest properties associated with the current repository
* * *@@ -199,7 +200,7 @@ public RegistryArtifactAsync getArtifact(String tagOrDigest) { ** * - * @return {@link PagedFlux} of ManifestProperties for all the artifacts in the given repository. + * @return {@link PagedFlux} of ManifestProperties for all the artifacts in the current repository. * @throws ClientAuthenticationException thrown if the client does not have access to the repository. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @@ -209,15 +210,13 @@ public PagedFluxlistManifestProperties() { } /** - * Fetches all the artifacts associated with the given {@link #getName() repository}. + * Fetches all manifest properties associated with artifacts in the current repository. * - * The method supports options to select the order in which the artifacts are returned by the service. + *
The method supports options to select the order in which the manifest properties 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.
+ *List all artifacts within current repository ordered by update time
* * *@@ -230,7 +229,7 @@ public PagedFluxlistManifestProperties() { * * * @param order The order in which the artifacts are returned by the service. - * @return {@link PagedFlux} of the artifacts for the given repository in the order specified by the options. + * @return {@link PagedFlux} of the artifacts for the current repository in the order specified by the options. * @throws ClientAuthenticationException thrown if the client does not have access to the repository. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @@ -263,11 +262,9 @@ private Mono > listManifestPropertiesNe } /** - * Gets the {@link ContainerRepositoryProperties properties} associated with the given {@link #getName() repository}. - * - * Code Samples
+ * Gets the {@link ContainerRepositoryProperties properties} associated with the current repository. * - *Get the properties for the given repository.
+ *Get the properties for the current repository
* * *@@ -278,7 +275,7 @@ private Mono* * - * @return A REST response with the {@link ContainerRepositoryProperties properties} associated with the given {@link #getName() repository}. + * @return A REST response with the {@link ContainerRepositoryProperties properties} associated with the current repository. * @throws ClientAuthenticationException thrown if the client have access to the repository. * @throws ResourceNotFoundException thrown if the repository with the given name was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. @@ -294,11 +291,9 @@ private Mono> listManifestPropertiesNe * > getPropertiesWithResponse( } /** - * Gets the {@link ContainerRepositoryProperties properties} associated with the given {@link #getName() repository}. - * - * Code Samples
+ * Gets the {@link ContainerRepositoryProperties properties} associated with the current repository. * - *Get the properties for the given repository.
+ *Get the properties for the current repository
* * *@@ -308,7 +303,7 @@ private Mono* * - * @return The {@link ContainerRepositoryProperties properties} associated with the given {@link #getName() repository}. + * @return The {@link ContainerRepositoryProperties properties} associated with the current repository. * @throws ClientAuthenticationException thrown if the client does not have access to the repository. * @throws ResourceNotFoundException thrown if the repository with the given name was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. @@ -319,12 +314,10 @@ public Mono> getPropertiesWithResponse( * getProperties() { } /** - * Update the repository properties {@link ContainerRepositoryProperties} of the given {@link #getName() repository}. + * Update the repository properties {@link ContainerRepositoryProperties} of the current repository. * These properties set the update, delete and retrieve options of the repository. * - * Code Samples
- * - *Update the writeable properties for the given repository.
+ *Update the writeable properties for the current repository
* * *@@ -362,12 +355,10 @@ private Mono> updatePropertiesWithRespon } /** - * Update the repository properties {@link ContainerRepositoryProperties} of the given {@link #getName() repository}. + * Update the repository properties {@link ContainerRepositoryProperties} of the current repository. * These properties set the update, delete and retrieve options of the repository. * - * Code Samples
- * - *Update the writeable properties for the given repository.
+ *Update the writeable properties for the current repository
* * *diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/RegistryArtifact.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/RegistryArtifact.java index 691aaf7168bc7..306739fe2ce9a 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/RegistryArtifact.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/RegistryArtifact.java @@ -38,9 +38,11 @@ import static com.azure.containers.containerregistry.implementation.UtilsImpl.mapAcrErrorsException; /** - * This class provides a helper type that contains all the operations for artifacts in a given repository. + *This class provides a client that works with a specific artifact. + * It allows to get and update manifest and tag properties, delete tags and the artifact
* - *Instantiating Registry Artifact
+ *Instantiating Registry Artifact
+ *
* * *@@ -50,6 +52,11 @@ * .buildClient().getArtifact(repository, digest); ** + * + *View {@link ContainerRegistryClientBuilder} for additional ways to construct the client.
+ * + * @see ContainerRegistryClientBuilder + * @see ContainerRegistryClient */ @ServiceClient(builder = ContainerRegistryClientBuilder.class) public final class RegistryArtifact { @@ -89,11 +96,9 @@ public final class RegistryArtifact { } /** - * Deletes the registry artifact with the digest and repository associated with the instance. - * - *Code Samples
+ * Deletes the current registry artifact. * - *Delete the registry artifact.
+ *Delete the registry artifact
* * *@@ -103,7 +108,7 @@ public final class RegistryArtifact { * * @param context Additional context that is passed through the Http pipeline during the service call. * @return A REST response containing the result of the service call. - * @throws ClientAuthenticationException thrown if the client does not have access to the repository. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -128,11 +133,9 @@ private String getDigest() { } /** - * Deletes the registry artifact with the digest and repository associated with the instance. + * Deletes the current registry artifact. * - *Code Samples
- * - *Delete the registry artifact.
+ *Delete the registry artifact
* * *@@ -140,7 +143,7 @@ private String getDigest() { ** * - * @throws ClientAuthenticationException thrown if the client does not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -149,11 +152,9 @@ public void delete() { } /** - * Deletes the tag with the matching tag name for the given {@link #getRepositoryName() repository}. - * - *Code Samples
+ * Deletes the tag with the matching name on the current artifact. * - *Delete the tag for the given repository.
+ *Delete the tag
* * *@@ -165,7 +166,7 @@ public void delete() { * @param tag The name of the tag that needs to be deleted. * @param context Additional context that is passed through the Http pipeline during the service call. * @return A REST response containing the result of the service call. - * @throws ClientAuthenticationException thrown if the client does not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. * @throws NullPointerException thrown if {@code tag} is null. * @throws IllegalArgumentException thrown if {@code tag} is empty. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. @@ -186,11 +187,9 @@ public ResponsedeleteTagWithResponse(String tag, Context context) { } /** - * Deletes the tag with the matching tag name for the given {@link #getRepositoryName() repository}. - * - * Code Samples
+ * Deletes the tag with the matching name on the current artifact. * - *Delete the tag for the given repository.
+ *Delete the tag on the current artifact
* * *@@ -200,7 +199,7 @@ public ResponsedeleteTagWithResponse(String tag, Context context) { * * * @param tag The name of the tag that needs to be deleted. - * @throws ClientAuthenticationException thrown if the client does not have access to modify the namespace. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. * @throws NullPointerException thrown if {@code tag} is null. * @throws IllegalArgumentException throws if {@code tag} is empty. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. @@ -211,14 +210,9 @@ public void deleteTag(String tag) { } /** - * Gets the {@link ArtifactManifestProperties properties} associated with an artifact in given {@link #getRepositoryName() repository}. + * Gets the {@link ArtifactManifestProperties properties} associated with the current artifact. * - * 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.
+ *Get manifest properties
* * *@@ -230,8 +224,8 @@ public void deleteTag(String tag) { * * * @param context Additional context that is passed through the Http pipeline during the service call. - * @return A REST response containing {@link ArtifactManifestProperties properties} associated with the given {@code Digest}. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @return A REST response containing {@link ArtifactManifestProperties properties} associated with the current artifact. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws ResourceNotFoundException thrown if the given digest was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @@ -250,14 +244,9 @@ public ResponsegetManifestPropertiesWithResponse(Co } /** - * Gets the {@link ArtifactManifestProperties properties} associated with an artifact in given {@link #getRepositoryName() repository}. - * - * This method can take in both a digest as well as a tag.
+ * Gets the {@link ArtifactManifestProperties properties} associated with the current artifact. * - *
- * 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.
+ *Get manifest properties
* * *@@ -266,8 +255,8 @@ public Response* * - * @return The {@link ArtifactManifestProperties properties} associated with the given {@code Digest}. - * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. + * @return The {@link ArtifactManifestProperties properties} associated with the current artifact. + * @throws ClientAuthenticationException thrown if the client's credentials do not have access to perform this operation. * @throws ResourceNotFoundException thrown if the given digest was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @@ -277,11 +266,9 @@ public ArtifactManifestProperties getManifestProperties() { } /** - * Gets the tag properties associated with a given tag in the {@link #getRepositoryName() repository}. - * - *getManifestPropertiesWithResponse(Co * Code Samples
+ * Gets the tag properties associated with a given tag on the current artifact. * - *Retrieve the properties associated with the given tag.
+ *Retrieve the properties associated with the given tag
* * *@@ -295,7 +282,7 @@ public ArtifactManifestProperties getManifestProperties() { * @param tag name of the tag. * @param context Additional context that is passed through the Http pipeline during the service call. * @return A REST response with the {@link ArtifactTagProperties properties} associated with the given tag. - * @throws ClientAuthenticationException thrown if the client does not have access to the repository. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. * @throws ResourceNotFoundException thrown if the given tag was not found. * @throws NullPointerException thrown if {@code tag} is null. * @throws IllegalArgumentException throws if {@code tag} is empty. @@ -320,11 +307,9 @@ public ResponsegetTagPropertiesWithResponse(String tag, } /** - * Gets the tag properties associated with a given tag in the {@link #getRepositoryName() repository}. - * - * Code Samples
+ * Gets the tag properties associated with a given tag on the current artifact. * - *Retrieve the properties associated with the given tag.
+ *Retrieve the properties associated with the given tag
* * *@@ -336,7 +321,7 @@ public ResponsegetTagPropertiesWithResponse(String tag, * * @param tag name of the tag. * @return The {@link ArtifactTagProperties properties} associated with the given tag. - * @throws ClientAuthenticationException thrown if the client does not have access to the repository. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. * @throws ResourceNotFoundException thrown if the given tag was not found. * @throws NullPointerException thrown if {@code tag} is null. * @throws IllegalArgumentException throws if {@code tag} is empty. @@ -348,16 +333,14 @@ public ArtifactTagProperties getTagProperties(String tag) { } /** - * Fetches all the tags associated with the given {@link #getRepositoryName() repository}. + * Fetches all the tags associated with the current artifact. * * If you would like to specify the order in which the tags are returned please - * use the overload that takes in the options parameter {@link #listTagProperties(ArtifactTagOrder, Context)} listTagProperties} + * use the overload that takes in the options parameter {@link #listTagProperties(ArtifactTagOrder)} * 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.
+ *Retrieve all the tags associated with the current artifact
* * *@@ -368,8 +351,8 @@ public ArtifactTagProperties getTagProperties(String tag) { ** * - * @return {@link PagedIterable} of the artifacts for the given repository in the order specified by the options. - * @throws ClientAuthenticationException thrown if the client does not have access to the repository. + * @return {@link PagedIterable} of the tag properties for the current artifact in the order specified by the options. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -378,16 +361,14 @@ public PagedIterablelistTagProperties() { } /** - * Fetches all the tags associated with the given {@link #getRepositoryName() repository}. + * Fetches all the tags associated with the current artifact. * * 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.
+ *List all tags associated with the current artifact ordered by update time
* * *@@ -402,8 +383,8 @@ public PagedIterablelistTagProperties() { * * * @param order The order in which the tags should be returned by the service. - * @return {@link PagedIterable} of the artifacts for the given repository in the order specified by the options. - * @throws ClientAuthenticationException thrown if the client does not have access to the repository. + * @return {@link PagedIterable} of the tags for the current artifact in the order specified by the options. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -412,16 +393,14 @@ public PagedIterable listTagProperties(ArtifactTagOrder o } /** - * Fetches all the tags associated with the given {@link #getRepositoryName() repository}. + * Fetches all the tags associated with the current artifact. * * 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.
+ *List all tags associated with the current artifact ordered by update time
* * *@@ -437,8 +416,8 @@ public PagedIterablelistTagProperties(ArtifactTagOrder o * * @param order The order in which the tags should be returned by the service. * @param context Additional context that is passed through the Http pipeline during the service call. - * @return {@link PagedIterable} of the artifacts for the given repository in the order specified by the options. - * @throws ClientAuthenticationException thrown if the client does not have access to the repository. + * @return {@link PagedIterable} of the tags for the current artifacts in the order specified by the options. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -459,12 +438,10 @@ private PagedResponse listTagPropertiesNextSinglePageSync } /** - * Update the properties {@link ArtifactTagProperties} of the given tag in {@link #getRepositoryName() repository}. + * Update the properties {@link ArtifactTagProperties} of the tag with the given name {@code tag}. * These properties set whether the given tag can be updated, deleted and retrieved. * - * Code Samples
- * - *Update the writeable properties of a given tag.
+ *Update writeable tag properties
* * *@@ -511,12 +488,10 @@ public ResponseupdateTagPropertiesWithResponse(String ta } /** - * Update the properties {@link ArtifactTagProperties} of the given {@code tag}. + * Update the properties {@link ArtifactTagProperties} of the tag with the given name {@code tag}. * These properties set whether the given tag can be updated, deleted and retrieved. * - * Code Samples
- * - *Update the writeable properties of a given tag.
+ *Update writable tag properties
* * *@@ -541,12 +516,10 @@ public ArtifactTagProperties updateTagProperties(String tag, ArtifactTagProperti } /** - * Update the properties {@link ArtifactTagProperties} of the artifact with the given {@code digest}. - * These properties set whether the given manifest can be updated, deleted and retrieved. - * - *Code Samples
+ * Update the properties {@link ArtifactTagProperties} of the tag with the given {@code tag}. + * These properties set whether the given tag can be updated, deleted and retrieved. * - *Update the writeable properties of a given artifact.
+ *Update writable tag properties
* * *@@ -560,7 +533,7 @@ public ArtifactTagProperties updateTagProperties(String tag, ArtifactTagProperti * @return A REST response for the completion. * @throws ClientAuthenticationException thrown if the client does not have access to repository. * @throws NullPointerException thrown if the {@code manifestProperties} is null. - * @throws ResourceNotFoundException thrown if the given {@code digest} was not found. + * @throws ResourceNotFoundException thrown if the current artifact was not found. */ @ServiceMethod(returns = ReturnType.SINGLE) public ResponseupdateManifestPropertiesWithResponse( @@ -587,12 +560,10 @@ public Response updateManifestPropertiesWithResponse } /** - * Update the writeable properties {@link ArtifactTagProperties} of the artifact with the given {@code digest}. + * Update the properties {@link ArtifactManifestProperties} of the current artifact. * These properties set whether the given manifest can be updated, deleted and retrieved. * - * Code Samples
- * - *Update the writeable properties of a given manifest.
+ *>Update writeable manifest properties
* * *@@ -604,7 +575,7 @@ public ResponseupdateManifestPropertiesWithResponse * @param manifestProperties {@link ArtifactManifestProperties manifestProperties} to be set. * @return The updated {@link ArtifactManifestProperties properties } * @throws ClientAuthenticationException thrown if the client does not have access to repository. - * @throws ResourceNotFoundException thrown if the given {@code digest} was not found. + * @throws ResourceNotFoundException thrown if the current artifact was not found. * @throws NullPointerException thrown if the {@code manifestProperties} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -613,18 +584,18 @@ public ArtifactManifestProperties updateManifestProperties(ArtifactManifestPrope } /** - * Gets the Azure Container Registry service endpoint for the current instance. - * @return The service endpoint for the current instance. + * Gets the Azure Container Registry service endpoint. + * + * @return The service endpoint. */ public String getRegistryEndpoint() { return endpoint; } /** - * Gets the fully qualified reference for the current instance. - * The fully qualifiedName is of the form 'registryName/repositoryName@digest' - * or 'registryName/repositoryName:tag' based on the docker naming convention and whether - * tag or digest was supplied to the constructor. + * Gets the fully qualified reference for the current instance + * following the 'registryName/repositoryName@digest' or 'registryName/repositoryName:tag' format. + * * @return Fully qualified reference of the current instance. * */ public String getFullyQualifiedReference() { @@ -632,9 +603,9 @@ public String getFullyQualifiedReference() { } /** - * Gets the repository name for the current instance. - * Gets the repository name for the current instance. - * @return Name of the repository for the current instance. + * Gets the repository name. + * + * @return Name of the current repository. * */ public String getRepositoryName() { return repositoryName; diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/RegistryArtifactAsync.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/RegistryArtifactAsync.java index 92d0117b76b5c..460fd2e4ef35c 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/RegistryArtifactAsync.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/RegistryArtifactAsync.java @@ -34,14 +34,15 @@ import static com.azure.containers.containerregistry.implementation.UtilsImpl.formatFullyQualifiedReference; import static com.azure.containers.containerregistry.implementation.UtilsImpl.isDigest; -import static com.azure.containers.containerregistry.implementation.UtilsImpl.mapAcrErrorsException; import static com.azure.core.util.FluxUtil.monoError; import static com.azure.core.util.FluxUtil.withContext; /** - * This class provides a helper type that contains all the operations for artifacts in a given repository. + * This class provides a client that works with a specific artifact. + * It allows to get and update manifest and tag properties, delete tags and the artifact
* - *Instantiating an asynchronous RegistryArtifact helper.
+ *Instantiating an asynchronous {@link RegistryArtifactAsync}
+ *
* * *@@ -52,9 +53,10 @@ ** * - *View {@link ContainerRegistryClientBuilder this} for additional ways to construct the client.
+ *View {@link ContainerRegistryClientBuilder} for additional ways to construct the client.
* * @see ContainerRegistryClientBuilder + * @see ContainerRegistryAsyncClient */ @ServiceClient(builder = ContainerRegistryClientBuilder.class, isAsync = true) public final class RegistryArtifactAsync { @@ -66,7 +68,7 @@ public final class RegistryArtifactAsync { private final MonodigestMono; /** - * Creates a RegistryArtifactAsync type that sends requests to the given repository in the container registry service at {@code endpoint}. + * Creates a RegistryArtifactAsync that sends requests to the current repository in the container registry service at {@code endpoint}. * Each service call goes through the {@code pipeline}. * @param repositoryName The name of the repository on which the service operations are performed. * @param tagOrDigest The tag or digest associated with the given artifact. @@ -96,11 +98,9 @@ public final class RegistryArtifactAsync { } /** - * Deletes the registry artifact with the matching digest in the given {@link #getRepositoryName() respository.} + * Deletes the current registry artifact. * - * Code Samples
- * - *Delete the registry artifact.
+ *Delete the registry artifact
* * *@@ -108,8 +108,8 @@ public final class RegistryArtifactAsync { ** * - * @return A REST response with completion signal. - * @throws ClientAuthenticationException thrown if the client does not have access to the repository. + * @return A REST response. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -125,11 +125,9 @@ private Mono> deleteWithResponse(Context context) { } /** - * Deletes the registry artifact with the matching digest in the given {@link #getRepositoryName() respository.} - * - * Code Samples
+ * Deletes the current registry artifact. * - *Delete the registry artifact.
+ *Delete the registry artifact
* * *@@ -138,7 +136,7 @@ private Mono> deleteWithResponse(Context context) { * * * @return the completion. - * @throws ClientAuthenticationException thrown if the client does not have access to the repository. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -147,11 +145,9 @@ public Mono delete() { } /** - * Deletes the tag with the matching tag name for the given {@link #getRepositoryName() repository}. - * - * Code Samples
+ * Deletes the tag with the matching name on the current artifact. * - *Delete the tag for the given repository.
+ *Delete the tag
* * *@@ -160,9 +156,9 @@ public Mono* * - * @param tag The name of the 'tag' that uniquely identifies the 'tag' that needs to be deleted. - * @return A REST response with completion signal. - * @throws ClientAuthenticationException thrown if the client does not have access to the repository. + * @param tag A tag to be deleted. + * @return A REST response. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. * @throws NullPointerException thrown if {@code tag} is null. * @throws IllegalArgumentException thrown if {@code tag} is empty. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. @@ -186,11 +182,9 @@ private Monodelete() { * > deleteTagWithResponse(String tag, Context context) } /** - * Deletes the tag with the matching tag name for the given {@link #getRepositoryName() repository}. + * Deletes the tag with the matching name on the current artifact. * - * Code Samples
- * - *Delete the tag for the given repository.
+ *Delete the tag on the current artifact
* * *@@ -199,9 +193,9 @@ private Mono* * - * @param tag The name of the tag that uniquely identifies the tag that needs to be deleted. + * @param tag The tag to be deleted. * @return The completion. - * @throws ClientAuthenticationException thrown if the client does not have access to the repository. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. * @throws NullPointerException thrown if {@code tag} is null. * @throws IllegalArgumentException thrown if the {@code tag} is empty. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. @@ -212,14 +206,9 @@ public Mono> deleteTagWithResponse(String tag, Context context) * deleteTag(String tag) { } /** - * Gets the {@link ArtifactManifestProperties properties} associated with an artifact in given {@link #getRepositoryName() repository}. - * - * 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
+ * Gets the {@link ArtifactManifestProperties properties} associated with the current artifact. * - *Get the properties for the given repository.
+ *Get manifest properties
* * *@@ -232,8 +221,8 @@ public MonodeleteTag(String tag) { * * * @return A REST response containing {@link ArtifactManifestProperties properties} associated with the given {@code Digest}. - * @throws ClientAuthenticationException thrown if the client does not have access to the repository. - * @throws ResourceNotFoundException thrown if the given digest was not found. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. + * @throws ResourceNotFoundException thrown if the current artifact was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -250,14 +239,9 @@ private Mono > getManifestPropertiesWithRes } /** - * Gets the {@link ArtifactManifestProperties properties} associated with an artifact in given {@link #getRepositoryName() repository}. + * Gets the {@link ArtifactManifestProperties properties} associated with the current artifact. * - * 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.
+ *Get manifest properties
* * *@@ -268,9 +252,9 @@ private Mono* * - * @return The {@link ArtifactManifestProperties properties} associated with the given {@code Digest}. - * @throws ClientAuthenticationException thrown if the client does not have access to the repository. - * @throws ResourceNotFoundException thrown if the given digest was not found. + * @return The {@link ArtifactManifestProperties properties} associated with the current artifact. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. + * @throws ResourceNotFoundException thrown if the current artifact was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -279,11 +263,9 @@ public Mono> getManifestPropertiesWithRes * getManifestProperties() { } /** - * Gets the tag properties associated with a given tag in the {@link #getRepositoryName() repository}. - * - * Code Samples
+ * Gets the tag properties associated with a given tag on the current artifact. * - *Retrieve the properties associated with the given tag.
+ *Retrieve the properties associated with the given tag
* * *@@ -295,9 +277,9 @@ public Mono* * - * @param tag name of the tag that uniquely identifies a given tag. + * @param tag name of the tag * @return A REST response with the {@link ArtifactTagProperties properties} associated with the given tag. - * @throws ClientAuthenticationException thrown if the client does not have access to the repository. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. * @throws ResourceNotFoundException thrown if the given tag was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. * @throws NullPointerException thrown if the {@code tag} is null. @@ -323,11 +305,9 @@ private MonogetManifestProperties() { * > getTagPropertiesWithResponse(Strin } /** - * Gets the tag properties associated with a given tag in the {@link #getRepositoryName() repository}. - * - * Code Samples
+ * Gets the tag properties associated with a given tag on the current artifact. * - *Retrieve the properties associated with the given tag.
+ *Retrieve the properties associated with the given tag
* * *@@ -340,7 +320,7 @@ private Mono> getTagPropertiesWithResponse(Strin * * @param tag name of the tag that uniquely identifies a given tag. * @return The {@link ArtifactTagProperties properties} associated with the given tag. - * @throws ClientAuthenticationException thrown if the client does not have access to the repository. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. * @throws ResourceNotFoundException thrown if the given tag was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. * @throws NullPointerException thrown if the {@code tag} is null. @@ -352,16 +332,14 @@ public Mono getTagProperties(String tag) { } /** - * Fetches all the tags associated with the given {@link #getRepositoryName() repository}. + * Fetches all the tags associated with the current artifact. * * If you would like to specify the order in which the tags are returned please - * use the overload that takes in the options parameter {@link #listTagProperties(ArtifactTagOrder)} listTagProperties} + * use the overload that takes in the options parameter {@link #listTagProperties(ArtifactTagOrder)} * 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.
+ *Retrieve all the tags associated with the current artifact
* * *@@ -373,8 +351,8 @@ public Mono* * - * @return {@link PagedFlux} of the artifacts for the given repository in the order specified by the options. - * @throws ClientAuthenticationException thrown if the client does not have access to the repository. + * @return {@link PagedFlux} of the tags for the current artifact. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -390,9 +368,7 @@ public PagedFluxgetTagProperties(String tag) { * 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 from the most recently updated to the last.
+ *List all tags associated with the current artifact ordered by update time
* * *@@ -408,7 +384,7 @@ public PagedFluxlistTagProperties() { * * @param order The order in which the tags should be returned by the service. * @return {@link PagedFlux} of the artifacts for the given repository in the order specified by the options. - * @throws ClientAuthenticationException thrown if the client does not have access to the repository. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. */ @ServiceMethod(returns = ReturnType.COLLECTION) @@ -440,12 +416,10 @@ private Mono > listTagPropertiesNextSinglePa } /** - * Update the properties {@link ArtifactTagProperties} of the tag with the given name {@code tag}.. + * Update the properties {@link ArtifactTagProperties} of the tag with the given name {@code tag}. * These properties set whether the given tag can be updated, deleted and retrieved. * - * Code Samples
- * - *Update the writeable properties of a given tag.
+ *Update writeable tag properties
* * *@@ -458,7 +432,7 @@ private Mono> listTagPropertiesNextSinglePa * @param tag Name of the tag that uniquely identifies it. * @param tagProperties {@link ArtifactTagProperties value} to be set. * @return A REST response for completion. - * @throws ClientAuthenticationException thrown if the client does not have access to repository. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. * @throws ResourceNotFoundException thrown if the given tag was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. * @throws NullPointerException thrown if the {@code tag} is null. @@ -501,9 +475,7 @@ private Mono > updateTagPropertiesWithResponse( * Update the properties {@link ArtifactTagProperties} of the tag with the given name {@code tag}. * These properties set whether the given tag can be updated, deleted and retrieved. * - * Code Samples
- * - *Update the writeable properties of a given tag.
+ *Update writable tag properties
* * *@@ -516,7 +488,7 @@ private Mono> updateTagPropertiesWithResponse( * @param tag Name of the tag that uniquely identifies it. * @param tagProperties {@link ArtifactTagProperties tagProperties} to be set. * @return The completion. - * @throws ClientAuthenticationException thrown if the client does not have access to repository. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. * @throws ResourceNotFoundException thrown if the given tag was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. * @throws NullPointerException thrown if the {@code tag} is null. @@ -529,12 +501,10 @@ public Mono updateTagProperties(String tag, ArtifactTagPr } /** - * Update the properties {@link ArtifactManifestProperties} of the artifact with the given {@code digest}. + * Update the properties {@link ArtifactManifestProperties} of the current artifact. * These properties set whether the given manifest can be updated, deleted and retrieved. * - * Code Samples
- * - *Update the writeable properties of a given manifest.
+ *>Update writeable manifest properties
* * *@@ -545,8 +515,8 @@ public MonoupdateTagProperties(String tag, ArtifactTagPr * * @param manifestProperties {@link ArtifactManifestProperties manifestProperties} to be set. * @return A REST response for the completion. - * @throws ClientAuthenticationException thrown if the client does not have access to repository. - * @throws ResourceNotFoundException thrown if the given digest was not found. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. + * @throws ResourceNotFoundException thrown if the current artifact was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. * @throws NullPointerException thrown if the {@code manifestProperties} is null. */ @@ -576,12 +546,10 @@ private Mono > updateManifestPropertiesWithR } /** - * Update the properties {@link ArtifactManifestProperties} of the artifact with the given {@code digest}. + * Update the properties {@link ArtifactManifestProperties} of the current artifact. * These properties set whether the given manifest can be updated, deleted and retrieved. * - * Code Samples
- * - *Update the writeable properties of a given manifest.
+ *Update writeable manifest properties
* * *@@ -592,8 +560,8 @@ private Mono> updateManifestPropertiesWithR * * @param manifestProperties {@link ArtifactManifestProperties manifestProperties} to be set. * @return The completion. - * @throws ClientAuthenticationException thrown if the client does not have access to repository. - * @throws ResourceNotFoundException thrown if the given digest was not found. + * @throws ClientAuthenticationException thrown if the client does not have access to perform this operation. + * @throws ResourceNotFoundException thrown if the current artifact was not found. * @throws HttpResponseException thrown if any other unexpected exception is returned by the service. * @throws NullPointerException thrown if the {@code manifestProperties} is null. */ @@ -604,18 +572,18 @@ public Mono updateManifestProperties(ArtifactManifes /** - * Gets the Azure Container Registry service endpoint for the current instance. - * @return The service endpoint for the current instance. + * Gets the Azure Container Registry service endpoint. + * + * @return The service endpoint. */ public String getRegistryEndpoint() { return endpoint; } /** - * Gets the fully qualified reference for the current instance. - * The fully qualifiedName is of the form 'registryName/repositoryName@digest' - * or 'registryName/repositoryName:tag' based on the docker naming convention and whether - * tag or digest was supplied to the constructor. + * Gets the fully qualified reference for the current instance + * following the 'registryName/repositoryName@digest' or 'registryName/repositoryName:tag' format. + * * @return Fully qualified reference of the current instance. * */ public String getFullyQualifiedReference() { @@ -623,9 +591,9 @@ public String getFullyQualifiedReference() { } /** - * Gets the repository name for the current instance. - * Gets the repository name for the current instance. - * @return Name of the repository for the current instance. + * Gets the repository name. + * + * @return Name of the current repository. * */ public String getRepositoryName() { return repositoryName; diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ContainerRegistryAudience.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ContainerRegistryAudience.java index b9b2e46b7618c..df9f2724b4807 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ContainerRegistryAudience.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ContainerRegistryAudience.java @@ -53,7 +53,11 @@ public static ContainerRegistryAudience fromString(String name) { return fromString(name, ContainerRegistryAudience.class); } - /** @return known ContainerRegistryAudience values. */ + /** + * Gets known ContainerRegistryAudience values. + * + * @return known ContainerRegistryAudience values. + */ public static Collection values() { return values(ContainerRegistryAudience.class); } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/package-info.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/package-info.java index afe2ffb432f3b..32fd25ab6737d 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/package-info.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/package-info.java @@ -1,9 +1,225 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - /** - * Package containing the classes for ContainerRegistry. Metadata API definition for the Azure Container Registry - * runtime. + * Azure Container Registry Service + * is a managed service provided by Microsoft Azure that allows developers to build, store, and manage + * container images and artifacts in a private registry for all types of container deployments.
+ * + *Containerization is a technology that allows developers to package an application and its dependencies into a + * single, ightweight container that can run consistently across different environments. Containers have become + * increasingly popular for building, packaging, and deploying applications, and Azure Container Registry helps with + * the management of the container images used in these applications.
+ * + *The Azure Container Registry library is a client library that provides Java developers with a simple and + * easy-to-use interface for accessing and using the Azure Container Registry Service. This library allows developers to + * easily manage their artifacts and repositories in the Azure Container Registry Service.
+ * + *Getting Started
+ * + *In order to interact with the Container Registry service you'll need to create an instance of + * {@link com.azure.containers.containerregistry.ContainerRegistryClient}, + * {@link com.azure.containers.containerregistry.ContainerRegistryContentClient} or their asynchronous counterparts.
+ * + *The {@link com.azure.containers.containerregistry.ContainerRegistryClient} allows to list and delete repositories + * within the registry or obtain an instance of {@link com.azure.containers.containerregistry.ContainerRepository} + * or {@link com.azure.containers.containerregistry.RegistryArtifact} that can be used to perform operations on the + * repository or artifact.
+ * + *The {@link com.azure.containers.containerregistry.ContainerRegistryContentClient} allows to upload, download, + * and delete artifacts in Azure Container Registry repository.
+ * + *To create one of these clients and communicate with the service, you'll need to use AAD authentication via + * Azure Identity
. + * + *Sample: Construct Synchronous Container Registry Client
+ * + *The following code sample demonstrates the creation of a + * {@link com.azure.containers.containerregistry.ContainerRegistryClient}.
+ * + * + *+ * ContainerRegistryClient registryAsyncClient = new ContainerRegistryClientBuilder() + * .endpoint(endpoint) + * .credential(credential) + * .buildClient(); + *+ * + * + *Note: For asynchronous sample, refer to + * {@link com.azure.containers.containerregistry.ContainerRegistryAsyncClient}.
+ * + *Container Registry Client allows to list and delete repositories and obtain instances of repository and + * artifact client. See methods in {@link com.azure.containers.containerregistry.ContainerRegistryClient} class to + * explore all capabilities that client provides.
+ * + *Sample: Construct Synchronous Container Registry Content Client
+ * + *The following code sample demonstrates the creation of a + * {@link com.azure.containers.containerregistry.ContainerRegistryContentClient}.
+ * + * + *+ * DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build(); + * ContainerRegistryContentClient contentClient = new ContainerRegistryContentClientBuilder() + * .endpoint(endpoint) + * .credential(credential) + * .repositoryName(repository) + * .buildClient(); + *+ * + * + *Note: For asynchronous sample, refer to + * {@link com.azure.containers.containerregistry.ContainerRegistryContentAsyncClient}.
+ * + *Container Registry Content Client allows to upload and download registry artifacts. + * See methods in {@link com.azure.containers.containerregistry.ContainerRegistryContentClient} class to explore all + * capabilities that client provides.
+ * + *
+ * + *
+ * + *List repositories within Container Registry
+ * + *The {@link com.azure.containers.containerregistry.ContainerRegistryClient#listRepositoryNames() listRepositoryNames} + * method can be used to list repositories within Azure Container Registry.
+ * + * + *+ * client.listRepositoryNames().stream().forEach(name -> { + * System.out.printf("Repository Name:%s,", name); + * }); + *+ * + * + *Note: For asynchronous sample, refer to {@link com.azure.containers.containerregistry.ContainerRegistryAsyncClient#listRepositoryNames()}.
+ * + *
+ * + *
+ * + *Get manifest properties
+ * + *The {@link com.azure.containers.containerregistry.ContainerRegistryClient#getArtifact(java.lang.String, java.lang.String) getArtifact} + * method can be used to get artifact client that allows to manage artifact tags and manifest properties.
+ * + *The sample below shows how to list manifest properties.
+ * + * + *+ * RegistryArtifact registryArtifact = client.getArtifact(repositoryName, tagOrDigest); + * ArtifactManifestProperties properties = registryArtifact.getManifestProperties(); + * System.out.println(properties.getDigest()); + *+ * + * + *Note: For asynchronous sample, refer to {@link com.azure.containers.containerregistry.ContainerRegistryAsyncClient#getArtifact(java.lang.String, java.lang.String)}.
+ * + *
+ * + *
+ * + *Delete repository
+ * + *The {@link com.azure.containers.containerregistry.ContainerRegistryClient#deleteRepository(java.lang.String) deleteRepository} + * method can be used to delete a repository.
+ * + * + *+ * client.deleteRepository(repositoryName); + *+ * + * + *Note: For asynchronous sample, refer to {@link com.azure.containers.containerregistry.ContainerRegistryAsyncClient#deleteRepository(java.lang.String)}.
+ * + *
+ * + *
+ * + *Upload an artifact
+ * + *The {@link com.azure.containers.containerregistry.ContainerRegistryContentClient#setManifest(com.azure.containers.containerregistry.models.OciImageManifest, java.lang.String) setManifest} + * method and its overloads can be used to upload artifact manifest.
+ * + *Note: artifacts configuration and all the layers must be uploaded before the manifest using + * {@link com.azure.containers.containerregistry.ContainerRegistryContentClient#uploadBlob(com.azure.core.util.BinaryData) uploadBlob} method or on of it's overloads.
+ * + *The sample below shows how to upload artifact to the Azure Container Registry.
+ * + * + *+ * BinaryData configContent = BinaryData + * .fromObject(Collections.singletonMap("hello", "world")); + * + * UploadRegistryBlobResult configUploadResult = contentClient.uploadBlob(configContent); + * System.out.printf("Uploaded config: digest - %s, size - %s\n", configUploadResult.getDigest(), + * configContent.getLength()); + * + * OciDescriptor configDescriptor = new OciDescriptor() + * .setMediaType("application/vnd.unknown.config.v1+json") + * .setDigest(configUploadResult.getDigest()) + * .setSizeInBytes(configContent.getLength()); + * + * BinaryData layerContent = BinaryData.fromString("Hello Azure Container Registry"); + * UploadRegistryBlobResult layerUploadResult = contentClient.uploadBlob(layerContent); + * System.out.printf("Uploaded layer: digest - %s, size - %s\n", layerUploadResult.getDigest(), + * layerContent.getLength()); + * + * OciImageManifest manifest = new OciImageManifest() + * .setConfiguration(configDescriptor) + * .setSchemaVersion(2) + * .setLayers(Collections.singletonList( + * new OciDescriptor() + * .setDigest(layerUploadResult.getDigest()) + * .setSizeInBytes(layerContent.getLength()) + * .setMediaType("application/octet-stream"))); + * + * SetManifestResult manifestResult = contentClient.setManifest(manifest, "latest"); + * System.out.printf("Uploaded manifest: digest - %s\n", manifestResult.getDigest()); + *+ * + * + *Note: For asynchronous sample, refer to {@link com.azure.containers.containerregistry.ContainerRegistryContentAsyncClient}.
+ * + *
+ * + *
+ * + *Download an artifact
+ * + *The {@link com.azure.containers.containerregistry.ContainerRegistryContentClient#getManifest(java.lang.String)} getManifest} + * method can be used to download manifest from Container Registry.
+ * + *To download artifact layers and configuration, you may use + * {@link com.azure.containers.containerregistry.ContainerRegistryContentClient#downloadStream(java.lang.String, java.nio.channels.WritableByteChannel) downloadStream} + * method or one of its overloads.
+ * + *The sample below shows how to download an artifact including configuration and all layers as files.
+ * + *+ * GetManifestResult manifestResult = contentClient.getManifest("latest"); + * + * OciImageManifest manifest = manifestResult.getManifest().toObject(OciImageManifest.class); + * System.out.printf("Got manifest:\n%s\n", PRETTY_PRINT.writeValueAsString(manifest)); + * + * String configFileName = manifest.getConfiguration().getDigest() + ".json"; + * contentClient.downloadStream(manifest.getConfiguration().getDigest(), createFileChannel(configFileName)); + * System.out.printf("Got config: %s\n", configFileName); + * + * for (OciDescriptor layer : manifest.getLayers()) { + * contentClient.downloadStream(layer.getDigest(), createFileChannel(layer.getDigest())); + * System.out.printf("Got layer: %s\n", layer.getDigest()); + * } + *+ * + * + *Note: For asynchronous examples, refer to the {@link com.azure.containers.containerregistry.ContainerRegistryContentAsyncClient}.
+ * + * @see com.azure.containers.containerregistry.ContainerRegistryClient + * @see com.azure.containers.containerregistry.ContainerRegistryAsyncClient + * @see com.azure.containers.containerregistry.ContainerRegistryClientBuilder + * @see com.azure.containers.containerregistry.ContainerRegistryContentClient + * @see com.azure.containers.containerregistry.ContainerRegistryContentAsyncClient + * @see com.azure.containers.containerregistry.ContainerRegistryContentClientBuilder */ package com.azure.containers.containerregistry; diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ReadmeSamples.java b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ReadmeSamples.java index f18685ed60ec5..a3b81e74b03c3 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ReadmeSamples.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ReadmeSamples.java @@ -48,6 +48,15 @@ public void createContentClient() { // END: readme-sample-createContentClient } + public void createAnonymousContentClient() { + // BEGIN: readme-sample-createAnonymousContentClient + ContainerRegistryContentClient contentClient = new ContainerRegistryContentClientBuilder() + .endpoint(endpoint) + .repositoryName(repository) + .buildClient(); + // END: readme-sample-createAnonymousContentClient + } + public void createAsyncClient() { // BEGIN: readme-sample-createAsyncClient DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build(); @@ -58,15 +67,15 @@ public void createAsyncClient() { // END: readme-sample-createAsyncClient } - public void createBlobAsyncClient() { - // BEGIN: readme-sample-createBlobAsyncClient + public void createContentAsyncClient() { + // BEGIN: readme-sample-createContentAsyncClient DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build(); ContainerRegistryContentAsyncClient contentClient = new ContainerRegistryContentClientBuilder() .endpoint(endpoint) .credential(credential) .repositoryName(repository) .buildAsyncClient(); - // END: readme-sample-createBlobAsyncClient + // END: readme-sample-createContentAsyncClient } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/UploadImage.java b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/UploadImage.java index 5b477c6a94ccb..bc9e00e9bff0a 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/UploadImage.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/UploadImage.java @@ -35,10 +35,12 @@ public static void main(String[] args) { .buildClient(); // BEGIN: readme-sample-uploadImage - BinaryData configContent = BinaryData.fromObject(Collections.singletonMap("hello", "world")); + BinaryData configContent = BinaryData + .fromObject(Collections.singletonMap("hello", "world")); UploadRegistryBlobResult configUploadResult = contentClient.uploadBlob(configContent); - System.out.printf("Uploaded config: digest - %s, size - %s\n", configUploadResult.getDigest(), configContent.getLength()); + System.out.printf("Uploaded config: digest - %s, size - %s\n", configUploadResult.getDigest(), + configContent.getLength()); OciDescriptor configDescriptor = new OciDescriptor() .setMediaType("application/vnd.unknown.config.v1+json") @@ -47,7 +49,8 @@ public static void main(String[] args) { BinaryData layerContent = BinaryData.fromString("Hello Azure Container Registry"); UploadRegistryBlobResult layerUploadResult = contentClient.uploadBlob(layerContent); - System.out.printf("Uploaded layer: digest - %s, size - %s\n", layerUploadResult.getDigest(), layerContent.getLength()); + System.out.printf("Uploaded layer: digest - %s, size - %s\n", layerUploadResult.getDigest(), + layerContent.getLength()); OciImageManifest manifest = new OciImageManifest() .setConfiguration(configDescriptor) diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/UploadImageAsync.java b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/UploadImageAsync.java index dd06e5de2c9ed..d01e384a6284b 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/UploadImageAsync.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/UploadImageAsync.java @@ -37,7 +37,8 @@ public static void main(String[] args) { .buildAsyncClient(); // BEGIN: readme-sample-uploadImageAsync - BinaryData configContent = BinaryData.fromObject(Collections.singletonMap("hello", "world")); + BinaryData configContent = BinaryData + .fromObject(Collections.singletonMap("hello", "world")); MonouploadConfig = contentClient .uploadBlob(configContent) @@ -47,7 +48,8 @@ public static void main(String[] args) { .setSizeInBytes(result.getSizeInBytes())); long dataLength = 1024 * 1024 * 1024; - Mono layerContent = BinaryData.fromFlux(getData(dataLength), dataLength, false); // 1 GB + Mono layerContent = BinaryData + .fromFlux(getData(dataLength), dataLength, false); // 1 GB Mono uploadLayer = layerContent.flatMap(content -> contentClient.uploadBlob(content)) .map(result -> new OciDescriptor() @@ -61,7 +63,8 @@ public static void main(String[] args) { .setSchemaVersion(2) .setLayers(Collections.singletonList(tuple.getT2()))) .flatMap(manifest -> contentClient.setManifest(manifest, "latest")) - .doOnSuccess(manifestResult -> System.out.printf("Uploaded manifest: digest - %s\n", manifestResult.getDigest())) + .doOnSuccess(manifestResult -> + System.out.printf("Uploaded manifest: digest - %s\n", manifestResult.getDigest())) .block(); // END: readme-sample-uploadImageAsync