Azure
@@ -171,12 +171,12 @@ public BlobClient getBlobClient(String blobName, String snapshot) {
}
/**
- * Initializes a {@link StorageClient} object pointing to the storage account this container is in.
+ * Initializes a {@link BlobServiceClient} object pointing to the storage account this container is in.
*
- * @return A {@link StorageClient} object pointing to the specified storage account
+ * @return A {@link BlobServiceClient} object pointing to the specified storage account
*/
- public StorageClient getStorageClient() {
- return new StorageClient(containerAsyncClient.getStorageAsyncClient());
+ public BlobServiceClient getBlobServiceClient() {
+ return new BlobServiceClient(containerAsyncClient.getBlobServiceAsyncClient());
}
/**
diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/DownloadAsyncResponse.java b/storage/client/blob/src/main/java/com/azure/storage/blob/DownloadAsyncResponse.java
index e22a3fa72a16..c27ad3645d20 100644
--- a/storage/client/blob/src/main/java/com/azure/storage/blob/DownloadAsyncResponse.java
+++ b/storage/client/blob/src/main/java/com/azure/storage/blob/DownloadAsyncResponse.java
@@ -18,7 +18,7 @@
/**
* {@code DownloadAsyncResponse} wraps the protocol-layer response from {@link BlobAsyncClient#download(BlobRange,
- * BlobAccessConditions, boolean, ReliableDownloadOptions)} to automatically retry failed reads from the body as
+ * ReliableDownloadOptions, BlobAccessConditions, boolean)} to automatically retry failed reads from the body as
* appropriate. If the download is interrupted, the {@code DownloadAsyncResponse} will make a request to resume the download
* from where it left off, allowing the user to consume the data as one continuous stream, for any interruptions are
* hidden. The retry behavior is defined by the options passed to the {@link #body(ReliableDownloadOptions)}. The
diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java
index 925f167b2ad9..3f5467a7a6a7 100644
--- a/storage/client/blob/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java
+++ b/storage/client/blob/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java
@@ -37,7 +37,7 @@
*
*
* This client contains operations on a blob. Operations on a container are available on {@link ContainerAsyncClient},
- * and operations on the service are available on {@link StorageAsyncClient}.
+ * and operations on the service are available on {@link BlobServiceAsyncClient}.
*
*
* Please refer
diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/PageBlobClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/PageBlobClient.java
index 14c0ea4644de..fc84f9c9ea21 100644
--- a/storage/client/blob/src/main/java/com/azure/storage/blob/PageBlobClient.java
+++ b/storage/client/blob/src/main/java/com/azure/storage/blob/PageBlobClient.java
@@ -34,7 +34,7 @@
*
*
* This client contains operations on a blob. Operations on a container are available on {@link ContainerClient},
- * and operations on the service are available on {@link StorageClient}.
+ * and operations on the service are available on {@link BlobServiceClient}.
*
*
* Please refer to the Azure Docs
diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/SignedIdentifierWrapper.java b/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/SignedIdentifierWrapper.java
index 8ad4982f3220..69a4eb5ed6c5 100644
--- a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/SignedIdentifierWrapper.java
+++ b/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/SignedIdentifierWrapper.java
@@ -14,7 +14,7 @@
/**
* A wrapper around List<SignedIdentifier> which provides top-level metadata for serialization.
*/
-@JacksonXmlRootElement(localName = "SignedIdentifier")
+@JacksonXmlRootElement(localName = "SignedIdentifiers")
public final class SignedIdentifierWrapper {
@JacksonXmlProperty(localName = "SignedIdentifier")
private final List signedIdentifier;
diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerListDetails.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerListDetails.java
index f51d897112d5..fbca16f733d7 100644
--- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerListDetails.java
+++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerListDetails.java
@@ -3,11 +3,11 @@
package com.azure.storage.blob.models;
-import com.azure.storage.blob.StorageClient;
+import com.azure.storage.blob.BlobServiceClient;
/**
* This type allows users to specify additional information the service should return with each container when listing
- * containers in an account (via a {@link StorageClient} object). This type is immutable to ensure thread-safety of
+ * containers in an account (via a {@link BlobServiceClient} object). This type is immutable to ensure thread-safety of
* requests, so changing the details for a different listing operation requires construction of a new object. Null may
* be passed if none of the options are desirable.
*/
diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListContainersOptions.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListContainersOptions.java
index 19d3e61a2c75..ed6c27b57d90 100644
--- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListContainersOptions.java
+++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListContainersOptions.java
@@ -3,10 +3,10 @@
package com.azure.storage.blob.models;
-import com.azure.storage.blob.StorageClient;
+import com.azure.storage.blob.BlobServiceClient;
/**
- * Defines options available to configure the behavior of a call to listContainersSegment on a {@link StorageClient}
+ * Defines options available to configure the behavior of a call to listContainersSegment on a {@link BlobServiceClient}
* object. See the constructor for details on each of the options. Null may be passed in place of an object of this
* type if no options are desirable.
*/
diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/package-info.java b/storage/client/blob/src/main/java/com/azure/storage/blob/package-info.java
index 6048911e2d09..54ad22687275 100644
--- a/storage/client/blob/src/main/java/com/azure/storage/blob/package-info.java
+++ b/storage/client/blob/src/main/java/com/azure/storage/blob/package-info.java
@@ -3,6 +3,6 @@
// Code generated by Microsoft (R) AutoRest Code Generator
/**
- * Package containing the classes for StorageClient.
+ * Package containing the classes for BlobServiceClient.
*/
package com.azure.storage.blob;
diff --git a/storage/client/blob/src/samples/java/AzureIdentityExample.java b/storage/client/blob/src/samples/java/com/azure/storage/blob/AzureIdentityExample.java
similarity index 89%
rename from storage/client/blob/src/samples/java/AzureIdentityExample.java
rename to storage/client/blob/src/samples/java/com/azure/storage/blob/AzureIdentityExample.java
index 6550c8c02a76..9945273cbccd 100644
--- a/storage/client/blob/src/samples/java/AzureIdentityExample.java
+++ b/storage/client/blob/src/samples/java/com/azure/storage/blob/AzureIdentityExample.java
@@ -1,9 +1,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
+package com.azure.storage.blob;
+
import com.azure.identity.credential.DefaultAzureCredential;
-import com.azure.storage.blob.StorageClient;
-import com.azure.storage.blob.StorageClientBuilder;
import java.util.Locale;
@@ -30,7 +30,7 @@ public static void main(String[] args) {
/*
* Create a storage client using the Azure Identity credentials.
*/
- StorageClient storageClient = new StorageClientBuilder()
+ BlobServiceClient storageClient = new BlobServiceClientBuilder()
.endpoint(endpoint)
.credential(new DefaultAzureCredential())
.buildClient();
diff --git a/storage/client/blob/src/samples/java/BasicExample.java b/storage/client/blob/src/samples/java/com/azure/storage/blob/BasicExample.java
similarity index 91%
rename from storage/client/blob/src/samples/java/BasicExample.java
rename to storage/client/blob/src/samples/java/com/azure/storage/blob/BasicExample.java
index 3f8edbd367cb..c47e753b3f07 100644
--- a/storage/client/blob/src/samples/java/BasicExample.java
+++ b/storage/client/blob/src/samples/java/com/azure/storage/blob/BasicExample.java
@@ -1,10 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-import com.azure.storage.blob.BlockBlobClient;
-import com.azure.storage.blob.ContainerClient;
-import com.azure.storage.blob.StorageClient;
-import com.azure.storage.blob.StorageClientBuilder;
+package com.azure.storage.blob;
+
import com.azure.storage.common.credentials.SharedKeyCredential;
import java.io.ByteArrayInputStream;
@@ -46,9 +44,9 @@ public static void main(String[] args) throws IOException {
String endpoint = String.format(Locale.ROOT, "https://%s.blob.core.windows.net", accountName);
/*
- * Create a StorageClient object that wraps the service endpoint, credential and a request pipeline.
+ * Create a BlobServiceClient object that wraps the service endpoint, credential and a request pipeline.
*/
- StorageClient storageClient = new StorageClientBuilder().endpoint(endpoint).credential(credential).buildClient();
+ BlobServiceClient storageClient = new BlobServiceClientBuilder().endpoint(endpoint).credential(credential).buildClient();
/*
* This example shows several common operations just to get you started.
diff --git a/storage/client/blob/src/samples/java/com/azure/storage/blob/BlobAsyncClientJavaDocCodeSnippets.java b/storage/client/blob/src/samples/java/com/azure/storage/blob/BlobAsyncClientJavaDocCodeSnippets.java
new file mode 100644
index 000000000000..3b82eabc7bcf
--- /dev/null
+++ b/storage/client/blob/src/samples/java/com/azure/storage/blob/BlobAsyncClientJavaDocCodeSnippets.java
@@ -0,0 +1,390 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.storage.blob;
+
+import com.azure.storage.blob.models.AccessTier;
+import com.azure.storage.blob.models.BlobAccessConditions;
+import com.azure.storage.blob.models.BlobHTTPHeaders;
+import com.azure.storage.blob.models.BlobRange;
+import com.azure.storage.blob.models.DeleteSnapshotsOptionType;
+import com.azure.storage.blob.models.LeaseAccessConditions;
+import com.azure.storage.blob.models.Metadata;
+import com.azure.storage.blob.models.ModifiedAccessConditions;
+import com.azure.storage.blob.models.ReliableDownloadOptions;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.net.URL;
+import java.time.OffsetDateTime;
+import java.util.Collections;
+
+/**
+ * Code snippets for {@link BlobAsyncClient}
+ */
+@SuppressWarnings("unused")
+public class BlobAsyncClientJavaDocCodeSnippets {
+ private BlobAsyncClient client = JavaDocCodeSnippetsHelpers.getBlobAsyncClient("blobName");
+ private String leaseId = "leaseId";
+ private String copyId = "copyId";
+ private URL url = JavaDocCodeSnippetsHelpers.generateURL("https://sample.com");
+ private String file = "file";
+
+ /**
+ * Code snippet for {@link BlobAsyncClient#exists()}
+ */
+ public void existsCodeSnippet() {
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.exists
+ client.exists().subscribe(response -> System.out.printf("Exists? %b%n", response.value()));
+ // END: com.azure.storage.blob.BlobAsyncClient.exists
+ }
+
+ /**
+ * Code snippets for {@link BlobAsyncClient#startCopyFromURL(URL)} and
+ * {@link BlobAsyncClient#startCopyFromURL(URL, Metadata, ModifiedAccessConditions, BlobAccessConditions)}
+ */
+ public void startCopyFromURL() {
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.startCopyFromURL#URL
+ client.startCopyFromURL(url)
+ .subscribe(response -> System.out.printf("Copy identifier: %s%n", response.value()));
+ // END: com.azure.storage.blob.BlobAsyncClient.startCopyFromURL#URL
+
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.startCopyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions
+ Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value"));
+ ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions()
+ .ifUnmodifiedSince(OffsetDateTime.now().minusDays(7));
+ BlobAccessConditions blobAccessConditions = new BlobAccessConditions()
+ .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId));
+
+ client.startCopyFromURL(url, metadata, modifiedAccessConditions, blobAccessConditions)
+ .subscribe(response -> System.out.printf("Copy identifier: %s%n", response.value()));
+ // END: com.azure.storage.blob.BlobAsyncClient.startCopyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions
+ }
+
+ /**
+ * Code snippets for {@link BlobAsyncClient#abortCopyFromURL(String)} and
+ * {@link BlobAsyncClient#abortCopyFromURL(String, LeaseAccessConditions)}
+ */
+ public void abortCopyFromURL() {
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.abortCopyFromURL#String
+ client.abortCopyFromURL(copyId)
+ .subscribe(response -> System.out.printf("Aborted copy completed with status %d%n", response.statusCode()));
+ // END: com.azure.storage.blob.BlobAsyncClient.abortCopyFromURL#String
+
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.abortCopyFromURL#String-LeaseAccessConditions
+ LeaseAccessConditions leaseAccessConditions = new LeaseAccessConditions().leaseId(leaseId);
+ client.abortCopyFromURL(copyId, leaseAccessConditions)
+ .subscribe(response -> System.out.printf("Aborted copy completed with status %d%n", response.statusCode()));
+ // END: com.azure.storage.blob.BlobAsyncClient.abortCopyFromURL#String-LeaseAccessConditions
+ }
+
+ /**
+ * Code snippets for {@link BlobAsyncClient#copyFromURL(URL)} and
+ * {@link BlobAsyncClient#copyFromURL(URL, Metadata, ModifiedAccessConditions, BlobAccessConditions)}
+ */
+ public void copyFromURL() {
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.copyFromURL#URL
+ client.copyFromURL(url).subscribe(response -> System.out.printf("Copy identifier: %s%n", response.value()));
+ // END: com.azure.storage.blob.BlobAsyncClient.copyFromURL#URL
+
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.copyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions
+ Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value"));
+ ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions()
+ .ifUnmodifiedSince(OffsetDateTime.now().minusDays(7));
+ BlobAccessConditions blobAccessConditions = new BlobAccessConditions()
+ .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId));
+
+ client.copyFromURL(url, metadata, modifiedAccessConditions, blobAccessConditions)
+ .subscribe(response -> System.out.printf("Copy identifier: %s%n", response.value()));
+ // END: com.azure.storage.blob.BlobAsyncClient.copyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions
+ }
+
+ /**
+ * Code snippets for {@link BlobAsyncClient#download()} and
+ * {@link BlobAsyncClient#download(BlobRange, ReliableDownloadOptions, BlobAccessConditions, boolean)}
+ *
+ * @throws UncheckedIOException If an I/O error occurs
+ */
+ public void download() {
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.download
+ client.download().subscribe(response -> {
+ ByteArrayOutputStream downloadData = new ByteArrayOutputStream();
+ response.value().subscribe(piece -> {
+ try {
+ downloadData.write(piece.array());
+ } catch (IOException ex) {
+ throw new UncheckedIOException(ex);
+ }
+ });
+ });
+ // END: com.azure.storage.blob.BlobAsyncClient.download
+
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.download#BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean
+ BlobRange range = new BlobRange(1024, 2048);
+ ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5);
+
+ client.download(range, options, null, false).subscribe(response -> {
+ ByteArrayOutputStream downloadData = new ByteArrayOutputStream();
+ response.value().subscribe(piece -> {
+ try {
+ downloadData.write(piece.array());
+ } catch (IOException ex) {
+ throw new UncheckedIOException(ex);
+ }
+ });
+ });
+ // END: com.azure.storage.blob.BlobAsyncClient.download#BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean
+ }
+
+ /**
+ * Code snippets for {@link BlobAsyncClient#downloadToFile(String)} and
+ * {@link BlobAsyncClient#downloadToFile(String, BlobRange, Integer, ReliableDownloadOptions, BlobAccessConditions, boolean)}
+ */
+ public void downloadToFile() {
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.downloadToFile#String
+ client.downloadToFile(file).subscribe(response -> System.out.println("Completed download to file"));
+ // END: com.azure.storage.blob.BlobAsyncClient.downloadToFile#String
+
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean
+ BlobRange range = new BlobRange(1024, 2048);
+ ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5);
+
+ client.downloadToFile(file, range, null, options, null, false)
+ .subscribe(response -> System.out.println("Completed download to file"));
+ // END: com.azure.storage.blob.BlobAsyncClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean
+ }
+
+ /**
+ * Code snippets for {@link BlobAsyncClient#delete()} and
+ * {@link BlobAsyncClient#delete(DeleteSnapshotsOptionType, BlobAccessConditions)}
+ */
+ public void delete() {
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.delete
+ client.delete()
+ .subscribe(response -> System.out.printf("Delete completed with status %d%n", response.statusCode()));
+ // END: com.azure.storage.blob.BlobAsyncClient.delete
+
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.delete#DeleteSnapshotsOptionType-BlobAccessConditions
+ client.delete(DeleteSnapshotsOptionType.INCLUDE, null)
+ .subscribe(response -> System.out.printf("Delete completed with status %d%n", response.statusCode()));
+ // END: com.azure.storage.blob.BlobAsyncClient.delete#DeleteSnapshotsOptionType-BlobAccessConditions
+ }
+
+ /**
+ * Code snippets for {@link BlobAsyncClient#getProperties()} and
+ * {@link BlobAsyncClient#getProperties(BlobAccessConditions)}
+ */
+ public void getProperties() {
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.getProperties
+ client.getProperties().subscribe(response ->
+ System.out.printf("Type: %s, Size: %d%n", response.value().blobType(), response.value().blobSize()));
+ // END: com.azure.storage.blob.BlobAsyncClient.getProperties
+
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.getProperties#BlobAccessConditions
+ BlobAccessConditions accessConditions = new BlobAccessConditions()
+ .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId));
+
+ client.getProperties(accessConditions).subscribe(response ->
+ System.out.printf("Type: %s, Size: %d%n", response.value().blobType(), response.value().blobSize()));
+ // END: com.azure.storage.blob.BlobAsyncClient.getProperties#BlobAccessConditions
+ }
+
+ /**
+ * Code snippets for {@link BlobAsyncClient#setHTTPHeaders(BlobHTTPHeaders)} and
+ * {@link BlobAsyncClient#setHTTPHeaders(BlobHTTPHeaders, BlobAccessConditions)}
+ */
+ public void setHTTPHeaders() {
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.setHTTPHeaders#BlobHTTPHeaders
+ client.setHTTPHeaders(new BlobHTTPHeaders()
+ .blobContentLanguage("en-US")
+ .blobContentType("binary")).subscribe(response ->
+ System.out.printf("Set HTTP headers completed with status %d%n", response.statusCode()));
+ // END: com.azure.storage.blob.BlobAsyncClient.setHTTPHeaders#BlobHTTPHeaders
+
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions
+ BlobAccessConditions accessConditions = new BlobAccessConditions()
+ .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId));
+
+ client.setHTTPHeaders(new BlobHTTPHeaders()
+ .blobContentLanguage("en-US")
+ .blobContentType("binary"), accessConditions).subscribe(response ->
+ System.out.printf("Set HTTP headers completed with status %d%n", response.statusCode()));
+ // END: com.azure.storage.blob.BlobAsyncClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions
+ }
+
+ /**
+ * Code snippets for {@link BlobAsyncClient#setMetadata(Metadata)} and
+ * {@link BlobAsyncClient#setMetadata(Metadata, BlobAccessConditions)}
+ */
+ public void setMetadata() {
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.setMetadata#Metadata
+ client.setMetadata(new Metadata(Collections.singletonMap("metadata", "value")))
+ .subscribe(response -> System.out.printf("Set metadata completed with status %d%n", response.statusCode()));
+ // END: com.azure.storage.blob.BlobAsyncClient.setMetadata#Metadata
+
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.setMetadata#Metadata-BlobAccessConditions
+ BlobAccessConditions accessConditions = new BlobAccessConditions()
+ .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId));
+
+ client.setMetadata(new Metadata(Collections.singletonMap("metadata", "value")), accessConditions)
+ .subscribe(response -> System.out.printf("Set metadata completed with status %d%n", response.statusCode()));
+ // END: com.azure.storage.blob.BlobAsyncClient.setMetadata#Metadata-BlobAccessConditions
+ }
+
+ /**
+ * Code snippets for {@link BlobAsyncClient#createSnapshot()} and
+ * {@link BlobAsyncClient#createSnapshot(Metadata, BlobAccessConditions)}
+ */
+ public void createSnapshot() {
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.createSnapshot
+ client.createSnapshot()
+ .subscribe(response -> System.out.printf("Identifier for the snapshot is %s%n", response.value()));
+ // END: com.azure.storage.blob.BlobAsyncClient.createSnapshot
+
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.createSnapshot#Metadata-BlobAccessConditions
+ Metadata snapshotMetadata = new Metadata(Collections.singletonMap("metadata", "value"));
+ BlobAccessConditions accessConditions = new BlobAccessConditions()
+ .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId));
+
+ client.createSnapshot(snapshotMetadata, accessConditions)
+ .subscribe(response -> System.out.printf("Identifier for the snapshot is %s%n", response.value()));
+ // END: com.azure.storage.blob.BlobAsyncClient.createSnapshot#Metadata-BlobAccessConditions
+ }
+
+ /**
+ * Code snippets for {@link BlobAsyncClient#setTier(AccessTier)} and
+ * {@link BlobAsyncClient#setTier(AccessTier, LeaseAccessConditions)}
+ */
+ public void setTier() {
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.setTier#AccessTier
+ client.setTier(AccessTier.HOT)
+ .subscribe(response -> System.out.printf("Set tier completed with status code %d%n", response.statusCode()));
+ // END: com.azure.storage.blob.BlobAsyncClient.setTier#AccessTier
+
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.setTier#AccessTier-LeaseAccessConditions
+ LeaseAccessConditions accessConditions = new LeaseAccessConditions().leaseId(leaseId);
+
+ client.setTier(AccessTier.HOT, accessConditions)
+ .subscribe(response -> System.out.printf("Set tier completed with status code %d%n", response.statusCode()));
+ // END: com.azure.storage.blob.BlobAsyncClient.setTier#AccessTier-LeaseAccessConditions
+ }
+
+ /**
+ * Code snippet for {@link BlobAsyncClient#undelete()}
+ */
+ public void undelete() {
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.undelete
+ client.undelete()
+ .subscribe(response -> System.out.printf("Undelete completed with status %d%n", response.statusCode()));
+ // END: com.azure.storage.blob.BlobAsyncClient.undelete
+ }
+
+ /**
+ * Code snippets for {@link BlobAsyncClient#acquireLease(String, int)} and
+ * {@link BlobAsyncClient#acquireLease(String, int, ModifiedAccessConditions)}
+ */
+ public void acquireLease() {
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int
+ client.acquireLease("proposedId", 60)
+ .subscribe(response -> System.out.printf("Lease ID is %s%n", response.value()));
+ // END: com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int
+
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int-ModifiedAccessConditions
+ ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions()
+ .ifModifiedSince(OffsetDateTime.now().minusDays(3));
+
+ client.acquireLease("proposedId", 60, modifiedAccessConditions)
+ .subscribe(response -> System.out.printf("Lease ID is %s%n", response.value()));
+ // END: com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int-ModifiedAccessConditions
+ }
+
+ /**
+ * Code snippets for {@link BlobAsyncClient#renewLease(String)} and
+ * {@link BlobAsyncClient#renewLease(String, ModifiedAccessConditions)}
+ */
+ public void renewLease() {
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.renewLease#String
+ client.renewLease(leaseId)
+ .subscribe(response -> System.out.printf("Renewed lease ID is %s%n", response.value()));
+ // END: com.azure.storage.blob.BlobAsyncClient.renewLease#String
+
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.renewLease#String-ModifiedAccessConditions
+ ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions()
+ .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3));
+
+ client.renewLease(leaseId, modifiedAccessConditions)
+ .subscribe(response -> System.out.printf("Renewed lease ID is %s%n", response.value()));
+ // END: com.azure.storage.blob.BlobAsyncClient.renewLease#String-ModifiedAccessConditions
+ }
+
+ /**
+ * Code snippets for {@link BlobAsyncClient#releaseLease(String)} and
+ * {@link BlobAsyncClient#releaseLease(String, ModifiedAccessConditions)}
+ */
+ public void releaseLease() {
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.releaseLease#String
+ client.releaseLease(leaseId)
+ .subscribe(response -> System.out.printf("Release lease completed with status %d%n", response.statusCode()));
+ // END: com.azure.storage.blob.BlobAsyncClient.releaseLease#String
+
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.releaseLease#String-ModifiedAccessConditions
+ ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions()
+ .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3));
+
+ client.releaseLease(leaseId, modifiedAccessConditions)
+ .subscribe(response -> System.out.printf("Release lease completed with status %d%n", response.statusCode()));
+ // END: com.azure.storage.blob.BlobAsyncClient.releaseLease#String-ModifiedAccessConditions
+ }
+
+ /**
+ * Code snippets for {@link BlobAsyncClient#breakLease()} and
+ * {@link BlobAsyncClient#breakLease(Integer, ModifiedAccessConditions)}
+ */
+ public void breakLease() {
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.breakLease
+ client.breakLease()
+ .subscribe(response ->
+ System.out.printf("The broken lease has %d seconds remaining on the lease", response.value()));
+ // END: com.azure.storage.blob.BlobAsyncClient.breakLease
+
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.breakLease#Integer-ModifiedAccessConditions
+ Integer retainLeaseInSeconds = 5;
+ ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions()
+ .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3));
+
+ client.breakLease(retainLeaseInSeconds, modifiedAccessConditions)
+ .subscribe(response ->
+ System.out.printf("The broken lease has %d seconds remaining on the lease", response.value()));
+ // END: com.azure.storage.blob.BlobAsyncClient.breakLease#Integer-ModifiedAccessConditions
+ }
+
+ /**
+ * Code snippets for {@link BlobAsyncClient#changeLease(String, String)} and
+ * {@link BlobAsyncClient#changeLease(String, String, ModifiedAccessConditions)}
+ */
+ public void changeLease() {
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.changeLease#String-String
+ client.changeLease(leaseId, "proposedId")
+ .subscribe(response -> System.out.printf("Changed lease ID is %s%n", response.value()));
+ // END: com.azure.storage.blob.BlobAsyncClient.changeLease#String-String
+
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.changeLease#String-String-ModifiedAccessConditions
+ ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions()
+ .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3));
+
+ client.changeLease(leaseId, "proposedId", modifiedAccessConditions)
+ .subscribe(response -> System.out.printf("Changed lease ID is %s%n", response.value()));
+ // END: com.azure.storage.blob.BlobAsyncClient.changeLease#String-String-ModifiedAccessConditions
+ }
+
+ /**
+ * Code snippet for {@link BlobAsyncClient#getAccountInfo()}
+ */
+ public void getAccountInfo() {
+ // BEGIN: com.azure.storage.blob.BlobAsyncClient.getAccountInfo
+ client.getAccountInfo().subscribe(response -> System.out.printf("Account Kind: %s, SKU: %s%n",
+ response.value().accountKind(), response.value().skuName()));
+ // END: com.azure.storage.blob.BlobAsyncClient.getAccountInfo
+ }
+}
diff --git a/storage/client/blob/src/samples/java/com/azure/storage/blob/BlobClientJavaDocCodeSnippets.java b/storage/client/blob/src/samples/java/com/azure/storage/blob/BlobClientJavaDocCodeSnippets.java
new file mode 100644
index 000000000000..d99b83f910ad
--- /dev/null
+++ b/storage/client/blob/src/samples/java/com/azure/storage/blob/BlobClientJavaDocCodeSnippets.java
@@ -0,0 +1,387 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.storage.blob;
+
+import com.azure.storage.blob.models.AccessTier;
+import com.azure.storage.blob.models.BlobAccessConditions;
+import com.azure.storage.blob.models.BlobHTTPHeaders;
+import com.azure.storage.blob.models.BlobRange;
+import com.azure.storage.blob.models.DeleteSnapshotsOptionType;
+import com.azure.storage.blob.models.LeaseAccessConditions;
+import com.azure.storage.blob.models.Metadata;
+import com.azure.storage.blob.models.ModifiedAccessConditions;
+import com.azure.storage.blob.models.ReliableDownloadOptions;
+import com.azure.storage.blob.models.StorageAccountInfo;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.time.Duration;
+import java.time.OffsetDateTime;
+import java.util.Collections;
+
+/**
+ * Code snippets for {@link BlobClient}
+ */
+@SuppressWarnings("unused")
+public class BlobClientJavaDocCodeSnippets {
+ private BlobClient client = JavaDocCodeSnippetsHelpers.getBlobClient("blobName");
+ private String leaseId = "leaseId";
+ private String copyId = "copyId";
+ private URL url = JavaDocCodeSnippetsHelpers.generateURL("https://sample.com");
+ private String file = "file";
+ private Duration timeout = Duration.ofSeconds(30);
+
+ /**
+ * Code snippets for {@link BlobClient#exists()} and {@link BlobClient#exists(Duration)}
+ */
+ public void existsCodeSnippet() {
+ // BEGIN: com.azure.storage.blob.BlobClient.exists
+ System.out.printf("Exists? %b%n", client.exists().value());
+ // END: com.azure.storage.blob.BlobClient.exists
+
+ // BEGIN: com.azure.storage.blob.BlobClient.exists#Duration
+ System.out.printf("Exists? %b%n", client.exists(timeout).value());
+ // END: com.azure.storage.blob.BlobClient.exists#Duration
+ }
+
+ /**
+ * Code snippets for {@link BlobClient#startCopyFromURL(URL)} and
+ * {@link BlobClient#startCopyFromURL(URL, Metadata, ModifiedAccessConditions, BlobAccessConditions, Duration)}
+ */
+ public void startCopyFromURL() {
+ // BEGIN: com.azure.storage.blob.BlobClient.startCopyFromURL#URL
+ System.out.printf("Copy identifier: %s%n", client.startCopyFromURL(url).value());
+ // END: com.azure.storage.blob.BlobClient.startCopyFromURL#URL
+
+ // BEGIN: com.azure.storage.blob.BlobClient.startCopyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration
+ Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value"));
+ ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions()
+ .ifUnmodifiedSince(OffsetDateTime.now().minusDays(7));
+ BlobAccessConditions blobAccessConditions = new BlobAccessConditions()
+ .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId));
+
+ System.out.printf("Copy identifier: %s%n",
+ client.startCopyFromURL(url, metadata, modifiedAccessConditions, blobAccessConditions, timeout));
+ // END: com.azure.storage.blob.BlobClient.startCopyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration
+ }
+
+ /**
+ * Code snippets for {@link BlobClient#abortCopyFromURL(String)} and
+ * {@link BlobClient#abortCopyFromURL(String, LeaseAccessConditions, Duration)}
+ */
+ public void abortCopyFromURL() {
+ // BEGIN: com.azure.storage.blob.BlobClient.abortCopyFromURL#String
+ System.out.printf("Aborted copy completed with status %d%n", client.abortCopyFromURL(copyId).statusCode());
+ // END: com.azure.storage.blob.BlobClient.abortCopyFromURL#String
+
+ // BEGIN: com.azure.storage.blob.BlobClient.abortCopyFromURL#String-LeaseAccessConditions-Duration
+ LeaseAccessConditions leaseAccessConditions = new LeaseAccessConditions().leaseId(leaseId);
+ System.out.printf("Aborted copy completed with status %d%n",
+ client.abortCopyFromURL(copyId, leaseAccessConditions, timeout).statusCode());
+ // END: com.azure.storage.blob.BlobClient.abortCopyFromURL#String-LeaseAccessConditions-Duration
+ }
+
+ /**
+ * Code snippets for {@link BlobClient#copyFromURL(URL)} and
+ * {@link BlobClient#copyFromURL(URL, Metadata, ModifiedAccessConditions, BlobAccessConditions, Duration)}
+ */
+ public void copyFromURL() {
+ // BEGIN: com.azure.storage.blob.BlobClient.copyFromURL#URL
+ System.out.printf("Copy identifier: %s%n", client.copyFromURL(url).value());
+ // END: com.azure.storage.blob.BlobClient.copyFromURL#URL
+
+ // BEGIN: com.azure.storage.blob.BlobClient.copyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration
+ Metadata metadata = new Metadata(Collections.singletonMap("metadata", "value"));
+ ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions()
+ .ifUnmodifiedSince(OffsetDateTime.now().minusDays(7));
+ BlobAccessConditions blobAccessConditions = new BlobAccessConditions()
+ .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId));
+
+ System.out.printf("Copy identifier: %s%n",
+ client.copyFromURL(url, metadata, modifiedAccessConditions, blobAccessConditions, timeout).value());
+ // END: com.azure.storage.blob.BlobClient.copyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration
+ }
+
+ /**
+ * Code snippets for {@link BlobClient#download(OutputStream)} and
+ * {@link BlobClient#download(OutputStream, BlobRange, ReliableDownloadOptions, BlobAccessConditions, boolean, Duration)}
+ */
+ public void download() {
+ // BEGIN: com.azure.storage.blob.BlobClient.download#OutputStream
+ System.out.printf("Download completed with status %d%n",
+ client.download(new ByteArrayOutputStream()).statusCode());
+ // END: com.azure.storage.blob.BlobClient.download#OutputStream
+
+ // BEGIN: com.azure.storage.blob.BlobClient.download#OutputStream-BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration
+ BlobRange range = new BlobRange(1024, 2048);
+ ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5);
+
+ System.out.printf("Download completed with status %d%n",
+ client.download(new ByteArrayOutputStream(), range, options, null, false, timeout).statusCode());
+ // END: com.azure.storage.blob.BlobClient.download#OutputStream-BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration
+ }
+
+ /**
+ * Code snippets for {@link BlobClient#downloadToFile(String)} and
+ * {@link BlobClient#downloadToFile(String, BlobRange, Integer, ReliableDownloadOptions, BlobAccessConditions, boolean, Duration)}
+ */
+ public void downloadToFile() {
+ // BEGIN: com.azure.storage.blob.BlobClient.downloadToFile#String
+ client.downloadToFile(file);
+ System.out.println("Completed download to file");
+ // END: com.azure.storage.blob.BlobClient.downloadToFile#String
+
+ // BEGIN: com.azure.storage.blob.BlobClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration
+ BlobRange range = new BlobRange(1024, 2048);
+ ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5);
+
+ client.downloadToFile(file, range, null, options, null, false, timeout);
+ System.out.println("Completed download to file");
+ // END: com.azure.storage.blob.BlobClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration
+ }
+
+ /**
+ * Code snippets for {@link BlobClient#delete()} and
+ * {@link BlobClient#delete(DeleteSnapshotsOptionType, BlobAccessConditions, Duration)}
+ */
+ public void delete() {
+ // BEGIN: com.azure.storage.blob.BlobClient.delete
+ System.out.printf("Delete completed with status %d%n", client.delete().statusCode());
+ // END: com.azure.storage.blob.BlobClient.delete
+
+ // BEGIN: com.azure.storage.blob.BlobClient.delete#DeleteSnapshotsOptionType-BlobAccessConditions-Duration
+ System.out.printf("Delete completed with status %d%n",
+ client.delete(DeleteSnapshotsOptionType.INCLUDE, null, timeout).statusCode());
+ // END: com.azure.storage.blob.BlobClient.delete#DeleteSnapshotsOptionType-BlobAccessConditions-Duration
+ }
+
+ /**
+ * Code snippets for {@link BlobClient#getProperties()}
+ */
+ public void getProperties() {
+ // BEGIN: com.azure.storage.blob.BlobClient.getProperties
+ BlobProperties properties = client.getProperties().value();
+ System.out.printf("Type: %s, Size: %d%n", properties.blobType(), properties.blobSize());
+ // END: com.azure.storage.blob.BlobClient.getProperties
+ }
+
+ /**
+ * Code snippet for {@link BlobClient#getProperties(BlobAccessConditions, Duration)}
+ */
+ public void getPropertiesWithTimeout() {
+ // BEGIN: com.azure.storage.blob.BlobClient.getProperties#BlobAccessConditions-Duration
+ BlobAccessConditions accessConditions = new BlobAccessConditions()
+ .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId));
+
+ BlobProperties properties = client.getProperties(accessConditions, timeout).value();
+ System.out.printf("Type: %s, Size: %d%n", properties.blobType(), properties.blobSize());
+ // END: com.azure.storage.blob.BlobClient.getProperties#BlobAccessConditions-Duration
+ }
+
+ /**
+ * Code snippets for {@link BlobClient#setHTTPHeaders(BlobHTTPHeaders)} and
+ * {@link BlobClient#setHTTPHeaders(BlobHTTPHeaders, BlobAccessConditions, Duration)}
+ */
+ public void setHTTPHeaders() {
+ // BEGIN: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders
+ System.out.printf("Set HTTP headers completed with status %d%n",
+ client.setHTTPHeaders(new BlobHTTPHeaders()
+ .blobContentLanguage("en-US")
+ .blobContentType("binary"))
+ .statusCode());
+ // END: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders
+
+ // BEGIN: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions-Duration
+ BlobAccessConditions accessConditions = new BlobAccessConditions()
+ .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId));
+
+ System.out.printf("Set HTTP headers completed with status %d%n",
+ client.setHTTPHeaders(new BlobHTTPHeaders()
+ .blobContentLanguage("en-US")
+ .blobContentType("binary"), accessConditions, timeout)
+ .statusCode());
+ // END: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions-Duration
+ }
+
+ /**
+ * Code snippets for {@link BlobClient#setMetadata(Metadata)} and
+ * {@link BlobClient#setMetadata(Metadata, BlobAccessConditions, Duration)}
+ */
+ public void setMetadata() {
+ // BEGIN: com.azure.storage.blob.BlobClient.setMetadata#Metadata
+ System.out.printf("Set metadata completed with status %d%n",
+ client.setMetadata(new Metadata(Collections.singletonMap("metadata", "value"))).statusCode());
+ // END: com.azure.storage.blob.BlobClient.setMetadata#Metadata
+
+ // BEGIN: com.azure.storage.blob.BlobClient.setMetadata#Metadata-BlobAccessConditions-Duration
+ BlobAccessConditions accessConditions = new BlobAccessConditions()
+ .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId));
+
+ System.out.printf("Set metadata completed with status %d%n",
+ client.setMetadata(
+ new Metadata(Collections.singletonMap("metadata", "value")), accessConditions, timeout).statusCode());
+ // END: com.azure.storage.blob.BlobClient.setMetadata#Metadata-BlobAccessConditions-Duration
+ }
+
+ /**
+ * Code snippets for {@link BlobClient#createSnapshot()} and
+ * {@link BlobClient#createSnapshot(Metadata, BlobAccessConditions, Duration)}
+ */
+ public void createSnapshot() {
+ // BEGIN: com.azure.storage.blob.BlobClient.createSnapshot
+ System.out.printf("Identifier for the snapshot is %s%n", client.createSnapshot().value());
+ // END: com.azure.storage.blob.BlobClient.createSnapshot
+
+ // BEGIN: com.azure.storage.blob.BlobClient.createSnapshot#Metadata-BlobAccessConditions-Duration
+ Metadata snapshotMetadata = new Metadata(Collections.singletonMap("metadata", "value"));
+ BlobAccessConditions accessConditions = new BlobAccessConditions()
+ .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId));
+
+ System.out.printf("Identifier for the snapshot is %s%n",
+ client.createSnapshot(snapshotMetadata, accessConditions, timeout).value());
+ // END: com.azure.storage.blob.BlobClient.createSnapshot#Metadata-BlobAccessConditions-Duration
+ }
+
+ /**
+ * Code snippets for {@link BlobClient#setTier(AccessTier)} and
+ * {@link BlobClient#setTier(AccessTier, LeaseAccessConditions, Duration)}
+ */
+ public void setTier() {
+ // BEGIN: com.azure.storage.blob.BlobClient.setTier#AccessTier
+ System.out.printf("Set tier completed with status code %d%n", client.setTier(AccessTier.HOT).statusCode());
+ // END: com.azure.storage.blob.BlobClient.setTier#AccessTier
+
+ // BEGIN: com.azure.storage.blob.BlobClient.setTier#AccessTier-LeaseAccessConditions-Duration
+ LeaseAccessConditions accessConditions = new LeaseAccessConditions().leaseId(leaseId);
+
+ System.out.printf("Set tier completed with status code %d%n",
+ client.setTier(AccessTier.HOT, accessConditions, timeout).statusCode());
+ // END: com.azure.storage.blob.BlobClient.setTier#AccessTier-LeaseAccessConditions-Duration
+ }
+
+ /**
+ * Code snippets for {@link BlobClient#undelete()} and {@link BlobClient#undelete(Duration)}
+ */
+ public void undelete() {
+ // BEGIN: com.azure.storage.blob.BlobClient.undelete
+ System.out.printf("Undelete completed with status %d%n", client.undelete().statusCode());
+ // END: com.azure.storage.blob.BlobClient.undelete
+
+ // BEGIN: com.azure.storage.blob.BlobClient.undelete#Duration
+ System.out.printf("Undelete completed with status %d%n", client.undelete(timeout).statusCode());
+ // END: com.azure.storage.blob.BlobClient.undelete#Duration
+ }
+
+ /**
+ * Code snippets for {@link BlobClient#acquireLease(String, int)} and
+ * {@link BlobClient#acquireLease(String, int, ModifiedAccessConditions, Duration)}
+ */
+ public void acquireLease() {
+ // BEGIN: com.azure.storage.blob.BlobClient.acquireLease#String-int
+ System.out.printf("Lease ID is %s%n", client.acquireLease("proposedId", 60).value());
+ // END: com.azure.storage.blob.BlobClient.acquireLease#String-int
+
+ // BEGIN: com.azure.storage.blob.BlobClient.acquireLease#String-int-ModifiedAccessConditions-Duration
+ ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions()
+ .ifModifiedSince(OffsetDateTime.now().minusDays(3));
+
+ System.out.printf("Lease ID is %s%n",
+ client.acquireLease("proposedId", 60, modifiedAccessConditions, timeout).value());
+ // END: com.azure.storage.blob.BlobClient.acquireLease#String-int-ModifiedAccessConditions-Duration
+ }
+
+ /**
+ * Code snippets for {@link BlobClient#renewLease(String)} and
+ * {@link BlobClient#renewLease(String, ModifiedAccessConditions, Duration)}
+ */
+ public void renewLease() {
+ // BEGIN: com.azure.storage.blob.BlobClient.renewLease#String
+ System.out.printf("Renewed lease ID is %s%n", client.renewLease(leaseId).value());
+ // END: com.azure.storage.blob.BlobClient.renewLease#String
+
+ // BEGIN: com.azure.storage.blob.BlobClient.renewLease#String-ModifiedAccessConditions-Duration
+ ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions()
+ .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3));
+
+ System.out.printf("Renewed lease ID is %s%n",
+ client.renewLease(leaseId, modifiedAccessConditions, timeout).value());
+ // END: com.azure.storage.blob.BlobClient.renewLease#String-ModifiedAccessConditions-Duration
+ }
+
+ /**
+ * Code snippets for {@link BlobClient#releaseLease(String)} and
+ * {@link BlobClient#releaseLease(String, ModifiedAccessConditions, Duration)}
+ */
+ public void releaseLease() {
+ // BEGIN: com.azure.storage.blob.BlobClient.releaseLease#String
+ System.out.printf("Release lease completed with status %d%n", client.releaseLease(leaseId).statusCode());
+ // END: com.azure.storage.blob.BlobClient.releaseLease#String
+
+ // BEGIN: com.azure.storage.blob.BlobClient.releaseLease#String-ModifiedAccessConditions-Duration
+ ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions()
+ .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3));
+
+ System.out.printf("Release lease completed with status %d%n",
+ client.releaseLease(leaseId, modifiedAccessConditions, timeout).statusCode());
+ // END: com.azure.storage.blob.BlobClient.releaseLease#String-ModifiedAccessConditions-Duration
+ }
+
+ /**
+ * Code snippets for {@link BlobClient#breakLease()} and
+ * {@link BlobClient#breakLease(Integer, ModifiedAccessConditions, Duration)}
+ */
+ public void breakLease() {
+ // BEGIN: com.azure.storage.blob.BlobClient.breakLease
+ System.out.printf("The broken lease has %d seconds remaining on the lease", client.breakLease().value());
+ // END: com.azure.storage.blob.BlobClient.breakLease
+
+ // BEGIN: com.azure.storage.blob.BlobClient.breakLease#Integer-ModifiedAccessConditions-Duration
+ Integer retainLeaseInSeconds = 5;
+ ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions()
+ .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3));
+
+ System.out.printf("The broken lease has %d seconds remaining on the lease",
+ client.breakLease(retainLeaseInSeconds, modifiedAccessConditions, timeout).value());
+ // END: com.azure.storage.blob.BlobClient.breakLease#Integer-ModifiedAccessConditions-Duration
+ }
+
+ /**
+ * Code snippets for {@link BlobClient#changeLease(String, String)} and
+ * {@link BlobClient#changeLease(String, String, ModifiedAccessConditions, Duration)}
+ */
+ public void changeLease() {
+ // BEGIN: com.azure.storage.blob.BlobClient.changeLease#String-String
+ System.out.printf("Changed lease ID is %s%n", client.changeLease(leaseId, "proposedId").value());
+ // END: com.azure.storage.blob.BlobClient.changeLease#String-String
+
+ // BEGIN: com.azure.storage.blob.BlobClient.changeLease#String-String-ModifiedAccessConditions-Duration
+ ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions()
+ .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3));
+
+ System.out.printf("Changed lease ID is %s%n",
+ client.changeLease(leaseId, "proposedId", modifiedAccessConditions, timeout).value());
+ // END: com.azure.storage.blob.BlobClient.changeLease#String-String-ModifiedAccessConditions-Duration
+ }
+
+ /**
+ * Code snippet for {@link BlobClient#getAccountInfo()}
+ */
+ public void getAccountInfo() {
+ // BEGIN: com.azure.storage.blob.BlobClient.getAccountInfo
+ StorageAccountInfo accountInfo = client.getAccountInfo().value();
+ System.out.printf("Account Kind: %s, SKU: %s%n", accountInfo.accountKind(), accountInfo.skuName());
+ // END: com.azure.storage.blob.BlobClient.getAccountInfo
+ }
+
+ /**
+ * Code snippet for {@link BlobClient#getAccountInfo(Duration)}
+ */
+ public void getAccountInfoWithTimeout() {
+ // BEGIN: com.azure.storage.blob.BlobClient.getAccountInfo#Duration
+ StorageAccountInfo accountInfo = client.getAccountInfo(timeout).value();
+ System.out.printf("Account Kind: %s, SKU: %s%n", accountInfo.accountKind(), accountInfo.skuName());
+ // END: com.azure.storage.blob.BlobClient.getAccountInfo#Duration
+ }
+}
diff --git a/storage/client/blob/src/samples/java/FileTransferExample.java b/storage/client/blob/src/samples/java/com/azure/storage/blob/FileTransferExample.java
similarity index 93%
rename from storage/client/blob/src/samples/java/FileTransferExample.java
rename to storage/client/blob/src/samples/java/com/azure/storage/blob/FileTransferExample.java
index cfd281c1e3f8..33886cd10750 100644
--- a/storage/client/blob/src/samples/java/FileTransferExample.java
+++ b/storage/client/blob/src/samples/java/com/azure/storage/blob/FileTransferExample.java
@@ -1,10 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-import com.azure.storage.blob.BlockBlobClient;
-import com.azure.storage.blob.ContainerClient;
-import com.azure.storage.blob.StorageClient;
-import com.azure.storage.blob.StorageClientBuilder;
+package com.azure.storage.blob;
+
import com.azure.storage.common.credentials.SharedKeyCredential;
import java.io.File;
@@ -52,10 +50,10 @@ public static void main(String[] args) throws IOException, NoSuchAlgorithmExcept
String endPoint = String.format(Locale.ROOT, "https://%s.blob.core.windows.net", accountName);
/*
- * Create a StorageClient object that wraps the service endpoint, credential and a request pipeline.
+ * Create a BlobServiceClient object that wraps the service endpoint, credential and a request pipeline.
* Now you can use the storageClient to perform various container and blob operations.
*/
- StorageClient storageClient = new StorageClientBuilder().endpoint(endPoint).credential(credential).buildClient();
+ BlobServiceClient storageClient = new BlobServiceClientBuilder().endpoint(endPoint).credential(credential).buildClient();
/*
diff --git a/storage/client/blob/src/samples/java/com/azure/storage/blob/JavaDocCodeSnippetsHelpers.java b/storage/client/blob/src/samples/java/com/azure/storage/blob/JavaDocCodeSnippetsHelpers.java
new file mode 100644
index 000000000000..febf2861cad9
--- /dev/null
+++ b/storage/client/blob/src/samples/java/com/azure/storage/blob/JavaDocCodeSnippetsHelpers.java
@@ -0,0 +1,29 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.storage.blob;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+final class JavaDocCodeSnippetsHelpers {
+ static ContainerAsyncClient getContainerAsyncClient() {
+ return new ContainerClientBuilder().buildAsyncClient();
+ }
+
+ static BlobAsyncClient getBlobAsyncClient(String blobName) {
+ return getContainerAsyncClient().getBlobAsyncClient(blobName);
+ }
+
+ static BlobClient getBlobClient(String blobName) {
+ return new BlobClient(getBlobAsyncClient(blobName));
+ }
+
+ static URL generateURL(String urlString) {
+ try {
+ return new URL(urlString);
+ } catch (MalformedURLException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+}
diff --git a/storage/client/blob/src/samples/java/ListContainersExample.java b/storage/client/blob/src/samples/java/com/azure/storage/blob/ListContainersExample.java
similarity index 84%
rename from storage/client/blob/src/samples/java/ListContainersExample.java
rename to storage/client/blob/src/samples/java/com/azure/storage/blob/ListContainersExample.java
index ab8c9b3709bc..5588ef64241c 100644
--- a/storage/client/blob/src/samples/java/ListContainersExample.java
+++ b/storage/client/blob/src/samples/java/com/azure/storage/blob/ListContainersExample.java
@@ -1,8 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-import com.azure.storage.blob.StorageClient;
-import com.azure.storage.blob.StorageClientBuilder;
+package com.azure.storage.blob;
+
import com.azure.storage.common.credentials.SharedKeyCredential;
import java.util.Locale;
@@ -32,9 +32,9 @@ public static void main(String[] args) {
String endpoint = String.format(Locale.ROOT, "https://%s.blob.core.windows.net", accountName);
/*
- * Create a StorageClient object that wraps the service endpoint, credential and a request pipeline.
+ * Create a BlobServiceClient object that wraps the service endpoint, credential and a request pipeline.
*/
- StorageClient storageClient = new StorageClientBuilder().endpoint(endpoint).credential(credential).buildClient();
+ BlobServiceClient storageClient = new BlobServiceClientBuilder().endpoint(endpoint).credential(credential).buildClient();
/*
* Create 3 different containers from the storageClient.
diff --git a/storage/client/blob/src/samples/java/SampleHelper.java b/storage/client/blob/src/samples/java/com/azure/storage/blob/SampleHelper.java
similarity index 94%
rename from storage/client/blob/src/samples/java/SampleHelper.java
rename to storage/client/blob/src/samples/java/com/azure/storage/blob/SampleHelper.java
index d841413f06bc..f72655d856bd 100644
--- a/storage/client/blob/src/samples/java/SampleHelper.java
+++ b/storage/client/blob/src/samples/java/com/azure/storage/blob/SampleHelper.java
@@ -1,6 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
+package com.azure.storage.blob;
+
import com.azure.core.util.configuration.ConfigurationManager;
/**
diff --git a/storage/client/blob/src/samples/java/SetMetadataAndHTTPHeadersExample.java b/storage/client/blob/src/samples/java/com/azure/storage/blob/SetMetadataAndHTTPHeadersExample.java
similarity index 87%
rename from storage/client/blob/src/samples/java/SetMetadataAndHTTPHeadersExample.java
rename to storage/client/blob/src/samples/java/com/azure/storage/blob/SetMetadataAndHTTPHeadersExample.java
index 6b475499eab2..591e78141f70 100644
--- a/storage/client/blob/src/samples/java/SetMetadataAndHTTPHeadersExample.java
+++ b/storage/client/blob/src/samples/java/com/azure/storage/blob/SetMetadataAndHTTPHeadersExample.java
@@ -1,10 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
-import com.azure.storage.blob.BlockBlobClient;
-import com.azure.storage.blob.ContainerClient;
-import com.azure.storage.blob.StorageClient;
-import com.azure.storage.blob.StorageClientBuilder;
+package com.azure.storage.blob;
+
import com.azure.storage.blob.models.BlobHTTPHeaders;
import com.azure.storage.blob.models.Metadata;
import com.azure.storage.common.credentials.SharedKeyCredential;
@@ -42,9 +40,9 @@ public static void main(String[] args) throws IOException {
String endpoint = String.format(Locale.ROOT, "https://%s.blob.core.windows.net", accountName);
/*
- * Create a StorageClient object that wraps the service endpoint, credential and a request pipeline.
+ * Create a BlobServiceClient object that wraps the service endpoint, credential and a request pipeline.
*/
- StorageClient storageClient = new StorageClientBuilder().endpoint(endpoint).credential(credential).buildClient();
+ BlobServiceClient storageClient = new BlobServiceClientBuilder().endpoint(endpoint).credential(credential).buildClient();
/*
* Create a container client from storageClient.
diff --git a/storage/client/blob/src/samples/java/StorageErrorHandlingExample.java b/storage/client/blob/src/samples/java/com/azure/storage/blob/StorageErrorHandlingExample.java
similarity index 94%
rename from storage/client/blob/src/samples/java/StorageErrorHandlingExample.java
rename to storage/client/blob/src/samples/java/com/azure/storage/blob/StorageErrorHandlingExample.java
index 50d4e81d600c..3a84d7026f7b 100644
--- a/storage/client/blob/src/samples/java/StorageErrorHandlingExample.java
+++ b/storage/client/blob/src/samples/java/com/azure/storage/blob/StorageErrorHandlingExample.java
@@ -1,10 +1,9 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
+package com.azure.storage.blob;
+
import com.azure.core.http.HttpResponse;
-import com.azure.storage.blob.ContainerClient;
-import com.azure.storage.blob.ContainerClientBuilder;
-import com.azure.storage.blob.StorageException;
import com.azure.storage.blob.models.StorageErrorCode;
/**
diff --git a/storage/client/blob/src/test/java/com/azure/storage/blob/APISpec.groovy b/storage/client/blob/src/test/java/com/azure/storage/blob/APISpec.groovy
index daf12f13fb8e..abac9b167e18 100644
--- a/storage/client/blob/src/test/java/com/azure/storage/blob/APISpec.groovy
+++ b/storage/client/blob/src/test/java/com/azure/storage/blob/APISpec.groovy
@@ -56,7 +56,7 @@ class APISpec extends Specification {
static defaultDataSize = defaultData.remaining()
// If debugging is enabled, recordings cannot run as there can only be one proxy at a time.
- static boolean enableDebugging = true
+ static boolean enableDebugging = false
// Prefixes for blobs and containers
static String containerPrefix = "jtc" // java test container
@@ -98,16 +98,16 @@ class APISpec extends Specification {
/*
URLs to various kinds of accounts.
*/
- StorageClient primaryServiceURL
+ BlobServiceClient primaryServiceURL
@Shared
- static StorageClient alternateServiceURL
+ static BlobServiceClient alternateServiceURL
@Shared
- static StorageClient blobStorageServiceURL
+ static BlobServiceClient blobStorageServiceURL
@Shared
- static StorageClient premiumServiceURL
+ static BlobServiceClient premiumServiceURL
/*
Constants for testing that the context parameter is properly passed to the pipeline.
@@ -195,10 +195,10 @@ class APISpec extends Specification {
}
}
- static StorageClient getGenericServiceURL(SharedKeyCredential creds) {
+ static BlobServiceClient getGenericServiceURL(SharedKeyCredential creds) {
// TODO: logging?
- return new StorageClientBuilder()
+ return new BlobServiceClientBuilder()
.endpoint("https://" + creds.accountName() + ".blob.core.windows.net")
.httpClient(getHttpClient())
.httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS)
@@ -207,7 +207,7 @@ class APISpec extends Specification {
}
static void cleanupContainers() throws MalformedURLException {
- StorageClient serviceURL = new StorageClientBuilder()
+ BlobServiceClient serviceURL = new BlobServiceClientBuilder()
.endpoint("http://" + primaryCreds.accountName() + ".blob.core.windows.net")
.credential(primaryCreds)
.buildClient()
@@ -556,7 +556,7 @@ class APISpec extends Specification {
}
def getOAuthServiceURL() {
- return new StorageClientBuilder()
+ return new BlobServiceClientBuilder()
.endpoint(String.format("https://%s.blob.core.windows.net/", primaryCreds.accountName()))
.credential(new EnvironmentCredential()) // AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET
.buildClient()
diff --git a/storage/client/blob/src/test/java/com/azure/storage/blob/AadLoginTest.java b/storage/client/blob/src/test/java/com/azure/storage/blob/AadLoginTest.java
index 3c2ee324d196..b284e65beb8c 100644
--- a/storage/client/blob/src/test/java/com/azure/storage/blob/AadLoginTest.java
+++ b/storage/client/blob/src/test/java/com/azure/storage/blob/AadLoginTest.java
@@ -11,11 +11,11 @@
public class AadLoginTest {
private static final Random RANDOM = new Random();
- private static StorageClient storageClient;
+ private static BlobServiceClient storageClient;
@BeforeClass
public static void setup() {
- storageClient = new StorageClientBuilder()
+ storageClient = new BlobServiceClientBuilder()
.endpoint("https://" + System.getenv("ACCOUNT_NAME") + ".blob.core.windows.net")
.credential(new EnvironmentCredential())
// .httpClient(HttpClient.createDefault().proxy(() -> new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888))))
diff --git a/storage/client/blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy b/storage/client/blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy
index d0be4d532642..5c1bd1178736 100644
--- a/storage/client/blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy
+++ b/storage/client/blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy
@@ -138,7 +138,7 @@ class BlobAPITest extends APISpec {
when:
def outStream = new ByteArrayOutputStream()
- bu.download(outStream, null, range, null, false, null)
+ bu.download(outStream, range, null, null, false, null)
String bodyStr = outStream.toString()
then:
@@ -208,7 +208,7 @@ class BlobAPITest extends APISpec {
def "Download md5"() {
when:
- VoidResponse response = bu.download(new ByteArrayOutputStream(), null, new BlobRange(0 ,3), null, true, null)
+ VoidResponse response = bu.download(new ByteArrayOutputStream(), new BlobRange(0 ,3), null, null, true, null)
byte[] contentMD5 = response.headers().value("content-md5").getBytes()
then:
@@ -1872,7 +1872,7 @@ class BlobAPITest extends APISpec {
def "Get account info error"() {
when:
- StorageClient serviceURL = new StorageClientBuilder()
+ BlobServiceClient serviceURL = new BlobServiceClientBuilder()
.endpoint(primaryServiceURL.getAccountUrl().toString())
.buildClient()
serviceURL.getContainerClient(generateContainerName()).getBlobClient(generateBlobName())
diff --git a/storage/client/blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.java b/storage/client/blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.java
index 7ebc5e8487cf..e7955c9b7be9 100644
--- a/storage/client/blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.java
+++ b/storage/client/blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.java
@@ -17,12 +17,12 @@
public class BlobOutputStreamTest {
private static final Random RANDOM = new Random();
- private static StorageClient storageClient;
+ private static BlobServiceClient storageClient;
private static ContainerClient containerClient;
@BeforeClass
public static void setup() {
- storageClient = new StorageClientBuilder()
+ storageClient = new BlobServiceClientBuilder()
.endpoint("https://" + System.getenv("ACCOUNT_NAME") + ".blob.core.windows.net")
.credential(new SharedKeyCredential(System.getenv("ACCOUNT_NAME"), System.getenv("ACCOUNT_KEY")))
// .httpClient(HttpClient.createDefault().proxy(() -> new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888))))
diff --git a/storage/client/blob/src/test/java/com/azure/storage/blob/ContainerAPITest.groovy b/storage/client/blob/src/test/java/com/azure/storage/blob/ContainerAPITest.groovy
index 86da9838d53b..f82f1d4220eb 100644
--- a/storage/client/blob/src/test/java/com/azure/storage/blob/ContainerAPITest.groovy
+++ b/storage/client/blob/src/test/java/com/azure/storage/blob/ContainerAPITest.groovy
@@ -1624,7 +1624,7 @@ class ContainerAPITest extends APISpec {
def "Get account info error"() {
when:
- StorageClient serviceURL = new StorageClientBuilder()
+ BlobServiceClient serviceURL = new BlobServiceClientBuilder()
.endpoint(primaryServiceURL.getAccountUrl().toString())
.buildClient()
diff --git a/storage/client/blob/src/test/java/com/azure/storage/blob/LargeFileTest.java b/storage/client/blob/src/test/java/com/azure/storage/blob/LargeFileTest.java
index a692d6d4c3c3..8bff57d55951 100644
--- a/storage/client/blob/src/test/java/com/azure/storage/blob/LargeFileTest.java
+++ b/storage/client/blob/src/test/java/com/azure/storage/blob/LargeFileTest.java
@@ -13,12 +13,12 @@
public class LargeFileTest {
private static final Random RANDOM = new Random();
private static final String FILE_PATH = "C:\\Users\\jianghlu\\10g.dat";
- private static StorageClient storageClient;
+ private static BlobServiceClient storageClient;
private static ContainerClient containerClient;
//@BeforeClass
public static void setup() {
- storageClient = new StorageClientBuilder()
+ storageClient = new BlobServiceClientBuilder()
.credential(new SharedKeyCredential(System.getenv("ACCOUNT_NAME"), System.getenv("ACCOUNT_KEY")))
.endpoint("https://" + System.getenv("ACCOUNT_NAME") + ".blob.core.windows.net")
// .httpClient(HttpClient.createDefault().proxy(() -> new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888))))
diff --git a/storage/client/blob/src/test/java/com/azure/storage/blob/SASTest.groovy b/storage/client/blob/src/test/java/com/azure/storage/blob/SASTest.groovy
index 2824ac1d3067..705453b54968 100644
--- a/storage/client/blob/src/test/java/com/azure/storage/blob/SASTest.groovy
+++ b/storage/client/blob/src/test/java/com/azure/storage/blob/SASTest.groovy
@@ -482,7 +482,7 @@ class SASTest extends APISpec {
when:
def sas = primaryServiceURL.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null)
- def scBuilder = new StorageClientBuilder()
+ def scBuilder = new BlobServiceClientBuilder()
scBuilder.endpoint(primaryServiceURL.getAccountUrl().toString())
.httpClient(getHttpClient())
.credential(SASTokenCredential.fromSASTokenString(sas))
@@ -509,7 +509,7 @@ class SASTest extends APISpec {
when:
def sas = primaryServiceURL.generateAccountSAS(service, resourceType, permissions, expiryTime, null, null, null, null)
- def scBuilder = new StorageClientBuilder()
+ def scBuilder = new BlobServiceClientBuilder()
scBuilder.endpoint(primaryServiceURL.getAccountUrl().toString())
.httpClient(getHttpClient())
.credential(SASTokenCredential.fromSASTokenString(sas))
diff --git a/storage/client/blob/src/test/java/com/azure/storage/blob/Sample.java b/storage/client/blob/src/test/java/com/azure/storage/blob/Sample.java
index f6d19d6b8416..d5955365880a 100644
--- a/storage/client/blob/src/test/java/com/azure/storage/blob/Sample.java
+++ b/storage/client/blob/src/test/java/com/azure/storage/blob/Sample.java
@@ -30,7 +30,7 @@ public class Sample {
//@Test
public void sample() throws IOException {
// get service client
- StorageClient serviceClient = new StorageClientBuilder().endpoint(ACCOUNT_ENDPOINT)
+ BlobServiceClient serviceClient = new BlobServiceClientBuilder().endpoint(ACCOUNT_ENDPOINT)
.credential(new SharedKeyCredential(ACCOUNT_NAME, ACCOUNT_KEY))
.httpClient(HttpClient.createDefault()/*.proxy(() -> new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888)))*/)
.buildClient();
@@ -82,7 +82,7 @@ public void sample() throws IOException {
//@Test
public void asyncSample() throws IOException {
// get service client
- StorageAsyncClient serviceClient = new StorageClientBuilder().endpoint(ACCOUNT_ENDPOINT)
+ BlobServiceAsyncClient serviceClient = new BlobServiceClientBuilder().endpoint(ACCOUNT_ENDPOINT)
.credential(new SharedKeyCredential(ACCOUNT_NAME, ACCOUNT_KEY))
.httpClient(HttpClient.createDefault()/*.proxy(() -> new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888)))*/)
.buildAsyncClient();
@@ -161,7 +161,7 @@ public void uploadDownloadFromFile() throws IOException {
fstream.close();
// get service client
- StorageClient serviceClient = new StorageClientBuilder().endpoint(ACCOUNT_ENDPOINT)
+ BlobServiceClient serviceClient = new BlobServiceClientBuilder().endpoint(ACCOUNT_ENDPOINT)
.credential(new SharedKeyCredential(ACCOUNT_NAME, ACCOUNT_KEY))
.httpClient(HttpClient.createDefault()/*.proxy(() -> new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888)))*/)
.buildClient();
@@ -191,7 +191,7 @@ public void uploadDownloadFromFileAsync() throws IOException {
fstream.close();
// get service client
- StorageAsyncClient serviceClient = new StorageClientBuilder().endpoint(ACCOUNT_ENDPOINT)
+ BlobServiceAsyncClient serviceClient = new BlobServiceClientBuilder().endpoint(ACCOUNT_ENDPOINT)
.credential(new SharedKeyCredential(ACCOUNT_NAME, ACCOUNT_KEY))
.httpClient(HttpClient.createDefault()/*.proxy(() -> new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888)))*/)
.buildAsyncClient();
diff --git a/storage/client/blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy b/storage/client/blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy
index d6e8861b4739..830dd34c2203 100644
--- a/storage/client/blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy
+++ b/storage/client/blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy
@@ -234,7 +234,7 @@ class ServiceAPITest extends APISpec {
def "Set props error"() {
when:
- new StorageClientBuilder()
+ new BlobServiceClientBuilder()
.endpoint("https://error.blob.core.windows.net")
.credential(primaryCreds)
.buildClient()
@@ -251,7 +251,7 @@ class ServiceAPITest extends APISpec {
def "Get props error"() {
when:
- new StorageClientBuilder()
+ new BlobServiceClientBuilder()
.endpoint("https://error.blob.core.windows.net")
.credential(primaryCreds)
.buildClient()
@@ -306,7 +306,7 @@ class ServiceAPITest extends APISpec {
def "Get stats"() {
setup:
String secondaryEndpoint = String.format("https://%s-secondary.blob.core.windows.net", primaryCreds.accountName())
- StorageClient serviceClient = new StorageClientBuilder().endpoint(secondaryEndpoint)
+ BlobServiceClient serviceClient = new BlobServiceClientBuilder().endpoint(secondaryEndpoint)
.credential(primaryCreds).buildClient()
Response response = serviceClient.getStatistics()
@@ -321,7 +321,7 @@ class ServiceAPITest extends APISpec {
def "Get stats min"() {
setup:
String secondaryEndpoint = String.format("https://%s-secondary.blob.core.windows.net", primaryCreds.accountName())
- StorageClient serviceClient = new StorageClientBuilder().endpoint(secondaryEndpoint)
+ BlobServiceClient serviceClient = new BlobServiceClientBuilder().endpoint(secondaryEndpoint)
.credential(primaryCreds).buildClient()
expect:
serviceClient.getStatistics().statusCode() == 200
@@ -354,7 +354,7 @@ class ServiceAPITest extends APISpec {
def "Get account info error"() {
when:
- StorageClient serviceURL = new StorageClientBuilder()
+ BlobServiceClient serviceURL = new BlobServiceClientBuilder()
.endpoint(primaryServiceURL.getAccountUrl().toString())
.buildClient()
serviceURL.getAccountInfo()
@@ -368,7 +368,7 @@ class ServiceAPITest extends APISpec {
def "Invalid account name"() {
setup:
URL badURL = new URL("http://fake.blobfake.core.windows.net")
- StorageClient client = new StorageClientBuilder()
+ BlobServiceClient client = new BlobServiceClientBuilder()
.endpoint(badURL.toString())
.credential(primaryCreds)
.retryOptions(new RequestRetryOptions(null, 2, null, null, null, null))
diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java b/storage/client/queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java
index 4bd8de4b8f13..659d128dc243 100644
--- a/storage/client/queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java
+++ b/storage/client/queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java
@@ -108,6 +108,9 @@ public URL getQueueUrl() {
*
* {@codesnippet com.azure.storage.queue.queueAsyncClient.create}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @return A response that only contains headers and response status code
* @throws StorageErrorException If a queue with the same name already exists in the queue service.
*/
@@ -124,6 +127,9 @@ public Mono create() {
*
* {@codesnippet com.azure.storage.queue.queueAsyncClient.create#map}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @param metadata Metadata to associate with the queue
* @return A response that only contains headers and response status code
* @throws StorageErrorException If a queue with the same name and different metadata already exists in the queue service.
@@ -142,6 +148,9 @@ public Mono create(Map metadata) {
*
* {@codesnippet com.azure.storage.queue.queueAsyncClient.delete}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @return A response that only contains headers and response status code
* @throws StorageErrorException If the queue doesn't exist
*/
@@ -159,6 +168,9 @@ public Mono delete() {
*
* {@codesnippet com.azure.storage.queue.queueAsyncClient.getProperties}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @return A response containing a {@link QueueProperties} value which contains the metadata and approximate
* messages count of the queue.
* @throws StorageErrorException If the queue doesn't exist
@@ -183,6 +195,9 @@ public Mono> getProperties() {
*
* {@codesnippet com.azure.storage.queue.queueAsyncClient.clearMetadata#map}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @param metadata Metadata to set on the queue
* @return A response that only contains headers and response status code
* @throws StorageErrorException If the queue doesn't exist
@@ -201,6 +216,9 @@ public Mono setMetadata(Map metadata) {
*
* {@codesnippet com.azure.storage.queue.queueAsyncClient.getAccessPolicy}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @return The stored access policies specified on the queue.
* @throws StorageErrorException If the queue doesn't exist
*/
@@ -218,6 +236,9 @@ public Flux getAccessPolicy() {
*
* {@codesnippet com.azure.storage.queue.queueAsyncClient.setAccessPolicy}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @param permissions Access policies to set on the queue
* @return A response that only contains headers and response status code
* @throws StorageErrorException If the queue doesn't exist, a stored access policy doesn't have all fields filled out,
@@ -237,6 +258,9 @@ public Mono setAccessPolicy(List permissions) {
*
* {@codesnippet com.azure.storage.queue.queueAsyncClient.clearMessages}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @return A response that only contains headers and response status code
* @throws StorageErrorException If the queue doesn't exist
*/
@@ -254,6 +278,9 @@ public Mono clearMessages() {
*
* {@codesnippet com.azure.storage.queue.queueAsyncClient.enqueueMessage#string}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @param messageText Message text
* @return A {@link EnqueuedMessage} value that contains the {@link EnqueuedMessage#messageId() messageId} and
* {@link EnqueuedMessage#popReceipt() popReceipt} that are used to interact with the message and other metadata
@@ -277,6 +304,9 @@ public Mono> enqueueMessage(String messageText) {
*
* {@codesnippet com.azure.storage.queue.queueAsyncClient.enqueueMessageLiveTime#string-duration-duration}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @param messageText Message text
* @param visibilityTimeout Optional. The timeout period for how long the message is invisible in the queue in seconds.
* If unset the value will default to 0 and the message will be instantly visible. The timeout must be between 0
@@ -307,6 +337,9 @@ public Mono> enqueueMessage(String messageText, Durati
*
* {@codesnippet com.azure.storage.queue.queueAsyncClient.dequeueMessages}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @return The first {@link DequeuedMessage} in the queue, it contains
* {@link DequeuedMessage#messageId() messageId} and {@link DequeuedMessage#popReceipt() popReceipt} used to interact
* with the message, additionally it contains other metadata about the message.
@@ -325,6 +358,9 @@ public Flux dequeueMessages() {
*
* {@codesnippet com.azure.storage.queue.queueAsyncClient.dequeueMessages#integer}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @param maxMessages Optional. Maximum number of messages to get, if there are less messages exist in the queue than requested
* all the messages will be returned. If left empty only 1 message will be retrieved, the allowed range is 1 to 32
* messages.
@@ -347,6 +383,9 @@ public Flux dequeueMessages(Integer maxMessages) {
*
* {@codesnippet com.azure.storage.queue.queueAsyncClient.dequeueMessages#integer-duration}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @param maxMessages Optional. Maximum number of messages to get, if there are less messages exist in the queue than requested
* all the messages will be returned. If left empty only 1 message will be retrieved, the allowed range is 1 to 32
* messages.
@@ -376,6 +415,9 @@ public Flux dequeueMessages(Integer maxMessages, Duration visib
*
* {@codesnippet com.azure.storage.queue.queueAsyncClient.peekMessages}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @return A {@link PeekedMessage} that contains metadata about the message.
*/
public Flux peekMessages() {
@@ -394,6 +436,9 @@ public Flux peekMessages() {
*
* {@codesnippet com.azure.storage.queue.queueAsyncClient.peekMessages#integer}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @param maxMessages Optional. Maximum number of messages to peek, if there are less messages exist in the queue than requested
* all the messages will be peeked. If left empty only 1 message will be peeked, the allowed range is 1 to 32
* messages.
@@ -415,6 +460,9 @@ public Flux peekMessages(Integer maxMessages) {
*
* {@codesnippet com.azure.storage.queue.queueAsyncClient.updateMessage}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @param messageText Updated value for the message
* @param messageId Id of the message to update
* @param popReceipt Unique identifier that must match for the message to be updated
@@ -440,6 +488,9 @@ public Mono> updateMessage(String messageText, String m
*
* {@codesnippet com.azure.storage.queue.queueAsyncClient.deleteMessage}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @param messageId Id of the message to deleted
* @param popReceipt Unique identifier that must match for the message to be deleted
* @return A response that only contains headers and response status code
diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/QueueClient.java b/storage/client/queue/src/main/java/com/azure/storage/queue/QueueClient.java
index 763c58560871..3e55da311b15 100644
--- a/storage/client/queue/src/main/java/com/azure/storage/queue/QueueClient.java
+++ b/storage/client/queue/src/main/java/com/azure/storage/queue/QueueClient.java
@@ -63,6 +63,9 @@ public URL getQueueUrl() {
*
*{@codesnippet com.azure.storage.queue.queueClient.create}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @return A response that only contains headers and response status code
* @throws StorageErrorException If a queue with the same name already exists in the queue service.
*/
@@ -79,6 +82,9 @@ public VoidResponse create() {
*
* {@codesnippet com.azure.storage.queue.queueClient.create#map}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @param metadata Metadata to associate with the queue
* @return A response that only contains headers and response status code
* @throws StorageErrorException If a queue with the same name and different metadata already exists in the queue service.
@@ -96,6 +102,9 @@ public VoidResponse create(Map metadata) {
*
* {@codesnippet com.azure.storage.queue.queueClient.delete}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @return A response that only contains headers and response status code
* @throws StorageErrorException If the queue doesn't exist
*/
@@ -112,6 +121,9 @@ public VoidResponse delete() {
*
* {@codesnippet com.azure.storage.queue.queueClient.getProperties}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @return A response containing a {@link QueueProperties} value which contains the metadata and approximate
* messages count of the queue.
* @throws StorageErrorException If the queue doesn't exist
@@ -135,6 +147,9 @@ public Response getProperties() {
*
* {@codesnippet com.azure.storage.queue.queueClient.clearMetadata#map}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @param metadata Metadata to set on the queue
* @return A response that only contains headers and response status code
* @throws StorageErrorException If the queue doesn't exist
@@ -152,6 +167,9 @@ public VoidResponse setMetadata(Map metadata) {
*
* {@codesnippet com.azure.storage.queue.queueClient.getAccessPolicy}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @return The stored access policies specified on the queue.
* @throws StorageErrorException If the queue doesn't exist
*/
@@ -168,6 +186,9 @@ public Iterable getAccessPolicy() {
*
* {@codesnippet com.azure.storage.queue.queueClient.setAccessPolicy}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @param permissions Access policies to set on the queue
* @return A response that only contains headers and response status code
* @throws StorageErrorException If the queue doesn't exist, a stored access policy doesn't have all fields filled out,
@@ -186,6 +207,9 @@ public VoidResponse setAccessPolicy(List permissions) {
*
* {@codesnippet com.azure.storage.queue.queueClient.clearMessages}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @return A response that only contains headers and response status code
* @throws StorageErrorException If the queue doesn't exist
*/
@@ -202,6 +226,9 @@ public VoidResponse clearMessages() {
*
* {@codesnippet com.azure.storage.queue.queueClient.enqueueMessage#string}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @param messageText Message text
* @return A {@link EnqueuedMessage} value that contains the {@link EnqueuedMessage#messageId() messageId} and
* {@link EnqueuedMessage#popReceipt() popReceipt} that are used to interact with the message and other metadata
@@ -225,6 +252,9 @@ public Response enqueueMessage(String messageText) {
*
* {@codesnippet com.azure.storage.queue.queueClient.enqueueMessageLiveTime#string-duration-duration}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @param messageText Message text
* @param visibilityTimeout Optional. The timeout period for how long the message is invisible in the queue in seconds.
* If unset the value will default to 0 and the message will be instantly visible. The timeout must be between 0
@@ -250,6 +280,9 @@ public Response enqueueMessage(String messageText, Duration vis
*
* {@codesnippet com.azure.storage.queue.queueClient.dequeueMessages}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @return The first {@link DequeuedMessage} in the queue, it contains
* {@link DequeuedMessage#messageId() messageId} and {@link DequeuedMessage#popReceipt() popReceipt} used to interact
* with the message, additionally it contains other metadata about the message.
@@ -268,6 +301,9 @@ public Iterable dequeueMessages() {
*
* {@codesnippet com.azure.storage.queue.queueClient.dequeueMessages#integer}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @param maxMessages Optional. Maximum number of messages to get, if there are less messages exist in the queue than requested
* all the messages will be returned. If left empty only 1 message will be retrieved, the allowed range is 1 to 32
* messages.
@@ -290,6 +326,9 @@ public Iterable dequeueMessages(Integer maxMessages) {
*
* {@codesnippet com.azure.storage.queue.queueClient.dequeueMessages#integer-duration}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @param maxMessages Optional. Maximum number of messages to get, if there are less messages exist in the queue than requested
* all the messages will be returned. If left empty only 1 message will be retrieved, the allowed range is 1 to 32
* messages.
@@ -317,6 +356,9 @@ public Iterable dequeueMessages(Integer maxMessages, Duration v
*
* {@codesnippet com.azure.storage.queue.queueClient.peekMessages}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @return A {@link PeekedMessage} that contains metadata about the message.
*/
public Iterable peekMessages() {
@@ -335,6 +377,9 @@ public Iterable peekMessages() {
*
* {@codesnippet com.azure.storage.queue.queueClient.peekMessages#integer}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @param maxMessages Optional. Maximum number of messages to peek, if there are less messages exist in the queue than requested
* all the messages will be peeked. If left empty only 1 message will be peeked, the allowed range is 1 to 32
* messages.
@@ -355,6 +400,9 @@ public Iterable peekMessages(Integer maxMessages) {
*
* {@codesnippet com.azure.storage.queue.queueClient.updateMessage}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @param messageText Updated value for the message
* @param messageId Id of the message to update
* @param popReceipt Unique identifier that must match for the message to be updated
@@ -378,6 +426,9 @@ public Response updateMessage(String messageText, String message
*
* {@codesnippet com.azure.storage.queue.queueClient.deleteMessage}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @param messageId Id of the message to deleted
* @param popReceipt Unique identifier that must match for the message to be deleted
* @return A response that only contains headers and response status code
diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java b/storage/client/queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java
index 6e6b099653bc..74a6e978a4f0 100644
--- a/storage/client/queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java
+++ b/storage/client/queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java
@@ -21,13 +21,14 @@
import com.azure.storage.queue.models.StorageErrorException;
import com.azure.storage.queue.models.StorageServiceProperties;
import com.azure.storage.queue.models.StorageServiceStats;
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import reactor.core.publisher.Flux;
-import reactor.core.publisher.Mono;
/**
* This class provides a client that contains all the operations for interacting with a queue account in Azure Storage.
@@ -153,6 +154,9 @@ public Mono deleteQueue(String queueName) {
*
* {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.listQueues}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @return {@link QueueItem Queues} in the storage account
*/
public Flux listQueues() {
@@ -171,6 +175,9 @@ public Flux listQueues() {
*
* {@codesnippet com.azure.storage.queue.queueServiceClient.listQueues#queueSergmentOptions}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @param options Options for listing queues
* @return {@link QueueItem Queues} in the storage account that satisfy the filter requirements
*/
@@ -240,6 +247,9 @@ private Flux extractAndFetchQueues(ServicesListQueuesSegmentResponse
*
* {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.getProperties}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @return Storage account Queue service properties
*/
public Mono> getProperties() {
@@ -264,6 +274,9 @@ public Mono> getProperties() {
*
* {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.setPropertiesEnableMetrics#storageServiceProperties}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @param properties Storage account Queue service properties
* @return A response that only contains headers and response status code
* @throws StorageErrorException When one of the following is true
@@ -292,6 +305,9 @@ public Mono setProperties(StorageServiceProperties properties) {
*
* {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.getStatistics}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @return The geo replication information about the Queue service
*/
public Mono> getStatistics() {
diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java b/storage/client/queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java
index a002e5b12f87..78ef5b204281 100644
--- a/storage/client/queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java
+++ b/storage/client/queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java
@@ -127,6 +127,9 @@ public VoidResponse deleteQueue(String queueName) {
*
* {@codesnippet com.azure.storage.queue.queueServiceClient.listQueues}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @return {@link QueueItem Queues} in the storage account
*/
public Iterable listQueues() {
@@ -145,6 +148,9 @@ public Iterable listQueues() {
*
* {@codesnippet com.azure.storage.queue.queueServiceClient.listQueues#queueSergmentOptions}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @param options Options for listing queues
* @return {@link QueueItem Queues} in the storage account that satisfy the filter requirements
*/
@@ -176,6 +182,9 @@ Iterable listQueues(String marker, QueuesSegmentOptions options) {
*
* {@codesnippet com.azure.storage.queue.queueServiceClient.getProperties}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @return Storage account Queue service properties
*/
public Response getProperties() {
@@ -199,6 +208,9 @@ public Response getProperties() {
*
* {@codesnippet com.azure.storage.queue.queueServiceClient.setPropertiesEnableMetrics#storageServiceProperties}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @param properties Storage account Queue service properties
* @return A response that only contains headers and response status code
* @throws StorageErrorException When one of the following is true
@@ -226,6 +238,9 @@ public VoidResponse setProperties(StorageServiceProperties properties) {
*
* {@codesnippet com.azure.storage.queue.queueServiceClient.getStatistics}
*
+ * For more information, see the
+ * Azure Docs.
+ *
* @return The geo replication information about the Queue service
*/
public Response getStatistics() {