use of com.emc.storageos.model.object.BucketRestRep in project coprhd-controller by CoprHD.
the class ObjectBuckets method bucket.
public static void bucket(String bucketId) {
ViPRCoreClient client = BourneUtil.getViprClient();
BucketRestRep bucket = null;
if (isBucketId(bucketId)) {
try {
bucket = client.objectBuckets().get(uri(bucketId));
} catch (ViPRHttpException e) {
if (e.getHttpCode() == 404) {
flash.error(MessagesUtils.get(UNKNOWN, bucketId));
buckets(null);
}
throw e;
}
}
if (bucket == null) {
notFound(Messages.get("resources.bucket.notfound"));
}
if (bucket.getVirtualArray() != null) {
// NOSONAR
// ("Suppressing Sonar violation of Possible null pointer dereference of volume. When volume is null, the previous if condition handles with throw")
renderArgs.put("virtualArray", VirtualArrayUtils.getVirtualArrayRef(bucket.getVirtualArray()));
}
if (bucket.getVirtualPool() != null) {
renderArgs.put("virtualPool", VirtualPoolUtils.getObjectVirtualPoolRef(bucket.getVirtualPool()));
}
Tasks<BucketRestRep> tasksResponse = client.objectBuckets().getTasks(bucket.getId());
List<Task<BucketRestRep>> tasks = tasksResponse.getTasks();
renderArgs.put("tasks", tasks);
render(bucket);
}
use of com.emc.storageos.model.object.BucketRestRep in project coprhd-controller by CoprHD.
the class ObjectBuckets method editBucketAce.
public static void editBucketAce(@Required String id) {
String type = BucketACLForm.extractTypeFromId(id);
String name = BucketACLForm.extractNameFromId(id);
String domain = BucketACLForm.extractDomainFromId(id);
String bucketId = BucketACLForm.extractBucketFromId(id);
String permissions = BucketACLForm.extractPermissionsFromId(id);
if ("null".equals(domain)) {
domain = "";
}
BucketACLForm bucketACL = new BucketACLForm();
bucketACL.type = type;
bucketACL.domain = domain;
bucketACL.name = name;
String[] strPerm = permissions.split("\\|");
bucketACL.permissions = new HashSet<String>(Arrays.asList(strPerm));
List<StringOption> permissionOptions = BucketACLForm.getPermissionOptions();
renderArgs.put("permissionOptions", permissionOptions);
renderArgs.put("bucketId", bucketId);
ViPRCoreClient client = BourneUtil.getViprClient();
BucketRestRep restRep = client.objectBuckets().get(uri(bucketId));
renderArgs.put("bucketName", restRep.getName());
renderArgs.put("TYPE", type.toUpperCase());
render(bucketACL);
}
use of com.emc.storageos.model.object.BucketRestRep in project coprhd-controller by CoprHD.
the class BucketMapper method map.
public static BucketRestRep map(Bucket from) {
if (from == null) {
return null;
}
BucketRestRep to = new BucketRestRep();
mapDataObjectFields(from, to);
if (null != from.getProject()) {
to.setProject(toRelatedResource(ResourceTypeEnum.PROJECT, from.getProject().getURI()));
}
if (null != from.getTenant()) {
to.setTenant(toRelatedResource(ResourceTypeEnum.TENANT, from.getTenant().getURI()));
}
if (null != from.getRetention()) {
to.setRetention(from.getRetention().toString());
}
to.setHardQuota(CapacityUtils.convertBytesToGBInStr(from.getHardQuota()));
to.setSoftQuota(CapacityUtils.convertBytesToGBInStr(from.getSoftQuota()));
to.setVirtualPool(toRelatedResource(ResourceTypeEnum.OBJECT_VPOOL, from.getVirtualPool()));
to.setVirtualArray(toRelatedResource(ResourceTypeEnum.VARRAY, from.getVirtualArray()));
to.setProtocols(from.getProtocol());
to.setNamespace(from.getNamespace());
to.setOwner(from.getOwner());
to.setPath(from.getPath());
to.setNativeId(from.getNativeId());
return to;
}
Aggregations