use of org.apache.hadoop.fs.azure.KeyProviderException in project kylo by Teradata.
the class AzureNativeFileSystemProvider method getCredentials.
@Nullable
private StorageCredentials getCredentials(@Nonnull final URI uri, @Nonnull final Configuration conf) {
// Find account name
final String accountName = uri.getHost();
if (StringUtils.isEmpty(accountName)) {
throw new CatalogException("catalog.fs.azure.missingAccountName");
}
// Find account key
final String accountKey;
try {
accountKey = AzureNativeFileSystemStore.getAccountKeyFromConfiguration(accountName, conf);
} catch (final KeyProviderException e) {
throw new CatalogException("catalog.fs.azure.invalidAccountKey");
}
// Create credentials
if (StringUtils.isNotEmpty(accountKey)) {
final String rawAccountName = accountName.split("\\.")[0];
return new StorageCredentialsAccountAndKey(rawAccountName, accountKey);
} else {
return null;
}
}
Aggregations