use of com.emc.storageos.model.file.policy.FilePolicyRestRep in project coprhd-controller by CoprHD.
the class FileProtectionPolicies method unassign.
@FlashException(value = "list", keep = true)
public static void unassign(String ids) {
FilePolicyRestRep filePolicyRestRep = getViprClient().fileProtectionPolicies().get(uri(ids));
if (filePolicyRestRep != null) {
AssignPolicyForm assignPolicy = new AssignPolicyForm().form(filePolicyRestRep);
addRenderApplyPolicysAt();
addAssignedProjectArgs(filePolicyRestRep);
addAssignedVPoolArgs(filePolicyRestRep);
render(assignPolicy);
} else {
flash.error(MessagesUtils.get(UNKNOWN, ids));
list();
}
}
use of com.emc.storageos.model.file.policy.FilePolicyRestRep in project coprhd-controller by CoprHD.
the class FileProvider method getFileTargetVirtualPools.
@Asset("fileTargetVirtualPool")
@AssetDependencies({ "fileFilePolicy" })
public List<AssetOption> getFileTargetVirtualPools(AssetOptionsContext ctx, URI filePolicy) {
List<AssetOption> options = Lists.newArrayList();
ViPRCoreClient client = api(ctx);
FilePolicyRestRep policyRest = client.fileProtectionPolicies().getFilePolicy(filePolicy);
List<FileVirtualPoolRestRep> vpoolChanges = client.fileVpools().getByTenant(ctx.getTenant());
for (FileVirtualPoolRestRep vpool : vpoolChanges) {
if (vpool.getProtection() != null) {
if ((policyRest.getType().equals("file_snapshot") && vpool.getProtection().getScheduleSnapshots()) || (policyRest.getType().equals("file_replication") && vpool.getProtection().getReplicationSupported())) {
options.add(new AssetOption(vpool.getId(), vpool.getName()));
}
}
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.storageos.model.file.policy.FilePolicyRestRep in project coprhd-controller by CoprHD.
the class VirtualArrayProvider method getTargetVirtualArrays.
@Asset("fileTargetVirtualArray")
@AssetDependencies({ "fileFilePolicy", "unprotectedFilesystem" })
public List<AssetOption> getTargetVirtualArrays(AssetOptionsContext context, URI filePolicy, URI fsId) {
ViPRCoreClient client = api(context);
FilePolicyRestRep policyRest = client.fileProtectionPolicies().getFilePolicy(filePolicy);
if (policyRest.getType().equals("file_snapshot")) {
VirtualArrayRestRep vArray = null;
List<AssetOption> options = Lists.newArrayList();
FileShareRestRep fsObj = client.fileSystems().get(fsId);
if (fsObj != null) {
vArray = client.varrays().get(fsObj.getVirtualArray().getId());
options.add(createBaseResourceOption(vArray));
}
return options;
} else {
return getFileVirtualArrays(context);
}
}
use of com.emc.storageos.model.file.policy.FilePolicyRestRep in project coprhd-controller by CoprHD.
the class FileProvider method getFilesystemsWithPolicies.
@Asset("fileFilesystemWithPolicies")
@AssetDependencies("project")
public List<AssetOption> getFilesystemsWithPolicies(AssetOptionsContext ctx, URI project) {
List<AssetOption> options = Lists.newArrayList();
List<FilePolicyRestRep> fileSystemPolicies = getAllFileSystemLevelPolicies(ctx);
List<FileShareRestRep> fileSystems = api(ctx).fileSystems().findByProject(project);
for (FilePolicyRestRep policyRestRep : fileSystemPolicies) {
if (policyRestRep.getAssignedResources() != null && !policyRestRep.getAssignedResources().isEmpty()) {
for (FileShareRestRep fileSystem : fileSystems) {
for (NamedRelatedResourceRep resource : policyRestRep.getAssignedResources()) {
if (resource.getId().equals(fileSystem.getId())) {
options.add(new AssetOption(fileSystem.getId(), fileSystem.getName()));
break;
}
}
}
}
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.storageos.model.file.policy.FilePolicyRestRep in project coprhd-controller by CoprHD.
the class FileProvider method getFileSystemPolicies.
@Asset("fileSystemPolicies")
@AssetDependencies("fileFilesystemWithPolicies")
public List<AssetOption> getFileSystemPolicies(AssetOptionsContext ctx, URI fsId) {
List<AssetOption> options = Lists.newArrayList();
List<FilePolicyRestRep> fileSystemPolicies = getAllFileSystemLevelPolicies(ctx);
for (FilePolicyRestRep policyRestRep : fileSystemPolicies) {
// workaround to display policy name in oder receipt: if fsId is null then list all the policy
if (fsId == null) {
options.add(new AssetOption(policyRestRep.getId(), policyRestRep.getName()));
} else if (policyRestRep.getAssignedResources() != null && !policyRestRep.getAssignedResources().isEmpty()) {
for (NamedRelatedResourceRep resource : policyRestRep.getAssignedResources()) {
if (resource.getId().equals(fsId)) {
options.add(new AssetOption(policyRestRep.getId(), policyRestRep.getName()));
}
}
}
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
Aggregations