diff --git a/storage/client/blob/CHANGELOG.md b/storage/client/blob/CHANGELOG.md index 32e9b8a3e4a41..27a9660550d7f 100644 --- a/storage/client/blob/CHANGELOG.md +++ b/storage/client/blob/CHANGELOG.md @@ -7,7 +7,7 @@ https://aka.ms/azure-sdk-preview1-java. **Breaking changes: New API design** - Operations are now scoped to a particular client: - - `StorageClient`: StorageURL's functionality was migrated to StorageClient. This client handles account-level operations. This includes managing service properties and listing the containers within an account. + - `BlobServiceClient`: StorageURL's functionality was migrated to BlobServiceClient. This client handles account-level operations. This includes managing service properties and listing the containers within an account. - `ContainerClient`: ContainerURL's functionality was migrated to ContainerClient. The client handles operations for a particular container. This includes creating or deleting that container, as well as listing the blobs within that container. - `BlobClient`: BlobURL's functionality was migrated to BlobClient, TransferManager download functionality was migrated to BlobClient and TransferManager upload functionality was migrated to BlockBlobClient. The client handles most operations, excluding upload, for an individual blob, including downloading data and working with blob properties. There are subclients (BlockBlobClient, PageBlobClient, AppendBlobClient) available for their respective blob types on the service. diff --git a/storage/client/blob/README.md b/storage/client/blob/README.md index 5a90220c5ed7b..a819bc1e98ba4 100644 --- a/storage/client/blob/README.md +++ b/storage/client/blob/README.md @@ -97,9 +97,9 @@ Blob storage is designed for: The following sections provide several code snippets covering some of the most common Azure Storage Blob tasks, including: -- [Create storage client](#create-storage-client) -- [Create container client](#create-container-client) -- [Create blob client](#create-blob-client) +- [Create BlobServiceClient](#create-blobserviceclient) +- [Create ContainerClient](#create-containerclient) +- [Create BlobClient](#create-blobclient) - [Create a container](#create-a-container) - [Upload a blob from InputStream](#uploading-a-blob-from-a-stream) - [Upload a blob from File](#uploading-a-blob-from-file) @@ -108,70 +108,70 @@ The following sections provide several code snippets covering some of the most c - [Enumerating blobs](#enumerating-blobs) - [Authenticate with Azure.Identity](#authenticate-with-azureidentity) -### Create storage client +### Create BlobServiceClient -Create a storage client using the [`sasToken`](#get-credentials) generated above. +Create a BlobServiceClient using the [`sasToken`](#get-credentials) generated above. ```java -StorageClient storageClient = StorageClient.builder() +BlobServiceClient blobServiceClient = new BlobServiceClientBuilder() .endpoint("") .credential("") - .build(); + .buildClient(); ``` -### Create container client +### Create ContainerClient -Create a container client if storage client exists. +Create a ContainerClient if a BlobServiceClient exists. ```java -ContainerClient containerClient = storageClient.getContainerClient("mycontainer"); +ContainerClient containerClient = blobServiceClient.getContainerClient("mycontainer"); ``` or -Create the container client from the builder [`sasToken`](#get-credentials) generated above. +Create the ContainerClient from the builder [`sasToken`](#get-credentials) generated above. ```java -ContainerClient containerClient = ContainerClient.builder() +ContainerClient containerClient = new ContainerClientBuilder() .endpoint("") .credential("") .containerName("mycontainer") - .build(); + .buildClient(); ``` -### Create blob client +### Create BlobClient -Create a blob client if container client exists. +Create a BlobClient if container client exists. ```java BlobClient blobClient = containerClient.getBlobClient("myblob"); ``` or -Create the blob client from the builder [`sasToken`](#get-credentials) generated above. +Create the BlobClient from the builder [`sasToken`](#get-credentials) generated above. ```java -BlobClient blobClient = BlobClient.builder() +BlobClient blobClient = new BlobClientBuilder() .endpoint("") .credential("") .containerName("mycontainer") .blobName("myblob") - .build(); + .buildBlobClient(); ``` ### Create a container -Create a container from storage client. +Create a container from a BlobServiceClient. ```java -storageClient.createContainer("mycontainer"); +blobServiceClient.createContainer("mycontainer"); ``` or -Create a container using container client. +Create a container using ContainerClient. ```java containerClient.create(); ``` ### Uploading a blob from a stream -Upload data stream to a blob using blockBlobClient generated from containerClient. +Upload data stream to a blob using BlockBlobClient generated from a ContainerClient. ```java BlockBlobClient blockBlobClient = containerClient.getBlockBlobClient("myblockblob"); @@ -183,7 +183,7 @@ try (ByteArrayInputStream dataStream = new ByteArrayInputStream(dataSample.getBy ### Uploading a blob from `File` -Upload a file to a blob using blockBlobClient generated from containerClient. +Upload a file to a blob using BlockBlobClient generated from ContainerClient. ```java BlockBlobClient blockBlobClient = containerClient.getBlockBlobClient("myblockblob"); @@ -192,7 +192,7 @@ blobClient.uploadFromFile("local-file.jpg"); ### Downloading a blob to output stream -Download blob to output stream using blobClient. +Download blob to output stream using BlobClient. ```java try(ByteArrayOutputStream outputStream = new ByteArrayOutputStream("downloaded-file.jpg")) { @@ -202,14 +202,14 @@ try(ByteArrayOutputStream outputStream = new ByteArrayOutputStream("downloaded-f ### Downloading a blob to local path -Download blob to local file using blobClient. +Download blob to local file using BlobClient. ```java blobClient.downloadToFile("downloaded-file.jpg"); ``` ### Enumerating blobs -Enumerating all blobs using `ContainerClient` +Enumerating all blobs using ContainerClient ```java containerClient.listBlobsFlat() .forEach( @@ -222,7 +222,7 @@ containerClient.listBlobsFlat() The [Azure Identity library][identity] provides Azure Active Directory support for authenticating with Azure Storage. ```java -StorageClient storageClient = StorageClient.storageClientBuilder() +BlobServiceClient storageClient = BlobServiceClient.storageClientBuilder() .endpoint(endpoint) .credential(new DefaultAzureCredential()) .buildClient(); diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/AnonymousCredentialPolicy.java b/storage/client/blob/src/main/java/com/azure/storage/blob/AnonymousCredentialPolicy.java index d54b264702f6b..d5b1b30df030a 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/AnonymousCredentialPolicy.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/AnonymousCredentialPolicy.java @@ -13,7 +13,7 @@ * Anonymous credentials are to be used with with HTTP(S) requests that read blobs from public containers or requests * that use a Shared Access Signature (SAS). This is because Anonymous credentials will not set an Authorization header. * Pass an instance of this class as the credentials parameter when creating a new pipeline (typically with - * {@link StorageClient}). + * {@link BlobServiceClient}). */ public final class AnonymousCredentialPolicy implements HttpPipelinePolicy { diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java index 7275f0fb326fe..af64a840c8cc5 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java @@ -32,7 +32,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/AppendBlobClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/AppendBlobClient.java index 246fe645af179..65468a2e42b54 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/AppendBlobClient.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/AppendBlobClient.java @@ -31,7 +31,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/BlobAsyncClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java index 1e5f741d3b8a6..d9c24f5859a4d 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java @@ -59,7 +59,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 to the Azure diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/BlobClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobClient.java index e2c6eab47a768..1db6a3526922a 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/BlobClient.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobClient.java @@ -39,7 +39,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}. + * operations on the service are available on {@link BlobServiceClient}. * *

