Search in sources :

Example 1 with StorageCredentialsAccountAndKey

use of com.microsoft.azure.storage.StorageCredentialsAccountAndKey in project camel by apache.

the class BlobServiceAppendConsumerTest method createRegistry.

@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();
    registry.bind("creds", new StorageCredentialsAccountAndKey("camelazure", "base64EncodedValue"));
    return registry;
}
Also used : JndiRegistry(org.apache.camel.impl.JndiRegistry) StorageCredentialsAccountAndKey(com.microsoft.azure.storage.StorageCredentialsAccountAndKey)

Example 2 with StorageCredentialsAccountAndKey

use of com.microsoft.azure.storage.StorageCredentialsAccountAndKey in project camel by apache.

the class BlobServiceBlockConsumerTest method createRegistry.

@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();
    registry.bind("creds", new StorageCredentialsAccountAndKey("camelazure", "base64EncodedValue"));
    return registry;
}
Also used : JndiRegistry(org.apache.camel.impl.JndiRegistry) StorageCredentialsAccountAndKey(com.microsoft.azure.storage.StorageCredentialsAccountAndKey)

Example 3 with StorageCredentialsAccountAndKey

use of com.microsoft.azure.storage.StorageCredentialsAccountAndKey in project camel by apache.

the class BlobServiceUtilTest method registerCredentials.

private void registerCredentials() {
    StorageCredentials creds = new StorageCredentialsAccountAndKey("camelazure", Base64.encode("key".getBytes()));
    JndiRegistry registry = (JndiRegistry) ((PropertyPlaceholderDelegateRegistry) context.getRegistry()).getRegistry();
    registry.bind("creds", creds);
}
Also used : JndiRegistry(org.apache.camel.impl.JndiRegistry) StorageCredentials(com.microsoft.azure.storage.StorageCredentials) StorageCredentialsAccountAndKey(com.microsoft.azure.storage.StorageCredentialsAccountAndKey)

Example 4 with StorageCredentialsAccountAndKey

use of com.microsoft.azure.storage.StorageCredentialsAccountAndKey in project hadoop by apache.

the class AzureNativeFileSystemStore method connectUsingConnectionStringCredentials.

/**
   * Connect to Azure storage using account key credentials.
   */
private void connectUsingConnectionStringCredentials(final String accountName, final String containerName, final String accountKey) throws InvalidKeyException, StorageException, IOException, URISyntaxException {
    // If the account name is "acc.blob.core.windows.net", then the
    // rawAccountName is just "acc"
    String rawAccountName = accountName.split("\\.")[0];
    StorageCredentials credentials = new StorageCredentialsAccountAndKey(rawAccountName, accountKey);
    connectUsingCredentials(accountName, credentials, containerName);
}
Also used : StorageCredentials(com.microsoft.azure.storage.StorageCredentials) StorageCredentialsAccountAndKey(com.microsoft.azure.storage.StorageCredentialsAccountAndKey)

Example 5 with StorageCredentialsAccountAndKey

use of com.microsoft.azure.storage.StorageCredentialsAccountAndKey in project hadoop by apache.

the class AzureNativeFileSystemStore method connectUsingCredentials.

private void connectUsingCredentials(String accountName, StorageCredentials credentials, String containerName) throws URISyntaxException, StorageException, AzureException {
    URI blobEndPoint;
    if (isStorageEmulatorAccount(accountName)) {
        isStorageEmulator = true;
        CloudStorageAccount account = CloudStorageAccount.getDevelopmentStorageAccount();
        storageInteractionLayer.createBlobClient(account);
    } else {
        blobEndPoint = new URI(getHTTPScheme() + "://" + accountName);
        storageInteractionLayer.createBlobClient(blobEndPoint, credentials);
    }
    suppressRetryPolicyInClientIfNeeded();
    // Capture the container reference for debugging purposes.
    container = storageInteractionLayer.getContainerReference(containerName);
    rootDirectory = container.getDirectoryReference("");
    // Can only create container if using account key credentials
    canCreateOrModifyContainer = credentials instanceof StorageCredentialsAccountAndKey;
    // Configure Azure storage session.
    configureAzureStorageSession();
}
Also used : CloudStorageAccount(com.microsoft.azure.storage.CloudStorageAccount) StorageCredentialsAccountAndKey(com.microsoft.azure.storage.StorageCredentialsAccountAndKey) URI(java.net.URI)

Aggregations

StorageCredentialsAccountAndKey (com.microsoft.azure.storage.StorageCredentialsAccountAndKey)6 JndiRegistry (org.apache.camel.impl.JndiRegistry)3 CloudStorageAccount (com.microsoft.azure.storage.CloudStorageAccount)2 StorageCredentials (com.microsoft.azure.storage.StorageCredentials)2 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1