From 7aa33cd96b1e4bdea63ff309d7f3d2ebc264eda3 Mon Sep 17 00:00:00 2001 From: Denislav Prinov Date: Tue, 22 Apr 2025 08:11:53 +0300 Subject: [PATCH] Refactoring the audit log message -> description field Signed-off-by: Denislav Prinov --- .../ddi/rest/resource/DdiRootController.java | 4 ++-- .../amqp/AmqpMessageHandlerService.java | 2 +- .../rest/resource/MgmtBasicAuthResource.java | 2 +- .../resource/MgmtDistributionSetResource.java | 8 +++---- .../MgmtDistributionSetTagResource.java | 8 +++---- .../MgmtDistributionSetTypeResource.java | 8 +++---- .../rest/resource/MgmtRolloutResource.java | 10 ++++----- .../resource/MgmtSoftwareModuleResource.java | 6 ++--- .../MgmtSoftwareModuleTypeResource.java | 2 +- .../MgmtTargetFilterQueryResource.java | 4 ++-- .../rest/resource/MgmtTargetResource.java | 22 +++++++++---------- .../rest/resource/MgmtTargetTagResource.java | 6 ++--- .../rest/resource/MgmtTargetTypeResource.java | 6 ++--- .../MgmtTenantManagementResource.java | 6 ++--- .../org/eclipse/hawkbit/audit/AuditLog.java | 2 +- .../hawkbit/audit/AuditLoggingAspect.java | 4 ++-- 16 files changed, 50 insertions(+), 50 deletions(-) diff --git a/hawkbit-ddi/hawkbit-ddi-resource/src/main/java/org/eclipse/hawkbit/ddi/rest/resource/DdiRootController.java b/hawkbit-ddi/hawkbit-ddi-resource/src/main/java/org/eclipse/hawkbit/ddi/rest/resource/DdiRootController.java index a2558eb96..19ce8026c 100644 --- a/hawkbit-ddi/hawkbit-ddi-resource/src/main/java/org/eclipse/hawkbit/ddi/rest/resource/DdiRootController.java +++ b/hawkbit-ddi/hawkbit-ddi-resource/src/main/java/org/eclipse/hawkbit/ddi/rest/resource/DdiRootController.java @@ -452,7 +452,7 @@ public class DdiRootController implements DdiRootControllerRestApi { } @Override - @AuditLog(entity = "DDI", type = AuditLog.Type.UPDATE, message = "Activate Auto Confirmation", logResponse = true) + @AuditLog(entity = "DDI", type = AuditLog.Type.UPDATE, description = "Activate Auto Confirmation", logResponse = true) public ResponseEntity activateAutoConfirmation( final String tenant, final String controllerId, final DdiActivateAutoConfirmation body) { final String initiator = body == null ? null : body.getInitiator(); @@ -464,7 +464,7 @@ public class DdiRootController implements DdiRootControllerRestApi { } @Override - @AuditLog(entity = "DDI", type = AuditLog.Type.UPDATE, message = "Deactivate Auto Confirmation", logResponse = true) + @AuditLog(entity = "DDI", type = AuditLog.Type.UPDATE, description = "Deactivate Auto Confirmation", logResponse = true) public ResponseEntity deactivateAutoConfirmation(final String tenant, final String controllerId) { log.debug("Deactivate auto-confirmation request for device ‘{}‘", controllerId); confirmationManagement.deactivateAutoConfirmation(controllerId); diff --git a/hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java b/hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java index c343db58b..75a1270a2 100644 --- a/hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java +++ b/hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java @@ -407,7 +407,7 @@ public class AmqpMessageHandlerService extends BaseAmqpService { } } - @AuditLog(entity = "DMF", type = AuditLog.Type.DELETE, message = "Delete Target", logResponse = true) + @AuditLog(entity = "DMF", type = AuditLog.Type.DELETE, description = "Delete Target", logResponse = true) private void deleteTarget(final Message message) { final String thingId = getStringHeaderKey(message, MessageHeaderKey.THING_ID, THING_ID_NULL); controllerManagement.deleteExistingTarget(thingId); diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtBasicAuthResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtBasicAuthResource.java index a55d82deb..1ba169c5c 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtBasicAuthResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtBasicAuthResource.java @@ -32,7 +32,7 @@ public class MgmtBasicAuthResource implements MgmtBasicAuthRestApi { } @Override - @AuditLog(entity = "BasicAuth", type = AuditLog.Type.READ, message = "Validate Basic Auth") + @AuditLog(entity = "BasicAuth", type = AuditLog.Type.READ, description = "Validate Basic Auth") public ResponseEntity validateBasicAuth() { final MgmtUserInfo userInfo = new MgmtUserInfo(); userInfo.setTenant(tenantAware.getCurrentTenant()); diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetResource.java index 68a426bef..c69dc4901 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetResource.java @@ -169,14 +169,14 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi { } @Override - @AuditLog(entity = "DistributionSet", type = AuditLog.Type.DELETE, message = "Delete Distribution Set") + @AuditLog(entity = "DistributionSet", type = AuditLog.Type.DELETE, description = "Delete Distribution Set") public ResponseEntity deleteDistributionSet(final Long distributionSetId) { distributionSetManagement.delete(distributionSetId); return ResponseEntity.ok().build(); } @Override - @AuditLog(entity = "DistributionSet", type = AuditLog.Type.UPDATE, message = "Update Distribution Set") + @AuditLog(entity = "DistributionSet", type = AuditLog.Type.UPDATE, description = "Update Distribution Set") public ResponseEntity updateDistributionSet( final Long distributionSetId, final MgmtDistributionSetRequestBodyPut toUpdate) { @@ -346,7 +346,7 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi { } @Override - @AuditLog(entity = "DistributionSet", type = AuditLog.Type.DELETE, message = "Delete Assigned Distribution Set") + @AuditLog(entity = "DistributionSet", type = AuditLog.Type.DELETE, description = "Delete Assigned Distribution Set") public ResponseEntity deleteAssignSoftwareModules(final Long distributionSetId, final Long softwareModuleId) { distributionSetManagement.unassignSoftwareModule(distributionSetId, softwareModuleId); return ResponseEntity.ok().build(); @@ -400,7 +400,7 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi { } @Override - @AuditLog(entity = "DistributionSet", type = AuditLog.Type.DELETE, message = "Invalidate Distribution Set") + @AuditLog(entity = "DistributionSet", type = AuditLog.Type.DELETE, description = "Invalidate Distribution Set") public ResponseEntity invalidateDistributionSet( final Long distributionSetId, final MgmtInvalidateDistributionSetRequestBody invalidateRequestBody) { distributionSetInvalidationManagement diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTagResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTagResource.java index ed5d2ad34..2a6c87113 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTagResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTagResource.java @@ -100,7 +100,7 @@ public class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRes } @Override - @AuditLog(entity = "DistributionSetTag", type = AuditLog.Type.UPDATE, message = "Update Distribution Set Tag") + @AuditLog(entity = "DistributionSetTag", type = AuditLog.Type.UPDATE, description = "Update Distribution Set Tag") public ResponseEntity updateDistributionSetTag( final Long distributionsetTagId, final MgmtTagRequestBodyPut restDSTagRest) { @@ -116,7 +116,7 @@ public class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRes } @Override - @AuditLog(entity = "DistributionSetTag", type = AuditLog.Type.DELETE, message = "Delete Distribution Set Tag") + @AuditLog(entity = "DistributionSetTag", type = AuditLog.Type.DELETE, description = "Delete Distribution Set Tag") public ResponseEntity deleteDistributionSetTag( final Long distributionsetTagId) { log.debug("Delete {} distribution set tag", distributionsetTagId); @@ -172,7 +172,7 @@ public class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRes } @Override - @AuditLog(entity = "DistributionSetTag", type = AuditLog.Type.UPDATE, message = "Unassign Distribution Set From Tag") + @AuditLog(entity = "DistributionSetTag", type = AuditLog.Type.UPDATE, description = "Unassign Distribution Set From Tag") public ResponseEntity unassignDistributionSet( final Long distributionsetTagId, final Long distributionsetId) { @@ -182,7 +182,7 @@ public class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRes } @Override - @AuditLog(entity = "DistributionSetTag", type = AuditLog.Type.UPDATE, message = "Unassign Distribution Sets From Tag") + @AuditLog(entity = "DistributionSetTag", type = AuditLog.Type.UPDATE, description = "Unassign Distribution Sets From Tag") public ResponseEntity unassignDistributionSets( final Long distributionsetTagId, final List distributionsetIds) { diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTypeResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTypeResource.java index 7965918bb..399fdc6a9 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTypeResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtDistributionSetTypeResource.java @@ -88,7 +88,7 @@ public class MgmtDistributionSetTypeResource implements MgmtDistributionSetTypeR } @Override - @AuditLog(entity = "DistributionSetType", type = AuditLog.Type.DELETE, message = "Delete Distribution Set Type") + @AuditLog(entity = "DistributionSetType", type = AuditLog.Type.DELETE, description = "Delete Distribution Set Type") public ResponseEntity deleteDistributionSetType(final Long distributionSetTypeId) { distributionSetTypeManagement.delete(distributionSetTypeId); @@ -96,7 +96,7 @@ public class MgmtDistributionSetTypeResource implements MgmtDistributionSetTypeR } @Override - @AuditLog(entity = "DistributionSetType", type = AuditLog.Type.UPDATE, message = "Update Distribution Set Type") + @AuditLog(entity = "DistributionSetType", type = AuditLog.Type.UPDATE, description = "Update Distribution Set Type") public ResponseEntity updateDistributionSetType( final Long distributionSetTypeId, final MgmtDistributionSetTypeRequestBodyPut restDistributionSetType) { final DistributionSetType updated = distributionSetTypeManagement.update(entityFactory.distributionSetType() @@ -156,7 +156,7 @@ public class MgmtDistributionSetTypeResource implements MgmtDistributionSetTypeR } @Override - @AuditLog(entity = "DistributionSetType", type = AuditLog.Type.UPDATE, message = "Remove Mandatory Module From Distribution Set Type") + @AuditLog(entity = "DistributionSetType", type = AuditLog.Type.UPDATE, description = "Remove Mandatory Module From Distribution Set Type") public ResponseEntity removeMandatoryModule(final Long distributionSetTypeId, final Long softwareModuleTypeId) { distributionSetTypeManagement.unassignSoftwareModuleType(distributionSetTypeId, softwareModuleTypeId); return ResponseEntity.ok().build(); @@ -168,7 +168,7 @@ public class MgmtDistributionSetTypeResource implements MgmtDistributionSetTypeR } @Override - @AuditLog(entity = "DistributionSetType", type = AuditLog.Type.UPDATE, message = "Add Mandatory Module From Distribution Set Type") + @AuditLog(entity = "DistributionSetType", type = AuditLog.Type.UPDATE, description = "Add Mandatory Module From Distribution Set Type") public ResponseEntity addMandatoryModule(final Long distributionSetTypeId, final MgmtId smtId) { distributionSetTypeManagement.assignMandatorySoftwareModuleTypes(distributionSetTypeId, Collections.singletonList(smtId.getId())); return ResponseEntity.ok().build(); diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtRolloutResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtRolloutResource.java index 219d2fd06..472de8527 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtRolloutResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtRolloutResource.java @@ -181,28 +181,28 @@ public class MgmtRolloutResource implements MgmtRolloutRestApi { } @Override - @AuditLog(entity = "Rollout", type = AuditLog.Type.UPDATE, message = "Start Rollout") + @AuditLog(entity = "Rollout", type = AuditLog.Type.UPDATE, description = "Start Rollout") public ResponseEntity start(final Long rolloutId) { this.rolloutManagement.start(rolloutId); return ResponseEntity.ok().build(); } @Override - @AuditLog(entity = "Rollout", type = AuditLog.Type.UPDATE, message = "Pause Rollout") + @AuditLog(entity = "Rollout", type = AuditLog.Type.UPDATE, description = "Pause Rollout") public ResponseEntity pause(final Long rolloutId) { this.rolloutManagement.pauseRollout(rolloutId); return ResponseEntity.ok().build(); } @Override - @AuditLog(entity = "Rollout", type = AuditLog.Type.DELETE, message = "Delete Rollout") + @AuditLog(entity = "Rollout", type = AuditLog.Type.DELETE, description = "Delete Rollout") public ResponseEntity delete(final Long rolloutId) { this.rolloutManagement.delete(rolloutId); return ResponseEntity.ok().build(); } @Override - @AuditLog(entity = "Rollout", type = AuditLog.Type.UPDATE, message = "Resume Rollout") + @AuditLog(entity = "Rollout", type = AuditLog.Type.UPDATE, description = "Resume Rollout") public ResponseEntity resume(final Long rolloutId) { this.rolloutManagement.resumeRollout(rolloutId); return ResponseEntity.ok().build(); @@ -281,7 +281,7 @@ public class MgmtRolloutResource implements MgmtRolloutRestApi { } @Override - @AuditLog(entity = "Rollout", type = AuditLog.Type.UPDATE, message = "Trigger Next Rollout Group") + @AuditLog(entity = "Rollout", type = AuditLog.Type.UPDATE, description = "Trigger Next Rollout Group") public ResponseEntity triggerNextGroup(final Long rolloutId) { this.rolloutManagement.triggerNextGroup(rolloutId); return ResponseEntity.ok().build(); diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleResource.java index 9872085eb..6ab318f94 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleResource.java @@ -147,7 +147,7 @@ public class MgmtSoftwareModuleResource implements MgmtSoftwareModuleRestApi { } @Override - @AuditLog(entity = "SoftwareModule", type = AuditLog.Type.DELETE, message = "Delete Software Module Artifact") + @AuditLog(entity = "SoftwareModule", type = AuditLog.Type.DELETE, description = "Delete Software Module Artifact") public ResponseEntity deleteArtifact(final Long softwareModuleId, final Long artifactId) { findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, artifactId); artifactManagement.delete(artifactId); @@ -225,7 +225,7 @@ public class MgmtSoftwareModuleResource implements MgmtSoftwareModuleRestApi { } @Override - @AuditLog(entity = "SoftwareModule", type = AuditLog.Type.DELETE, message = "Delete Software Module") + @AuditLog(entity = "SoftwareModule", type = AuditLog.Type.DELETE, description = "Delete Software Module") public ResponseEntity deleteSoftwareModule(final Long softwareModuleId) { final SoftwareModule module = findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, null); softwareModuleManagement.delete(module.getId()); @@ -277,7 +277,7 @@ public class MgmtSoftwareModuleResource implements MgmtSoftwareModuleRestApi { } @Override - @AuditLog(entity = "SoftwareModule", type = AuditLog.Type.DELETE, message = "Delete Software Module Metadata") + @AuditLog(entity = "SoftwareModule", type = AuditLog.Type.DELETE, description = "Delete Software Module Metadata") public ResponseEntity deleteMetadata(final Long softwareModuleId, final String metadataKey) { softwareModuleManagement.deleteMetaData(softwareModuleId, metadataKey); return ResponseEntity.ok().build(); diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleTypeResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleTypeResource.java index cef721b95..8c3f07893 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleTypeResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtSoftwareModuleTypeResource.java @@ -75,7 +75,7 @@ public class MgmtSoftwareModuleTypeResource implements MgmtSoftwareModuleTypeRes } @Override - @AuditLog(entity = "SoftwareModuleType", type = AuditLog.Type.DELETE, message = "Delete Software Module Type") + @AuditLog(entity = "SoftwareModuleType", type = AuditLog.Type.DELETE, description = "Delete Software Module Type") public ResponseEntity deleteSoftwareModuleType(final Long softwareModuleTypeId) { softwareModuleTypeManagement.delete(softwareModuleTypeId); return ResponseEntity.ok().build(); diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetFilterQueryResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetFilterQueryResource.java index 1d4460b90..a291714e6 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetFilterQueryResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetFilterQueryResource.java @@ -128,7 +128,7 @@ public class MgmtTargetFilterQueryResource implements MgmtTargetFilterQueryRestA } @Override - @AuditLog(entity = "TargetFilter", type = AuditLog.Type.DELETE, message = "Delete Target Filter") + @AuditLog(entity = "TargetFilter", type = AuditLog.Type.DELETE, description = "Delete Target Filter") public ResponseEntity deleteFilter(final Long filterId) { filterManagement.delete(filterId); log.debug("{} target filter query deleted, return status {}", filterId, HttpStatus.OK); @@ -171,7 +171,7 @@ public class MgmtTargetFilterQueryResource implements MgmtTargetFilterQueryRestA } @Override - @AuditLog(entity = "TargetFilter", type = AuditLog.Type.DELETE, message = "Delete Target Filter Assigned Distribution Set") + @AuditLog(entity = "TargetFilter", type = AuditLog.Type.DELETE, description = "Delete Target Filter Assigned Distribution Set") public ResponseEntity deleteAssignedDistributionSet(final Long filterId) { filterManagement.updateAutoAssignDS(entityFactory.targetFilterQuery().updateAutoAssign(filterId).ds(null)); return ResponseEntity.noContent().build(); diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetResource.java index 050002d57..7456ba707 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetResource.java @@ -139,7 +139,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi { } @Override - @AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, message = "Update Target") + @AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, description = "Update Target") public ResponseEntity updateTarget(final String targetId, final MgmtTargetRequestBody targetRest) { if (targetRest.getRequestAttributes() != null) { if (Boolean.TRUE.equals(targetRest.getRequestAttributes())) { @@ -174,7 +174,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi { } @Override - @AuditLog(entity = "Target", type = AuditLog.Type.DELETE, message = "Delete Target") + @AuditLog(entity = "Target", type = AuditLog.Type.DELETE, description = "Delete Target") public ResponseEntity deleteTarget(final String targetId) { this.targetManagement.deleteByControllerID(targetId); log.debug("{} target deleted, return status {}", targetId, HttpStatus.OK); @@ -182,14 +182,14 @@ public class MgmtTargetResource implements MgmtTargetRestApi { } @Override - @AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, message = "Unassign Target Type") + @AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, description = "Unassign Target Type") public ResponseEntity unassignTargetType(final String targetId) { this.targetManagement.unassignType(targetId); return ResponseEntity.ok().build(); } @Override - @AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, message = "Assign Target") + @AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, description = "Assign Target") public ResponseEntity assignTargetType(final String targetId, final MgmtId targetTypeId) { this.targetManagement.assignType(targetId, targetTypeId.getId()); return ResponseEntity.ok().build(); @@ -250,7 +250,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi { } @Override - @AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, message = "Cancel Target Action") + @AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, description = "Cancel Target Action") public ResponseEntity cancelAction(final String targetId, final Long actionId, final boolean force) { final Action action = deploymentManagement.findAction(actionId) .orElseThrow(() -> new EntityNotFoundException(Action.class, actionId)); @@ -272,7 +272,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi { } @Override - @AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, message = "Update Target Action") + @AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, description = "Update Target Action") public ResponseEntity updateAction(final String targetId, final Long actionId, final MgmtActionRequestBodyPut actionUpdate) { Action action = deploymentManagement.findAction(actionId) @@ -292,7 +292,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi { } @Override - @AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, message = "Cancel Target Action Confirmation") + @AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, description = "Cancel Target Action Confirmation") public ResponseEntity updateActionConfirmation(final String targetId, final Long actionId, final MgmtActionConfirmationRequestBodyPut actionConfirmation) { log.debug("updateActionConfirmation with data [targetId={}, actionId={}]: {}", targetId, actionId, actionConfirmation); @@ -377,7 +377,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi { } @Override - @AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, message = "Set Distribution Set To Target") + @AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, description = "Set Distribution Set To Target") public ResponseEntity postAssignedDistributionSet( final String targetId, final MgmtDistributionSetAssignments dsAssignments, final Boolean offline) { if (offline != null && offline) { @@ -461,7 +461,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi { } @Override - @AuditLog(entity = "Target", type = AuditLog.Type.DELETE, message = "Delete Target Metadata") + @AuditLog(entity = "Target", type = AuditLog.Type.DELETE, description = "Delete Target Metadata") public ResponseEntity deleteMetadata(final String targetId, final String metadataKey) { targetManagement.deleteMetaData(targetId, metadataKey); return ResponseEntity.ok().build(); @@ -482,7 +482,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi { } @Override - @AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, message = "Activate Target Auto Confirmation") + @AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, description = "Activate Target Auto Confirmation") public ResponseEntity activateAutoConfirm(final String targetId, final MgmtTargetAutoConfirmUpdate update) { final String initiator = getNullIfEmpty(update, MgmtTargetAutoConfirmUpdate::getInitiator); final String remark = getNullIfEmpty(update, MgmtTargetAutoConfirmUpdate::getRemark); @@ -491,7 +491,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi { } @Override - @AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, message = "Deactivate Target Auto Confirmation") + @AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, description = "Deactivate Target Auto Confirmation") public ResponseEntity deactivateAutoConfirm(final String targetId) { confirmationManagement.deactivateAutoConfirmation(targetId); return new ResponseEntity<>(HttpStatus.OK); diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTagResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTagResource.java index 80d14094e..a83561190 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTagResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTagResource.java @@ -113,7 +113,7 @@ public class MgmtTargetTagResource implements MgmtTargetTagRestApi { } @Override - @AuditLog(entity = "TargetTag", type = AuditLog.Type.DELETE, message = "Delete Target Tag") + @AuditLog(entity = "TargetTag", type = AuditLog.Type.DELETE, description = "Delete Target Tag") public ResponseEntity deleteTargetTag(final Long targetTagId) { log.debug("Delete {} target tag", targetTagId); final TargetTag targetTag = findTargetTagById(targetTagId); @@ -168,7 +168,7 @@ public class MgmtTargetTagResource implements MgmtTargetTagRestApi { } @Override - @AuditLog(entity = "TargetTag", type = AuditLog.Type.UPDATE, message = "Unassign Target From Target Tag") + @AuditLog(entity = "TargetTag", type = AuditLog.Type.UPDATE, description = "Unassign Target From Target Tag") public ResponseEntity unassignTarget(final Long targetTagId, final String controllerId) { log.debug("Unassign target {} for target tag {}", controllerId, targetTagId); this.targetManagement.unassignTag(List.of(controllerId), targetTagId); @@ -176,7 +176,7 @@ public class MgmtTargetTagResource implements MgmtTargetTagRestApi { } @Override - @AuditLog(entity = "TargetTag", type = AuditLog.Type.UPDATE, message = "Unassign Targets From Target Tag") + @AuditLog(entity = "TargetTag", type = AuditLog.Type.UPDATE, description = "Unassign Targets From Target Tag") public ResponseEntity unassignTargets( final Long targetTagId, final OnNotFoundPolicy onNotFoundPolicy, final List controllerIds) { log.debug("Unassign {} targets for target tag {}", controllerIds.size(), targetTagId); diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTypeResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTypeResource.java index 0ffc1554d..b6a9f3783 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTypeResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTargetTypeResource.java @@ -80,7 +80,7 @@ public class MgmtTargetTypeResource implements MgmtTargetTypeRestApi { } @Override - @AuditLog(entity = "TargetType", type = AuditLog.Type.DELETE, message = "Delete Target Type") + @AuditLog(entity = "TargetType", type = AuditLog.Type.DELETE, description = "Delete Target Type") public ResponseEntity deleteTargetType(final Long targetTypeId) { log.debug("Delete {} target type", targetTypeId); targetTypeManagement.delete(targetTypeId); @@ -111,14 +111,14 @@ public class MgmtTargetTypeResource implements MgmtTargetTypeRestApi { } @Override - @AuditLog(entity = "TargetType", type = AuditLog.Type.DELETE, message = "Remove Compatible Distribution Set From Target Type") + @AuditLog(entity = "TargetType", type = AuditLog.Type.DELETE, description = "Remove Compatible Distribution Set From Target Type") public ResponseEntity removeCompatibleDistributionSet(final Long targetTypeId, final Long distributionSetTypeId) { targetTypeManagement.unassignDistributionSetType(targetTypeId, distributionSetTypeId); return ResponseEntity.ok().build(); } @Override - @AuditLog(entity = "TargetType", type = AuditLog.Type.UPDATE, message = "Add Compatible Distribution Set To Target Type") + @AuditLog(entity = "TargetType", type = AuditLog.Type.UPDATE, description = "Add Compatible Distribution Set To Target Type") public ResponseEntity addCompatibleDistributionSets( final Long targetTypeId, final List distributionSetTypeIds) { targetTypeManagement.assignCompatibleDistributionSetTypes( diff --git a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTenantManagementResource.java b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTenantManagementResource.java index e4cdee7fb..27cf21a1a 100644 --- a/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTenantManagementResource.java +++ b/hawkbit-mgmt/hawkbit-mgmt-resource/src/main/java/org/eclipse/hawkbit/mgmt/rest/resource/MgmtTenantManagementResource.java @@ -73,7 +73,7 @@ public class MgmtTenantManagementResource implements MgmtTenantManagementRestApi } @Override - @AuditLog(entity = "TenantConfiguration", type = AuditLog.Type.DELETE, message = "Delete Tenant Configuration Value") + @AuditLog(entity = "TenantConfiguration", type = AuditLog.Type.DELETE, description = "Delete Tenant Configuration Value") public ResponseEntity deleteTenantConfigurationValue(final String keyName) { //Default DistributionSet Type cannot be deleted as is part of TenantMetadata if (isDefaultDistributionSetTypeKey(keyName)) { @@ -92,7 +92,7 @@ public class MgmtTenantManagementResource implements MgmtTenantManagementRestApi } @Override - @AuditLog(entity = "TenantConfiguration", type = AuditLog.Type.UPDATE, message = "Update Tenant Configuration Value") + @AuditLog(entity = "TenantConfiguration", type = AuditLog.Type.UPDATE, description = "Update Tenant Configuration Value") public ResponseEntity updateTenantConfigurationValue( final String keyName, final MgmtSystemTenantConfigurationValueRequest configurationValueRest) { Serializable configurationValue = configurationValueRest.getValue(); @@ -109,7 +109,7 @@ public class MgmtTenantManagementResource implements MgmtTenantManagementRestApi } @Override - @AuditLog(entity = "TenantConfiguration", type = AuditLog.Type.UPDATE, message = "Update Tenant Configuration") + @AuditLog(entity = "TenantConfiguration", type = AuditLog.Type.UPDATE, description = "Update Tenant Configuration") public ResponseEntity> updateTenantConfiguration( final Map configurationValueMap) { final boolean containsNull = configurationValueMap.keySet().stream().anyMatch(Objects::isNull); diff --git a/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/audit/AuditLog.java b/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/audit/AuditLog.java index 4807078df..20aacc9b2 100644 --- a/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/audit/AuditLog.java +++ b/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/audit/AuditLog.java @@ -32,7 +32,7 @@ public @interface AuditLog { String entity(); - String message() default ""; + String description() default ""; String[] logParams() default {"*"}; diff --git a/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/audit/AuditLoggingAspect.java b/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/audit/AuditLoggingAspect.java index 485863a76..8a0cbd6a4 100644 --- a/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/audit/AuditLoggingAspect.java +++ b/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/audit/AuditLoggingAspect.java @@ -75,8 +75,8 @@ public class AuditLoggingAspect { final String methodName = joinPoint.getSignature().getName(); final String logMessage = String.format( - "Type: %s, Method: %s - Message: %s - Parameters: %s - Response: %s", - auditLog.type(), methodName, auditLog.message(), paramsToLog, resultMessage + "Type: %s, Method: %s - Description: %s - Parameters: %s - Response: %s", + auditLog.type(), methodName, auditLog.description(), paramsToLog, resultMessage ); switch (logLevel) {