private static void handleContainerExists(BlobStore blobStore, String containerName) throws IOException, S3Exception { if (!blobStore.containerExists(containerName)) { throw new S3Exception(S3ErrorCode.NO_SUCH_BUCKET); } }
BlobStore blobStore, String containerName, String blobName) throws IOException, S3Exception { if (!blobStore.containerExists(containerName)) {
private static void handleContainerDelete(HttpServletResponse response, BlobStore blobStore, String containerName) throws IOException, S3Exception { if (!blobStore.containerExists(containerName)) { throw new S3Exception(S3ErrorCode.NO_SUCH_BUCKET); } String blobStoreType = getBlobStoreType(blobStore); if (blobStoreType.equals("b2")) { // S3 allows deleting a container with in-progress MPU while B2 does // not. Explicitly cancel uploads for B2. for (MultipartUpload mpu : blobStore.listMultipartUploads( containerName)) { blobStore.abortMultipartUpload(mpu); } } if (!blobStore.deleteContainerIfEmpty(containerName)) { throw new S3Exception(S3ErrorCode.BUCKET_NOT_EMPTY); } response.setStatus(HttpServletResponse.SC_NO_CONTENT); }
throw new S3Exception(S3ErrorCode.ACCESS_DENIED); if (!blobStore.containerExists(containerName)) { throw new S3Exception(S3ErrorCode.NO_SUCH_BUCKET);
private static void handleContainerExists(BlobStore blobStore, String containerName) throws IOException, S3Exception { if (!blobStore.containerExists(containerName)) { throw new S3Exception(S3ErrorCode.NO_SUCH_BUCKET); } }
private static void handleContainerExists(BlobStore blobStore, String containerName) throws IOException, S3Exception { if (!blobStore.containerExists(containerName)) { throw new S3Exception(S3ErrorCode.NO_SUCH_BUCKET); } }
@Override public boolean containerExists(String container) { return delegate().containerExists(container); }
@Override protected Object doExecute() throws Exception { BlobStore blobStore = getBlobStore(); for (String container : containerNames) { if (!blobStore.containerExists(container)) { throw new ContainerNotFoundException(container, "while checking existence"); } } return null; } }
public BlobStoreConfigurationSource(BlobStoreContext ctx) { this.ctx = checkNotNull(ctx, "ctx"); String container = containerName.get(); checkState(ctx.getBlobStore().containerExists(container), "%s: container %s doesn't exist", ctx.unwrap() .getName(), container); }
public void run() { try { assert view.getBlobStore().containerExists(containerName) : String.format("container %s doesn't exist", containerName); } catch (Exception e) { Throwables.propagate(e); } } });
public void run() { try { assert !view.getBlobStore().containerExists(containerName) : "container " + containerName + " still exists"; } catch (Exception e) { propagateIfPossible(e); } } });
/** * Delete the cloud container and all its contents. * */ public void deleteBucket() { Preconditions.checkNotNull(context); if (context.getBlobStore().containerExists(cloudContainer)) { context.getBlobStore().deleteContainer(cloudContainer); } context.close(); }
@Test(groups = { "integration", "live" }) public void containerDoesntExist() { assert !view.getBlobStore().containerExists("forgetaboutit"); assert !view.getBlobStore().containerExists("cloudcachestorefunctionalintegrationtest-first"); }
@Override protected Result check() throws Exception { BlobStore blobStore = blobStoreContext.getBlobStore(); if (blobStore.containerExists(container)) { return Result.healthy(); } return Result.unhealthy("container does not exist: %s", container); }
/** * Delete the cloud container and all its contents. * */ public void deleteBucket() { Preconditions.checkNotNull(context); if (context.getBlobStore().containerExists(cloudContainer)) { context.getBlobStore().deleteContainer(cloudContainer); } context.close(); }
public void run() { try { assert view.getBlobStore().containerExists(containerName) : String.format("container %s doesn't exist", containerName); } catch (Exception e) { Throwables.propagate(e); } } });
public BlobClusterStateStore(ClusterSpec spec) { this.spec = spec; this.context = BlobStoreContextBuilder.build(spec); this.container = checkNotNull(spec.getStateStoreContainer()); this.blobName = checkNotNull(spec.getStateStoreBlob()); /* create container if it does not already exists */ if (!context.getBlobStore().containerExists(container)) { context.getBlobStore().createContainerInLocation(null, container); } }
@Override public void run() { PageSet<? extends StorageMetadata> list = view.getBlobStore().list(); assert Iterables.any(list, new Predicate<StorageMetadata>() { public boolean apply(StorageMetadata md) { return containerName.equals(md.getName()) && location.equals(md.getLocation()); } }) : String.format("container %s/%s not found in list %s", location, containerName, list); assertTrue(view.getBlobStore().containerExists(containerName), containerName); }
public void testDeleteContainer_EmptyContanier() { boolean result; blobStore.createContainerInLocation(null, CONTAINER_NAME); result = blobStore.containerExists(CONTAINER_NAME); assertTrue(result, "Container doesn't exists"); TestUtils.directoryExists(TARGET_CONTAINER_NAME, true); // delete container blobStore.deleteContainer(CONTAINER_NAME); result = blobStore.containerExists(CONTAINER_NAME); assertFalse(result, "Container still exists"); TestUtils.directoryExists(TARGET_CONTAINER_NAME, false); }
@Test(groups = { "integration", "live" }) public void containerExists() throws InterruptedException { String containerName = getContainerName(); try { assert view.getBlobStore().containerExists(containerName); } finally { returnContainer(containerName); } }