/** * Returns an enumerable collection of containers for the service client associated with this container. * * @return An enumerable collection of {@link CloudBlobContainer} objects retrieved lazily that represent the * containers for the service client associated with this container. */ @DoesServiceRequest public Iterable<CloudBlobContainer> listContainers() { return this.blobServiceClient.listContainers(); }
/** * Returns an enumerable collection of containers for the service client associated with this container. * * @return An enumerable collection of {@link CloudBlobContainer} objects retrieved lazily that represent the * containers for the service client associated with this container. */ @DoesServiceRequest public Iterable<CloudBlobContainer> listContainers() { return this.blobServiceClient.listContainers(); }
/** * Returns an enumerable collection of containers whose names begin with the specified prefix for the service client * associated with this container. * * @param prefix * A <code>String</code> that represents the container name prefix. * * @return An enumerable collection of {@link CloudBlobContainer} objects retrieved lazily that represent the * containers whose names begin with the specified prefix for the service client associated with this * container. */ @DoesServiceRequest public Iterable<CloudBlobContainer> listContainers(final String prefix) { return this.blobServiceClient.listContainers(prefix); }
/** * Returns an enumerable collection of containers whose names begin with the specified prefix for the service client * associated with this container. * * @param prefix * A <code>String</code> that represents the container name prefix. * * @return An enumerable collection of {@link CloudBlobContainer} objects retrieved lazily that represent the * containers whose names begin with the specified prefix for the service client associated with this * container. */ @DoesServiceRequest public Iterable<CloudBlobContainer> listContainers(final String prefix) { return this.blobServiceClient.listContainers(prefix); }
CloudStorageAccount storageAccount = CloudStorageAccount.parse(storageConnectionString); CloudBlobClient blobClient = storageAccount.createCloudBlobClient(); for(CloudBlobContainer item: blobClient.listContainers()) { System.out.println(item.getName()); }
/** * Returns an enumerable collection of containers whose names begin with the specified prefix for the service client * associated with this container, using the specified details setting, request options, and operation context. * * @param prefix * A <code>String</code> that represents the container name prefix. * @param detailsIncluded * A {@link ContainerListingDetails} value that indicates whether container metadata will be returned. * @param options * A {@link BlobRequestOptions} object that specifies any additional options for the request. Specifying * <code>null</code> will use the default request options from the associated service client ( * {@link CloudBlobClient}). * @param opContext * An {@link OperationContext} object that represents the context for the current operation. This object * is used to track requests to the storage service, and to provide additional runtime information about * the operation. * * @return An enumerable collection of {@link CloudBlobContainer} objects retrieved lazily that represents the * containers for the * service client associated with this container. */ @DoesServiceRequest public Iterable<CloudBlobContainer> listContainers(final String prefix, final ContainerListingDetails detailsIncluded, final BlobRequestOptions options, final OperationContext opContext) { return this.blobServiceClient.listContainers(prefix, detailsIncluded, options, opContext); }
@Override public boolean checkAccess(String username, String password, Properties props) throws Exception { String storageConnectionString = "DefaultEndpointsProtocol=" + props.getProperty("protocol") + ";" + "AccountName=" + Main.cloudAccessKey + ";" + "AccountKey=" + Main.cloudSecretKey; account = CloudStorageAccount.parse(storageConnectionString); serviceClient = account.createCloudBlobClient(); serviceClient.listContainers(); return true; }
/** * Returns an enumerable collection of containers whose names begin with the specified prefix for the service client * associated with this container, using the specified details setting, request options, and operation context. * * @param prefix * A <code>String</code> that represents the container name prefix. * @param detailsIncluded * A {@link ContainerListingDetails} value that indicates whether container metadata will be returned. * @param options * A {@link BlobRequestOptions} object that specifies any additional options for the request. Specifying * <code>null</code> will use the default request options from the associated service client ( * {@link CloudBlobClient}). * @param opContext * An {@link OperationContext} object that represents the context for the current operation. This object * is used to track requests to the storage service, and to provide additional runtime information about * the operation. * * @return An enumerable collection of {@link CloudBlobContainer} objects retrieved lazily that represents the * containers for the * service client associated with this container. */ @DoesServiceRequest public Iterable<CloudBlobContainer> listContainers(final String prefix, final ContainerListingDetails detailsIncluded, final BlobRequestOptions options, final OperationContext opContext) { return this.blobServiceClient.listContainers(prefix, detailsIncluded, options, opContext); }
@NotNull public static String listContainers(@NotNull final StorageInputs inputs) throws Exception { final CloudBlobClient blobClient = getCloudBlobClient(inputs); final List<String> containerList = new ArrayList<>(); for (final CloudBlobContainer blobItem : blobClient.listContainers()) { containerList.add(blobItem.getName()); } return StringUtilities.join(containerList, COMMA); }
public Iterable<CloudBlobContainer> listContainers() throws InvalidKeyException, URISyntaxException { CloudBlobClient cloudBlobClient = connection.getCloudStorageAccount().createCloudBlobClient(); return cloudBlobClient .listContainers(null, ContainerListingDetails.NONE, null, AzureStorageUtils.getTalendOperationContext()); }
public Iterable<CloudBlobContainer> listContainers() throws InvalidKeyException, URISyntaxException { CloudBlobClient cloudBlobClient = connection.getCloudStorageAccount().createCloudBlobClient(); return cloudBlobClient .listContainers(null, ContainerListingDetails.NONE, null, AzureStorageUtils.getTalendOperationContext()); }
CloudStorageAccount cloudStorageAccount = CloudStorageAccount.parse(storageConnectionString); CloudBlobClient cloudBlobClient = cloudStorageAccount.createCloudBlobClient(); Iterable<CloudBlobContainer> containersList= cloudBlobClient.listContainers(); for(CloudBlobContainer container:containersList) { String currentContainerName = container.getName(); logger.debug("Current Container Name : "+currentContainerName); CloudBlobContainer blobContainer = cloudBlobClient.getContainerReference(currentContainerName); CloudPageBlob pageBlob = blobContainer.getPageBlobReference(diskName); if(pageBlob.exists()) return pageBlob.deleteIfExists(); }
@Override public List<NamedThing> getSchemaNames(RuntimeContainer container) throws IOException { List<NamedThing> result = new ArrayList<>(); try { CloudStorageAccount storageAccount = getAzureConnection(container).getCloudStorageAccount(); CloudBlobClient client = storageAccount.createCloudBlobClient(); for (CloudBlobContainer c : client.listContainers()) { result.add(new SimpleNamedThing(c.getName(), c.getName())); } } catch (InvalidKeyException | URISyntaxException e) { throw new ComponentException(e); } return result; }
@Override public List<NamedThing> getSchemaNames(RuntimeContainer container) throws IOException { List<NamedThing> result = new ArrayList<>(); try { CloudStorageAccount storageAccount = getAzureConnection(container).getCloudStorageAccount(); CloudBlobClient client = storageAccount.createCloudBlobClient(); for (CloudBlobContainer c : client.listContainers()) { result.add(new SimpleNamedThing(c.getName(), c.getName())); } } catch (InvalidKeyException | URISyntaxException e) { throw new ComponentException(e); } return result; }
@Test public void testEnumContainers() throws Throwable { describe("Enumerating all the WASB test containers"); int count = 0; CloudStorageAccount storageAccount = getTestAccount().getRealAccount(); CloudBlobClient blobClient = storageAccount.createCloudBlobClient(); Iterable<CloudBlobContainer> containers = blobClient.listContainers(CONTAINER_PREFIX); for (CloudBlobContainer container : containers) { count++; LOG.info("Container {} URI {}", container.getName(), container.getUri()); } LOG.info("Found {} test containers", count); }
/** * If unit tests were interrupted and crushed accidentally, the test containers won't be deleted. * In that case, dev can use this tool to list and delete all test containers. * By default, all test container used in E2E tests sharing same prefix: "abfs-testcontainer-" */ public void checkContainers() throws Throwable { Assume.assumeTrue(this.getAuthType() == AuthType.SharedKey); int count = 0; CloudStorageAccount storageAccount = AzureBlobStorageTestAccount.createTestAccount(); CloudBlobClient blobClient = storageAccount.createCloudBlobClient(); Iterable<CloudBlobContainer> containers = blobClient.listContainers(TEST_CONTAINER_PREFIX); for (CloudBlobContainer container : containers) { count++; LOG.info("Container {}, URI {}", container.getName(), container.getUri()); } LOG.info("Found {} test containers", count); }
public void deleteContainers() throws Throwable { Assume.assumeTrue(this.getAuthType() == AuthType.SharedKey); int count = 0; CloudStorageAccount storageAccount = AzureBlobStorageTestAccount.createTestAccount(); CloudBlobClient blobClient = storageAccount.createCloudBlobClient(); Iterable<CloudBlobContainer> containers = blobClient.listContainers(TEST_CONTAINER_PREFIX); for (CloudBlobContainer container : containers) { LOG.info("Container {} URI {}", container.getName(), container.getUri()); if (container.deleteIfExists()) { count++; } } LOG.info("Deleted {} test containers", count); } }
@Test public void testDeleteContainers() throws Throwable { describe("Delete all the WASB test containers"); int count = 0; CloudStorageAccount storageAccount = getTestAccount().getRealAccount(); CloudBlobClient blobClient = storageAccount.createCloudBlobClient(); Iterable<CloudBlobContainer> containers = blobClient.listContainers(CONTAINER_PREFIX); for (CloudBlobContainer container : containers) { LOG.info("Container {} URI {}", container.getName(), container.getUri()); if (container.deleteIfExists()) { count++; } } LOG.info("Deleted {} test containers", count); }
@Test @Category({ DevFabricTests.class, DevStoreTests.class }) public void testCloudBlobContainerUploadMetadata() throws StorageException, URISyntaxException { this.container.create(); CloudBlobContainer container2 = this.container.getServiceClient().getContainerReference( this.container.getName()); container2.downloadAttributes(); assertEquals(0, container2.getMetadata().size()); this.container.getMetadata().put("key1", "value1"); this.container.uploadMetadata(); container2.downloadAttributes(); assertEquals(1, container2.getMetadata().size()); assertEquals("value1", container2.getMetadata().get("key1")); Iterable<CloudBlobContainer> containers = this.container.getServiceClient().listContainers( this.container.getName(), ContainerListingDetails.METADATA, null, null); for (CloudBlobContainer container3 : containers) { assertEquals(1, container3.getMetadata().size()); assertEquals("value1", container3.getMetadata().get("key1")); } this.container.getMetadata().clear(); this.container.uploadMetadata(); container2.downloadAttributes(); assertEquals(0, container2.getMetadata().size()); }
assertEquals(accessType, container3.downloadPermissions().getPublicAccess()); Iterator<CloudBlobContainer> results = bClient.listContainers(name, ContainerListingDetails.NONE, null, null).iterator(); assertTrue(results.hasNext()); assertEquals(accessType, results.next().properties.getPublicAccess());