use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.
the class FileSnapshots method save.
@FlashException(referrer = { "snapshot" })
public static void save(Boolean edit, String id, String fsPath, String exportPath, String security, String anon, @As(",") List<String> ro, @As(",") List<String> rw, @As(",") List<String> root) {
ExportRule rule = new ExportRule();
rule.setAnon(anon);
rule.setSecFlavor(security);
// Clean up endpoints list by removing all empty items if any
List<String> empty = Arrays.asList("");
rw.removeAll(empty);
ro.removeAll(empty);
root.removeAll(empty);
if (!ro.isEmpty()) {
rule.setReadOnlyHosts(FileUtils.buildEndpointList(ro));
}
if (!rw.isEmpty()) {
rule.setReadWriteHosts(FileUtils.buildEndpointList(rw));
}
if (!root.isEmpty()) {
rule.setRootHosts(FileUtils.buildEndpointList(root));
}
List<ExportRule> addRules = Lists.newArrayList();
addRules.add(rule);
ExportRules exportRules = new ExportRules();
exportRules.setExportRules(addRules);
SnapshotExportUpdateParams params = new SnapshotExportUpdateParams();
if (!edit) {
params.setExportRulesToAdd(exportRules);
} else {
params.setExportRulesToModify(exportRules);
}
ViPRCoreClient client = BourneUtil.getViprClient();
client.fileSnapshots().updateExport(uri(id), null, params);
flash.put("info", MessagesUtils.get("resources.filesystem.export.update"));
snapshot(id);
}
use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.
the class FileSnapshots method snapshotShares.
public static void snapshotShares(String snapshotId) {
ViPRCoreClient client = BourneUtil.getViprClient();
List<SmbShareResponse> shares = client.fileSnapshots().getShares(uri(snapshotId));
render(shares);
}
use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.
the class FileSnapshots method deleteSnapshotExport.
@FlashException(referrer = { "snapshot" })
public static void deleteSnapshotExport(String snapshotId, String security, String exportPath) {
ViPRCoreClient client = BourneUtil.getViprClient();
ExportRule rule = new ExportRule();
rule.setSecFlavor(security);
List<ExportRule> list = Lists.newArrayList();
list.add(rule);
ExportRules exportRules = new ExportRules();
exportRules.setExportRules(list);
SnapshotExportUpdateParams params = new SnapshotExportUpdateParams();
params.setExportRulesToDelete(exportRules);
FileSnapshotRestRep snapshot = client.fileSnapshots().get(uri(snapshotId));
String subDir = FileUtils.findSubDirectory(snapshot.getMountPath(), exportPath);
client.fileSnapshots().updateExport(uri(snapshotId), subDir, params);
flash.put("info", MessagesUtils.get("resources.filesnapshot.export.deactivate"));
snapshot(snapshotId);
}
use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.
the class FileSystems method unassignPolicyToFileSystem.
@FlashException(referrer = { "fileSystem" })
public static void unassignPolicyToFileSystem(String fileSystemId, String policyId) {
ViPRCoreClient client = BourneUtil.getViprClient();
try {
client.fileSystems().dissociateFilePolicy(uri(fileSystemId), uri(policyId));
} catch (Exception ex) {
flash.error(MessagesUtils.get("schedulePolicy.unassign.error"), null);
}
fileSystem(fileSystemId);
}
use of com.emc.vipr.client.ViPRCoreClient in project coprhd-controller by CoprHD.
the class FileSystems method saveNfsAce.
@FlashException(referrer = { "fileSystem" })
public static void saveNfsAce(NfsACLForm nfsACL) {
String name = params.get("name");
String type = params.get("type");
String domain = params.get("domain");
String subDir = params.get("subDir");
String fsMountPath = params.get("fsMountPath");
String fileSystemId = params.get("fileSystemId");
Set<String> permissions = nfsACL.permissions;
String permissionType = nfsACL.permissionType;
String strPer = "";
nfsACL.validate("nfsACL");
if (Validation.hasErrors()) {
Common.handleError();
}
for (String permission : permissions) {
strPer = strPer + permission.toLowerCase() + ",";
}
strPer = strPer.substring(0, strPer.length() - 1);
List<NfsACE> aces = Lists.newArrayList();
NfsACE nfsAce = new NfsACE();
nfsAce.setType(type.toLowerCase());
nfsAce.setUser(name);
nfsAce.setPermissions(strPer);
nfsAce.setPermissionType(permissionType);
if (domain != null && !"".equals(domain) && !"null".equals(domain)) {
nfsAce.setDomain(domain);
}
aces.add(nfsAce);
FileNfsACLUpdateParams input = new FileNfsACLUpdateParams();
input.setAcesToModify(aces);
if (subDir != null && !"null".equals(subDir)) {
input.setSubDir(subDir);
}
ViPRCoreClient client = BourneUtil.getViprClient();
client.fileSystems().updateNfsACL(uri(fileSystemId), input);
listNfsAcl(fileSystemId, fsMountPath, subDir);
}
Aggregations