>From Michael Blow <[email protected]>:
Michael Blow has uploaded this change for review. (
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20250 )
Change subject: [NO ISSUE][*DB][STO] Support HTTP for Azure Blob Cloud Storage
......................................................................
[NO ISSUE][*DB][STO] Support HTTP for Azure Blob Cloud Storage
Support HTTP connections using shared key credentials (e.g. setting
${AZURE_STORAGE_ACCOUNT} and ${AZURE_STORAGE_KEY} in env).
Ext-ref: MB-68179
Change-Id: I88583c6f7e69c294a95d8b0b30d7dab2ceef1ab9
---
M
asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/azure/blobstorage/AzBlobStorageCloudClient.java
M
asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestConstants.java
2 files changed, 22 insertions(+), 4 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb
refs/changes/50/20250/1
diff --git
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestConstants.java
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestConstants.java
index 8a6b99c..8c59c56 100644
---
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestConstants.java
+++
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestConstants.java
@@ -45,10 +45,8 @@
public static final String ACCOUNT_NAME_PLACEHOLDER =
"%azure-accountname%";
public static final String AZURITE_ACCOUNT_NAME_DEFAULT =
"devstoreaccount1";
public static final int AZURITE_PORT = 15055;
- public static final String AZURITE_HOSTNAME = "127.0.0.1:" +
AZURITE_PORT;
public static final String AZURITE_ENDPOINT =
"http://127.0.0.1:" + AZURITE_PORT + "/" +
AZURITE_ACCOUNT_NAME_DEFAULT;
-
// account key
public static final String ACCOUNT_KEY_PLACEHOLDER =
"%azure-accountkey%";
public static final String AZURITE_ACCOUNT_KEY_DEFAULT =
diff --git
a/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/azure/blobstorage/AzBlobStorageCloudClient.java
b/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/azure/blobstorage/AzBlobStorageCloudClient.java
index e2bbb5b..bbd6b20 100644
---
a/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/azure/blobstorage/AzBlobStorageCloudClient.java
+++
b/asterixdb/asterix-cloud/src/main/java/org/apache/asterix/cloud/clients/azure/blobstorage/AzBlobStorageCloudClient.java
@@ -407,16 +407,23 @@
private static void configCredentialsToAzClient(BlobServiceClientBuilder
builder,
AzBlobStorageClientConfig config) {
- if (config.isAnonymousAuth()) {
+ String storageAccount = System.getenv("AZURE_STORAGE_ACCOUNT");
+ String storageKey = System.getenv("AZURE_STORAGE_KEY");
+
+ if (storageAccount != null && storageKey != null) {
+ StorageSharedKeyCredential creds = new
StorageSharedKeyCredential(storageAccount, storageKey);
+ builder.credential(creds);
+ } else if (config.isAnonymousAuth()) {
+ // TODO(mblow): this mapping anonymous auth -> Azurite default
account (hack) should be removed ASAP
StorageSharedKeyCredential creds =
new StorageSharedKeyCredential(AZURITE_ACCOUNT_NAME,
AZURITE_ACCOUNT_KEY);
- builder.credential(creds);
} else {
builder.credential(config.createCredentialsProvider());
}
}
private static String getEndpoint(AzBlobStorageClientConfig config) {
+ // TODO(mblow): this mapping anonymous auth -> Azurite default
endpoint (hack) should be removed ASAP
return config.isAnonymousAuth() ? AZURITE_ENDPOINT + config.getBucket()
: config.getEndpoint() + "/" + config.getBucket();
}
--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20250
To unsubscribe, or for help writing mail filters, visit
https://asterix-gerrit.ics.uci.edu/settings
Gerrit-Project: asterixdb
Gerrit-Branch: phoenix
Gerrit-Change-Id: I88583c6f7e69c294a95d8b0b30d7dab2ceef1ab9
Gerrit-Change-Number: 20250
Gerrit-PatchSet: 1
Gerrit-Owner: Michael Blow <[email protected]>
Gerrit-MessageType: newchange