Search in sources :

Example 81 with AssetDependencies

use of com.emc.sa.asset.annotation.AssetDependencies 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;
}
Also used : FileSystemExportParam(com.emc.storageos.model.file.FileSystemExportParam) AssetOption(com.emc.vipr.model.catalog.AssetOption) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 82 with AssetDependencies

use of com.emc.sa.asset.annotation.AssetDependencies 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();
}
Also used : FileProtectionRestRep(com.emc.storageos.model.file.FileShareRestRep.FileProtectionRestRep) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) AssetOption(com.emc.vipr.model.catalog.AssetOption) FileShareRestRep(com.emc.storageos.model.file.FileShareRestRep) VirtualArrayRelatedResourceRep(com.emc.storageos.model.VirtualArrayRelatedResourceRep) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 83 with AssetDependencies

use of com.emc.sa.asset.annotation.AssetDependencies 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;
}
Also used : AssetOption(com.emc.vipr.model.catalog.AssetOption) ExportRule(com.emc.storageos.model.file.ExportRule) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 84 with AssetDependencies

use of com.emc.sa.asset.annotation.AssetDependencies 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;
}
Also used : FileSystemExportParam(com.emc.storageos.model.file.FileSystemExportParam) AssetOption(com.emc.vipr.model.catalog.AssetOption) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Example 85 with AssetDependencies

use of com.emc.sa.asset.annotation.AssetDependencies 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;
}
Also used : AssetOption(com.emc.vipr.model.catalog.AssetOption) FilePolicyRestRep(com.emc.storageos.model.file.policy.FilePolicyRestRep) NamedRelatedResourceRep(com.emc.storageos.model.NamedRelatedResourceRep) AssetDependencies(com.emc.sa.asset.annotation.AssetDependencies) Asset(com.emc.sa.asset.annotation.Asset)

Aggregations

Asset (com.emc.sa.asset.annotation.Asset)102 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)102 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)66 AssetOption (com.emc.vipr.model.catalog.AssetOption)63 URI (java.net.URI)43 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)35 ArrayList (java.util.ArrayList)22 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)17 FileShareRestRep (com.emc.storageos.model.file.FileShareRestRep)13 HashSet (java.util.HashSet)12 StoragePortGroupRestRepList (com.emc.storageos.model.portgroup.StoragePortGroupRestRepList)11 VirtualArrayRestRep (com.emc.storageos.model.varray.VirtualArrayRestRep)11 VirtualArrayRelatedResourceRep (com.emc.storageos.model.VirtualArrayRelatedResourceRep)10 BlockConsistencyGroupRestRep (com.emc.storageos.model.block.BlockConsistencyGroupRestRep)10 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)10 BlockSnapshotRestRep (com.emc.storageos.model.block.BlockSnapshotRestRep)8 RelatedResourceRep (com.emc.storageos.model.RelatedResourceRep)7 SimpleValueRep (com.emc.storageos.model.customconfig.SimpleValueRep)7 FileVirtualPoolRestRep (com.emc.storageos.model.vpool.FileVirtualPoolRestRep)7 FilePolicyRestRep (com.emc.storageos.model.file.policy.FilePolicyRestRep)6