use of com.microsoft.azure.storage.blob.CloudBlobClient in project crate by crate.
the class AzureStorageService method deleteFiles.
public void deleteFiles(String container, String path) throws URISyntaxException, StorageException {
final Tuple<CloudBlobClient, Supplier<OperationContext>> client = client();
// container name must be lower case.
LOGGER.trace(() -> new ParameterizedMessage("delete files container [{}], path [{}]", container, path));
// list the blobs using a flat blob listing mode
final CloudBlobContainer blobContainer = client.v1().getContainerReference(container);
for (final ListBlobItem blobItem : blobContainer.listBlobs(path, true, EnumSet.noneOf(BlobListingDetails.class), null, client.v2().get())) {
final String blobName = blobNameFromUri(blobItem.getUri());
LOGGER.trace(() -> new ParameterizedMessage("removing blob [{}] full URI was [{}]", blobName, blobItem.getUri()));
// don't call {@code #deleteBlob}, use the same client
final CloudBlockBlob azureBlob = blobContainer.getBlockBlobReference(blobName);
azureBlob.delete(DeleteSnapshotsOption.NONE, null, null, client.v2().get());
}
}
use of com.microsoft.azure.storage.blob.CloudBlobClient in project crate by crate.
the class AzureStorageServiceTests method testGetSelectedClientBackoffPolicy.
public void testGetSelectedClientBackoffPolicy() {
final AzureStorageService azureStorageService = storageServiceWithSettings(buildClientCredSettings());
final CloudBlobClient client = azureStorageService.client().v1();
assertThat(client.getDefaultRequestOptions().getRetryPolicyFactory(), is(notNullValue()));
assertThat(client.getDefaultRequestOptions().getRetryPolicyFactory(), instanceOf(RetryExponentialRetry.class));
}
use of com.microsoft.azure.storage.blob.CloudBlobClient in project crate by crate.
the class AzureStorageServiceTests method testCreateClientWithEndpointSuffix.
public void testCreateClientWithEndpointSuffix() {
final Settings settings = Settings.builder().put(buildClientCredSettings()).put("endpoint_suffix", "my_endpoint_suffix").build();
final AzureStorageService azureStorageService = storageServiceWithSettings(settings);
final CloudBlobClient client = azureStorageService.client().v1();
assertThat(client.getEndpoint().toString(), equalTo("https://myaccount1.blob.my_endpoint_suffix"));
}
use of com.microsoft.azure.storage.blob.CloudBlobClient in project crate by crate.
the class AzureStorageServiceTests method testGetSelectedClientNoTimeout.
public void testGetSelectedClientNoTimeout() {
final AzureStorageService azureStorageService = storageServiceWithSettings(buildClientCredSettings());
final CloudBlobClient client = azureStorageService.client().v1();
assertThat(client.getDefaultRequestOptions().getTimeoutIntervalInMs(), is(nullValue()));
}
Aggregations