Class AzureUtils


  • public class AzureUtils
    extends Object
    Utility class for miscellaneous things involving Azure.
    • Field Detail

      • 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 client
        config - specifies the configuration to use when finding matching files in Azure Storage to delete
        bucket - Azure Storage bucket
        prefix - the file prefix
        filter - function which returns true if the prefix file found should be deleted and false otherwise.
        Throws:
        Exception