* Please refer to the Azure diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/StorageAsyncClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/StorageAsyncClient.java rename to storage/client/blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java index e84d23ee1dbe0..4738c234387b1 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/StorageAsyncClient.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java @@ -32,7 +32,7 @@ import static com.azure.storage.blob.Utility.postProcessResponse; /** - * Client to a storage account. It may only be instantiated through a {@link StorageClientBuilder}. This class does not + * Client to a storage account. It may only be instantiated through a {@link BlobServiceClientBuilder}. This class does not * hold any state about a particular storage account but is instead a convenient way of sending off appropriate requests * to the resource on the service. It may also be used to construct URLs to blobs and containers. * @@ -50,15 +50,15 @@ * operation, until {@code .subscribe()} is called on the reactive response. You can simply convert one of these * responses to a {@link java.util.concurrent.CompletableFuture} object through {@link Mono#toFuture()}. */ -public final class StorageAsyncClient { +public final class BlobServiceAsyncClient { private final AzureBlobStorageImpl azureBlobStorage; /** - * Package-private constructor for use by {@link StorageClientBuilder}. + * Package-private constructor for use by {@link BlobServiceClientBuilder}. * * @param azureBlobStorageBuilder the API client builder for blob storage API */ - StorageAsyncClient(AzureBlobStorageBuilder azureBlobStorageBuilder) { + BlobServiceAsyncClient(AzureBlobStorageBuilder azureBlobStorageBuilder) { this.azureBlobStorage = azureBlobStorageBuilder.build(); } diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/StorageClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java similarity index 89% rename from storage/client/blob/src/main/java/com/azure/storage/blob/StorageClient.java rename to storage/client/blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java index 5749b1b3fe7d7..782e766330abe 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/StorageClient.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java @@ -24,7 +24,7 @@ import java.time.OffsetDateTime; /** - * Client to a storage account. It may only be instantiated through a {@link StorageClientBuilder}. This class does not + * Client to a storage account. It may only be instantiated through a {@link BlobServiceClientBuilder}. This class does not * hold any state about a particular storage account but is instead a convenient way of sending off appropriate requests * to the resource on the service. It may also be used to construct URLs to blobs and containers. * @@ -36,16 +36,16 @@ * Please see here for more * information on containers. */ -public final class StorageClient { - private final StorageAsyncClient storageAsyncClient; +public final class BlobServiceClient { + private final BlobServiceAsyncClient blobServiceAsyncClient; /** - * Package-private constructor for use by {@link StorageClientBuilder}. + * Package-private constructor for use by {@link BlobServiceClientBuilder}. * - * @param storageAsyncClient the async storage account client + * @param blobServiceAsyncClient the async storage account client */ - StorageClient(StorageAsyncClient storageAsyncClient) { - this.storageAsyncClient = storageAsyncClient; + BlobServiceClient(BlobServiceAsyncClient blobServiceAsyncClient) { + this.blobServiceAsyncClient = blobServiceAsyncClient; } /** @@ -56,7 +56,7 @@ public final class StorageClient { * @return A {@link ContainerClient} object pointing to the specified container */ public ContainerClient getContainerClient(String containerName) { - return new ContainerClient(storageAsyncClient.getContainerAsyncClient(containerName)); + return new ContainerClient(blobServiceAsyncClient.getContainerAsyncClient(containerName)); } /** @@ -96,7 +96,7 @@ public Response createContainer(String containerName, Metadata * @return A response containing status code and HTTP headers */ public VoidResponse deleteContainer(String containerName) { - return storageAsyncClient.deleteContainer(containerName).block(); + return blobServiceAsyncClient.deleteContainer(containerName).block(); } /** @@ -105,7 +105,7 @@ public VoidResponse deleteContainer(String containerName) { * @return the URL. */ public URL getAccountUrl() { - return storageAsyncClient.getAccountUrl(); + return blobServiceAsyncClient.getAccountUrl(); } /** @@ -129,7 +129,7 @@ public Iterable listContainers() { * @return The list of containers. */ public Iterable listContainers(ListContainersOptions options, Duration timeout) { - Flux response = storageAsyncClient.listContainers(options); + Flux response = blobServiceAsyncClient.listContainers(options); return timeout == null ? response.toIterable() : response.timeout(timeout).toIterable(); } @@ -153,7 +153,7 @@ public Response getProperties() { */ public Response getProperties(Duration timeout) { - Mono> response = storageAsyncClient.getProperties(); + Mono> response = blobServiceAsyncClient.getProperties(); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -182,7 +182,7 @@ public VoidResponse setProperties(StorageServiceProperties properties) { * @return The storage account properties. */ public VoidResponse setProperties(StorageServiceProperties properties, Duration timeout) { - Mono response = storageAsyncClient.setProperties(properties); + Mono response = blobServiceAsyncClient.setProperties(properties); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -210,7 +210,7 @@ public Response getUserDelegationKey(OffsetDateTime start, Of */ public Response getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry, Duration timeout) { - Mono> response = storageAsyncClient.getUserDelegationKey(start, expiry); + Mono> response = blobServiceAsyncClient.getUserDelegationKey(start, expiry); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -237,7 +237,7 @@ public Response getStatistics() { * @return The storage account statistics. */ public Response getStatistics(Duration timeout) { - Mono> response = storageAsyncClient.getStatistics(); + Mono> response = blobServiceAsyncClient.getStatistics(); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -260,7 +260,7 @@ public Response getAccountInfo() { * @return The storage account info. */ public Response getAccountInfo(Duration timeout) { - Mono> response = storageAsyncClient.getAccountInfo(); + Mono> response = blobServiceAsyncClient.getAccountInfo(); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -276,7 +276,7 @@ public Response getAccountInfo(Duration timeout) { */ public String generateAccountSAS(AccountSASService accountSASService, AccountSASResourceType accountSASResourceType, AccountSASPermission accountSASPermission, OffsetDateTime expiryTime) { - return this.storageAsyncClient.generateAccountSAS(accountSASService, accountSASResourceType, accountSASPermission, expiryTime); + return this.blobServiceAsyncClient.generateAccountSAS(accountSASService, accountSASResourceType, accountSASPermission, expiryTime); } /** @@ -295,6 +295,6 @@ public String generateAccountSAS(AccountSASService accountSASService, AccountSAS public String generateAccountSAS(AccountSASService accountSASService, AccountSASResourceType accountSASResourceType, AccountSASPermission accountSASPermission, OffsetDateTime expiryTime, OffsetDateTime startTime, String version, IPRange ipRange, SASProtocol sasProtocol) { - return this.storageAsyncClient.generateAccountSAS(accountSASService, accountSASResourceType, accountSASPermission, expiryTime, startTime, version, ipRange, sasProtocol); + return this.blobServiceAsyncClient.generateAccountSAS(accountSASService, accountSASResourceType, accountSASPermission, expiryTime, startTime, version, ipRange, sasProtocol); } } diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/StorageClientBuilder.java b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobServiceClientBuilder.java similarity index 79% rename from storage/client/blob/src/main/java/com/azure/storage/blob/StorageClientBuilder.java rename to storage/client/blob/src/main/java/com/azure/storage/blob/BlobServiceClientBuilder.java index a73249dec8f70..114924273c6cf 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/StorageClientBuilder.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobServiceClientBuilder.java @@ -35,8 +35,8 @@ import java.util.Objects; /** - * Fluent StorageClientBuilder for instantiating a {@link StorageClient} or {@link StorageAsyncClient} - * using {@link StorageClientBuilder#buildClient()} or {@link StorageClientBuilder#buildAsyncClient()} respectively. + * Fluent BlobServiceClientBuilder for instantiating a {@link BlobServiceClient} or {@link BlobServiceAsyncClient} + * using {@link BlobServiceClientBuilder#buildClient()} or {@link BlobServiceClientBuilder#buildAsyncClient()} respectively. * *

* The following information must be provided on this builder: @@ -48,9 +48,9 @@ * *

* Once all the configurations are set on this builder, call {@code .buildClient()} to create a - * {@link StorageClient} or {@code .buildAsyncClient()} to create a {@link StorageAsyncClient}. + * {@link BlobServiceClient} or {@code .buildAsyncClient()} to create a {@link BlobServiceAsyncClient}. */ -public final class StorageClientBuilder { +public final class BlobServiceClientBuilder { private static final String ACCOUNT_NAME = "accountname"; private static final String ACCOUNT_KEY = "accountkey"; private static final String ENDPOINT_PROTOCOL = "defaultendpointsprotocol"; @@ -68,10 +68,10 @@ public final class StorageClientBuilder { private Configuration configuration; /** - * Creates a builder instance that is able to configure and construct {@link StorageClient StorageClients} - * and {@link StorageAsyncClient StorageAsyncClients}. + * Creates a builder instance that is able to configure and construct {@link BlobServiceClient BlobServiceClients} + * and {@link BlobServiceAsyncClient BlobServiceAsyncClients}. */ - public StorageClientBuilder() { + public BlobServiceClientBuilder() { retryOptions = new RequestRetryOptions(); logLevel = HttpLogDetailLevel.NONE; policies = new ArrayList<>(); @@ -116,32 +116,32 @@ private AzureBlobStorageBuilder buildImpl() { } /** - * Creates a {@link StorageClient} based on options set in the Builder. + * Creates a {@link BlobServiceClient} based on options set in the Builder. * - * @return a {@link StorageClient} created from the configurations in this builder. + * @return a {@link BlobServiceClient} created from the configurations in this builder. * @throws NullPointerException If {@code endpoint} is {@code null}. */ - public StorageClient buildClient() { - return new StorageClient(buildAsyncClient()); + public BlobServiceClient buildClient() { + return new BlobServiceClient(buildAsyncClient()); } /** - * Creates a {@link StorageAsyncClient} based on options set in the Builder. + * Creates a {@link BlobServiceAsyncClient} based on options set in the Builder. * - * @return a {@link StorageAsyncClient} created from the configurations in this builder. + * @return a {@link BlobServiceAsyncClient} created from the configurations in this builder. * @throws NullPointerException If {@code endpoint} is {@code null}. */ - public StorageAsyncClient buildAsyncClient() { - return new StorageAsyncClient(buildImpl()); + public BlobServiceAsyncClient buildAsyncClient() { + return new BlobServiceAsyncClient(buildImpl()); } /** * Sets the blob service endpoint, additionally parses it for information (SAS token, queue name) * @param endpoint URL of the service - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object * @throws IllegalArgumentException If {@code endpoint} is {@code null} or is a malformed URL. */ - public StorageClientBuilder endpoint(String endpoint) { + public BlobServiceClientBuilder endpoint(String endpoint) { try { URL url = new URL(endpoint); this.endpoint = url.getProtocol() + "://" + url.getAuthority(); @@ -168,7 +168,7 @@ String endpoint() { * @return the updated ContainerClientBuilder object * @throws NullPointerException If {@code credential} is {@code null}. */ - public StorageClientBuilder credential(SharedKeyCredential credential) { + public BlobServiceClientBuilder credential(SharedKeyCredential credential) { this.sharedKeyCredential = Objects.requireNonNull(credential); this.tokenCredential = null; this.sasTokenCredential = null; @@ -178,10 +178,10 @@ public StorageClientBuilder credential(SharedKeyCredential credential) { /** * Sets the credential used to authorize requests sent to the service * @param credential authorization credential - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object * @throws NullPointerException If {@code credential} is {@code null}. */ - public StorageClientBuilder credential(TokenCredential credential) { + public BlobServiceClientBuilder credential(TokenCredential credential) { this.tokenCredential = Objects.requireNonNull(credential); this.sharedKeyCredential = null; this.sasTokenCredential = null; @@ -191,10 +191,10 @@ public StorageClientBuilder credential(TokenCredential credential) { /** * Sets the credential used to authorize requests sent to the service * @param credential authorization credential - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object * @throws NullPointerException If {@code credential} is {@code null}. */ - public StorageClientBuilder credential(SASTokenCredential credential) { + public BlobServiceClientBuilder credential(SASTokenCredential credential) { this.sasTokenCredential = Objects.requireNonNull(credential); this.sharedKeyCredential = null; this.tokenCredential = null; @@ -203,9 +203,9 @@ public StorageClientBuilder credential(SASTokenCredential credential) { /** * Clears the credential used to authorize requests sent to the service - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object */ - public StorageClientBuilder anonymousCredential() { + public BlobServiceClientBuilder anonymousCredential() { this.sharedKeyCredential = null; this.tokenCredential = null; this.sasTokenCredential = null; @@ -215,10 +215,10 @@ public StorageClientBuilder anonymousCredential() { /** * Sets the connection string for the service, parses it for authentication information (account name, account key) * @param connectionString connection string from access keys section - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object * @throws IllegalArgumentException If {@code connectionString} doesn't contain AccountName or AccountKey. */ - public StorageClientBuilder connectionString(String connectionString) { + public BlobServiceClientBuilder connectionString(String connectionString) { Objects.requireNonNull(connectionString); Map connectionKVPs = new HashMap<>(); @@ -248,10 +248,10 @@ public StorageClientBuilder connectionString(String connectionString) { /** * Sets the http client used to send service requests * @param httpClient http client to send requests - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object * @throws NullPointerException If {@code httpClient} is {@code null}. */ - public StorageClientBuilder httpClient(HttpClient httpClient) { + public BlobServiceClientBuilder httpClient(HttpClient httpClient) { this.httpClient = Objects.requireNonNull(httpClient); return this; } @@ -259,10 +259,10 @@ public StorageClientBuilder httpClient(HttpClient httpClient) { /** * Adds a pipeline policy to apply on each request sent * @param pipelinePolicy a pipeline policy - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object * @throws NullPointerException If {@code pipelinePolicy} is {@code null}. */ - public StorageClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { + public BlobServiceClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { this.policies.add(Objects.requireNonNull(pipelinePolicy)); return this; } @@ -270,9 +270,9 @@ public StorageClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { /** * Sets the logging level for service requests * @param logLevel logging level - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object */ - public StorageClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { + public BlobServiceClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { this.logLevel = logLevel; return this; } @@ -281,9 +281,9 @@ public StorageClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { * Sets the configuration object used to retrieve environment configuration values used to buildClient the client with * when they are not set in the appendBlobClientBuilder, defaults to Configuration.NONE * @param configuration configuration store - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object */ - public StorageClientBuilder configuration(Configuration configuration) { + public BlobServiceClientBuilder configuration(Configuration configuration) { this.configuration = configuration; return this; } @@ -291,10 +291,10 @@ public StorageClientBuilder configuration(Configuration configuration) { /** * Sets the request retry options for all the requests made through the client. * @param retryOptions the options to configure retry behaviors - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object * @throws NullPointerException If {@code retryOptions} is {@code null}. */ - public StorageClientBuilder retryOptions(RequestRetryOptions retryOptions) { + public BlobServiceClientBuilder retryOptions(RequestRetryOptions retryOptions) { this.retryOptions = Objects.requireNonNull(retryOptions); return this; } diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/BlobURLParts.java b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobURLParts.java index 1200e960f7501..5c629e719ca3d 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/BlobURLParts.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobURLParts.java @@ -76,14 +76,14 @@ public BlobURLParts host(String host) { } /** - * The container name or {@code null} if a {@link StorageAsyncClient} was parsed. + * The container name or {@code null} if a {@link BlobServiceAsyncClient} was parsed. */ public String containerName() { return containerName; } /** - * The container name or {@code null} if a {@link StorageAsyncClient} was parsed. + * The container name or {@code null} if a {@link BlobServiceAsyncClient} was parsed. */ public BlobURLParts containerName(String containerName) { this.containerName = containerName; @@ -91,14 +91,14 @@ public BlobURLParts containerName(String containerName) { } /** - * The blob name or {@code null} if a {@link StorageAsyncClient} or {@link ContainerAsyncClient} was parsed. + * The blob name or {@code null} if a {@link BlobServiceAsyncClient} or {@link ContainerAsyncClient} was parsed. */ public String blobName() { return blobName; } /** - * The blob name or {@code null} if a {@link StorageAsyncClient} or {@link ContainerAsyncClient} was parsed. + * The blob name or {@code null} if a {@link BlobServiceAsyncClient} or {@link ContainerAsyncClient} was parsed. */ public BlobURLParts blobName(String blobName) { this.blobName = blobName; diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java index cdb0a06fa68e2..ffb2eddc60b84 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java @@ -50,7 +50,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/BlockBlobClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/BlockBlobClient.java index 6af92555c2b00..69bad81c7ff22 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/BlockBlobClient.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/BlockBlobClient.java @@ -36,7 +36,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/ContainerAsyncClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java index f9cf29c3e79f0..67bd29d4d381d 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java @@ -41,13 +41,13 @@ /** * Client to a container. It may only be instantiated through a {@link ContainerClientBuilder} or via the method {@link - * StorageAsyncClient#getContainerAsyncClient(String)}. This class does not hold any state about a particular blob but + * BlobServiceAsyncClient#getContainerAsyncClient(String)}. This class does not hold any state about a particular blob but * is instead a convenient way of sending off appropriate requests to the resource on the service. It may also be used * to construct URLs to blobs. * *

* This client contains operations on a container. Operations on a blob are available on {@link BlobAsyncClient} through - * {@link #getBlobAsyncClient(String)}, and operations on the service are available on {@link StorageAsyncClient}. + * {@link #getBlobAsyncClient(String)}, and operations on the service are available on {@link BlobServiceAsyncClient}. * *

* Please refer to the Azure @@ -206,12 +206,12 @@ public BlobAsyncClient getBlobAsyncClient(String blobName, String snapshot) { } /** - * Initializes a {@link StorageAsyncClient} object pointing to the storage account this container is in. + * Initializes a {@link BlobServiceAsyncClient} object pointing to the storage account this container is in. * - * @return A {@link StorageAsyncClient} object pointing to the specified storage account + * @return A {@link BlobServiceAsyncClient} object pointing to the specified storage account */ - public StorageAsyncClient getStorageAsyncClient() { - return new StorageAsyncClient(new AzureBlobStorageBuilder() + public BlobServiceAsyncClient getBlobServiceAsyncClient() { + return new BlobServiceAsyncClient(new AzureBlobStorageBuilder() .url(Utility.stripLastPathSegment(getContainerUrl()).toString()) .pipeline(azureBlobStorage.getHttpPipeline())); } diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/ContainerClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/ContainerClient.java index 12d5844a696f4..c66b9d8c2373d 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/ContainerClient.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/ContainerClient.java @@ -26,13 +26,13 @@ /** * Client to a container. It may only be instantiated through a {@link ContainerClientBuilder} or via the method {@link - * StorageClient#getContainerClient(String)}. This class does not hold any state about a particular container but is + * BlobServiceClient#getContainerClient(String)}. This class does not hold any state about a particular container but is * instead a convenient way of sending off appropriate requests to the resource on the service. It may also be used to * construct URLs to blobs. * *

* This client contains operations on a container. Operations on a blob are available on {@link BlobClient} through - * {@link #getBlobClient(String)}, and operations on the service are available on {@link StorageClient}. + * {@link #getBlobClient(String)}, and operations on the service are available on {@link BlobServiceClient}. * *

* Please refer to the 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/PageBlobAsyncClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java index 925f167b2ad91..3f5467a7a6a7b 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 14c0ea4644ded..fc84f9c9ea211 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 8ad4982f32207..69a4eb5ed6c54 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 f51d897112d5d..fbca16f733d72 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 19d3e61a2c75d..ed6c27b57d90a 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 6048911e2d091..54ad226872756 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/AzureIdentityExample.java index 6550c8c02a76d..16bf515d372ec 100644 --- a/storage/client/blob/src/samples/java/AzureIdentityExample.java +++ b/storage/client/blob/src/samples/java/AzureIdentityExample.java @@ -2,8 +2,8 @@ // Licensed under the MIT License. import com.azure.identity.credential.DefaultAzureCredential; -import com.azure.storage.blob.StorageClient; -import com.azure.storage.blob.StorageClientBuilder; +import com.azure.storage.blob.BlobServiceClient; +import com.azure.storage.blob.BlobServiceClientBuilder; 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/BasicExample.java index 3f8edbd367cb8..dbcb6dbfbb60e 100644 --- a/storage/client/blob/src/samples/java/BasicExample.java +++ b/storage/client/blob/src/samples/java/BasicExample.java @@ -3,8 +3,8 @@ import com.azure.storage.blob.BlockBlobClient; import com.azure.storage.blob.ContainerClient; -import com.azure.storage.blob.StorageClient; -import com.azure.storage.blob.StorageClientBuilder; +import com.azure.storage.blob.BlobServiceClient; +import com.azure.storage.blob.BlobServiceClientBuilder; import com.azure.storage.common.credentials.SharedKeyCredential; import java.io.ByteArrayInputStream; @@ -46,9 +46,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/FileTransferExample.java b/storage/client/blob/src/samples/java/FileTransferExample.java index cfd281c1e3f8c..2dc5afc81c619 100644 --- a/storage/client/blob/src/samples/java/FileTransferExample.java +++ b/storage/client/blob/src/samples/java/FileTransferExample.java @@ -3,8 +3,8 @@ import com.azure.storage.blob.BlockBlobClient; import com.azure.storage.blob.ContainerClient; -import com.azure.storage.blob.StorageClient; -import com.azure.storage.blob.StorageClientBuilder; +import com.azure.storage.blob.BlobServiceClient; +import com.azure.storage.blob.BlobServiceClientBuilder; import com.azure.storage.common.credentials.SharedKeyCredential; import java.io.File; @@ -52,10 +52,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/ListContainersExample.java b/storage/client/blob/src/samples/java/ListContainersExample.java index ab8c9b3709bc7..f7cecf62d6362 100644 --- a/storage/client/blob/src/samples/java/ListContainersExample.java +++ b/storage/client/blob/src/samples/java/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; +import com.azure.storage.blob.BlobServiceClient; +import com.azure.storage.blob.BlobServiceClientBuilder; 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/SetMetadataAndHTTPHeadersExample.java b/storage/client/blob/src/samples/java/SetMetadataAndHTTPHeadersExample.java index 6b475499eab2c..909d3f42b475b 100644 --- a/storage/client/blob/src/samples/java/SetMetadataAndHTTPHeadersExample.java +++ b/storage/client/blob/src/samples/java/SetMetadataAndHTTPHeadersExample.java @@ -3,8 +3,8 @@ import com.azure.storage.blob.BlockBlobClient; import com.azure.storage.blob.ContainerClient; -import com.azure.storage.blob.StorageClient; -import com.azure.storage.blob.StorageClientBuilder; +import com.azure.storage.blob.BlobServiceClient; +import com.azure.storage.blob.BlobServiceClientBuilder; import com.azure.storage.blob.models.BlobHTTPHeaders; import com.azure.storage.blob.models.Metadata; import com.azure.storage.common.credentials.SharedKeyCredential; @@ -42,9 +42,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/test/java/com/azure/storage/blob/APISpec.groovy b/storage/client/blob/src/test/java/com/azure/storage/blob/APISpec.groovy index daf12f13fb8e1..abac9b167e18f 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 3c2ee324d1967..b284e65beb8ce 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 d0be4d532642a..bb9da16258978 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 @@ -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 7ebc5e8487cf2..e7955c9b7be9a 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 86da9838d53bb..f82f1d4220eb7 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 a692d6d4c3c34..8bff57d559513 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 2824ac1d3067d..705453b54968d 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 f6d19d6b84167..d5955365880a3 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 d6e8861b47398..830dd34c22034 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))