use of com.emc.sa.asset.annotation.Asset in project coprhd-controller by CoprHD.
the class FileProvider method getFileExportsWithRootPermissions.
@Asset("fileExportsWithRootPermissions")
@AssetDependencies("fileUnmountedFilesystem")
public List<AssetOption> getFileExportsWithRootPermissions(AssetOptionsContext ctx, URI fileFilesystem) {
List<AssetOption> options = Lists.newArrayList();
for (FileSystemExportParam export : listFileExports(ctx, fileFilesystem)) {
if (export.getPermissions().equalsIgnoreCase("root")) {
options.add(new AssetOption(export.getMountPoint(), export.getMountPoint()));
}
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.sa.asset.annotation.Asset in project coprhd-controller by CoprHD.
the class FileProvider method getFailbackFileTarget.
@Asset("failbackFileTarget")
@AssetDependencies("protectedRemoteFileSystem")
public List<AssetOption> getFailbackFileTarget(AssetOptionsContext ctx, URI protectedFileSystem) {
if (protectedFileSystem != null) {
ViPRCoreClient client = api(ctx);
List<AssetOption> options = Lists.newArrayList();
debug("getting failbackFileTargets (protectedFileSystem=%s)", protectedFileSystem);
FileShareRestRep file = client.fileSystems().get(protectedFileSystem);
FileProtectionRestRep protection = file.getProtection();
if (protection != null) {
List<VirtualArrayRelatedResourceRep> targets = protection.getTargetFileSystems();
for (VirtualArrayRelatedResourceRep target : targets) {
FileShareRestRep fileshare = client.fileSystems().get(target.getId());
options.add(new AssetOption(fileshare.getId(), fileshare.getName()));
}
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
return Lists.newArrayList();
}
use of com.emc.sa.asset.annotation.Asset in project coprhd-controller by CoprHD.
the class FileProvider method getExportedSubdirectory.
@Asset("securityType")
@AssetDependencies({ "fileExportedFilesystem", "subDirectory" })
public List<AssetOption> getExportedSubdirectory(AssetOptionsContext ctx, URI fileExportedFilesystem, String subDirectory) {
List<AssetOption> options = Lists.newArrayList();
String subDir = subDirectory;
if ("!No subdirectory".equalsIgnoreCase(subDir)) {
subDir = null;
}
List<ExportRule> exports = api(ctx).fileSystems().getExport(fileExportedFilesystem, false, subDir);
for (ExportRule rule : exports) {
List<String> securityTypes = Arrays.asList(rule.getSecFlavor().split("\\s*,\\s*"));
for (String sec : securityTypes) {
options.add(new AssetOption(sec, sec));
}
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.sa.asset.annotation.Asset in project coprhd-controller by CoprHD.
the class FileProvider method getCIFSFileExports.
@Asset("fileExports")
@AssetDependencies("fileCIFSFilesystem")
public List<AssetOption> getCIFSFileExports(AssetOptionsContext ctx, URI fileFilesystem) {
List<AssetOption> options = Lists.newArrayList();
for (FileSystemExportParam export : listFileExports(ctx, fileFilesystem)) {
options.add(new AssetOption(export.getMountPoint(), export.getMountPoint()));
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.sa.asset.annotation.Asset 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