use of com.emc.storageos.model.file.SmbShareResponse in project coprhd-controller by CoprHD.
the class FileProvider method getFileShares.
@Asset("fileShares")
@AssetDependencies("fileFilesystem")
public List<AssetOption> getFileShares(AssetOptionsContext ctx, URI fileFilesystem) {
List<AssetOption> options = Lists.newArrayList();
for (SmbShareResponse share : listFileShares(ctx, fileFilesystem)) {
String label = String.format("%s [%s]", share.getShareName(), share.getMountPoint());
options.add(new AssetOption(share.getShareName(), label));
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.storageos.model.file.SmbShareResponse in project coprhd-controller by CoprHD.
the class FileProvider method getNFSFileShares.
@Asset("fileShares")
@AssetDependencies("fileNFSFilesystem")
public List<AssetOption> getNFSFileShares(AssetOptionsContext ctx, URI fileFilesystem) {
List<AssetOption> options = Lists.newArrayList();
for (SmbShareResponse share : listFileShares(ctx, fileFilesystem)) {
String label = String.format("%s [%s]", share.getShareName(), share.getMountPoint());
options.add(new AssetOption(share.getShareName(), label));
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.storageos.model.file.SmbShareResponse in project coprhd-controller by CoprHD.
the class FileProvider method getCIFSFileShares.
@Asset("fileShares")
@AssetDependencies("fileCIFSFilesystem")
public List<AssetOption> getCIFSFileShares(AssetOptionsContext ctx, URI fileFilesystem) {
List<AssetOption> options = Lists.newArrayList();
for (SmbShareResponse share : listFileShares(ctx, fileFilesystem)) {
String label = String.format("%s [%s]", share.getShareName(), share.getMountPoint());
options.add(new AssetOption(share.getShareName(), label));
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
use of com.emc.storageos.model.file.SmbShareResponse in project coprhd-controller by CoprHD.
the class FileSnapshotService method getFileSystemShareList.
/**
* Lists all SMB shares for the specified snapshot.
*
* @param id
* the URN of a ViPR Snapshot
* @brief List file snapshot SMB shares
* @return List of SMB shares
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/shares")
@CheckPermission(roles = { Role.SYSTEM_MONITOR, Role.TENANT_ADMIN }, acls = { ACL.ANY })
public FileSystemShareList getFileSystemShareList(@PathParam("id") URI id) {
_log.info(String.format("Get list of SMB file shares for snapshot: %1$s", id));
ArgValidator.checkFieldUriType(id, Snapshot.class, "id");
Snapshot snap = queryResource(id);
FileSystemShareList fileShareListResponse = new FileSystemShareList();
if (snap.getInactive()) {
return fileShareListResponse;
}
// Get SMB share map from snapshot
SMBShareMap smbShareMap = snap.getSMBFileShares();
Collection<SMBFileShare> smbShares = new ArrayList<SMBFileShare>();
if (smbShareMap != null) {
smbShares = smbShareMap.values();
}
// Process each share from the map and add its data to shares in response list.
for (SMBFileShare smbShare : smbShares) {
SmbShareResponse shareParam = new SmbShareResponse();
shareParam.setShareName(smbShare.getName());
shareParam.setDescription(smbShare.getDescription());
shareParam.setMaxUsers(Integer.toString(smbShare.getMaxUsers()));
// Check for "unlimited"
if (shareParam.getMaxUsers().equals("-1")) {
shareParam.setMaxUsers(FileService.UNLIMITED_USERS);
}
shareParam.setPermissionType(smbShare.getPermissionType());
shareParam.setPermission(smbShare.getPermission());
shareParam.setMountPoint(smbShare.getMountPoint());
shareParam.setPath(smbShare.getPath());
fileShareListResponse.getShareList().add(shareParam);
}
return fileShareListResponse;
}
Aggregations