use of controllers.util.FlashException in project coprhd-controller by CoprHD.
the class FileSystems method fileSystemSnapshotPolicies.
@FlashException(referrer = { "fileSystem" })
public static void fileSystemSnapshotPolicies(String fileSystemId) {
ViPRCoreClient client = BourneUtil.getViprClient();
List<FilePolicyRestRep> filePolicies = Lists.newArrayList();
FileShareRestRep fs = client.fileSystems().get(uri(fileSystemId));
if (fs != null) {
// Get file system snapshot policies!!
if (fs.getFilePolicies() != null && !fs.getFilePolicies().isEmpty()) {
for (String uriPolicy : fs.getFilePolicies()) {
FilePolicyRestRep policyRestRep = client.fileProtectionPolicies().get(uri(uriPolicy));
if (policyRestRep != null) {
filePolicies.add(policyRestRep);
}
}
}
}
render(filePolicies);
}
use of controllers.util.FlashException in project coprhd-controller by CoprHD.
the class FileSystems method save.
@FlashException(referrer = { "fileSystem" })
public static void save(Boolean edit, String id, String fsPath, String exportPath, String security, String anon, String subDir, @As(",") List<String> ro, @As(",") List<String> rw, @As(",") List<String> root, Boolean bypassDnsCheck) {
ExportRule rule = new ExportRule();
rule.setFsID(uri(id));
rule.setMountPoint(fsPath);
rule.setExportPath(exportPath);
rule.setAnon(anon);
rule.setSecFlavor(security);
// Clean up endpoints list by removing all empty items
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);
FileShareExportUpdateParams params = new FileShareExportUpdateParams();
params.setBypassDnsCheck(bypassDnsCheck);
if (!edit) {
params.setExportRulesToAdd(exportRules);
} else {
params.setExportRulesToModify(exportRules);
subDir = FileUtils.findSubDirectory(fsPath, exportPath);
}
ViPRCoreClient client = BourneUtil.getViprClient();
client.fileSystems().updateExport(uri(id), subDir, params);
flash.put("info", MessagesUtils.get("resources.filesystem.export.update"));
fileSystem(id);
}
use of controllers.util.FlashException 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 controllers.util.FlashException 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);
}
use of controllers.util.FlashException in project coprhd-controller by CoprHD.
the class Projects method delete.
@FlashException("list")
public static void delete(@As(",") String[] ids) {
String tenantId = null;
if (ids != null && ids.length > 0) {
ProjectRestRep project = ProjectUtils.getProject(ids[0]);
if (project != null) {
tenantId = project.getTenant().toString();
}
for (String id : ids) {
ProjectUtils.deactivate(uri(id));
}
flash.success(MessagesUtils.get("projects.deleted"));
}
list();
}
Aggregations