Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blobs Sync Stack Migration #40812

Merged
merged 61 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
d8a0417
autorest generated changes including removal of enable-xml
ibrahimrabab Jun 17, 2024
7797a77
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-java in…
ibrahimrabab Jun 18, 2024
a9586d2
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-java in…
ibrahimrabab Jun 19, 2024
76c2536
adding all changes for decoupling sync and async client
ibrahimrabab Jun 25, 2024
d5b0353
fixing logic for findBlobs
ibrahimrabab Jun 26, 2024
a3c2050
fixing listBlobs include logic
ibrahimrabab Jun 26, 2024
cf5475c
removing commented line
ibrahimrabab Jun 26, 2024
cb231b2
using final pageblob request conditions
ibrahimrabab Jun 26, 2024
9417589
fixing getBlobClient in containerclient class
ibrahimrabab Jun 27, 2024
849c611
fixing the async client that created from versionId and snapshot
ibrahimrabab Jun 27, 2024
f889874
fixed lambda function for listing apis
ibrahimrabab Jun 27, 2024
6a26ca6
fixing pageList method
ibrahimrabab Jun 28, 2024
6591665
adding changes from xml removal
ibrahimrabab Jun 28, 2024
f87d900
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-java in…
ibrahimrabab Jun 28, 2024
7f70d75
adding xml migration changes
ibrahimrabab Jun 28, 2024
34b1288
copying changes from xml migration pr
ibrahimrabab Jun 28, 2024
80a5b41
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-java in…
ibrahimrabab Jul 1, 2024
c814194
removing all references of xmlJackson
ibrahimrabab Jul 1, 2024
cd0e261
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-java in…
ibrahimrabab Jul 2, 2024
b6efa1d
updating lease id after aqcuire and change lease
ibrahimrabab Jul 3, 2024
396e6bd
fix listing apis and versioning apis
ibrahimrabab Jul 3, 2024
a39fe65
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-java in…
ibrahimrabab Jul 8, 2024
0172612
fixing listPages and queryWithResponse
ibrahimrabab Jul 9, 2024
db6159a
fixed queryWithResponse and queryInputStream tests
ibrahimrabab Jul 9, 2024
74ef4b5
Merge remote-tracking branch 'azure' into syncStack-blobs
ibrahimrabab Jul 25, 2024
afe670b
fixing comments from PR
ibrahimrabab Jul 25, 2024
09ee10d
addressing more comments, fixing analyze issues
ibrahimrabab Jul 25, 2024
aa14bf2
adding stylecheck fixes
ibrahimrabab Jul 26, 2024
64fad9b
copying main
ibrahimrabab Jul 26, 2024
839a226
removing blank lines from the generated models
ibrahimrabab Jul 26, 2024
57d7785
adding suppression checkstyle to allow leaseId as non final field in …
ibrahimrabab Jul 27, 2024
2bbea6c
remove unused import
ibrahimrabab Jul 27, 2024
241705c
suppressing checkstyle issues
ibrahimrabab Jul 29, 2024
e9bb8f1
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-java in…
ibrahimrabab Jul 29, 2024
5de9d11
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-java in…
ibrahimrabab Jul 29, 2024
04263be
adding BlobClientBase to override CT_CONSTRUCTOR_THROW exception
ibrahimrabab Jul 29, 2024
b859547
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-java in…
ibrahimrabab Jul 31, 2024
da4166a
adding extra check in BlobClientBase.existsWithResponse
ibrahimrabab Jul 31, 2024
500b1b7
fixing lint issues
ibrahimrabab Jul 31, 2024
7c1e59c
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-java in…
ibrahimrabab Aug 5, 2024
e47f574
fixing merge conflicts for userDelegationSas and generateSas methods
ibrahimrabab Aug 20, 2024
01e0a0c
adding new exception BlobStorageExceptionInternal
ibrahimrabab Aug 22, 2024
06f2831
adding wrapTimeoutServiceCallWithExceptionMapping to each api call
ibrahimrabab Aug 23, 2024
84fd1b4
fixing exists() test, removing unused import
ibrahimrabab Aug 23, 2024
500a5a7
blob-nio test fix
ibrahimrabab Aug 23, 2024
5e0945f
now using new sync internal-avro with BlobQueryReader
ibrahimrabab Aug 24, 2024
9f14867
debugging
ibrahimrabab Aug 26, 2024
3efde0f
changed fatalQueryError test case to handle exception thrown earlier
ibrahimrabab Aug 26, 2024
3636759
changing queryFatalError test to expect UncheckedIOException
ibrahimrabab Aug 26, 2024
fd9632a
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-java in…
ibrahimrabab Aug 30, 2024
0519090
updating files
ibrahimrabab Sep 3, 2024
6788379
erge branch 'main' of https://github.com/Azure/azure-sdk-for-java int…
ibrahimrabab Sep 3, 2024
950f7ad
regenerating swagger files
ibrahimrabab Sep 3, 2024
06aa0da
using unreleased version of core to test whether tests pass now for q…
ibrahimrabab Sep 4, 2024
3380c21
updating okhttp version
ibrahimrabab Sep 4, 2024
f7a52b9
updating version_client.txt to use unreleased version of blob and dat…
ibrahimrabab Sep 4, 2024
c93d9b0
updating unreleased versions for core and okhttp
ibrahimrabab Sep 4, 2024
592c079
fixing unreleased version
ibrahimrabab Sep 4, 2024
d2c2500
removing dead method readFromInputStream
ibrahimrabab Sep 4, 2024
06a97a3
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-java in…
ibrahimrabab Sep 5, 2024
9358ad0
adding checkstyle suppression for impl clients
ibrahimrabab Sep 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ private static boolean shouldDiscard(String packageName) {
} else if (packageName.regionMatches(18, "queue.models", 0, 12)) {
// Queue
return true;
} else if (packageName.regionMatches(18, "blob.", 0, 5)) {
// Blob
return packageName.regionMatches(23, "models", 0, 6) || packageName.regionMatches(23, "options", 0, 7);
}
} else if (packageName.regionMatches(10, "communication.", 0, 14)) {
if (packageName.regionMatches(24, "jobrouter.models", 0, 16)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<suppress files="com.azure.storage.blob.implementation.util.ModelHelper.java" checks="MissingJavadocMethodCheck" />
<suppress files="com.azure.storage.blob.implementation.models.PageListHelper.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.storage.blob.implementation.util.BlobRequestConditionProperty.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.storage.blob.implementation.util.CustomHierarchicalListingDeserializer.java" checks="MissingJavadocTypeCheck" />
<suppress files="com.azure.storage.blob.implementation.BlobsImpl.java" checks="com.azure.tools.checkstyle.checks.DenyListedWordsCheck" />
<suppress files="com.azure.storage.blob.implementation.BlockBlobsImpl.java" checks="com.azure.tools.checkstyle.checks.DenyListedWordsCheck" />
<suppress files="com.azure.storage.blob.implementation.PageBlobsImpl.java" checks="com.azure.tools.checkstyle.checks.DenyListedWordsCheck" />
Expand Down
27 changes: 4 additions & 23 deletions sdk/storage/azure-storage-blob/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
<version>1.49.1</version> <!-- {x-version-update;com.azure:azure-core;dependency} -->
<version>1.50.0-beta.1</version> <!-- {x-version-update;com.azure:azure-core;dependency} -->
ibrahimrabab marked this conversation as resolved.
Show resolved Hide resolved
</dependency>
<dependency>
<groupId>com.azure</groupId>
Expand All @@ -89,9 +89,9 @@
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.13.5</version> <!-- {x-version-update;com.fasterxml.jackson.dataformat:jackson-dataformat-xml;external_dependency} -->
<groupId>com.azure</groupId>
<artifactId>azure-xml</artifactId>
<version>1.0.0</version> <!-- {x-version-update;com.azure:azure-xml;dependency} -->
</dependency>

<!-- Added this dependency to include necessary annotations used by reactor core.
Expand Down Expand Up @@ -193,25 +193,6 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.4.1</version> <!-- {x-version-update;org.apache.maven.plugins:maven-enforcer-plugin;external_dependency} -->
<configuration>
<rules>
<bannedDependencies>
<includes>
<include>com.fasterxml.jackson.dataformat:jackson-dataformat-xml:[2.13.5]</include> <!-- {x-include-update;com.fasterxml.jackson.dataformat:jackson-dataformat-xml;external_dependency} -->
</includes>
</bannedDependencies>
</rules>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>inject-sas-service-version</id>
Expand Down
14 changes: 14 additions & 0 deletions sdk/storage/azure-storage-blob/spotbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
<Class name="com.azure.storage.blob.implementation.models.ContainersGetPropertiesHeaders" />
<Class name="com.azure.storage.blob.implementation.models.PageListCollection" />
<Class name="com.azure.storage.blob.implementation.models.PageListSegment" />
<Class name="com.azure.storage.blob.implementation.models.ArrowConfiguration" />
<Class name="com.azure.storage.blob.implementation.models.BlobContainersSegment" />
<Class name="com.azure.storage.blob.implementation.models.BlobSignedIdentifierWrapper" />
<Class name="com.azure.storage.blob.implementation.models.BlobTags" />
<Class name="com.azure.storage.blob.implementation.models.FilterBlobSegment" />
<Class name="com.azure.storage.blob.models.BlobContainerAccessPolicies" />
<Class name="com.azure.storage.blob.models.BlobContainerItem" />
<Class name="com.azure.storage.blob.models.BlobContainerProperties" />
Expand All @@ -40,6 +45,8 @@
<Class name="com.azure.storage.blob.models.BlockLookupList" />
<Class name="com.azure.storage.blob.models.PageList" />
<Class name="com.azure.storage.blob.models.TaggedBlobItem" />
<Class name="com.azure.storage.blob.models.BlobServiceProperties" />
<Class name="com.azure.storage.blob.models.BlockList" />
<Class name="com.azure.storage.blob.options.AppendBlobAppendBlockFromUrlOptions" />
<Class name="com.azure.storage.blob.options.AppendBlobCreateOptions" />
<Class name="com.azure.storage.blob.options.AppendBlobSealOptions" />
Expand Down Expand Up @@ -92,6 +99,11 @@
<Class name="com.azure.storage.blob.implementation.models.ContainersGetPropertiesHeaders" />
<Class name="com.azure.storage.blob.implementation.models.PageListCollection" />
<Class name="com.azure.storage.blob.implementation.models.PageListSegment" />
<Class name="com.azure.storage.blob.implementation.models.ArrowConfiguration" />
<Class name="com.azure.storage.blob.implementation.models.BlobContainersSegment" />
<Class name="com.azure.storage.blob.implementation.models.BlobSignedIdentifierWrapper" />
<Class name="com.azure.storage.blob.implementation.models.BlobTags" />
<Class name="com.azure.storage.blob.implementation.models.FilterBlobSegment" />
<Class name="com.azure.storage.blob.models.BlobContainerAccessPolicies" />
<Class name="com.azure.storage.blob.models.BlobContainerItem" />
<Class name="com.azure.storage.blob.models.BlobContainerProperties" />
Expand All @@ -100,6 +112,8 @@
<Class name="com.azure.storage.blob.models.BlockLookupList" />
<Class name="com.azure.storage.blob.models.PageList" />
<Class name="com.azure.storage.blob.models.TaggedBlobItem" />
<Class name="com.azure.storage.blob.models.BlobServiceProperties" />
<Class name="com.azure.storage.blob.models.BlockList" />
<Class name="com.azure.storage.blob.options.AppendBlobAppendBlockFromUrlOptions" />
<Class name="com.azure.storage.blob.options.AppendBlobCreateOptions" />
<Class name="com.azure.storage.blob.options.AppendBlobSealOptions" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.rest.Response;
import com.azure.core.util.BinaryData;
import com.azure.core.util.Context;
import com.azure.core.util.FluxUtil;
import com.azure.core.util.logging.ClientLogger;
import com.azure.storage.blob.implementation.models.EncryptionScope;
import com.azure.storage.blob.implementation.util.ModelHelper;
import com.azure.storage.blob.models.AccessTier;
import com.azure.storage.blob.models.CpkInfo;
import com.azure.storage.blob.models.CustomerProvidedKey;
import com.azure.storage.blob.options.BlobParallelUploadOptions;
import com.azure.storage.blob.models.BlobRequestConditions;
Expand All @@ -32,6 +35,8 @@

import java.io.InputStream;
import java.io.UncheckedIOException;
import java.nio.channels.AsynchronousFileChannel;
import java.nio.file.Path;
import java.time.Duration;
import java.util.Map;
import java.util.Objects;
Expand Down Expand Up @@ -61,19 +66,26 @@ public class BlobClient extends BlobClientBase {
/**
* The block size to use if none is specified in parallel operations.
*/
public static final int BLOB_DEFAULT_UPLOAD_BLOCK_SIZE = BlobAsyncClient.BLOB_DEFAULT_UPLOAD_BLOCK_SIZE;
public static final int BLOB_DEFAULT_UPLOAD_BLOCK_SIZE = 4 * Constants.MB;

/**
* The number of buffers to use if none is specied on the buffered upload method.
*/
public static final int BLOB_DEFAULT_NUMBER_OF_BUFFERS = BlobAsyncClient.BLOB_DEFAULT_NUMBER_OF_BUFFERS;
public static final int BLOB_DEFAULT_NUMBER_OF_BUFFERS = 8;
/**
* If a blob is known to be greater than 100MB, using a larger block size will trigger some server-side
* optimizations. If the block size is not set and the size of the blob is known to be greater than 100MB, this
* value will be used.
*/
public static final int BLOB_DEFAULT_HTBB_UPLOAD_BLOCK_SIZE = BlobAsyncClient.BLOB_DEFAULT_HTBB_UPLOAD_BLOCK_SIZE;
public static final int BLOB_DEFAULT_HTBB_UPLOAD_BLOCK_SIZE = 8 * Constants.MB;

/**
* The default block size used in {@link FluxUtil#readFile(AsynchronousFileChannel)}.
* This is to make sure we're using same size when using {@link BinaryData#fromFile(Path, int)}
* and {@link BinaryData#fromFile(Path, Long, Long, int)}
* to represent the content.
*/
private static final int DEFAULT_FILE_READ_CHUNK_SIZE = 1024 * 64;
private final BlobAsyncClient client;

private BlockBlobClient blockBlobClient;
Expand All @@ -89,6 +101,74 @@ protected BlobClient(BlobAsyncClient client) {
this.client = client;
}

/**
* Protected constructor for use by {@link BlobClientBuilder}.
*
* @param client the async blob client
* @param pipeline The pipeline used to send and receive service requests.
* @param url The endpoint where to send service requests.
* @param serviceVersion The version of the service to receive requests.
* @param accountName The storage account name.
* @param containerName The container name.
* @param blobName The blob name.
* @param snapshot The snapshot identifier for the blob, pass {@code null} to interact with the blob directly.
* @param customerProvidedKey Customer provided key used during encryption of the blob's data on the server, pass
* {@code null} to allow the service to use its own encryption.
*/
protected BlobClient(BlobAsyncClient client, HttpPipeline pipeline, String url, BlobServiceVersion serviceVersion,
String accountName, String containerName, String blobName, String snapshot, CpkInfo customerProvidedKey) {
this(client, pipeline, url, serviceVersion, accountName, containerName, blobName, snapshot,
customerProvidedKey, null);
}

/**
* Protected constructor for use by {@link BlobClientBuilder}.
*
* @param client the async blob client
* @param pipeline The pipeline used to send and receive service requests.
* @param url The endpoint where to send service requests.
* @param serviceVersion The version of the service to receive requests.
* @param accountName The storage account name.
* @param containerName The container name.
* @param blobName The blob name.
* @param snapshot The snapshot identifier for the blob, pass {@code null} to interact with the blob directly.
* @param customerProvidedKey Customer provided key used during encryption of the blob's data on the server, pass
* {@code null} to allow the service to use its own encryption.
* @param encryptionScope Encryption scope used during encryption of the blob's data on the server, pass
* {@code null} to allow the service to use its own encryption.
*/
protected BlobClient(BlobAsyncClient client, HttpPipeline pipeline, String url, BlobServiceVersion serviceVersion,
ibrahimrabab marked this conversation as resolved.
Show resolved Hide resolved
String accountName, String containerName, String blobName, String snapshot, CpkInfo customerProvidedKey,
EncryptionScope encryptionScope) {
this(client, pipeline, url, serviceVersion, accountName, containerName, blobName, snapshot, customerProvidedKey,
encryptionScope, null);
}

/**
* Protected constructor for use by {@link BlobClientBuilder}.
*
* @param client the async blob client
* @param pipeline The pipeline used to send and receive service requests.
* @param url The endpoint where to send service requests.
* @param serviceVersion The version of the service to receive requests.
* @param accountName The storage account name.
* @param containerName The container name.
* @param blobName The blob name.
* @param snapshot The snapshot identifier for the blob, pass {@code null} to interact with the blob directly.
* @param customerProvidedKey Customer provided key used during encryption of the blob's data on the server, pass
* {@code null} to allow the service to use its own encryption.
* @param encryptionScope Encryption scope used during encryption of the blob's data on the server, pass
* {@code null} to allow the service to use its own encryption.
* @param versionId The version identifier for the blob, pass {@code null} to interact with the latest blob version.
*/
protected BlobClient(BlobAsyncClient client, HttpPipeline pipeline, String url, BlobServiceVersion serviceVersion,
String accountName, String containerName, String blobName, String snapshot, CpkInfo customerProvidedKey,
EncryptionScope encryptionScope, String versionId) {
super(client, pipeline, url, serviceVersion, accountName, containerName, blobName, snapshot, customerProvidedKey,
encryptionScope, versionId);
this.client = client;
}

/**
* Creates a new {@link BlobClient} linked to the {@code snapshot} of this blob resource.
*
Expand All @@ -97,7 +177,11 @@ protected BlobClient(BlobAsyncClient client) {
*/
@Override
public BlobClient getSnapshotClient(String snapshot) {
return new BlobClient(client.getSnapshotClient(snapshot));
BlobAsyncClient asyncClient = new BlobAsyncClient(getHttpPipeline(), getAccountUrl(), getServiceVersion(),
getAccountName(), getContainerName(), getBlobName(), snapshot, getCustomerProvidedKey(),
encryptionScope, getVersionId());
return new BlobClient(asyncClient, getHttpPipeline(), getAccountUrl(), getServiceVersion(), getAccountName(),
getContainerName(), getBlobName(), snapshot, getCustomerProvidedKey(), encryptionScope, getVersionId());
}

/**
Expand All @@ -109,7 +193,11 @@ public BlobClient getSnapshotClient(String snapshot) {
*/
@Override
public BlobClient getVersionClient(String versionId) {
return new BlobClient(client.getVersionClient(versionId));
BlobAsyncClient asyncClient = new BlobAsyncClient(getHttpPipeline(), getAccountUrl(), getServiceVersion(),
getAccountName(), getContainerName(), getBlobName(), getSnapshotId(), getCustomerProvidedKey(),
encryptionScope, versionId);
return new BlobClient(asyncClient, getHttpPipeline(), getAccountUrl(), getServiceVersion(), getAccountName(),
getContainerName(), getBlobName(), getSnapshotId(), getCustomerProvidedKey(), encryptionScope, versionId);
}

/**
Expand All @@ -120,7 +208,13 @@ public BlobClient getVersionClient(String versionId) {
*/
@Override
public BlobClient getEncryptionScopeClient(String encryptionScope) {
return new BlobClient(client.getEncryptionScopeAsyncClient(encryptionScope));
EncryptionScope finalEncryptionScope = null;
if (encryptionScope != null) {
finalEncryptionScope = new EncryptionScope().setEncryptionScope(encryptionScope);
}
return new BlobClient(this.client, getHttpPipeline(), getAccountUrl(), getServiceVersion(), getAccountName(),
ibrahimrabab marked this conversation as resolved.
Show resolved Hide resolved
getContainerName(), getBlobName(), getSnapshotId(), getCustomerProvidedKey(), finalEncryptionScope,
getVersionId());
}

/**
Expand All @@ -132,7 +226,16 @@ public BlobClient getEncryptionScopeClient(String encryptionScope) {
*/
@Override
public BlobClient getCustomerProvidedKeyClient(CustomerProvidedKey customerProvidedKey) {
return new BlobClient(client.getCustomerProvidedKeyAsyncClient(customerProvidedKey));
CpkInfo finalCustomerProvidedKey = null;
if (customerProvidedKey != null) {
finalCustomerProvidedKey = new CpkInfo()
.setEncryptionKey(customerProvidedKey.getKey())
.setEncryptionKeySha256(customerProvidedKey.getKeySha256())
.setEncryptionAlgorithm(customerProvidedKey.getEncryptionAlgorithm());
}
return new BlobClient(this.client, getHttpPipeline(), getAccountUrl(), getServiceVersion(), getAccountName(),
getContainerName(), getBlobName(), getSnapshotId(), finalCustomerProvidedKey, encryptionScope,
getVersionId());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,29 @@ public BlobClientBuilder() {
* and {@link #retryOptions(RequestRetryOptions)} have been set.
*/
public BlobClient buildClient() {
return new BlobClient(buildAsyncClient());
Objects.requireNonNull(blobName, "'blobName' cannot be null.");
Objects.requireNonNull(endpoint, "'endpoint' cannot be null");

BuilderHelper.httpsValidation(customerProvidedKey, "customer provided key", endpoint, LOGGER);

if (Objects.nonNull(customerProvidedKey) && Objects.nonNull(encryptionScope)) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException("Customer provided key and encryption "
+ "scope cannot both be set"));
}

/*
Implicit and explicit root container access are functionally equivalent, but explicit references are easier
to read and debug.
*/
String blobContainerName = CoreUtils.isNullOrEmpty(containerName) ? BlobContainerClient.ROOT_CONTAINER_NAME
: containerName;

BlobServiceVersion serviceVersion = version != null ? version : BlobServiceVersion.getLatest();

BlobAsyncClient asyncClient = buildAsyncClient();

return new BlobClient(asyncClient, asyncClient.getHttpPipeline(), endpoint, serviceVersion, accountName,
blobContainerName, blobName, snapshot, customerProvidedKey, encryptionScope, versionId);
}

/**
Expand Down Expand Up @@ -171,15 +193,19 @@ public BlobAsyncClient buildAsyncClient() {

BlobServiceVersion serviceVersion = version != null ? version : BlobServiceVersion.getLatest();

HttpPipeline pipeline = (httpPipeline != null) ? httpPipeline : BuilderHelper.buildPipeline(
storageSharedKeyCredential, tokenCredential, azureSasCredential, sasToken,
endpoint, retryOptions, coreRetryOptions, logOptions,
clientOptions, httpClient, perCallPolicies, perRetryPolicies, configuration, audience, LOGGER);
HttpPipeline pipeline = constructPipeline();

return new BlobAsyncClient(pipeline, endpoint, serviceVersion, accountName, blobContainerName, blobName,
snapshot, customerProvidedKey, encryptionScope, versionId);
}

private HttpPipeline constructPipeline() {
return (httpPipeline != null) ? httpPipeline : BuilderHelper.buildPipeline(
storageSharedKeyCredential, tokenCredential, azureSasCredential, sasToken,
endpoint, retryOptions, coreRetryOptions, logOptions,
clientOptions, httpClient, perCallPolicies, perRetryPolicies, configuration, audience, LOGGER);
}

/**
* Sets the {@link CustomerProvidedKey customer provided key} that is used to encrypt blob contents on the server.
*
Expand Down
Loading
Loading