use of com.microsoft.azure.storage.blob.CloudBlobClient in project elasticsearch by elastic.
the class AzureStorageServiceTests method testGetSelectedClientSecondary2.
public void testGetSelectedClientSecondary2() {
AzureStorageServiceImpl azureStorageService = new AzureStorageServiceMock(settings);
CloudBlobClient client = azureStorageService.getSelectedClient("azure3", LocationMode.PRIMARY_ONLY);
assertThat(client.getEndpoint(), is(URI.create("https://azure3")));
}
use of com.microsoft.azure.storage.blob.CloudBlobClient in project elasticsearch by elastic.
the class AzureStorageServiceTests method testGetSelectedClientSecondary1.
public void testGetSelectedClientSecondary1() {
AzureStorageServiceImpl azureStorageService = new AzureStorageServiceMock(settings);
CloudBlobClient client = azureStorageService.getSelectedClient("azure2", LocationMode.PRIMARY_ONLY);
assertThat(client.getEndpoint(), is(URI.create("https://azure2")));
}
use of com.microsoft.azure.storage.blob.CloudBlobClient in project elasticsearch by elastic.
the class AzureStorageServiceTests method testGetSelectedClientWithNoSecondary.
public void testGetSelectedClientWithNoSecondary() {
AzureStorageServiceImpl azureStorageService = new AzureStorageServiceMock(Settings.builder().put("cloud.azure.storage.azure1.account", "myaccount1").put("cloud.azure.storage.azure1.key", "mykey1").build());
CloudBlobClient client = azureStorageService.getSelectedClient("azure1", LocationMode.PRIMARY_ONLY);
assertThat(client.getEndpoint(), is(URI.create("https://azure1")));
}
use of com.microsoft.azure.storage.blob.CloudBlobClient in project elasticsearch by elastic.
the class AzureStorageServiceTests method testGetSelectedClientGlobalTimeout.
public void testGetSelectedClientGlobalTimeout() {
Settings timeoutSettings = Settings.builder().put(settings).put(AzureStorageService.Storage.TIMEOUT_SETTING.getKey(), "10s").build();
AzureStorageServiceImpl azureStorageService = new AzureStorageServiceMock(timeoutSettings);
CloudBlobClient client1 = azureStorageService.getSelectedClient("azure1", LocationMode.PRIMARY_ONLY);
assertThat(client1.getDefaultRequestOptions().getTimeoutIntervalInMs(), is(10 * 1000));
CloudBlobClient client3 = azureStorageService.getSelectedClient("azure3", LocationMode.PRIMARY_ONLY);
assertThat(client3.getDefaultRequestOptions().getTimeoutIntervalInMs(), is(30 * 1000));
}
use of com.microsoft.azure.storage.blob.CloudBlobClient in project hadoop by apache.
the class LocalSASKeyGeneratorImpl method getContainerSASUri.
/**
* Implementation to generate SAS Key for a container
*/
@Override
public URI getContainerSASUri(String accountName, String container) throws SASKeyGenerationException {
try {
CloudStorageAccount account = getSASKeyBasedStorageAccountInstance(accountName);
CloudBlobClient client = account.createCloudBlobClient();
return client.getCredentials().transformUri(client.getContainerReference(container).getUri());
} catch (StorageException stoEx) {
throw new SASKeyGenerationException("Encountered StorageException while" + " generating SAS Key for container " + container + " inside " + "storage account " + accountName, stoEx);
} catch (URISyntaxException uriSyntaxEx) {
throw new SASKeyGenerationException("Encountered URISyntaxException while" + " generating SAS Key for container " + container + " inside storage" + " account " + accountName, uriSyntaxEx);
}
}
Aggregations