use of com.emc.storageos.vnxe.models.CifsShareCreateParam in project coprhd-controller by CoprHD.
the class VNXeApiClient method createCIFSShare.
/**
* create cifsShare
*/
public VNXeCommandJob createCIFSShare(String fsId, String cifsName, String permission, String path) throws VNXeException {
_logger.info("creating CIFS share:" + fsId);
FileSystemRequest fsRequest = new FileSystemRequest(_khClient, fsId);
VNXeFileSystem fs = fsRequest.get();
if (fs == null) {
_logger.info("Could not find file system in the vxne");
throw VNXeException.exceptions.vnxeCommandFailed("Could not find file system in the vnxe for: " + fsId);
}
String resourceId = fs.getStorageResource().getId();
ModifyFileSystemParam modifyFSParm = new ModifyFileSystemParam();
CifsShareParam cifsParam = new CifsShareParam();
/*
* CifsShareACE ace = new CifsShareACE();
* ace.setAccessLevel(4);
* ace.setAccessType(1);
* ace.setSid("S-1-5-21-3623811015-3361044348-30300820-1014");
* List<CifsShareACE> aceList = new ArrayList<CifsShareACE>();
* aceList.add(ace);
* cifsParam.setAddACE(aceList);
*/
cifsParam.setIsACEEnabled(false);
if (permission != null && !permission.isEmpty() && permission.equalsIgnoreCase(AccessEnum.READ.name())) {
cifsParam.setIsReadOnly(true);
} else {
cifsParam.setIsReadOnly(false);
}
CifsShareCreateParam cifsCreate = new CifsShareCreateParam();
cifsCreate.setName(cifsName);
cifsCreate.setPath(path);
_logger.info("Creating VNXe CIFS share by name: {} for path: {}", cifsName, path);
List<VNXeCifsServer> cifsServers = getCifsServers(fs.getNasServer().getId());
if (cifsServers == null || cifsServers.isEmpty()) {
throw VNXeException.exceptions.vnxeCommandFailed("The nasServer is not configured to support CIFS");
}
VNXeBase cifsServer = new VNXeBase();
cifsServer.setId(cifsServers.get(0).getId());
cifsCreate.setCifsServer(cifsServer);
cifsCreate.setCifsShareParameters(cifsParam);
netBios = cifsServers.get(0).getNetbiosName();
List<CifsShareCreateParam> cifsCreateList = new ArrayList<CifsShareCreateParam>();
cifsCreateList.add(cifsCreate);
modifyFSParm.setCifsShareCreate(cifsCreateList);
FileSystemActionRequest req = new FileSystemActionRequest(_khClient);
return req.modifyFileSystemAsync(modifyFSParm, resourceId);
}
Aggregations