use of controllers.util.FlashException 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 controllers.util.FlashException 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 controllers.util.FlashException 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);
}
use of controllers.util.FlashException in project coprhd-controller by CoprHD.
the class FileSystems method addSubDirectory.
/**
* This method called when user adds sub directory.
*
* @param id
* id of the file system.
* @param shareName
* shareName of the sub directory.
* @param subDirectory
* name of the sub directory.
* @param description
* Given description during creation of sub directory.
*/
@FlashException(referrer = { "fileSystem" })
public static void addSubDirectory(String id, String shareName, String subDirectroy, String description) {
ViPRCoreClient client = BourneUtil.getViprClient();
FileSystemShareParam param = new FileSystemShareParam();
param.setShareName(shareName);
if (subDirectroy != null && !"".equals(subDirectroy)) {
param.setSubDirectory(subDirectroy);
}
if (description != null && !"".equals(description)) {
param.setDescription(description);
}
client.fileSystems().share(uri(id), param);
flash.put("info", MessagesUtils.get("resources.filesystem.subdir.add"));
fileSystem(id);
}
use of controllers.util.FlashException in project coprhd-controller by CoprHD.
the class FileSystems method deleteFileSystemShare.
@FlashException(referrer = { "fileSystem" })
public static void deleteFileSystemShare(String fileSystemId, String shareName) {
ViPRCoreClient client = BourneUtil.getViprClient();
Task<FileShareRestRep> task = client.fileSystems().removeShare(uri(fileSystemId), shareName);
flash.put("info", MessagesUtils.get("resources.filesystem.share.deactivate"));
fileSystem(fileSystemId);
}
Aggregations