>From Michael Blow <[email protected]>:
Michael Blow has submitted this change. (
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
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20250
Reviewed-by: Michael Blow <[email protected]>
Tested-by: Michael Blow <[email protected]>
---
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, 25 insertions(+), 6 deletions(-)
Approvals:
Michael Blow: Looks good to me, approved; Verified
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..d7b680e 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,21 @@
private static void configCredentialsToAzClient(BlobServiceClientBuilder
builder,
AzBlobStorageClientConfig config) {
- if (config.isAnonymousAuth()) {
- StorageSharedKeyCredential creds =
- new StorageSharedKeyCredential(AZURITE_ACCOUNT_NAME,
AZURITE_ACCOUNT_KEY);
- builder.credential(creds);
+ String storageAccount = System.getenv("AZURE_STORAGE_ACCOUNT");
+ String storageKey = System.getenv("AZURE_STORAGE_KEY");
+
+ if (storageAccount != null && storageKey != null) {
+ builder.credential(new StorageSharedKeyCredential(storageAccount,
storageKey));
+ } else if (config.isAnonymousAuth()) {
+ // TODO(mblow): this mapping anonymous auth -> Azurite default
account (hack) should be removed ASAP
+ builder.credential(new
StorageSharedKeyCredential(AZURITE_ACCOUNT_NAME, AZURITE_ACCOUNT_KEY));
} 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: 3
Gerrit-Owner: Michael Blow <[email protected]>
Gerrit-Reviewer: Ali Alsuliman <[email protected]>
Gerrit-Reviewer: Hussain Towaileb <[email protected]>
Gerrit-Reviewer: Jenkins <[email protected]>
Gerrit-Reviewer: Michael Blow <[email protected]>
Gerrit-CC: Anon. E. Moose #1000171
Gerrit-MessageType: merged