Commit d5fb310d authored by Preksha Beohar-Slb's avatar Preksha Beohar-Slb
Browse files

updated formatting

parent 6fac7cdc
Pipeline #48765 failed with stages
in 26 minutes and 45 seconds
......@@ -68,6 +68,17 @@ public class AuditEvents {
.build();
}
public AuditPayload getReadPartitionEvent(AuditStatus status, List<String> resources) {
return AuditPayload.builder()
.action(AuditAction.READ)
.status(status)
.user(this.user)
.actionId(READ_PARTITION_ACTION_ID)
.message(getStatusMessage(status, READ_PARTITION_MESSAGE))
.resources(resources)
.build();
}
public AuditPayload getDeletePartitionEvent(AuditStatus status, List<String> resources) {
return AuditPayload.builder()
.action(AuditAction.DELETE)
......@@ -101,6 +112,17 @@ public class AuditEvents {
.build();
}
public AuditPayload getListPartitionEvent(AuditStatus status, List<String> resources) {
return AuditPayload.builder()
.action(AuditAction.READ)
.status(status)
.user(this.user)
.actionId(READ_LIST_PARTITION_ACTION_ID)
.message(getStatusMessage(status, READ_LIST_PARTITION_MESSAGE))
.resources(resources)
.build();
}
private String getStatusMessage(AuditStatus status, String message) {
return format("%s - %s", message, status.name().toLowerCase());
}
......
......@@ -50,11 +50,11 @@ public class AuditLogger {
}
public void readPartitionSuccess(List<String> resources) {
this.logger.debug(String.format("Successfully read partition: %s",resources));
writeDebugLog(getAuditEvents().getReadPartitionEvent(AuditStatus.SUCCESS, resources));
}
public void readPartitionFailure(List<String> resources) {
this.logger.debug(String.format("Failed reading partition: %s",resources));
writeDebugLog(getAuditEvents().getReadPartitionEvent(AuditStatus.FAILURE, resources));
}
public void deletePartitionSuccess(List<String> resources) {
......@@ -82,14 +82,19 @@ public class AuditLogger {
}
public void readListPartitionSuccess(List<String> resources) {
this.logger.debug(String.format("Read ListPartition Successfully. Partition list size = %s", resources));
writeDebugLog(getAuditEvents().getListPartitionEvent(AuditStatus.SUCCESS, resources));
}
public void readListPartitionFailure(List<String> resources) {
this.logger.debug(String.format("Failed Listing Partitions. Partition list size = %s", resources));
writeDebugLog(getAuditEvents().getListPartitionEvent(AuditStatus.FAILURE, resources));
}
private void writeLog(AuditPayload log) {
this.logger.audit(log);
}
private void writeDebugLog(AuditPayload log) {
this.logger.debug(log.toString());
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment