Package org.apache.druid.storage.azure
Class AzureUtils
- java.lang.Object
-
- org.apache.druid.storage.azure.AzureUtils
-
public class AzureUtils extends Object
Utility class for miscellaneous things involving Azure.
-
-
Field Summary
Fields Modifier and Type Field Description static com.google.common.base.Predicate<Throwable>
AZURE_RETRY
static String
DEFAULT_AZURE_BLOB_STORAGE_ENDPOINT_SUFFIX
static String
DEFAULT_AZURE_ENDPOINT_SUFFIX
-
Constructor Summary
Constructors Constructor Description AzureUtils(String blobStorageEndpointSuffix)
Creates an AzureUtils object with the blob storage endpoint suffix.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
deleteObjectsInPath(AzureStorage storage, AzureInputDataConfig config, AzureAccountConfig accountConfig, AzureCloudBlobIterableFactory azureCloudBlobIterableFactory, String bucket, String prefix, com.google.common.base.Predicate<CloudBlobHolder> filter)
Delete the files from Azure Storage in a specified bucket, matching a specified prefix and filterstatic String
extractAzureKey(URI uri)
extracts the path component of the supplied uri with any leading '/' characters removed.String
maybeRemoveAzurePathPrefix(String blobPath)
extracts the blob path component of the supplied uri with any leading 'blob.core.windows.net/' string removed.
-
-
-
Field Detail
-
DEFAULT_AZURE_ENDPOINT_SUFFIX
public static final String DEFAULT_AZURE_ENDPOINT_SUFFIX
- See Also:
- Constant Field Values
-
DEFAULT_AZURE_BLOB_STORAGE_ENDPOINT_SUFFIX
public static final String DEFAULT_AZURE_BLOB_STORAGE_ENDPOINT_SUFFIX
- See Also:
- Constant Field Values
-
AZURE_RETRY
public static final com.google.common.base.Predicate<Throwable> AZURE_RETRY
-
-
Constructor Detail
-
AzureUtils
public AzureUtils(String blobStorageEndpointSuffix)
Creates an AzureUtils object with the blob storage endpoint suffix.- Parameters:
blobStorageEndpointSuffix
- the blob storage endpoint, like"blob.core.windows.net"
,"blob.core.chinacloudapi.cn"
or"blob.core.usgovcloudapi.net
"
-
-
Method Detail
-
extractAzureKey
public static String extractAzureKey(URI uri)
extracts the path component of the supplied uri with any leading '/' characters removed.- Parameters:
uri
- the uri to extract the path for- Returns:
- a String representing the path component of the uri with any leading '/' characters removed.
-
maybeRemoveAzurePathPrefix
public String maybeRemoveAzurePathPrefix(String blobPath)
extracts the blob path component of the supplied uri with any leading 'blob.core.windows.net/' string removed.- Parameters:
blobPath
- the path of the blob- Returns:
- a String representing the blob path component of the uri with any leading 'blob.core.windows.net/' string removed characters removed.
-
deleteObjectsInPath
public static void deleteObjectsInPath(AzureStorage storage, AzureInputDataConfig config, AzureAccountConfig accountConfig, AzureCloudBlobIterableFactory azureCloudBlobIterableFactory, String bucket, String prefix, com.google.common.base.Predicate<CloudBlobHolder> filter) throws Exception
Delete the files from Azure Storage in a specified bucket, matching a specified prefix and filter- Parameters:
storage
- Azure Storage clientconfig
- specifies the configuration to use when finding matching files in Azure Storage to deletebucket
- Azure Storage bucketprefix
- the file prefixfilter
- function which returns true if the prefix file found should be deleted and false otherwise.- Throws:
Exception
-
-