Allign MGMT Rest APIs -> return 204 NO_CONTENT w/o body where success… (#2793)
* Allign MGMT Rest APIs -> return 204 NO_CONTENT w/o body where success w/o body is intended # Conflicts: # hawkbit-mgmt/hawkbit-mgmt-api/src/main/java/org/eclipse/hawkbit/mgmt/rest/api/MgmtTargetTagRestApi.java * Fix File download wrong no_content, Fix Tests * Fix ApiResponses where missed 200->204 --------- Co-authored-by: vasilchev <vasil.ilchev@bosch.com>
This commit is contained in:
@@ -74,7 +74,7 @@ public class MgmtActionResource implements MgmtActionRestApi {
|
||||
@AuditLog(entity = "Actions",type = AuditLog.Type.DELETE, description = "Delete Action", logResponse = true)
|
||||
public ResponseEntity<Void> deleteAction(Long actionId) {
|
||||
deploymentManagement.deleteAction(actionId);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -95,7 +95,7 @@ public class MgmtActionResource implements MgmtActionRestApi {
|
||||
throw new IllegalArgumentException("Either action id list or rsql filter should be provided.");
|
||||
}
|
||||
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
private MgmtRepresentationMode getRepresentationModeFromString(final String representationModeParam) {
|
||||
|
||||
@@ -176,7 +176,7 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
|
||||
@AuditLog(entity = "DistributionSet", type = AuditLog.Type.DELETE, description = "Delete Distribution Set")
|
||||
public ResponseEntity<Void> deleteDistributionSet(final Long distributionSetId) {
|
||||
distributionSetManagement.delete(distributionSetId);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -267,8 +267,9 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMetadata(final Long distributionSetId, final List<MgmtMetadata> metadataRest) {
|
||||
public ResponseEntity<Void> createMetadata(final Long distributionSetId, final List<MgmtMetadata> metadataRest) {
|
||||
distributionSetManagement.createMetadata(distributionSetId, MgmtDistributionSetMapper.fromRequestDsMetadata(metadataRest));
|
||||
return ResponseEntity.status(HttpStatus.CREATED).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -287,13 +288,15 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMetadata(final Long distributionSetId, final String metadataKey, final MgmtMetadataBodyPut metadata) {
|
||||
public ResponseEntity<Void> updateMetadata(final Long distributionSetId, final String metadataKey, final MgmtMetadataBodyPut metadata) {
|
||||
distributionSetManagement.createMetadata(distributionSetId, metadataKey, metadata.getValue());
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteMetadata(final Long distributionSetId, final String metadataKey) {
|
||||
public ResponseEntity<Void> deleteMetadata(final Long distributionSetId, final String metadataKey) {
|
||||
distributionSetManagement.deleteMetadata(distributionSetId, metadataKey);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -304,14 +307,14 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
|
||||
softwareModuleIDs.stream()
|
||||
.map(MgmtSoftwareModuleAssignment::getId)
|
||||
.toList());
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@AuditLog(entity = "DistributionSet", type = AuditLog.Type.DELETE, description = "Delete Assigned Distribution Set")
|
||||
public ResponseEntity<Void> deleteAssignSoftwareModules(final Long distributionSetId, final Long softwareModuleId) {
|
||||
distributionSetManagement.unassignSoftwareModule(distributionSetId, softwareModuleId);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -365,6 +368,6 @@ public class MgmtDistributionSetResource implements MgmtDistributionSetRestApi {
|
||||
distributionSetInvalidationManagement.invalidateDistributionSet(new DistributionSetInvalidation(
|
||||
List.of(distributionSetId),
|
||||
MgmtRestModelMapper.convertCancelationType(invalidateRequestBody.getActionCancelationType())));
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
}
|
||||
@@ -108,7 +108,7 @@ class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRestApi {
|
||||
public ResponseEntity<Void> deleteDistributionSetTag(final Long distributionsetTagId) {
|
||||
log.debug("Delete {} distribution set tag", distributionsetTagId);
|
||||
distributionSetTagManagement.delete(distributionsetTagId);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -131,7 +131,7 @@ class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRestApi {
|
||||
public ResponseEntity<Void> assignDistributionSet(final Long distributionSetTagId, final Long distributionSetId) {
|
||||
log.debug("Assign ds {} for ds tag {}", distributionSetId, distributionSetTagId);
|
||||
this.distributionSetManagement.assignTag(List.of(distributionSetId), distributionSetTagId);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -139,7 +139,7 @@ class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRestApi {
|
||||
log.debug("Assign DistributionSet {} for ds tag {}", distributionSetIds.size(), distributionSetTagId);
|
||||
final List<? extends DistributionSet> assignedDs = this.distributionSetManagement.assignTag(distributionSetIds, distributionSetTagId);
|
||||
log.debug("Assigned DistributionSet {}", assignedDs.size());
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -147,7 +147,7 @@ class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRestApi {
|
||||
public ResponseEntity<Void> unassignDistributionSet(final Long distributionsetTagId, final Long distributionsetId) {
|
||||
log.debug("Unassign ds {} for ds tag {}", distributionsetId, distributionsetTagId);
|
||||
this.distributionSetManagement.unassignTag(List.of(distributionsetId), distributionsetTagId);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -156,7 +156,7 @@ class MgmtDistributionSetTagResource implements MgmtDistributionSetTagRestApi {
|
||||
log.debug("Unassign DistributionSet {} for ds tag {}", distributionsetIds.size(), distributionsetTagId);
|
||||
final List<? extends DistributionSet> assignedDs = this.distributionSetManagement.unassignTag(distributionsetIds, distributionsetTagId);
|
||||
log.debug("Unassigned DistributionSet {}", assignedDs.size());
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
private DistributionSetTag findDistributionTagById(final Long distributionsetTagId) {
|
||||
|
||||
@@ -89,8 +89,7 @@ public class MgmtDistributionSetTypeResource implements MgmtDistributionSetTypeR
|
||||
@AuditLog(entity = "DistributionSetType", type = AuditLog.Type.DELETE, description = "Delete Distribution Set Type")
|
||||
public ResponseEntity<Void> deleteDistributionSetType(final Long distributionSetTypeId) {
|
||||
distributionSetTypeManagement.delete(distributionSetTypeId);
|
||||
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -157,7 +156,7 @@ public class MgmtDistributionSetTypeResource implements MgmtDistributionSetTypeR
|
||||
@AuditLog(entity = "DistributionSetType", type = AuditLog.Type.UPDATE, description = "Remove Mandatory Module From Distribution Set Type")
|
||||
public ResponseEntity<Void> removeMandatoryModule(final Long distributionSetTypeId, final Long softwareModuleTypeId) {
|
||||
distributionSetTypeManagement.unassignSoftwareModuleType(distributionSetTypeId, softwareModuleTypeId);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -169,14 +168,13 @@ public class MgmtDistributionSetTypeResource implements MgmtDistributionSetTypeR
|
||||
@AuditLog(entity = "DistributionSetType", type = AuditLog.Type.UPDATE, description = "Add Mandatory Module From Distribution Set Type")
|
||||
public ResponseEntity<Void> addMandatoryModule(final Long distributionSetTypeId, final MgmtId smtId) {
|
||||
distributionSetTypeManagement.assignMandatorySoftwareModuleTypes(distributionSetTypeId, Collections.singletonList(smtId.getId()));
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Void> addOptionalModule(final Long distributionSetTypeId, final MgmtId smtId) {
|
||||
distributionSetTypeManagement.assignOptionalSoftwareModuleTypes(distributionSetTypeId, Collections.singletonList(smtId.getId()));
|
||||
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
private DistributionSetType findDistributionSetTypeWithExceptionIfNotFound(final Long distributionSetTypeId) {
|
||||
|
||||
@@ -159,48 +159,48 @@ public class MgmtRolloutResource implements MgmtRolloutRestApi {
|
||||
@Override
|
||||
public ResponseEntity<Void> approve(final Long rolloutId, final String remark) {
|
||||
rolloutManagement.approveOrDeny(rolloutId, Rollout.ApprovalDecision.APPROVED, remark);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Void> deny(final Long rolloutId, final String remark) {
|
||||
rolloutManagement.approveOrDeny(rolloutId, Rollout.ApprovalDecision.DENIED, remark);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@AuditLog(entity = "Rollout", type = AuditLog.Type.UPDATE, description = "Start Rollout")
|
||||
public ResponseEntity<Void> start(final Long rolloutId) {
|
||||
this.rolloutManagement.start(rolloutId);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@AuditLog(entity = "Rollout", type = AuditLog.Type.UPDATE, description = "Pause Rollout")
|
||||
public ResponseEntity<Void> pause(final Long rolloutId) {
|
||||
this.rolloutManagement.pauseRollout(rolloutId);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@AuditLog(entity = "Rollout", type = AuditLog.Type.UPDATE, description = "Stop Rollout")
|
||||
public ResponseEntity<Void> stop(Long rolloutId) {
|
||||
this.rolloutManagement.stop(rolloutId);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@AuditLog(entity = "Rollout", type = AuditLog.Type.DELETE, description = "Delete Rollout")
|
||||
public ResponseEntity<Void> delete(final Long rolloutId) {
|
||||
this.rolloutManagement.delete(rolloutId);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@AuditLog(entity = "Rollout", type = AuditLog.Type.UPDATE, description = "Resume Rollout")
|
||||
public ResponseEntity<Void> resume(final Long rolloutId) {
|
||||
this.rolloutManagement.resumeRollout(rolloutId);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -264,7 +264,7 @@ public class MgmtRolloutResource implements MgmtRolloutRestApi {
|
||||
@AuditLog(entity = "Rollout", type = AuditLog.Type.UPDATE, description = "Trigger Next Rollout Group")
|
||||
public ResponseEntity<Void> triggerNextGroup(final Long rolloutId) {
|
||||
rolloutManagement.triggerNextGroup(rolloutId);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -159,7 +159,7 @@ public class MgmtSoftwareModuleResource implements MgmtSoftwareModuleRestApi {
|
||||
findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, artifactId);
|
||||
artifactManagement.delete(artifactId);
|
||||
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -234,12 +234,13 @@ public class MgmtSoftwareModuleResource implements MgmtSoftwareModuleRestApi {
|
||||
final SoftwareModule module = findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, null);
|
||||
softwareModuleManagement.delete(module.getId());
|
||||
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMetadata(final Long softwareModuleId, final List<MgmtSoftwareModuleMetadata> metadataRest) {
|
||||
public ResponseEntity<Void> createMetadata(final Long softwareModuleId, final List<MgmtSoftwareModuleMetadata> metadataRest) {
|
||||
softwareModuleManagement.createMetadata(softwareModuleId, MgmtSoftwareModuleMapper.fromRequestSwMetadata(metadataRest));
|
||||
return ResponseEntity.status(HttpStatus.CREATED).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -262,15 +263,17 @@ public class MgmtSoftwareModuleResource implements MgmtSoftwareModuleRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMetadata(final Long softwareModuleId, final String metadataKey, final MgmtSoftwareModuleMetadataBodyPut metadata) {
|
||||
public ResponseEntity<Void> updateMetadata(final Long softwareModuleId, final String metadataKey, final MgmtSoftwareModuleMetadataBodyPut metadata) {
|
||||
softwareModuleManagement.createMetadata(
|
||||
softwareModuleId, metadataKey, new MetadataValueCreate(metadata.getValue(), metadata.getTargetVisible()));
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@AuditLog(entity = "SoftwareModule", type = AuditLog.Type.DELETE, description = "Delete Software Module Metadata")
|
||||
public void deleteMetadata(final Long softwareModuleId, final String metadataKey) {
|
||||
public ResponseEntity<Void> deleteMetadata(final Long softwareModuleId, final String metadataKey) {
|
||||
softwareModuleManagement.deleteMetadata(softwareModuleId, metadataKey);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
private static MgmtRepresentationMode parseRepresentationMode(final String representationModeParam) {
|
||||
|
||||
@@ -71,7 +71,7 @@ public class MgmtSoftwareModuleTypeResource implements MgmtSoftwareModuleTypeRes
|
||||
@AuditLog(entity = "SoftwareModuleType", type = AuditLog.Type.DELETE, description = "Delete Software Module Type")
|
||||
public ResponseEntity<Void> deleteSoftwareModuleType(final Long softwareModuleTypeId) {
|
||||
softwareModuleTypeManagement.delete(softwareModuleTypeId);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -119,7 +119,7 @@ public class MgmtTargetFilterQueryResource implements MgmtTargetFilterQueryRestA
|
||||
public ResponseEntity<Void> deleteFilter(final Long filterId) {
|
||||
filterManagement.delete(filterId);
|
||||
log.debug("{} target filter query deleted, return status {}", filterId, HttpStatus.OK);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -83,7 +83,7 @@ public class MgmtTargetGroupResource implements MgmtTargetGroupRestApi {
|
||||
@Override
|
||||
public ResponseEntity<Void> unassignTargetsFromGroup(final List<String> controllerIds) {
|
||||
targetManagement.assignTargetsWithGroup(null, controllerIds);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -104,11 +104,11 @@ public class MgmtTargetGroupResource implements MgmtTargetGroupRestApi {
|
||||
|
||||
private ResponseEntity<Void> assignTargets(final String group, final List<String> controllerIds) {
|
||||
targetManagement.assignTargetsWithGroup(group, controllerIds);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
private ResponseEntity<Void> assignTargetsToGroupWithRsql0(final String group, final String rsql) {
|
||||
targetManagement.assignTargetGroupWithRsql(group, rsql);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
}
|
||||
@@ -177,21 +177,21 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
||||
public ResponseEntity<Void> deleteTarget(final String targetId) {
|
||||
this.targetManagement.deleteByControllerId(targetId);
|
||||
log.debug("{} target deleted, return status {}", targetId, HttpStatus.OK);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, description = "Unassign Target Type")
|
||||
public ResponseEntity<Void> unassignTargetType(final String targetId) {
|
||||
this.targetManagement.unassignType(targetId);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, description = "Assign Target")
|
||||
public ResponseEntity<Void> assignTargetType(final String targetId, final MgmtId targetTypeId) {
|
||||
this.targetManagement.assignType(targetId, targetTypeId.getId());
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -244,7 +244,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
||||
deploymentManagement.deleteOldestTargetActions(targetId, keepLast);
|
||||
}
|
||||
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -326,7 +326,7 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
||||
confirmationManagement.denyAction(actionId, actionConfirmation.getCode(), actionConfirmation.getDetails());
|
||||
break;
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
return ResponseEntity.noContent().build();
|
||||
} catch (final InvalidConfirmationFeedbackException e) {
|
||||
if (e.getReason() == InvalidConfirmationFeedbackException.Reason.ACTION_CLOSED) {
|
||||
log.warn("Updating action {} with confirmation {} not possible since action not active anymore.",
|
||||
@@ -429,8 +429,9 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMetadata(final String targetId, final List<MgmtMetadata> metadataRest) {
|
||||
public ResponseEntity<Void> createMetadata(final String targetId, final List<MgmtMetadata> metadataRest) {
|
||||
targetManagement.createMetadata(targetId, MgmtTargetMapper.fromRequestMetadata(metadataRest));
|
||||
return ResponseEntity.status(HttpStatus.CREATED).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -449,14 +450,16 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMetadata(final String targetId, final String metadataKey, final MgmtMetadataBodyPut metadata) {
|
||||
public ResponseEntity<Void> updateMetadata(final String targetId, final String metadataKey, final MgmtMetadataBodyPut metadata) {
|
||||
targetManagement.createMetadata(targetId, metadataKey, metadata.getValue());
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@AuditLog(entity = "Target", type = AuditLog.Type.DELETE, description = "Delete Target Metadata")
|
||||
public void deleteMetadata(final String targetId, final String metadataKey) {
|
||||
public ResponseEntity<Void> deleteMetadata(final String targetId, final String metadataKey) {
|
||||
targetManagement.deleteMetadata(targetId, metadataKey);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -472,14 +475,14 @@ public class MgmtTargetResource implements MgmtTargetRestApi {
|
||||
final String initiator = getNullIfEmpty(update, MgmtTargetAutoConfirmUpdate::getInitiator);
|
||||
final String remark = getNullIfEmpty(update, MgmtTargetAutoConfirmUpdate::getRemark);
|
||||
confirmationManagement.activateAutoConfirmation(targetId, initiator, remark);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@AuditLog(entity = "Target", type = AuditLog.Type.UPDATE, description = "Deactivate Target Auto Confirmation")
|
||||
public ResponseEntity<Void> deactivateAutoConfirm(final String targetId) {
|
||||
confirmationManagement.deactivateAutoConfirmation(targetId);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
private <T, R> R getNullIfEmpty(final T object, final Function<T, R> extractMethod) {
|
||||
|
||||
@@ -114,7 +114,7 @@ public class MgmtTargetTagResource implements MgmtTargetTagRestApi {
|
||||
|
||||
this.tagManagement.delete(targetTag.getId());
|
||||
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -137,7 +137,7 @@ public class MgmtTargetTagResource implements MgmtTargetTagRestApi {
|
||||
public ResponseEntity<Void> assignTarget(final Long targetTagId, final String controllerId) {
|
||||
log.debug("Assign target {} for target tag {}", controllerId, targetTagId);
|
||||
this.targetManagement.assignTag(List.of(controllerId), targetTagId);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -154,7 +154,7 @@ public class MgmtTargetTagResource implements MgmtTargetTagRestApi {
|
||||
throw new EntityNotFoundException(Target.class, notFound.get());
|
||||
}
|
||||
}
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -162,7 +162,7 @@ public class MgmtTargetTagResource implements MgmtTargetTagRestApi {
|
||||
public ResponseEntity<Void> unassignTarget(final Long targetTagId, final String controllerId) {
|
||||
log.debug("Unassign target {} for target tag {}", controllerId, targetTagId);
|
||||
targetManagement.unassignTag(List.of(controllerId), targetTagId);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -180,7 +180,7 @@ public class MgmtTargetTagResource implements MgmtTargetTagRestApi {
|
||||
throw new EntityNotFoundException(Target.class, notFound.get());
|
||||
}
|
||||
}
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
private TargetTag findTargetTagById(final Long targetTagId) {
|
||||
|
||||
@@ -79,7 +79,7 @@ public class MgmtTargetTypeResource implements MgmtTargetTypeRestApi {
|
||||
public ResponseEntity<Void> deleteTargetType(final Long targetTypeId) {
|
||||
log.debug("Delete {} target type", targetTypeId);
|
||||
targetTypeManagement.delete(targetTypeId);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -109,7 +109,7 @@ public class MgmtTargetTypeResource implements MgmtTargetTypeRestApi {
|
||||
@AuditLog(entity = "TargetType", type = AuditLog.Type.DELETE, description = "Remove Compatible Distribution Set From Target Type")
|
||||
public ResponseEntity<Void> removeCompatibleDistributionSet(final Long targetTypeId, final Long distributionSetTypeId) {
|
||||
targetTypeManagement.unassignDistributionSetType(targetTypeId, distributionSetTypeId);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -118,7 +118,7 @@ public class MgmtTargetTypeResource implements MgmtTargetTypeRestApi {
|
||||
final Long targetTypeId, final List<MgmtDistributionSetTypeAssignment> distributionSetTypeIds) {
|
||||
targetTypeManagement.assignCompatibleDistributionSetTypes(
|
||||
targetTypeId, distributionSetTypeIds.stream().map(MgmtDistributionSetTypeAssignment::getId).toList());
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
private TargetType findTargetTypeWithExceptionIfNotFound(final Long targetTypeId) {
|
||||
|
||||
@@ -84,7 +84,7 @@ public class MgmtTenantManagementResource implements MgmtTenantManagementRestApi
|
||||
tenantConfigurationManagement.deleteConfiguration(keyName);
|
||||
|
||||
log.debug("{} config value deleted, return status {}", keyName, HttpStatus.OK);
|
||||
return ResponseEntity.ok().build();
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user