use of com.microsoft.azure.storage.blob.CloudBlobClient in project components by Talend.
the class AzureStorageBlobService method setPublicAccess.
public void setPublicAccess(String containerName) throws URISyntaxException, StorageException, InvalidKeyException {
CloudBlobClient cloudBlobClient = connection.getCloudStorageAccount().createCloudBlobClient();
CloudBlobContainer cloudBlobContainer = cloudBlobClient.getContainerReference(containerName);
BlobContainerPermissions containerPermissions = new BlobContainerPermissions();
containerPermissions.setPublicAccess(BlobContainerPublicAccessType.CONTAINER);
cloudBlobContainer.uploadPermissions(containerPermissions);
}
use of com.microsoft.azure.storage.blob.CloudBlobClient in project components by Talend.
the class AzureStorageBlobService method listBlobs.
public Iterable<ListBlobItem> listBlobs(final String containerName, final String prefix, final boolean useFlatBlobListing) throws URISyntaxException, StorageException, InvalidKeyException {
CloudBlobClient cloudBlobClient = connection.getCloudStorageAccount().createCloudBlobClient();
CloudBlobContainer cloudBlobContainer = cloudBlobClient.getContainerReference(containerName);
return cloudBlobContainer.listBlobs(prefix, useFlatBlobListing);
}
use of com.microsoft.azure.storage.blob.CloudBlobClient in project components by Talend.
the class AzureStorageBlobService method deleteContainerIfExist.
/**
* This method delete the container if exist
*/
public boolean deleteContainerIfExist(final String containerName) throws StorageException, URISyntaxException, InvalidKeyException {
CloudBlobClient cloudBlobClient = connection.getCloudStorageAccount().createCloudBlobClient();
CloudBlobContainer cloudBlobContainer = cloudBlobClient.getContainerReference(containerName);
return cloudBlobContainer.deleteIfExists();
}
use of com.microsoft.azure.storage.blob.CloudBlobClient in project components by Talend.
the class AzureStorageBlobService method containerExist.
/**
* @return true if the a container exist with the given name, false otherwise
*/
public boolean containerExist(final String containerName) throws StorageException, URISyntaxException, InvalidKeyException {
CloudBlobClient cloudBlobClient = connection.getCloudStorageAccount().createCloudBlobClient();
CloudBlobContainer cloudBlobContainer = cloudBlobClient.getContainerReference(containerName);
return cloudBlobContainer.exists();
}
use of com.microsoft.azure.storage.blob.CloudBlobClient in project kylo by Teradata.
the class AzureNativeFileSystemProvider method listFiles.
@Nonnull
@Override
@SuppressWarnings("squid:S1075")
public List<DataSetFile> listFiles(@Nonnull final Path path, @Nonnull final Configuration conf) {
// Create Azure Blob client
final URI uri = path.toUri();
final CloudBlobClient client = createBlobClient(uri, conf);
// List containers as data set files
final String pathPrefix = uri.getScheme() + "://";
final String pathSuffix = "@" + uri.getHost() + (uri.getPort() > -1 ? ":" + uri.getPort() : "") + "/";
return StreamSupport.stream(listContainers(client).spliterator(), false).map(container -> {
final DataSetFile file = new DataSetFile();
file.setName(container.getName());
file.setDirectory(true);
file.setModificationTime(container.getProperties().getLastModified().getTime());
file.setPath(pathPrefix + container.getName() + pathSuffix);
return file;
}).collect(Collectors.toList());
}
Aggregations