diff --git a/storage/client/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java b/storage/client/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java index 19aa0749673c..cd8762e7a08c 100644 --- a/storage/client/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java +++ b/storage/client/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java @@ -4,14 +4,9 @@ package com.azure.storage.blob; import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.ResponseBase; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.AppendBlobAppendBlockFromUrlHeaders; -import com.azure.storage.blob.models.AppendBlobAppendBlockHeaders; -import com.azure.storage.blob.models.AppendBlobCreateHeaders; import com.azure.storage.blob.models.AppendBlobItem; import com.azure.storage.blob.models.BlobHTTPHeaders; import com.azure.storage.blob.models.SourceModifiedAccessConditions; @@ -46,7 +41,7 @@ * object through {@link Mono#toFuture()}. */ public final class AppendBlobAsyncClient extends BlobAsyncClient { - AppendBlobAsyncRawClient appendBlobAsyncRawClient; + private final AppendBlobAsyncRawClient appendBlobAsyncRawClient; /** * Indicates the maximum number of bytes that can be sent in a call to appendBlock. @@ -63,7 +58,7 @@ public final class AppendBlobAsyncClient extends BlobAsyncClient { * @param azureBlobStorageBuilder the API client builder for blob storage API */ AppendBlobAsyncClient(AzureBlobStorageBuilder azureBlobStorageBuilder) { - super(azureBlobStorageBuilder); + super(azureBlobStorageBuilder, null); appendBlobAsyncRawClient = new AppendBlobAsyncRawClient(azureBlobStorageBuilder.build()); } diff --git a/storage/client/src/main/java/com/azure/storage/blob/AppendBlobClientBuilder.java b/storage/client/src/main/java/com/azure/storage/blob/AppendBlobClientBuilder.java index c4c584e4b078..92447213be70 100644 --- a/storage/client/src/main/java/com/azure/storage/blob/AppendBlobClientBuilder.java +++ b/storage/client/src/main/java/com/azure/storage/blob/AppendBlobClientBuilder.java @@ -39,7 +39,7 @@ * *
@@ -180,40 +180,40 @@ public AppendBlobClientBuilder blobName(String blobName) { } /** - * Sets the credentials used to authorize requests sent to the service - * @param credentials authorization credentials + * Sets the credential used to authorize requests sent to the service + * @param credential authorization credential * @return the updated AppendBlobClientBuilder object */ - public AppendBlobClientBuilder credentials(SharedKeyCredential credentials) { - this.sharedKeyCredential = credentials; + public AppendBlobClientBuilder credential(SharedKeyCredential credential) { + this.sharedKeyCredential = credential; return this; } /** - * Sets the credentials used to authorize requests sent to the service - * @param credentials authorization credentials + * Sets the credential used to authorize requests sent to the service + * @param credential authorization credential * @return the updated AppendBlobClientBuilder object */ - public AppendBlobClientBuilder credentials(TokenCredential credentials) { - this.tokenCredential = credentials; + public AppendBlobClientBuilder credential(TokenCredential credential) { + this.tokenCredential = credential; return this; } /** - * Sets the credentials used to authorize requests sent to the service - * @param credentials authorization credentials + * Sets the credential used to authorize requests sent to the service + * @param credential authorization credential * @return the updated AppendBlobClientBuilder object */ - public AppendBlobClientBuilder credentials(SASTokenCredential credentials) { - this.sasTokenCredential = credentials; + public AppendBlobClientBuilder credential(SASTokenCredential credential) { + this.sasTokenCredential = credential; return this; } /** - * Clears the credentials used to authorize requests sent to the service + * Clears the credential used to authorize requests sent to the service * @return the updated AppendBlobClientBuilder object */ - public AppendBlobClientBuilder anonymousCredentials() { + public AppendBlobClientBuilder anonymousCredential() { this.sharedKeyCredential = null; this.tokenCredential = null; return this; @@ -248,7 +248,7 @@ public AppendBlobClientBuilder connectionString(String connectionString) { } // Use accountName and accountKey to get the SAS token using the credential class. - return credentials(new SharedKeyCredential(accountName, accountKey)); + return credential(new SharedKeyCredential(accountName, accountKey)); } /** diff --git a/storage/client/src/main/java/com/azure/storage/blob/BlobAsyncClient.java b/storage/client/src/main/java/com/azure/storage/blob/BlobAsyncClient.java index 60cc58bf51ef..02d447b528d6 100644 --- a/storage/client/src/main/java/com/azure/storage/blob/BlobAsyncClient.java +++ b/storage/client/src/main/java/com/azure/storage/blob/BlobAsyncClient.java @@ -5,13 +5,11 @@ import com.azure.core.http.HttpResponse; import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.ResponseBase; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; import com.azure.core.implementation.util.FluxUtil; import com.azure.core.util.Context; import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; import com.azure.storage.blob.models.AccessTier; import com.azure.storage.blob.models.BlobHTTPHeaders; import com.azure.storage.blob.models.BlobStartCopyFromURLHeaders; @@ -19,14 +17,10 @@ import com.azure.storage.blob.models.LeaseAccessConditions; import com.azure.storage.blob.models.ModifiedAccessConditions; import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.core.scheduler.Schedulers; -import reactor.netty.ByteBufFlux; -import java.io.File; -import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.UncheckedIOException; @@ -34,7 +28,6 @@ import java.net.URL; import java.nio.ByteBuffer; import java.nio.channels.AsynchronousFileChannel; -import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.time.Duration; @@ -71,14 +64,17 @@ public class BlobAsyncClient { private static final long BLOB_DEFAULT_DOWNLOAD_BLOCK_SIZE = 4 * Constants.MB; - BlobAsyncRawClient blobAsyncRawClient; + private final BlobAsyncRawClient blobAsyncRawClient; + + private final String snapshot; /** * Package-private constructor for use by {@link BlobClientBuilder}. * @param azureBlobStorageBuilder the API client builder for blob storage API */ - BlobAsyncClient(AzureBlobStorageBuilder azureBlobStorageBuilder) { - blobAsyncRawClient = new BlobAsyncRawClient(azureBlobStorageBuilder.build()); + BlobAsyncClient(AzureBlobStorageBuilder azureBlobStorageBuilder, String snapshot) { + this.blobAsyncRawClient = new BlobAsyncRawClient(azureBlobStorageBuilder.build()); + this.snapshot = snapshot; } /** @@ -99,7 +95,7 @@ public static BlobClientBuilder blobClientBuilder() { * A {@link BlockBlobAsyncClient} to this resource. */ public BlockBlobAsyncClient asBlockBlobAsyncClient() { - return new BlockBlobAsyncClient(new AzureBlobStorageBuilder().url(getUrl().toString()).pipeline(blobAsyncRawClient.azureBlobStorage.httpPipeline())); + return new BlockBlobAsyncClient(new AzureBlobStorageBuilder().url(getUrl().toString()).pipeline(blobAsyncRawClient.azureBlobStorage.httpPipeline()), snapshot); } /** @@ -121,7 +117,7 @@ public AppendBlobAsyncClient asAppendBlobAsyncClient() { * A {@link PageBlobAsyncClient} to this resource. */ public PageBlobAsyncClient asPageBlobAsyncClient() { - return new PageBlobAsyncClient(new AzureBlobStorageBuilder().url(getUrl().toString()).pipeline(blobAsyncRawClient.azureBlobStorage.httpPipeline())); + return new PageBlobAsyncClient(new AzureBlobStorageBuilder().url(getUrl().toString()).pipeline(blobAsyncRawClient.azureBlobStorage.httpPipeline()), snapshot); } /** diff --git a/storage/client/src/main/java/com/azure/storage/blob/BlobClient.java b/storage/client/src/main/java/com/azure/storage/blob/BlobClient.java index 8922072d84a2..c0d2a92209e6 100644 --- a/storage/client/src/main/java/com/azure/storage/blob/BlobClient.java +++ b/storage/client/src/main/java/com/azure/storage/blob/BlobClient.java @@ -40,7 +40,7 @@ */ public class BlobClient { - private BlobAsyncClient blobAsyncClient; + private final BlobAsyncClient blobAsyncClient; /** * Package-private constructor for use by {@link BlobClientBuilder}. diff --git a/storage/client/src/main/java/com/azure/storage/blob/BlobClientBuilder.java b/storage/client/src/main/java/com/azure/storage/blob/BlobClientBuilder.java index 8c9b826d9cec..446fdd47844f 100644 --- a/storage/client/src/main/java/com/azure/storage/blob/BlobClientBuilder.java +++ b/storage/client/src/main/java/com/azure/storage/blob/BlobClientBuilder.java @@ -39,7 +39,7 @@ * *
@@ -57,6 +57,7 @@ public final class BlobClientBuilder { private URL endpoint; private String containerName; private String blobName; + private String snapshot; private SharedKeyCredential sharedKeyCredential; private TokenCredential tokenCredential; private SASTokenCredential sasTokenCredential; @@ -122,7 +123,7 @@ public BlobClient buildClient() { * @return a {@link BlobAsyncClient} created from the configurations in this builder. */ public BlobAsyncClient buildAsyncClient() { - return new BlobAsyncClient(buildImpl()); + return new BlobAsyncClient(buildImpl(), snapshot); } /** @@ -180,40 +181,50 @@ public BlobClientBuilder blobName(String blobName) { } /** - * Sets the credentials used to authorize requests sent to the service - * @param credentials authorization credentials + * Sets the snapshot of the blob this client is connecting to. + * @param snapshot the snapshot identifier for the blob * @return the updated BlobClientBuilder object */ - public BlobClientBuilder credentials(SharedKeyCredential credentials) { - this.sharedKeyCredential = credentials; + public BlobClientBuilder snapshot(String snapshot) { + this.snapshot = snapshot; return this; } /** - * Sets the credentials used to authorize requests sent to the service - * @param credentials authorization credentials + * Sets the credential used to authorize requests sent to the service + * @param credential authorization credential * @return the updated BlobClientBuilder object */ - public BlobClientBuilder credentials(TokenCredential credentials) { - this.tokenCredential = credentials; + public BlobClientBuilder credential(SharedKeyCredential credential) { + this.sharedKeyCredential = credential; return this; } /** - * Sets the credentials used to authorize requests sent to the service - * @param credentials authorization credentials + * Sets the credential used to authorize requests sent to the service + * @param credential authorization credential * @return the updated BlobClientBuilder object */ - public BlobClientBuilder credentials(SASTokenCredential credentials) { - this.sasTokenCredential = credentials; + public BlobClientBuilder credential(TokenCredential credential) { + this.tokenCredential = credential; return this; } /** - * Clears the credentials used to authorize requests sent to the service + * Sets the credential used to authorize requests sent to the service + * @param credential authorization credential * @return the updated BlobClientBuilder object */ - public BlobClientBuilder anonymousCredentials() { + public BlobClientBuilder credential(SASTokenCredential credential) { + this.sasTokenCredential = credential; + return this; + } + + /** + * Clears the credential used to authorize requests sent to the service + * @return the updated BlobClientBuilder object + */ + public BlobClientBuilder anonymousCredential() { this.sharedKeyCredential = null; this.tokenCredential = null; return this; @@ -248,7 +259,7 @@ public BlobClientBuilder connectionString(String connectionString) { } // Use accountName and accountKey to get the SAS token using the credential class. - return credentials(new SharedKeyCredential(accountName, accountKey)); + return credential(new SharedKeyCredential(accountName, accountKey)); } /** diff --git a/storage/client/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java b/storage/client/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java index 40b2922cbc36..b55fc1054c69 100644 --- a/storage/client/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java +++ b/storage/client/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java @@ -6,11 +6,9 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.ResponseBase; import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.http.rest.VoidResponse; import com.azure.core.implementation.util.FluxUtil; import com.azure.core.util.Context; import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; import com.azure.storage.blob.models.BlobHTTPHeaders; import com.azure.storage.blob.models.BlockBlobItem; import com.azure.storage.blob.models.BlockItem; @@ -21,7 +19,6 @@ import io.netty.buffer.Unpooled; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import reactor.netty.ByteBufFlux; import java.io.File; import java.io.IOException; @@ -65,7 +62,7 @@ public final class BlockBlobAsyncClient extends BlobAsyncClient { static final long BLOB_DEFAULT_UPLOAD_BLOCK_SIZE = 4 * Constants.MB; - private BlockBlobAsyncRawClient blockBlobAsyncRawClient; + private final BlockBlobAsyncRawClient blockBlobAsyncRawClient; /** * Indicates the maximum number of bytes that can be sent in a call to upload. @@ -86,9 +83,9 @@ public final class BlockBlobAsyncClient extends BlobAsyncClient { * Package-private constructor for use by {@link BlockBlobClientBuilder}. * @param azureBlobStorageBuilder the API client builder for blob storage API */ - BlockBlobAsyncClient(AzureBlobStorageBuilder azureBlobStorageBuilder) { - super(azureBlobStorageBuilder); - blockBlobAsyncRawClient = new BlockBlobAsyncRawClient(azureBlobStorageBuilder.build()); + BlockBlobAsyncClient(AzureBlobStorageBuilder azureBlobStorageBuilder, String snapshot) { + super(azureBlobStorageBuilder, snapshot); + this.blockBlobAsyncRawClient = new BlockBlobAsyncRawClient(azureBlobStorageBuilder.build()); } /** @@ -97,7 +94,7 @@ public final class BlockBlobAsyncClient extends BlobAsyncClient { * @return * A new {@link BlockBlobClientBuilder} instance. */ - public static BlockBlobClientBuilder builder() { + public static BlockBlobClientBuilder blockBlobClientBuilder() { return new BlockBlobClientBuilder(); } diff --git a/storage/client/src/main/java/com/azure/storage/blob/BlockBlobClientBuilder.java b/storage/client/src/main/java/com/azure/storage/blob/BlockBlobClientBuilder.java index 38ba3b963cbd..2633b402c41e 100644 --- a/storage/client/src/main/java/com/azure/storage/blob/BlockBlobClientBuilder.java +++ b/storage/client/src/main/java/com/azure/storage/blob/BlockBlobClientBuilder.java @@ -39,7 +39,7 @@ * *
@@ -57,6 +57,7 @@ public final class BlockBlobClientBuilder { private URL endpoint; private String containerName; private String blobName; + private String snapshot; private SharedKeyCredential sharedKeyCredential; private TokenCredential tokenCredential; private SASTokenCredential sasTokenCredential; @@ -126,7 +127,7 @@ public BlockBlobClient buildClient() { * @return a {@link BlockBlobAsyncClient} created from the configurations in this builder. */ public BlockBlobAsyncClient buildAsyncClient() { - return new BlockBlobAsyncClient(buildImpl()); + return new BlockBlobAsyncClient(buildImpl(), snapshot); } /** @@ -184,40 +185,50 @@ public BlockBlobClientBuilder blobName(String blobName) { } /** - * Sets the credentials used to authorize requests sent to the service - * @param credentials authorization credentials + * Sets the snapshot of the blob this client is connecting to. + * @param snapshot the snapshot identifier for the blob * @return the updated BlockBlobClientBuilder object */ - public BlockBlobClientBuilder credentials(SharedKeyCredential credentials) { - this.sharedKeyCredential = credentials; + public BlockBlobClientBuilder snapshot(String snapshot) { + this.snapshot = snapshot; return this; } /** - * Sets the credentials used to authorize requests sent to the service - * @param credentials authorization credentials + * Sets the credential used to authorize requests sent to the service + * @param credential authorization credential * @return the updated BlockBlobClientBuilder object */ - public BlockBlobClientBuilder credentials(TokenCredential credentials) { - this.tokenCredential = credentials; + public BlockBlobClientBuilder credential(SharedKeyCredential credential) { + this.sharedKeyCredential = credential; return this; } /** - * Sets the credentials used to authorize requests sent to the service - * @param credentials authorization credentials + * Sets the credential used to authorize requests sent to the service + * @param credential authorization credential * @return the updated BlockBlobClientBuilder object */ - public BlockBlobClientBuilder credentials(SASTokenCredential credentials) { - this.sasTokenCredential = credentials; + public BlockBlobClientBuilder credential(TokenCredential credential) { + this.tokenCredential = credential; return this; } /** - * Clears the credentials used to authorize requests sent to the service + * Sets the credential used to authorize requests sent to the service + * @param credential authorization credential * @return the updated BlockBlobClientBuilder object */ - public BlockBlobClientBuilder anonymousCredentials() { + public BlockBlobClientBuilder credential(SASTokenCredential credential) { + this.sasTokenCredential = credential; + return this; + } + + /** + * Clears the credential used to authorize requests sent to the service + * @return the updated BlockBlobClientBuilder object + */ + public BlockBlobClientBuilder anonymousCredential() { this.sharedKeyCredential = null; this.tokenCredential = null; return this; @@ -252,7 +263,7 @@ public BlockBlobClientBuilder connectionString(String connectionString) { } // Use accountName and accountKey to get the SAS token using the credential class. - return credentials(new SharedKeyCredential(accountName, accountKey)); + return credential(new SharedKeyCredential(accountName, accountKey)); } /** diff --git a/storage/client/src/main/java/com/azure/storage/blob/ContainerClientBuilder.java b/storage/client/src/main/java/com/azure/storage/blob/ContainerClientBuilder.java index 7a35fa9d73c4..671ba4448bbf 100644 --- a/storage/client/src/main/java/com/azure/storage/blob/ContainerClientBuilder.java +++ b/storage/client/src/main/java/com/azure/storage/blob/ContainerClientBuilder.java @@ -39,7 +39,7 @@ * *
@@ -174,40 +174,40 @@ String endpoint() { } /** - * Sets the credentials used to authorize requests sent to the service - * @param credentials authorization credentials + * Sets the credential used to authorize requests sent to the service + * @param credential authorization credential * @return the updated ContainerClientBuilder object */ - public ContainerClientBuilder credentials(SharedKeyCredential credentials) { - this.sharedKeyCredential = credentials; + public ContainerClientBuilder credential(SharedKeyCredential credential) { + this.sharedKeyCredential = credential; return this; } /** - * Sets the credentials used to authorize requests sent to the service - * @param credentials authorization credentials + * Sets the credential used to authorize requests sent to the service + * @param credential authorization credential * @return the updated ContainerClientBuilder object */ - public ContainerClientBuilder credentials(TokenCredential credentials) { - this.tokenCredential = credentials; + public ContainerClientBuilder credential(TokenCredential credential) { + this.tokenCredential = credential; return this; } /** - * Sets the credentials used to authorize requests sent to the service - * @param credentials authorization credentials + * Sets the credential used to authorize requests sent to the service + * @param credential authorization credential * @return the updated ContainerClientBuilder object */ - public ContainerClientBuilder credentials(SASTokenCredential credentials) { - this.sasTokenCredential = credentials; + public ContainerClientBuilder credential(SASTokenCredential credential) { + this.sasTokenCredential = credential; return this; } /** - * Clears the credentials used to authorize requests sent to the service + * Clears the credential used to authorize requests sent to the service * @return the updated ContainerClientBuilder object */ - public ContainerClientBuilder anonymousCredentials() { + public ContainerClientBuilder anonymousCredential() { this.sharedKeyCredential = null; this.tokenCredential = null; return this; @@ -242,7 +242,7 @@ public ContainerClientBuilder connectionString(String connectionString) { } // Use accountName and accountKey to get the SAS token using the credential class. - return credentials(new SharedKeyCredential(accountName, accountKey)); + return credential(new SharedKeyCredential(accountName, accountKey)); } /** diff --git a/storage/client/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java b/storage/client/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java index 64aa5ac8f9d5..25180d8cb06d 100644 --- a/storage/client/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java +++ b/storage/client/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java @@ -11,12 +11,7 @@ import com.azure.storage.blob.models.BlobHTTPHeaders; import com.azure.storage.blob.models.CopyStatusType; import com.azure.storage.blob.models.ModifiedAccessConditions; -import com.azure.storage.blob.models.PageBlobClearPagesHeaders; import com.azure.storage.blob.models.PageBlobItem; -import com.azure.storage.blob.models.PageBlobResizeHeaders; -import com.azure.storage.blob.models.PageBlobUpdateSequenceNumberHeaders; -import com.azure.storage.blob.models.PageBlobUploadPagesFromURLHeaders; -import com.azure.storage.blob.models.PageBlobUploadPagesHeaders; import com.azure.storage.blob.models.PageRange; import com.azure.storage.blob.models.SequenceNumberActionType; import com.azure.storage.blob.models.SourceModifiedAccessConditions; @@ -51,7 +46,7 @@ */ public final class PageBlobAsyncClient extends BlobAsyncClient { - private PageBlobAsyncRawClient pageBlobAsyncRawClient; + private final PageBlobAsyncRawClient pageBlobAsyncRawClient; /** * Indicates the number of bytes in a page. @@ -67,8 +62,8 @@ public final class PageBlobAsyncClient extends BlobAsyncClient { * Package-private constructor for use by {@link PageBlobClientBuilder}. * @param azureBlobStorageBuilder the API client builder for blob storage API */ - PageBlobAsyncClient(AzureBlobStorageBuilder azureBlobStorageBuilder) { - super(azureBlobStorageBuilder); + PageBlobAsyncClient(AzureBlobStorageBuilder azureBlobStorageBuilder, String snapshot) { + super(azureBlobStorageBuilder, snapshot); this.pageBlobAsyncRawClient = new PageBlobAsyncRawClient(azureBlobStorageBuilder.build()); } diff --git a/storage/client/src/main/java/com/azure/storage/blob/PageBlobClient.java b/storage/client/src/main/java/com/azure/storage/blob/PageBlobClient.java index f1c7c6b5abfe..3ef66569bc91 100644 --- a/storage/client/src/main/java/com/azure/storage/blob/PageBlobClient.java +++ b/storage/client/src/main/java/com/azure/storage/blob/PageBlobClient.java @@ -9,12 +9,7 @@ import com.azure.storage.blob.models.BlobHTTPHeaders; import com.azure.storage.blob.models.CopyStatusType; import com.azure.storage.blob.models.ModifiedAccessConditions; -import com.azure.storage.blob.models.PageBlobClearPagesHeaders; import com.azure.storage.blob.models.PageBlobItem; -import com.azure.storage.blob.models.PageBlobResizeHeaders; -import com.azure.storage.blob.models.PageBlobUpdateSequenceNumberHeaders; -import com.azure.storage.blob.models.PageBlobUploadPagesFromURLHeaders; -import com.azure.storage.blob.models.PageBlobUploadPagesHeaders; import com.azure.storage.blob.models.PageRange; import com.azure.storage.blob.models.SequenceNumberActionType; import com.azure.storage.blob.models.SourceModifiedAccessConditions; @@ -41,8 +36,7 @@ * for more information. */ public final class PageBlobClient extends BlobClient { - - private PageBlobAsyncClient pageBlobAsyncClient; + private final PageBlobAsyncClient pageBlobAsyncClient; /** * Indicates the number of bytes in a page. diff --git a/storage/client/src/main/java/com/azure/storage/blob/PageBlobClientBuilder.java b/storage/client/src/main/java/com/azure/storage/blob/PageBlobClientBuilder.java index 44c10def605a..ec800c6a18d8 100644 --- a/storage/client/src/main/java/com/azure/storage/blob/PageBlobClientBuilder.java +++ b/storage/client/src/main/java/com/azure/storage/blob/PageBlobClientBuilder.java @@ -39,7 +39,7 @@ * *
@@ -57,6 +57,7 @@ public final class PageBlobClientBuilder {
private URL endpoint;
private String containerName;
private String blobName;
+ private String snapshot;
private SharedKeyCredential sharedKeyCredential;
private TokenCredential tokenCredential;
private SASTokenCredential sasTokenCredential;
@@ -122,7 +123,7 @@ public PageBlobClient buildClient() {
* @return a {@link PageBlobAsyncClient} created from the configurations in this builder.
*/
public PageBlobAsyncClient buildAsyncClient() {
- return new PageBlobAsyncClient(buildImpl());
+ return new PageBlobAsyncClient(buildImpl(), snapshot);
}
/**
@@ -180,40 +181,50 @@ public PageBlobClientBuilder blobName(String blobName) {
}
/**
- * Sets the credentials used to authorize requests sent to the service
- * @param credentials authorization credentials
+ * Sets the snapshot of the blob this client is connecting to.
+ * @param snapshot the snapshot identifier for the blob
* @return the updated PageBlobClientBuilder object
*/
- public PageBlobClientBuilder credentials(SharedKeyCredential credentials) {
- this.sharedKeyCredential = credentials;
+ public PageBlobClientBuilder snapshot(String snapshot) {
+ this.snapshot = snapshot;
return this;
}
/**
- * Sets the credentials used to authorize requests sent to the service
- * @param credentials authorization credentials
+ * Sets the credential used to authorize requests sent to the service
+ * @param credential authorization credential
* @return the updated PageBlobClientBuilder object
*/
- public PageBlobClientBuilder credentials(TokenCredential credentials) {
- this.tokenCredential = credentials;
+ public PageBlobClientBuilder credential(SharedKeyCredential credential) {
+ this.sharedKeyCredential = credential;
return this;
}
/**
- * Sets the credentials used to authorize requests sent to the service
- * @param credentials authorization credentials
+ * Sets the credential used to authorize requests sent to the service
+ * @param credential authorization credential
* @return the updated PageBlobClientBuilder object
*/
- public PageBlobClientBuilder credentials(SASTokenCredential credentials) {
- this.sasTokenCredential = credentials;
+ public PageBlobClientBuilder credential(TokenCredential credential) {
+ this.tokenCredential = credential;
return this;
}
/**
- * Clears the credentials used to authorize requests sent to the service
+ * Sets the credential used to authorize requests sent to the service
+ * @param credential authorization credential
* @return the updated PageBlobClientBuilder object
*/
- public PageBlobClientBuilder anonymousCredentials() {
+ public PageBlobClientBuilder credential(SASTokenCredential credential) {
+ this.sasTokenCredential = credential;
+ return this;
+ }
+
+ /**
+ * Clears the credential used to authorize requests sent to the service
+ * @return the updated PageBlobClientBuilder object
+ */
+ public PageBlobClientBuilder anonymousCredential() {
this.sharedKeyCredential = null;
this.tokenCredential = null;
return this;
@@ -248,7 +259,7 @@ public PageBlobClientBuilder connectionString(String connectionString) {
}
// Use accountName and accountKey to get the SAS token using the credential class.
- return credentials(new SharedKeyCredential(accountName, accountKey));
+ return credential(new SharedKeyCredential(accountName, accountKey));
}
/**
diff --git a/storage/client/src/main/java/com/azure/storage/blob/StorageAsyncClient.java b/storage/client/src/main/java/com/azure/storage/blob/StorageAsyncClient.java
index 58811c0e7b61..2cf811a4b6b3 100644
--- a/storage/client/src/main/java/com/azure/storage/blob/StorageAsyncClient.java
+++ b/storage/client/src/main/java/com/azure/storage/blob/StorageAsyncClient.java
@@ -5,14 +5,12 @@
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.rest.Response;
-import com.azure.core.http.rest.ResponseBase;
import com.azure.core.http.rest.SimpleResponse;
import com.azure.core.http.rest.VoidResponse;
-import com.azure.core.implementation.http.UrlBuilder;
import com.azure.core.util.Context;
import com.azure.storage.blob.implementation.AzureBlobStorageBuilder;
-import com.azure.storage.blob.implementation.AzureBlobStorageImpl;
import com.azure.storage.blob.models.ContainerItem;
+import com.azure.storage.blob.models.PublicAccessType;
import com.azure.storage.blob.models.ServicesListContainersSegmentResponse;
import com.azure.storage.blob.models.StorageServiceProperties;
import com.azure.storage.blob.models.StorageServiceStats;
@@ -22,7 +20,6 @@
import java.net.MalformedURLException;
import java.net.URL;
-import java.net.UnknownHostException;
import java.time.OffsetDateTime;
/**
@@ -83,6 +80,38 @@ public ContainerAsyncClient getContainerAsyncClient(String containerName) {
.pipeline(storageAsyncRawClient.azureBlobStorage.httpPipeline()));
}
+ /**
+ * Creates a new container within a storage account. If a container with the same name already exists, the operation
+ * fails. For more information, see the
+ * Azure Docs.
+ *
+ * @param containerName Name of the container to create
+ * @return A response containing a {@link ContainerAsyncClient} used to interact with the container created.
+ */
+ public Mono
@@ -142,40 +142,40 @@ String endpoint() {
}
/**
- * Sets the credentials used to authorize requests sent to the service
- * @param credentials authorization credentials
+ * Sets the credential used to authorize requests sent to the service
+ * @param credential authorization credential
* @return the updated ContainerClientBuilder object
*/
- public StorageClientBuilder credentials(SharedKeyCredential credentials) {
- this.sharedKeyCredential = credentials;
+ public StorageClientBuilder credential(SharedKeyCredential credential) {
+ this.sharedKeyCredential = credential;
return this;
}
/**
- * Sets the credentials used to authorize requests sent to the service
- * @param credentials authorization credentials
+ * Sets the credential used to authorize requests sent to the service
+ * @param credential authorization credential
* @return the updated StorageClientBuilder object
*/
- public StorageClientBuilder credentials(TokenCredential credentials) {
- this.tokenCredential = credentials;
+ public StorageClientBuilder credential(TokenCredential credential) {
+ this.tokenCredential = credential;
return this;
}
/**
- * Sets the credentials used to authorize requests sent to the service
- * @param credentials authorization credentials
+ * Sets the credential used to authorize requests sent to the service
+ * @param credential authorization credential
* @return the updated StorageClientBuilder object
*/
- public StorageClientBuilder credentials(SASTokenCredential credentials) {
- this.sasTokenCredential = credentials;
+ public StorageClientBuilder credential(SASTokenCredential credential) {
+ this.sasTokenCredential = credential;
return this;
}
/**
- * Clears the credentials used to authorize requests sent to the service
+ * Clears the credential used to authorize requests sent to the service
* @return the updated StorageClientBuilder object
*/
- public StorageClientBuilder anonymousCredentials() {
+ public StorageClientBuilder anonymousCredential() {
this.sharedKeyCredential = null;
this.tokenCredential = null;
return this;
@@ -210,7 +210,7 @@ public StorageClientBuilder connectionString(String connectionString) {
}
// Use accountName and accountKey to get the SAS token using the credential class.
- return credentials(new SharedKeyCredential(accountName, accountKey));
+ return credential(new SharedKeyCredential(accountName, accountKey));
}
/**
*
*
*