use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.
the class FileSystems method fileSystemMirrors.
public static void fileSystemMirrors(String fileSystemId) {
URI id = uri(fileSystemId);
ViPRCoreClient client = BourneUtil.getViprClient();
FileProtectionRestRep targetFileSystems = client.fileSystems().get(id).getProtection();
List<FileShareRestRep> fileMirrors = new ArrayList<FileShareRestRep>();
for (VirtualArrayRelatedResourceRep virtualResource : targetFileSystems.getTargetFileSystems()) {
fileMirrors.add(client.fileSystems().get(virtualResource.getId()));
}
String personality = targetFileSystems.getPersonality();
// The code will be refactored once 1:n or cascaded FS replication is supported
if (!fileMirrors.isEmpty()) {
FileShareRestRep fsRestRep = fileMirrors.get(0);
fsRestRep.getProtection().setMirrorStatus(targetFileSystems.getMirrorStatus());
}
// Verify the replication is at fs level or not
boolean replicationAtFs = false;
FileShareRestRep fs = client.fileSystems().get(id);
if (fs != null) {
FilePolicyRestRep replicationPolicy = getReplicationPolicy(client, fs);
if (replicationPolicy != null) {
if (FilePolicyApplyLevel.file_system.name().equalsIgnoreCase(replicationPolicy.getAppliedAt())) {
replicationAtFs = true;
}
renderArgs.put("replicationPolicy", replicationPolicy);
}
renderArgs.put("replicationAtFsLevel", replicationAtFs);
}
renderArgs.put("personality", personality);
renderArgs.put("fileMirrors", fileMirrors);
renderArgs.put("fileSystemId", fileSystemId);
render();
}
use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.
the class FileSystems method mirrorOperationFileSystem.
@FlashException(referrer = { "fileSystem" })
public static void mirrorOperationFileSystem(String fileSystemId, String mirrorOperation) {
ViPRCoreClient client = BourneUtil.getViprClient();
FileCopy copy = new FileCopy();
copy.setType(LOCAL_MIRROR);
FileReplicationParam param = new FileReplicationParam();
List<FileCopy> listCopy = new ArrayList();
listCopy.add(copy);
param.setCopies(listCopy);
URI fileSystemUri = URI.create(fileSystemId);
if ("refresh".equalsIgnoreCase(mirrorOperation)) {
client.fileSystems().refreshFileContinuousCopies(fileSystemUri, param);
}
if ("stop".equalsIgnoreCase(mirrorOperation)) {
client.fileSystems().stopFileContinuousCopies(fileSystemUri, param);
}
if ("pause".equalsIgnoreCase(mirrorOperation)) {
client.fileSystems().pauseFileContinuousCopies(fileSystemUri, param);
}
if ("resume".equalsIgnoreCase(mirrorOperation)) {
client.fileSystems().resumeContinousCopies(fileSystemUri, param);
}
fileSystem(fileSystemId);
}
use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.
the class ObjectBuckets method addBucketAcl.
public static void addBucketAcl(String bucketId, BucketACLForm bucketACL, String formAccessControlList) {
if (formAccessControlList == null || formAccessControlList.isEmpty()) {
flash.error(MessagesUtils.get("resources.bucket.acl.invalid.settings"));
listBucketACL(bucketId);
}
ObjectBucketACLUpdateParams updateParam = createObjectBucketACLUpdateParams(formAccessControlList);
ViPRCoreClient client = BourneUtil.getViprClient();
try {
client.objectBuckets().updateBucketACL(uri(bucketId), updateParam);
} catch (Exception e) {
flash.error(e.getMessage(), null);
listBucketACL(bucketId);
}
flash.success(MessagesUtils.get(ADDED));
listBucketACL(bucketId);
}
use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.
the class ObjectBuckets method delete.
private static void delete(List<URI> ids, String deleteType) {
if (ids != null) {
ViPRCoreClient client = BourneUtil.getViprClient();
List<Task<BucketRestRep>> tasks = Lists.newArrayList();
for (URI id : ids) {
boolean forceDelete = false;
Task<BucketRestRep> task = client.objectBuckets().deactivate(id, new BucketDeleteParam(forceDelete, deleteType));
tasks.add(task);
}
if (!tasks.isEmpty()) {
flash.put("info", MessagesUtils.get("resources.buckets.deactivate", tasks.size()));
}
}
buckets(null);
}
use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.
the class ObjectBuckets method deleteBucket.
@FlashException(referrer = { "bucket" })
public static void deleteBucket(String bucketId, String deleteType) {
if (StringUtils.isNotBlank(bucketId)) {
ViPRCoreClient client = BourneUtil.getViprClient();
boolean forceDelete = false;
Task<BucketRestRep> task = client.objectBuckets().deactivate(uri(bucketId), new BucketDeleteParam(forceDelete, deleteType));
flash.put("info", MessagesUtils.get("resources.bucket.deactivate"));
}
bucket(bucketId);
}
Aggregations