Search in sources :

Example 6 with BucketRestRep

use of com.emc.storageos.model.object.BucketRestRep in project coprhd-controller by CoprHD.

the class ObjectBucketsDataTable method fetch.

public static List<Bucket> fetch(URI projectId) {
    if (projectId == null) {
        return Collections.EMPTY_LIST;
    }
    ViPRCoreClient client = getViprClient();
    List<BucketRestRep> buckets = client.objectBuckets().findByProject(projectId);
    Map<URI, String> virtualArrays = ResourceUtils.mapNames(client.varrays().list());
    Map<URI, String> virtualPools = ResourceUtils.mapNames(client.objectVpools().list());
    List<Bucket> results = Lists.newArrayList();
    for (BucketRestRep bucket : buckets) {
        results.add(new Bucket(bucket, virtualArrays, virtualPools));
    }
    return results;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BucketRestRep(com.emc.storageos.model.object.BucketRestRep) URI(java.net.URI)

Example 7 with BucketRestRep

use of com.emc.storageos.model.object.BucketRestRep in project coprhd-controller by CoprHD.

the class ObjectStorageUtils method createBucket.

public static URI createBucket(String bucketName, URI virtualArray, URI virtualPoolId, URI projectId, Double softQuota, Double hardQuota, String retention, String owner) {
    String softQuotaSize = gbToQuotaSize(softQuota);
    String hardQuotaSize = gbToQuotaSize(hardQuota);
    Task<BucketRestRep> task = execute(new CreateBucket(bucketName, virtualArray, virtualPoolId, projectId, softQuotaSize, hardQuotaSize, retention, owner));
    addAffectedResource(task);
    URI bucketId = task.getResourceId();
    addRollback(new DeactivateBucket(bucketId));
    logInfo("object.bucket.task", bucketId, task.getOpId());
    return bucketId;
}
Also used : DeactivateBucket(com.emc.sa.service.vipr.object.tasks.DeactivateBucket) BucketRestRep(com.emc.storageos.model.object.BucketRestRep) CreateBucket(com.emc.sa.service.vipr.object.tasks.CreateBucket) URI(java.net.URI)

Example 8 with BucketRestRep

use of com.emc.storageos.model.object.BucketRestRep in project coprhd-controller by CoprHD.

the class ObjectStorageUtils method removeBucketResource.

public static void removeBucketResource(URI bucketResourceId) {
    Task<BucketRestRep> task = execute(new DeactivateBucket(bucketResourceId));
    addAffectedResource(task);
}
Also used : DeactivateBucket(com.emc.sa.service.vipr.object.tasks.DeactivateBucket) BucketRestRep(com.emc.storageos.model.object.BucketRestRep)

Example 9 with BucketRestRep

use of com.emc.storageos.model.object.BucketRestRep in project coprhd-controller by CoprHD.

the class ObjectStorageUtils method editBucketResource.

public static void editBucketResource(URI bucketResourceId, Double softQuota, Double hardQuota, String retention) {
    String softQuotaSize = gbToQuotaSize(softQuota);
    String hardQuotaSize = gbToQuotaSize(hardQuota);
    Task<BucketRestRep> task = execute(new UpdateBucket(bucketResourceId, softQuotaSize, hardQuotaSize, retention));
    addAffectedResource(task);
}
Also used : UpdateBucket(com.emc.sa.service.vipr.object.tasks.UpdateBucket) BucketRestRep(com.emc.storageos.model.object.BucketRestRep)

Example 10 with BucketRestRep

use of com.emc.storageos.model.object.BucketRestRep in project coprhd-controller by CoprHD.

the class GetBucketResource method executeTask.

@Override
public DataObjectRestRep executeTask() throws Exception {
    ViPRCoreClient client = getClient();
    BucketRestRep bucket = client.objectBuckets().get(resourceId);
    if (bucket != null) {
        return bucket;
    }
    throw stateException("GetBucketResource.illegalState.notFound", resourceId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) BucketRestRep(com.emc.storageos.model.object.BucketRestRep)

Aggregations

BucketRestRep (com.emc.storageos.model.object.BucketRestRep)13 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)7 URI (java.net.URI)4 DeactivateBucket (com.emc.sa.service.vipr.object.tasks.DeactivateBucket)2 BucketDeleteParam (com.emc.storageos.model.object.BucketDeleteParam)2 Task (com.emc.vipr.client.Task)2 CreateBucket (com.emc.sa.service.vipr.object.tasks.CreateBucket)1 SetObjectStorageACL (com.emc.sa.service.vipr.object.tasks.SetObjectStorageACL)1 UpdateBucket (com.emc.sa.service.vipr.object.tasks.UpdateBucket)1 DataObjectRestRep (com.emc.storageos.model.DataObjectRestRep)1 ViPRHttpException (com.emc.vipr.client.exceptions.ViPRHttpException)1 AssetOption (com.emc.vipr.model.catalog.AssetOption)1 FlashException (controllers.util.FlashException)1 BucketACLDataTable (models.datatable.BucketACLDataTable)1 StringOption (util.StringOption)1