Search in sources :

Example 1 with StorageCredentials

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

the class QueueServiceUtil method createQueueClient.

public static CloudQueue createQueueClient(QueueServiceConfiguration cfg) throws Exception {
    CloudQueue client = (CloudQueue) getConfiguredClient(cfg);
    if (client == null) {
        URI uri = prepareStorageQueueUri(cfg);
        StorageCredentials creds = getAccountCredentials(cfg);
        client = new CloudQueue(uri, creds);
    }
    return client;
}
Also used : StorageCredentials(com.microsoft.azure.storage.StorageCredentials) URI(java.net.URI) CloudQueue(com.microsoft.azure.storage.queue.CloudQueue)

Example 2 with StorageCredentials

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

the class BlobServiceUtil method createBlobContainerClient.

public static CloudBlobContainer createBlobContainerClient(BlobServiceConfiguration cfg) throws Exception {
    URI uri = prepareStorageBlobUri(cfg, false);
    StorageCredentials creds = getAccountCredentials(cfg);
    return new CloudBlobContainer(uri, creds);
}
Also used : StorageCredentials(com.microsoft.azure.storage.StorageCredentials) CloudBlobContainer(com.microsoft.azure.storage.blob.CloudBlobContainer) URI(java.net.URI)

Example 3 with StorageCredentials

use of com.microsoft.azure.storage.StorageCredentials 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 StorageCredentials

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

the class BlobServiceComponent method checkCredentials.

private void checkCredentials(BlobServiceConfiguration cfg) {
    CloudBlob client = cfg.getAzureBlobClient();
    StorageCredentials creds = client == null ? cfg.getCredentials() : client.getServiceClient().getCredentials();
    if ((creds == null || creds instanceof StorageCredentialsAnonymous) && !cfg.isPublicForRead()) {
        throw new IllegalArgumentException("Credentials must be specified.");
    }
}
Also used : CloudBlob(com.microsoft.azure.storage.blob.CloudBlob) StorageCredentials(com.microsoft.azure.storage.StorageCredentials) StorageCredentialsAnonymous(com.microsoft.azure.storage.StorageCredentialsAnonymous)

Example 5 with StorageCredentials

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

the class BlobServiceUtil method createAppendBlobClient.

public static CloudAppendBlob createAppendBlobClient(BlobServiceConfiguration cfg) throws Exception {
    CloudAppendBlob client = (CloudAppendBlob) getConfiguredClient(cfg);
    if (client == null) {
        URI uri = prepareStorageBlobUri(cfg);
        StorageCredentials creds = getAccountCredentials(cfg);
        client = new CloudAppendBlob(uri, creds);
    }
    return client;
}
Also used : StorageCredentials(com.microsoft.azure.storage.StorageCredentials) CloudAppendBlob(com.microsoft.azure.storage.blob.CloudAppendBlob) URI(java.net.URI)

Aggregations

StorageCredentials (com.microsoft.azure.storage.StorageCredentials)10 URI (java.net.URI)5 StorageCredentialsAccountAndKey (com.microsoft.azure.storage.StorageCredentialsAccountAndKey)2 CloudQueue (com.microsoft.azure.storage.queue.CloudQueue)2 StorageCredentialsAnonymous (com.microsoft.azure.storage.StorageCredentialsAnonymous)1 StorageCredentialsSharedAccessSignature (com.microsoft.azure.storage.StorageCredentialsSharedAccessSignature)1 CloudAppendBlob (com.microsoft.azure.storage.blob.CloudAppendBlob)1 CloudBlob (com.microsoft.azure.storage.blob.CloudBlob)1 CloudBlobContainer (com.microsoft.azure.storage.blob.CloudBlobContainer)1 CloudBlockBlob (com.microsoft.azure.storage.blob.CloudBlockBlob)1 CloudPageBlob (com.microsoft.azure.storage.blob.CloudPageBlob)1 JndiRegistry (org.apache.camel.impl.JndiRegistry)1