use of com.emc.storageos.db.client.model.QuotaDirectory in project coprhd-controller by CoprHD.
the class FileDeviceController method recordFileDeviceOperation.
public static void recordFileDeviceOperation(DbClient dbClient, OperationTypeEnum opType, boolean opStatus, String evDesc, String extensions, Object... extParam) {
String evType;
if (evDesc == null || evDesc.isEmpty()) {
evDesc = opType.getDescription();
}
evType = opType.getEvType(opStatus);
String opStage = AuditLogManager.AUDITOP_END;
_log.info("opType: {} detail: {}", opType.toString(), evType + ':' + evDesc);
FileShare fs = null;
Snapshot snapshotObj = null;
QuotaDirectory quotaDirObj = null;
if (extParam[0] instanceof Snapshot) {
snapshotObj = (Snapshot) extParam[0];
fs = (FileShare) extParam[1];
recordSnapshotEvent(dbClient, snapshotObj, fs, evType, evDesc, extensions);
} else if (extParam[0] instanceof QuotaDirectory) {
quotaDirObj = (QuotaDirectory) extParam[0];
fs = (FileShare) extParam[1];
recordQuotaDirectoryEvent(dbClient, quotaDirObj, fs, evType, evDesc, extensions);
} else if (extParam[0] instanceof FileShare) {
fs = (FileShare) extParam[0];
recordFsEvent(dbClient, fs, evType, evDesc, extensions);
} else {
_log.error("unrecognized param list");
}
FileSMBShare smbShare = null;
switch(opType) {
case CREATE_FILE_SYSTEM:
auditFile(dbClient, opType, opStatus, opStage, fs.getLabel(), fs.getVirtualArray().toString(), (fs.getProject() != null) ? fs.getProject().toString() : null);
break;
case DELETE_FILE_SYSTEM:
auditFile(dbClient, opType, opStatus, opStage, fs.getId().toString(), ((StorageSystem) extParam[1]).getId().toString());
break;
case DELETE_FILE_SNAPSHOT:
auditFile(dbClient, opType, opStatus, opStage, snapshotObj.getId().toString(), ((StorageSystem) extParam[2]).getId().toString());
break;
case EXPORT_FILE_SYSTEM:
case UPDATE_EXPORT_RULES_FILE_SYSTEM:
case UPDATE_FILE_SYSTEM_SHARE_ACL:
case UNEXPORT_FILE_SYSTEM:
auditFile(dbClient, opType, opStatus, opStage, fs.getId().toString(), ((StorageSystem) extParam[1]).getId().toString(), extensions);
break;
case EXPAND_FILE_SYSTEM:
case REDUCE_FILE_SYSTEM:
auditFile(dbClient, opType, opStatus, opStage, fs.getId().toString(), extParam[1]);
break;
case CREATE_FILE_SYSTEM_SHARE:
case DELETE_FILE_SYSTEM_SHARE:
smbShare = (FileSMBShare) extParam[1];
auditFile(dbClient, opType, opStatus, opStage, smbShare.getName(), smbShare.getPermissionType(), smbShare.getPermission(), smbShare.getMaxUsers(), smbShare.getDescription(), fs.getId().toString());
break;
case RESTORE_FILE_SNAPSHOT:
URI snapshot = (URI) extParam[1];
auditFile(dbClient, opType, opStatus, opStage, snapshot, fs.getId().toString());
break;
case CREATE_FILE_SYSTEM_SNAPSHOT:
auditFile(dbClient, opType, opStatus, opStage, snapshotObj.getLabel(), snapshotObj.getId(), fs.getId().toString());
break;
case EXPORT_FILE_SNAPSHOT:
case UPDATE_EXPORT_RULES_FILE_SNAPSHOT:
case UPDATE_FILE_SNAPSHOT_SHARE_ACL:
case UNEXPORT_FILE_SNAPSHOT:
auditFile(dbClient, opType, opStatus, opStage, snapshotObj.getId().toString(), ((StorageSystem) extParam[2]).getId().toString(), extensions);
break;
case CREATE_FILE_SNAPSHOT_SHARE:
case DELETE_FILE_SNAPSHOT_SHARE:
smbShare = (FileSMBShare) extParam[2];
auditFile(dbClient, opType, opStatus, opStage, smbShare.getName(), smbShare.getPermissionType(), smbShare.getPermission(), smbShare.getMaxUsers(), smbShare.getDescription(), snapshotObj.getId().toString());
break;
case CREATE_FILE_SYSTEM_QUOTA_DIR:
case DELETE_FILE_SYSTEM_QUOTA_DIR:
case UPDATE_FILE_SYSTEM_QUOTA_DIR:
auditFile(dbClient, opType, opStatus, opStage, quotaDirObj.getLabel(), quotaDirObj.getId(), fs.getId().toString());
break;
case DELETE_FILE_SYSTEM_SHARE_ACL:
auditFile(dbClient, opType, opStatus, opStage, fs.getId().toString(), ((StorageSystem) extParam[1]).getId().toString(), extensions);
break;
case DELETE_FILE_SNAPSHOT_SHARE_ACL:
auditFile(dbClient, opType, opStatus, opStage, snapshotObj.getId().toString(), ((StorageSystem) extParam[2]).getId().toString(), extensions);
break;
case ASSIGN_FILE_SYSTEM_SNAPSHOT_SCHEDULE:
case UNASSIGN_FILE_SYSTEM_SNAPSHOT_SCHEDULE:
auditFile(dbClient, opType, opStatus, opStage, fs.getId().toString(), ((SchedulePolicy) extParam[1]).getId().toString(), extensions);
break;
default:
_log.error("unrecognized fileshare operation type");
}
}
Aggregations