/** * Deactivate Bucket, this will move the Bucket to a "marked-for-delete" state * * <p>NOTE: This is an asynchronous operation. * * @param id the URN of a ViPR Bucket * @param param Bucket delete param for optional force delete * @brief Delete Bucket * @return Task resource representation * @throws InternalException */ @POST @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Path("/{id}/deactivate") @CheckPermission( roles = {Role.TENANT_ADMIN}, acls = {ACL.OWN, ACL.ALL}) public TaskResourceRep deactivateBucket(@PathParam("id") URI id, BucketDeleteParam param) throws InternalException { String task = UUID.randomUUID().toString(); _log.info( String.format( "BucketDelete --- Bucket id: %1$s, Task: %2$s, ForceDelete: %3$s", id, task, param.getForceDelete())); ArgValidator.checkFieldUriType(id, Bucket.class, "id"); Bucket bucket = queryResource(id); if (!param.getForceDelete()) { ArgValidator.checkReference(Bucket.class, id, checkForDelete(bucket)); } StorageSystem device = _dbClient.queryObject(StorageSystem.class, bucket.getStorageDevice()); Operation op = _dbClient.createTaskOpStatus( Bucket.class, bucket.getId(), task, ResourceOperationTypeEnum.DELETE_BUCKET); op.setDescription("Bucket deactivate"); ObjectController controller = getController(ObjectController.class, device.getSystemType()); controller.deleteBucket(bucket.getStorageDevice(), id, task); auditOp( OperationTypeEnum.DELETE_BUCKET, true, AuditLogManager.AUDITOP_BEGIN, bucket.getId().toString(), device.getId().toString()); return toTask(bucket, task, op); }