Search in sources :

Example 6 with ECSException

use of com.emc.storageos.ecs.api.ECSException in project coprhd-controller by CoprHD.

the class ECSObjectStorageDevice method doUpdateBucket.

@Override
public BiosCommandResult doUpdateBucket(StorageSystem storageObj, Bucket bucket, Long softQuota, Long hardQuota, Integer retention, String taskId) {
    // Update Quota
    ECSApi objectAPI = getAPI(storageObj);
    try {
        objectAPI.updateBucketQuota(bucket.getName(), bucket.getNamespace(), softQuota, hardQuota);
        bucket.setHardQuota(hardQuota);
        bucket.setSoftQuota(softQuota);
    } catch (ECSException e) {
        _log.error("Quota Update for Bucket : {} failed.", bucket.getName(), e);
        completeTask(bucket.getId(), taskId, e);
        return BiosCommandResult.createErrorResult(e);
    }
    // Update Retention
    try {
        objectAPI.updateBucketRetention(bucket.getName(), bucket.getNamespace(), retention);
        bucket.setRetention(retention);
    } catch (ECSException e) {
        _log.error("Retention Update for Bucket : {} failed.", bucket.getName(), e);
        completeTask(bucket.getId(), taskId, e);
        return BiosCommandResult.createErrorResult(e);
    }
    _dbClient.persistObject(bucket);
    completeTask(bucket.getId(), taskId, "Successfully updated Bucket.");
    return BiosCommandResult.createSuccessfulResult();
}
Also used : ECSApi(com.emc.storageos.ecs.api.ECSApi) ECSException(com.emc.storageos.ecs.api.ECSException)

Aggregations

ECSApi (com.emc.storageos.ecs.api.ECSApi)6 ECSException (com.emc.storageos.ecs.api.ECSException)6 ObjectBucketACL (com.emc.storageos.db.client.model.ObjectBucketACL)3 ECSBucketACL (com.emc.storageos.ecs.api.ECSBucketACL)2 BucketACE (com.emc.storageos.model.object.BucketACE)2 BucketACL (com.emc.storageos.model.object.BucketACL)2 BucketACLUpdateParams (com.emc.storageos.model.object.BucketACLUpdateParams)2 BiosCommandResult (com.emc.storageos.volumecontroller.impl.BiosCommandResult)2 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)1 ControllerException (com.emc.storageos.volumecontroller.ControllerException)1 Gson (com.google.gson.Gson)1 URISyntaxException (java.net.URISyntaxException)1