Search in sources :

Example 6 with BlobDirectory

use of com.microsoft.tooling.msservices.model.storage.BlobDirectory in project azure-tools-for-java by Microsoft.

the class StorageClientSDKManager method getRootDirectory.

@NotNull
public BlobDirectory getRootDirectory(@NotNull String connectionString, @NotNull BlobContainer blobContainer) throws AzureCmdException {
    try {
        CloudBlobClient client = getCloudBlobClient(connectionString);
        CloudBlobContainer container = client.getContainerReference(blobContainer.getName());
        CloudBlobDirectory directory = container.getDirectoryReference("");
        String uri = directory.getUri() != null ? directory.getUri().toString() : "";
        return new BlobDirectory("", uri, blobContainer.getName(), "");
    } catch (Throwable t) {
        throw new AzureCmdException("Error retrieving the root Blob Directory", t);
    }
}
Also used : BlobDirectory(com.microsoft.tooling.msservices.model.storage.BlobDirectory) AzureCmdException(com.microsoft.azuretools.azurecommons.helpers.AzureCmdException) NotNull(com.microsoft.azuretools.azurecommons.helpers.NotNull)

Aggregations

BlobDirectory (com.microsoft.tooling.msservices.model.storage.BlobDirectory)6 AzureCmdException (com.microsoft.azuretools.azurecommons.helpers.AzureCmdException)4 BlobFile (com.microsoft.tooling.msservices.model.storage.BlobFile)3 BlobItem (com.microsoft.tooling.msservices.model.storage.BlobItem)3 NotNull (com.microsoft.azuretools.azurecommons.helpers.NotNull)2 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 Task (com.intellij.openapi.progress.Task)1 CallableSingleArg (com.microsoft.tooling.msservices.helpers.CallableSingleArg)1 BufferedInputStream (java.io.BufferedInputStream)1 FileInputStream (java.io.FileInputStream)1 IOException (java.io.IOException)1 SocketTimeoutException (java.net.SocketTimeoutException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 DefaultTableModel (javax.swing.table.DefaultTableModel)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 Job (org.eclipse.core.runtime.jobs.Job)1 PartInitException (org.eclipse.ui.PartInitException)1