use of com.emc.storageos.model.file.SmbShareResponse in project coprhd-controller by CoprHD.
the class FileService method getFileSystemShareList.
/**
* Get list of SMB shares for the specified file system.
*
* @param id
* the URN of a ViPR File system
* @brief List file system SMB shares
* @return List of file system 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 file system: %1$s", id));
ArgValidator.checkFieldUriType(id, FileShare.class, "id");
FileShare fileShare = queryResource(id);
FileSystemShareList fileShareListResponse = new FileSystemShareList();
if (fileShare.getInactive()) {
return fileShareListResponse;
}
SMBShareMap smbShareMap = fileShare.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(UNLIMITED_USERS);
}
shareParam.setPermissionType(smbShare.getPermissionType());
shareParam.setPermission(smbShare.getPermission());
shareParam.setMountPoint(smbShare.getMountPoint());
shareParam.setPath(smbShare.getPath());
fileShareListResponse.getShareList().add(shareParam);
}
return fileShareListResponse;
}
use of com.emc.storageos.model.file.SmbShareResponse in project coprhd-controller by CoprHD.
the class FileService method getFileSystemShare.
/**
* Get the SMB share for the specified file system.
*
* @param id
* the URN of a ViPR File system
* @param shareName
* file system share name
* @brief Show specified share
* @return List of file system shares.
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}/shares/{shareName}")
@CheckPermission(roles = { Role.SYSTEM_MONITOR, Role.TENANT_ADMIN }, acls = { ACL.ANY })
public SmbShareResponse getFileSystemShare(@PathParam("id") URI id, @PathParam("shareName") String shareName) throws InternalException {
_log.info(String.format("Get SMB file share %s for file system: %s", shareName, id.toString()));
ArgValidator.checkFieldUriType(id, FileShare.class, "id");
ArgValidator.checkFieldNotNull(shareName, "shareName");
FileShare fileShare = queryResource(id);
SMBFileShare smbShare = null;
FileSystemShareList fileShareListResponse = new FileSystemShareList();
SmbShareResponse shareParam = null;
if (fileShare.getSMBFileShares() != null) {
_log.info("Number of SMBShares found {} and looking for share to read {} ", fileShare.getSMBFileShares().size(), shareName);
_log.info(String.format("Get file system share: file system id: %1$s, share name %2$s", id, shareName));
smbShare = fileShare.getSMBFileShares().get(shareName);
if (smbShare == null) {
_log.info("CIFS share does not exist {}", shareName);
} else {
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(UNLIMITED_USERS);
}
shareParam.setPermissionType(smbShare.getPermissionType());
shareParam.setPermission(smbShare.getPermission());
shareParam.setMountPoint(smbShare.getMountPoint());
shareParam.setPath(smbShare.getPath());
}
}
return shareParam;
}
use of com.emc.storageos.model.file.SmbShareResponse in project coprhd-controller by CoprHD.
the class FileSnapshots method snapshotShares.
public static void snapshotShares(String snapshotId) {
ViPRCoreClient client = BourneUtil.getViprClient();
List<SmbShareResponse> shares = client.fileSnapshots().getShares(uri(snapshotId));
render(shares);
}
use of com.emc.storageos.model.file.SmbShareResponse in project coprhd-controller by CoprHD.
the class FileSystems method fileSystemShares.
public static void fileSystemShares(String fileSystemId) {
ViPRCoreClient client = BourneUtil.getViprClient();
List<SmbShareResponse> shares = client.fileSystems().getShares(uri(fileSystemId));
render(shares);
}
use of com.emc.storageos.model.file.SmbShareResponse in project coprhd-controller by CoprHD.
the class FileProvider method getFileSnapshotShares.
@Asset("fileSnapshotShares")
@AssetDependencies("fileSnapshot")
public List<AssetOption> getFileSnapshotShares(AssetOptionsContext ctx, URI fileSnapshot) {
List<AssetOption> options = Lists.newArrayList();
for (SmbShareResponse share : api(ctx).fileSnapshots().getShares(fileSnapshot)) {
String label = String.format("%s [%s]", share.getShareName(), share.getMountPoint());
options.add(new AssetOption(share.getShareName(), label));
}
AssetOptionsUtils.sortOptionsByLabel(options);
return options;
}
Aggregations