Refactor REST Constants (#2881)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -1,73 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015 Bosch Software Innovations GmbH and others
|
||||
*
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*/
|
||||
package org.eclipse.hawkbit.ddi.rest.api;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* Constants for the direct device integration rest resources.
|
||||
*/
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public final class DdiRestConstants {
|
||||
|
||||
/**
|
||||
* The base URL mapping of the direct device integration rest resources.
|
||||
*/
|
||||
public static final String BASE_V1_REQUEST_MAPPING = "/{tenant}/controller/v1";
|
||||
|
||||
/**
|
||||
* Deployment action resources.
|
||||
*/
|
||||
public static final String DEPLOYMENT_BASE = "deploymentBase";
|
||||
/**
|
||||
* Confirmation base resource.
|
||||
*/
|
||||
public static final String CONFIRMATION_BASE = "confirmationBase";
|
||||
/**
|
||||
* Installed action resources.
|
||||
*/
|
||||
public static final String INSTALLED_BASE = "installedBase";
|
||||
/**
|
||||
* Feedback channel.
|
||||
*/
|
||||
public static final String FEEDBACK = "feedback";
|
||||
/**
|
||||
* Cancel action resources.
|
||||
*/
|
||||
public static final String CANCEL_ACTION = "cancelAction";
|
||||
/**
|
||||
* Config data action resources.
|
||||
*/
|
||||
public static final String CONFIG_DATA = "configData";
|
||||
/**
|
||||
* Activate auto-confirm
|
||||
*/
|
||||
public static final String ACTIVATE_AUTO_CONFIRM = "activateAutoConfirm";
|
||||
/**
|
||||
* Deactivate auto-confirm
|
||||
*/
|
||||
public static final String DEACTIVATE_AUTO_CONFIRM = "deactivateAutoConfirm";
|
||||
|
||||
/**
|
||||
* Media type for CBOR content.
|
||||
*/
|
||||
public static final String MEDIA_TYPE_APPLICATION_CBOR = "application/cbor";
|
||||
|
||||
/**
|
||||
* File suffix for MDH hash download (see Linux md5sum).
|
||||
*/
|
||||
public static final String ARTIFACT_MD5_DOWNLOAD_SUFFIX = ".MD5SUM";
|
||||
/**
|
||||
* Default value specifying that no action history to be sent as part of response to deploymentBase
|
||||
* {@link DdiRootControllerRestApi#getControllerDeploymentBaseAction}, {@link DdiRootControllerRestApi#getConfirmationBaseAction}.
|
||||
*/
|
||||
public static final String NO_ACTION_HISTORY = "0";
|
||||
}
|
||||
@@ -9,10 +9,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ddi.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.ddi.rest.api.DdiRestConstants.BASE_V1_REQUEST_MAPPING;
|
||||
import static org.eclipse.hawkbit.ddi.rest.api.DdiRestConstants.DEPLOYMENT_BASE;
|
||||
import static org.eclipse.hawkbit.ddi.rest.api.DdiRestConstants.FEEDBACK;
|
||||
import static org.eclipse.hawkbit.ddi.rest.api.DdiRestConstants.MEDIA_TYPE_APPLICATION_CBOR;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GONE_410;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.INTERNAL_SERVER_ERROR_500;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.METHOD_NOT_ALLOWED_405;
|
||||
@@ -66,6 +62,57 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
@Tag(name = "DDI Root Controller", description = "REST resource handling for root controller CRUD operations")
|
||||
public interface DdiRootControllerRestApi {
|
||||
|
||||
/**
|
||||
* The base URL mapping of the direct device integration rest resources.
|
||||
*/
|
||||
String CONTROLLER_V1 = "/{tenant}/controller/v1";
|
||||
|
||||
/**
|
||||
* Deployment action resources.
|
||||
*/
|
||||
String DEPLOYMENT_BASE = "deploymentBase";
|
||||
/**
|
||||
* Confirmation base resource.
|
||||
*/
|
||||
String CONFIRMATION_BASE = "confirmationBase";
|
||||
/**
|
||||
* Installed action resources.
|
||||
*/
|
||||
String INSTALLED_BASE = "installedBase";
|
||||
/**
|
||||
* Feedback channel.
|
||||
*/
|
||||
String FEEDBACK = "feedback";
|
||||
/**
|
||||
* Cancel action resources.
|
||||
*/
|
||||
String CANCEL_ACTION = "cancelAction";
|
||||
/**
|
||||
* Config data action resources.
|
||||
*/
|
||||
String CONFIG_DATA = "configData";
|
||||
/**
|
||||
* Activate auto-confirm
|
||||
*/
|
||||
String ACTIVATE_AUTO_CONFIRM = "activateAutoConfirm";
|
||||
/**
|
||||
* Deactivate auto-confirm
|
||||
*/
|
||||
String DEACTIVATE_AUTO_CONFIRM = "deactivateAutoConfirm";
|
||||
/**
|
||||
* Media type for CBOR content.
|
||||
*/
|
||||
String MEDIA_TYPE_APPLICATION_CBOR = "application/cbor";
|
||||
/**
|
||||
* File suffix for MDH hash download (see Linux md5sum).
|
||||
*/
|
||||
String ARTIFACT_MD5_DOWNLOAD_SUFFIX = ".MD5SUM";
|
||||
/**
|
||||
* Default value specifying that no action history to be sent as part of response to deploymentBase
|
||||
* {@link DdiRootControllerRestApi#getControllerDeploymentBaseAction}, {@link DdiRootControllerRestApi#getConfirmationBaseAction}.
|
||||
*/
|
||||
String NO_ACTION_HISTORY = "0";
|
||||
|
||||
/**
|
||||
* Returns all artifacts of a given software module and target.
|
||||
*
|
||||
@@ -77,7 +124,7 @@ public interface DdiRootControllerRestApi {
|
||||
@Operation(summary = "Return all artifacts of a given software module and target",
|
||||
description = "Returns all artifacts that are assigned to the software module")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = BASE_V1_REQUEST_MAPPING + "/{controllerId}/softwaremodules/{softwareModuleId}/artifacts",
|
||||
@GetMapping(value = CONTROLLER_V1 + "/{controllerId}/softwaremodules/{softwareModuleId}/artifacts",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE, MEDIA_TYPE_APPLICATION_CBOR })
|
||||
ResponseEntity<List<DdiArtifact>> getSoftwareModulesArtifacts(
|
||||
@PathVariable("tenant") String tenant,
|
||||
@@ -100,7 +147,7 @@ public interface DdiRootControllerRestApi {
|
||||
Note: deployments have to be confirmed in order to move on to the next action. Cancellations have to be
|
||||
confirmed or rejected.""")
|
||||
@GetResponses
|
||||
@GetMapping(value = BASE_V1_REQUEST_MAPPING + "/{controllerId}",
|
||||
@GetMapping(value = CONTROLLER_V1 + "/{controllerId}",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE, MEDIA_TYPE_APPLICATION_CBOR })
|
||||
ResponseEntity<DdiControllerBase> getControllerBase(
|
||||
@PathVariable("tenant") String tenant,
|
||||
@@ -117,15 +164,15 @@ public interface DdiRootControllerRestApi {
|
||||
* @return response of the servlet which in case of success is status code
|
||||
* {@link HttpStatus#OK} or in case of partial download {@link HttpStatus#PARTIAL_CONTENT}.
|
||||
*/
|
||||
@Operation(summary = "Artifact download", description = "Handles GET DdiArtifact download request. This could be " +
|
||||
"full or partial (as specified by RFC7233 (Range Requests)) download request.")
|
||||
@Operation(summary = "Artifact download",
|
||||
description = "Handles GET DdiArtifact download request. This could be full or partial (as specified by RFC7233 (Range Requests)) " +
|
||||
"download request.")
|
||||
@GetResponses
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = INTERNAL_SERVER_ERROR_500, description = "Artifact download or decryption failed",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@GetMapping(value = BASE_V1_REQUEST_MAPPING +
|
||||
"/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{fileName}")
|
||||
@GetMapping(value = CONTROLLER_V1 + "/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{fileName}")
|
||||
ResponseEntity<InputStream> downloadArtifact(
|
||||
@PathVariable("tenant") String tenant,
|
||||
@PathVariable("controllerId") String controllerId,
|
||||
@@ -144,8 +191,8 @@ public interface DdiRootControllerRestApi {
|
||||
@Operation(summary = "MD5 checksum download",
|
||||
description = "Handles GET {@link DdiArtifact} MD5 checksum file download request.")
|
||||
@GetResponses
|
||||
@GetMapping(value = BASE_V1_REQUEST_MAPPING + "/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{fileName}" +
|
||||
DdiRestConstants.ARTIFACT_MD5_DOWNLOAD_SUFFIX, produces = MediaType.TEXT_PLAIN_VALUE)
|
||||
@GetMapping(value = CONTROLLER_V1 + "/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/{fileName}" + ARTIFACT_MD5_DOWNLOAD_SUFFIX,
|
||||
produces = MediaType.TEXT_PLAIN_VALUE)
|
||||
ResponseEntity<Void> downloadArtifactMd5(
|
||||
@PathVariable("tenant") String tenant,
|
||||
@PathVariable("controllerId") String controllerId,
|
||||
@@ -176,14 +223,14 @@ public interface DdiRootControllerRestApi {
|
||||
runtime.
|
||||
""")
|
||||
@GetResponses
|
||||
@GetMapping(value = BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DEPLOYMENT_BASE + "/{actionId}",
|
||||
@GetMapping(value = CONTROLLER_V1 + "/{controllerId}/" + DEPLOYMENT_BASE + "/{actionId}",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE, MEDIA_TYPE_APPLICATION_CBOR })
|
||||
ResponseEntity<DdiDeploymentBase> getControllerDeploymentBaseAction(
|
||||
@PathVariable("tenant") String tenant,
|
||||
@PathVariable("controllerId") @NotEmpty String controllerId,
|
||||
@PathVariable("actionId") @NotNull Long actionId,
|
||||
@RequestParam(value = "c", required = false, defaultValue = "-1") int resource,
|
||||
@RequestParam(value = "actionHistory", defaultValue = DdiRestConstants.NO_ACTION_HISTORY)
|
||||
@RequestParam(value = "actionHistory", defaultValue = NO_ACTION_HISTORY)
|
||||
@Schema(description = """
|
||||
(Optional) GET parameter to retrieve a given number of messages which are previously provided by the
|
||||
device. Useful if the devices sent state information to the feedback channel and never stored them
|
||||
@@ -208,7 +255,7 @@ public interface DdiRootControllerRestApi {
|
||||
@ApiResponse(responseCode = GONE_410, description = "Action is not active anymore.",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DEPLOYMENT_BASE +
|
||||
@PostMapping(value = CONTROLLER_V1 + "/{controllerId}/" + DEPLOYMENT_BASE +
|
||||
"/{actionId}/" + FEEDBACK, consumes = { APPLICATION_JSON_VALUE, MEDIA_TYPE_APPLICATION_CBOR })
|
||||
ResponseEntity<Void> postDeploymentBaseActionFeedback(
|
||||
@Valid @RequestBody DdiActionFeedback feedback,
|
||||
@@ -229,7 +276,7 @@ public interface DdiRootControllerRestApi {
|
||||
information that will allow the server to identify the device on a hardware level (e.g. hardware revision,
|
||||
mac address, serial number etc.).""")
|
||||
@PutResponses
|
||||
@PutMapping(value = BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CONFIG_DATA,
|
||||
@PutMapping(value = CONTROLLER_V1 + "/{controllerId}/" + CONFIG_DATA,
|
||||
consumes = { APPLICATION_JSON_VALUE, MEDIA_TYPE_APPLICATION_CBOR })
|
||||
ResponseEntity<Void> putConfigData(
|
||||
@Valid @RequestBody DdiConfigData configData,
|
||||
@@ -248,7 +295,7 @@ public interface DdiRootControllerRestApi {
|
||||
The Hawkbit server might cancel an operation, e.g. an unfinished update has a successor. It is up to the
|
||||
provisioning target to decide to accept the cancellation or reject it.""")
|
||||
@GetResponses
|
||||
@GetMapping(value = BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CANCEL_ACTION + "/{actionId}",
|
||||
@GetMapping(value = CONTROLLER_V1 + "/{controllerId}/" + CANCEL_ACTION + "/{actionId}",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE, MEDIA_TYPE_APPLICATION_CBOR })
|
||||
ResponseEntity<DdiCancel> getControllerCancelAction(
|
||||
@PathVariable("tenant") String tenant,
|
||||
@@ -272,7 +319,7 @@ public interface DdiRootControllerRestApi {
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = METHOD_NOT_ALLOWED_405, description = "Software module is locked", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CANCEL_ACTION + "/{actionId}/" +
|
||||
@PostMapping(value = CONTROLLER_V1 + "/{controllerId}/" + CANCEL_ACTION + "/{actionId}/" +
|
||||
FEEDBACK, consumes = { APPLICATION_JSON_VALUE, MEDIA_TYPE_APPLICATION_CBOR })
|
||||
ResponseEntity<Void> postCancelActionFeedback(
|
||||
@Valid @RequestBody DdiActionFeedback feedback,
|
||||
@@ -305,13 +352,13 @@ public interface DdiRootControllerRestApi {
|
||||
runtime.
|
||||
""")
|
||||
@GetResponses
|
||||
@GetMapping(value = BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.INSTALLED_BASE + "/{actionId}",
|
||||
@GetMapping(value = CONTROLLER_V1 + "/{controllerId}/" + INSTALLED_BASE + "/{actionId}",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE, MEDIA_TYPE_APPLICATION_CBOR })
|
||||
ResponseEntity<DdiDeploymentBase> getControllerInstalledAction(
|
||||
@PathVariable("tenant") String tenant,
|
||||
@PathVariable("controllerId") @NotEmpty String controllerId,
|
||||
@PathVariable("actionId") @NotNull Long actionId,
|
||||
@RequestParam(value = "actionHistory", defaultValue = DdiRestConstants.NO_ACTION_HISTORY) Integer actionHistoryMessageCount);
|
||||
@RequestParam(value = "actionHistory", defaultValue = NO_ACTION_HISTORY) Integer actionHistoryMessageCount);
|
||||
|
||||
/**
|
||||
* Returns the confirmation base with the current auto-confirmation state for a given controllerId and toggle links. In case there are
|
||||
@@ -328,7 +375,7 @@ public interface DdiRootControllerRestApi {
|
||||
Reference links to switch the auto-confirmation state are exposed as well.
|
||||
""")
|
||||
@GetResponses
|
||||
@GetMapping(value = BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CONFIRMATION_BASE,
|
||||
@GetMapping(value = CONTROLLER_V1 + "/{controllerId}/" + CONFIRMATION_BASE,
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE, MEDIA_TYPE_APPLICATION_CBOR })
|
||||
ResponseEntity<DdiConfirmationBase> getConfirmationBase(
|
||||
@PathVariable("tenant") String tenant,
|
||||
@@ -360,14 +407,14 @@ public interface DdiRootControllerRestApi {
|
||||
runtime.
|
||||
""")
|
||||
@GetResponses
|
||||
@GetMapping(value = BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CONFIRMATION_BASE + "/{actionId}",
|
||||
@GetMapping(value = CONTROLLER_V1 + "/{controllerId}/" + CONFIRMATION_BASE + "/{actionId}",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE, MEDIA_TYPE_APPLICATION_CBOR })
|
||||
ResponseEntity<DdiConfirmationBaseAction> getConfirmationBaseAction(
|
||||
@PathVariable("tenant") String tenant,
|
||||
@PathVariable("controllerId") @NotEmpty String controllerId,
|
||||
@PathVariable("actionId") @NotNull Long actionId,
|
||||
@RequestParam(value = "c", required = false, defaultValue = "-1") int resource,
|
||||
@RequestParam(value = "actionHistory", defaultValue = DdiRestConstants.NO_ACTION_HISTORY) Integer actionHistoryMessageCount);
|
||||
@RequestParam(value = "actionHistory", defaultValue = NO_ACTION_HISTORY) Integer actionHistoryMessageCount);
|
||||
|
||||
/**
|
||||
* This is the feedback channel for the {@link DdiConfirmationBaseAction} action.
|
||||
@@ -388,8 +435,7 @@ public interface DdiRootControllerRestApi {
|
||||
@ApiResponse(responseCode = GONE_410, description = "Action is not active anymore.",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CONFIRMATION_BASE + "/{actionId}/" +
|
||||
FEEDBACK,
|
||||
@PostMapping(value = CONTROLLER_V1 + "/{controllerId}/" + CONFIRMATION_BASE + "/{actionId}/" + FEEDBACK,
|
||||
consumes = { APPLICATION_JSON_VALUE, MEDIA_TYPE_APPLICATION_CBOR })
|
||||
ResponseEntity<Void> postConfirmationActionFeedback(
|
||||
@Valid @RequestBody DdiConfirmationFeedback feedback,
|
||||
@@ -413,8 +459,8 @@ public interface DdiRootControllerRestApi {
|
||||
be automatically confirmed, as long as auto-confirmation is active.
|
||||
""")
|
||||
@PostUpdateResponses
|
||||
@PostMapping(value = BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CONFIRMATION_BASE + "/" +
|
||||
DdiRestConstants.ACTIVATE_AUTO_CONFIRM, consumes = { APPLICATION_JSON_VALUE, MEDIA_TYPE_APPLICATION_CBOR })
|
||||
@PostMapping(value = CONTROLLER_V1 + "/{controllerId}/" + CONFIRMATION_BASE + "/" + ACTIVATE_AUTO_CONFIRM,
|
||||
consumes = { APPLICATION_JSON_VALUE, MEDIA_TYPE_APPLICATION_CBOR })
|
||||
ResponseEntity<Void> activateAutoConfirmation(
|
||||
@PathVariable("tenant") String tenant,
|
||||
@PathVariable("controllerId") @NotEmpty String controllerId,
|
||||
@@ -432,8 +478,7 @@ public interface DdiRootControllerRestApi {
|
||||
while all future actions need to be confirmed, before processing with the deployment.
|
||||
""")
|
||||
@PostUpdateResponses
|
||||
@PostMapping(value = BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.CONFIRMATION_BASE + "/" +
|
||||
DdiRestConstants.DEACTIVATE_AUTO_CONFIRM)
|
||||
@PostMapping(value = CONTROLLER_V1 + "/{controllerId}/" + CONFIRMATION_BASE + "/" + DEACTIVATE_AUTO_CONFIRM)
|
||||
ResponseEntity<Void> deactivateAutoConfirmation(
|
||||
@PathVariable("tenant") String tenant,
|
||||
@PathVariable("controllerId") @NotEmpty String controllerId);
|
||||
@@ -455,7 +500,7 @@ public interface DdiRootControllerRestApi {
|
||||
@ApiResponse(responseCode = GONE_410, description = "Action is not active anymore.",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PutMapping(value = BASE_V1_REQUEST_MAPPING + "/{controllerId}/" + DdiRestConstants.INSTALLED_BASE,
|
||||
@PutMapping(value = CONTROLLER_V1 + "/{controllerId}/" + INSTALLED_BASE,
|
||||
consumes = { APPLICATION_JSON_VALUE, MEDIA_TYPE_APPLICATION_CBOR })
|
||||
ResponseEntity<Void> setAssignedOfflineVersion(
|
||||
@Valid @RequestBody DdiAssignedVersion ddiAssignedVersion,
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.eclipse.hawkbit.ddi.json.model.DdiConfirmationBase;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiControllerBase;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiMetadata;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiPolling;
|
||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRestConstants;
|
||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRootControllerRestApi;
|
||||
import org.eclipse.hawkbit.repository.ControllerManagement;
|
||||
import org.eclipse.hawkbit.repository.SystemManagement;
|
||||
import org.eclipse.hawkbit.repository.model.Action;
|
||||
@@ -54,19 +54,19 @@ public final class DataConversionHelper {
|
||||
confirmationBase.add(WebMvcLinkBuilder
|
||||
.linkTo(WebMvcLinkBuilder.methodOn(DdiRootController.class, AccessContext.tenant())
|
||||
.deactivateAutoConfirmation(AccessContext.tenant(), controllerId))
|
||||
.withRel(DdiRestConstants.DEACTIVATE_AUTO_CONFIRM).expand());
|
||||
.withRel(DdiRootControllerRestApi.DEACTIVATE_AUTO_CONFIRM).expand());
|
||||
} else {
|
||||
confirmationBase.add(WebMvcLinkBuilder
|
||||
.linkTo(WebMvcLinkBuilder.methodOn(DdiRootController.class, AccessContext.tenant())
|
||||
.activateAutoConfirmation(AccessContext.tenant(), controllerId, null))
|
||||
.withRel(DdiRestConstants.ACTIVATE_AUTO_CONFIRM).expand());
|
||||
.withRel(DdiRootControllerRestApi.ACTIVATE_AUTO_CONFIRM).expand());
|
||||
}
|
||||
if (activeAction != null && activeAction.isWaitingConfirmation()) {
|
||||
confirmationBase.add(WebMvcLinkBuilder
|
||||
.linkTo(WebMvcLinkBuilder.methodOn(DdiRootController.class, AccessContext.tenant())
|
||||
.getConfirmationBaseAction(AccessContext.tenant(), controllerId,
|
||||
activeAction.getId(), calculateEtag(activeAction), null))
|
||||
.withRel(DdiRestConstants.CONFIRMATION_BASE).expand());
|
||||
.withRel(DdiRootControllerRestApi.CONFIRMATION_BASE).expand());
|
||||
}
|
||||
|
||||
return confirmationBase;
|
||||
@@ -84,14 +84,14 @@ public final class DataConversionHelper {
|
||||
.methodOn(DdiRootController.class, AccessContext.tenant())
|
||||
.getConfirmationBaseAction(AccessContext.tenant(), target.getControllerId(),
|
||||
activeAction.getId(), calculateEtag(activeAction), null))
|
||||
.withRel(DdiRestConstants.CONFIRMATION_BASE).expand());
|
||||
.withRel(DdiRootControllerRestApi.CONFIRMATION_BASE).expand());
|
||||
|
||||
} else if (activeAction.isCancelingOrCanceled()) {
|
||||
result.add(WebMvcLinkBuilder
|
||||
.linkTo(WebMvcLinkBuilder.methodOn(DdiRootController.class, AccessContext.tenant())
|
||||
.getControllerCancelAction(AccessContext.tenant(), target.getControllerId(),
|
||||
activeAction.getId()))
|
||||
.withRel(DdiRestConstants.CANCEL_ACTION).expand());
|
||||
.withRel(DdiRootControllerRestApi.CANCEL_ACTION).expand());
|
||||
} else {
|
||||
// we need to add the hashcode here of the actionWithStatus because the action might
|
||||
// have changed from 'soft' to 'forced' type, and we need to change the payload of the
|
||||
@@ -101,7 +101,7 @@ public final class DataConversionHelper {
|
||||
.getControllerDeploymentBaseAction(
|
||||
AccessContext.tenant(), target.getControllerId(),
|
||||
activeAction.getId(), calculateEtag(activeAction), null))
|
||||
.withRel(DdiRestConstants.DEPLOYMENT_BASE).expand());
|
||||
.withRel(DdiRootControllerRestApi.DEPLOYMENT_BASE).expand());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ public final class DataConversionHelper {
|
||||
.linkTo(WebMvcLinkBuilder.methodOn(DdiRootController.class, AccessContext.tenant())
|
||||
.getControllerInstalledAction(AccessContext.tenant(),
|
||||
target.getControllerId(), installedAction.getId(), null))
|
||||
.withRel(DdiRestConstants.INSTALLED_BASE).expand());
|
||||
.withRel(DdiRootControllerRestApi.INSTALLED_BASE).expand());
|
||||
}
|
||||
|
||||
if (target.isRequestControllerAttributes()) {
|
||||
@@ -120,7 +120,7 @@ public final class DataConversionHelper {
|
||||
.methodOn(DdiRootController.class, AccessContext.tenant())
|
||||
// doesn't really call the putConfigData with null, just create the link
|
||||
.putConfigData(null, AccessContext.tenant(), target.getControllerId()))
|
||||
.withRel(DdiRestConstants.CONFIG_DATA).expand());
|
||||
.withRel(DdiRootControllerRestApi.CONFIG_DATA).expand());
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -45,7 +45,6 @@ import org.eclipse.hawkbit.ddi.json.model.DdiDeployment.HandlingType;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiDeploymentBase;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiResult.FinalResult;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiUpdateMode;
|
||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRestConstants;
|
||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRootControllerRestApi;
|
||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||
import org.eclipse.hawkbit.repository.ConfirmationManagement;
|
||||
@@ -581,7 +580,7 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
||||
final byte[] content = (md5Hash + " " + filename).getBytes(StandardCharsets.US_ASCII);
|
||||
response.setContentType("text/plain");
|
||||
response.setContentLength(content.length);
|
||||
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + filename + DdiRestConstants.ARTIFACT_MD5_DOWNLOAD_SUFFIX);
|
||||
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + filename + DdiRootControllerRestApi.ARTIFACT_MD5_DOWNLOAD_SUFFIX);
|
||||
response.getOutputStream().write(content);
|
||||
}
|
||||
|
||||
@@ -740,7 +739,7 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
||||
private Optional<DdiActionHistory> generateDdiActionHistory(final Action action, final Integer actionHistoryMessageCount) {
|
||||
final List<String> actionHistoryMessages = controllerManagement.getActionHistoryMessages(
|
||||
action.getId(),
|
||||
actionHistoryMessageCount == null ? Integer.parseInt(DdiRestConstants.NO_ACTION_HISTORY) : actionHistoryMessageCount);
|
||||
actionHistoryMessageCount == null ? Integer.parseInt(DdiRootControllerRestApi.NO_ACTION_HISTORY) : actionHistoryMessageCount);
|
||||
return actionHistoryMessages.isEmpty()
|
||||
? Optional.empty()
|
||||
: Optional.of(new DdiActionHistory(action.getStatus().name(), actionHistoryMessages));
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.util.List;
|
||||
import org.eclipse.hawkbit.context.AccessContext;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiResult;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiStatus;
|
||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRestConstants;
|
||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRootControllerRestApi;
|
||||
import org.eclipse.hawkbit.repository.jpa.repository.ActionStatusRepository;
|
||||
import org.eclipse.hawkbit.repository.model.Action;
|
||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||
@@ -68,10 +68,10 @@ class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
||||
final byte[] result = mvc
|
||||
.perform(get("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/cancelAction/"
|
||||
+ cancelAction.getId(), AccessContext.tenant())
|
||||
.accept(DdiRestConstants.MEDIA_TYPE_APPLICATION_CBOR))
|
||||
.accept(DdiRootControllerRestApi.MEDIA_TYPE_APPLICATION_CBOR))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentType(DdiRestConstants.MEDIA_TYPE_APPLICATION_CBOR))
|
||||
.andExpect(content().contentType(DdiRootControllerRestApi.MEDIA_TYPE_APPLICATION_CBOR))
|
||||
.andReturn().getResponse()
|
||||
.getContentAsByteArray();
|
||||
assertThat(JsonPathUtils.<String> evaluate(cborToJson(result), "$.id"))
|
||||
@@ -83,7 +83,7 @@ class DdiCancelActionTest extends AbstractDDiApiIntegrationTest {
|
||||
mvc.perform(post("/{tenant}/controller/v1/" + TestdataFactory.DEFAULT_CONTROLLER_ID + "/cancelAction/"
|
||||
+ cancelAction.getId() + "/feedback", AccessContext.tenant())
|
||||
.content(jsonToCbor(getJsonProceedingCancelActionFeedback()))
|
||||
.contentType(DdiRestConstants.MEDIA_TYPE_APPLICATION_CBOR).accept(DdiRestConstants.MEDIA_TYPE_APPLICATION_CBOR))
|
||||
.contentType(DdiRootControllerRestApi.MEDIA_TYPE_APPLICATION_CBOR).accept(DdiRootControllerRestApi.MEDIA_TYPE_APPLICATION_CBOR))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk());
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.hawkbit.context.AccessContext;
|
||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRestConstants;
|
||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRootControllerRestApi;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.repository.exception.AssignmentQuotaExceededException;
|
||||
import org.eclipse.hawkbit.repository.exception.InvalidTargetAttributeException;
|
||||
@@ -65,7 +65,7 @@ class DdiConfigDataTest extends AbstractDDiApiIntegrationTest {
|
||||
|
||||
mvc.perform(put(TARGET1_CONFIG_DATA_PATH, AccessContext.tenant())
|
||||
.content(jsonToCbor(JsonBuilder.configData(attributes).toString()))
|
||||
.contentType(DdiRestConstants.MEDIA_TYPE_APPLICATION_CBOR))
|
||||
.contentType(DdiRootControllerRestApi.MEDIA_TYPE_APPLICATION_CBOR))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk());
|
||||
assertThat(targetManagement.getControllerAttributes(TARGET1_ID)).isEqualTo(attributes);
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.stream.Stream;
|
||||
import org.eclipse.hawkbit.context.AccessContext;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiActivateAutoConfirmation;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiConfirmationFeedback;
|
||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRestConstants;
|
||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRootControllerRestApi;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetAssignDistributionSetEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetPollEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.ActionCreatedEvent;
|
||||
@@ -150,11 +150,11 @@ class DdiConfirmationBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
final Action action = deploymentManagement.findActiveActionsByTarget(target.getControllerId(), PAGE).getContent().get(0);
|
||||
|
||||
// get confirmation base
|
||||
performGet(CONFIRMATION_BASE_ACTION, MediaType.parseMediaType(DdiRestConstants.MEDIA_TYPE_APPLICATION_CBOR),
|
||||
performGet(CONFIRMATION_BASE_ACTION, MediaType.parseMediaType(DdiRootControllerRestApi.MEDIA_TYPE_APPLICATION_CBOR),
|
||||
status().isOk(), AccessContext.tenant(), target.getControllerId(), action.getId().toString());
|
||||
|
||||
// get artifacts
|
||||
performGet(SOFTWARE_MODULE_ARTIFACTS, MediaType.parseMediaType(DdiRestConstants.MEDIA_TYPE_APPLICATION_CBOR),
|
||||
performGet(SOFTWARE_MODULE_ARTIFACTS, MediaType.parseMediaType(DdiRootControllerRestApi.MEDIA_TYPE_APPLICATION_CBOR),
|
||||
status().isOk(), AccessContext.tenant(), target.getControllerId(),
|
||||
String.valueOf(softwareModuleId));
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.assertj.core.api.Condition;
|
||||
import org.eclipse.hawkbit.context.AccessContext;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiResult;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiStatus;
|
||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRestConstants;
|
||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRootControllerRestApi;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetAssignDistributionSetEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.ActionCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetCreatedEvent;
|
||||
@@ -96,17 +96,17 @@ class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
final Action action = deploymentManagement.findActiveActionsByTarget(target.getControllerId(), PAGE).getContent().get(0);
|
||||
|
||||
// get deployment base
|
||||
performGet(DEPLOYMENT_BASE, MediaType.parseMediaType(DdiRestConstants.MEDIA_TYPE_APPLICATION_CBOR), status().isOk(),
|
||||
performGet(DEPLOYMENT_BASE, MediaType.parseMediaType(DdiRootControllerRestApi.MEDIA_TYPE_APPLICATION_CBOR), status().isOk(),
|
||||
AccessContext.tenant(), target.getControllerId(), action.getId().toString());
|
||||
|
||||
// get artifacts
|
||||
performGet(SOFTWARE_MODULE_ARTIFACTS, MediaType.parseMediaType(DdiRestConstants.MEDIA_TYPE_APPLICATION_CBOR),
|
||||
performGet(SOFTWARE_MODULE_ARTIFACTS, MediaType.parseMediaType(DdiRootControllerRestApi.MEDIA_TYPE_APPLICATION_CBOR),
|
||||
status().isOk(), AccessContext.tenant(), target.getControllerId(),
|
||||
String.valueOf(softwareModuleId));
|
||||
|
||||
final byte[] feedback = jsonToCbor(getJsonProceedingDeploymentActionFeedback());
|
||||
postDeploymentFeedback(
|
||||
MediaType.parseMediaType(DdiRestConstants.MEDIA_TYPE_APPLICATION_CBOR), target.getControllerId(), action.getId(), feedback,
|
||||
MediaType.parseMediaType(DdiRootControllerRestApi.MEDIA_TYPE_APPLICATION_CBOR), target.getControllerId(), action.getId(), feedback,
|
||||
status().isOk());
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import java.util.stream.Stream;
|
||||
import org.eclipse.hawkbit.context.AccessContext;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiResult;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiStatus;
|
||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRestConstants;
|
||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRootControllerRestApi;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetAssignDistributionSetEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetAttributesRequestedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetPollEvent;
|
||||
@@ -90,11 +90,11 @@ class DdiInstalledBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
postDeploymentFeedback(target.getControllerId(), actionId, getJsonClosedDeploymentActionFeedback(), status().isOk());
|
||||
|
||||
// get installed base
|
||||
performGet(INSTALLED_BASE, MediaType.parseMediaType(DdiRestConstants.MEDIA_TYPE_APPLICATION_CBOR), status().isOk(),
|
||||
performGet(INSTALLED_BASE, MediaType.parseMediaType(DdiRootControllerRestApi.MEDIA_TYPE_APPLICATION_CBOR), status().isOk(),
|
||||
AccessContext.tenant(), target.getControllerId(), actionId.toString());
|
||||
|
||||
// get artifacts
|
||||
performGet(SOFTWARE_MODULE_ARTIFACTS, MediaType.parseMediaType(DdiRestConstants.MEDIA_TYPE_APPLICATION_CBOR),
|
||||
performGet(SOFTWARE_MODULE_ARTIFACTS, MediaType.parseMediaType(DdiRootControllerRestApi.MEDIA_TYPE_APPLICATION_CBOR),
|
||||
status().isOk(), AccessContext.tenant(), target.getControllerId(),
|
||||
String.valueOf(softwareModuleId));
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.eclipse.hawkbit.auth.SpPermission;
|
||||
import org.eclipse.hawkbit.context.AccessContext;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiResult;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiStatus;
|
||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRestConstants;
|
||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRootControllerRestApi;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetAssignDistributionSetEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetAttributesRequestedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.TargetPollEvent;
|
||||
@@ -94,9 +94,9 @@ class DdiRootControllerTest extends AbstractDDiApiIntegrationTest {
|
||||
*/
|
||||
@Test
|
||||
void rootPollResourceCbor() throws Exception {
|
||||
mvc.perform(get(CONTROLLER_BASE, AccessContext.tenant(), 4711).accept(DdiRestConstants.MEDIA_TYPE_APPLICATION_CBOR))
|
||||
mvc.perform(get(CONTROLLER_BASE, AccessContext.tenant(), 4711).accept(DdiRootControllerRestApi.MEDIA_TYPE_APPLICATION_CBOR))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(content().contentType(DdiRestConstants.MEDIA_TYPE_APPLICATION_CBOR))
|
||||
.andExpect(content().contentType(DdiRootControllerRestApi.MEDIA_TYPE_APPLICATION_CBOR))
|
||||
.andExpect(status().isOk());
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.eclipse.hawkbit.context.Mdc;
|
||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRestConstants;
|
||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRootControllerRestApi;
|
||||
import org.eclipse.hawkbit.repository.ControllerManagement;
|
||||
import org.eclipse.hawkbit.rest.SecurityManagedConfiguration;
|
||||
import org.eclipse.hawkbit.rest.security.DosFilter;
|
||||
@@ -44,7 +44,7 @@ import org.springframework.security.web.access.intercept.AuthorizationFilter;
|
||||
class ControllerDownloadSecurityConfiguration {
|
||||
|
||||
private static final String DDI_DL_ANT_MATCHER =
|
||||
DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/*";
|
||||
DdiRootControllerRestApi.CONTROLLER_V1 + "/{controllerId}/softwaremodules/{softwareModuleId}/artifacts/*";
|
||||
|
||||
private final ControllerManagement controllerManagement;
|
||||
private final DdiSecurityProperties ddiSecurityConfiguration;
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.eclipse.hawkbit.context.Mdc;
|
||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRestConstants;
|
||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRootControllerRestApi;
|
||||
import org.eclipse.hawkbit.repository.ControllerManagement;
|
||||
import org.eclipse.hawkbit.rest.SecurityManagedConfiguration;
|
||||
import org.eclipse.hawkbit.rest.security.DosFilter;
|
||||
@@ -46,7 +46,7 @@ import org.springframework.security.web.access.intercept.AuthorizationFilter;
|
||||
@EnableWebSecurity
|
||||
class ControllerSecurityConfiguration {
|
||||
|
||||
private static final String[] DDI_ANT_MATCHERS = { DdiRestConstants.BASE_V1_REQUEST_MAPPING + "/**" };
|
||||
private static final String[] DDI_ANT_MATCHERS = { DdiRootControllerRestApi.CONTROLLER_V1 + "/**" };
|
||||
|
||||
private final ControllerManagement controllerManagement;
|
||||
private final DdiSecurityProperties ddiSecurityConfiguration;
|
||||
|
||||
@@ -86,6 +86,22 @@ import org.eclipse.hawkbit.mgmt.json.model.MgmtPollStatus;
|
||||
}""")
|
||||
public class MgmtTarget extends MgmtNamedEntity {
|
||||
|
||||
/**
|
||||
* The target URL mapping, href link for assigned target type.
|
||||
*/
|
||||
public static final String TARGET_TYPE = "targetType";
|
||||
/**
|
||||
* The target URL mapping, href link for autoConfirm state of a target.
|
||||
*/
|
||||
public static final String AUTO_CONFIRM = "autoConfirm";
|
||||
/**
|
||||
* The target URL mapping, href link for target actions.
|
||||
*/
|
||||
public static final String TARGET_V1_ACTIONS = "actions";
|
||||
/**
|
||||
* The target URL mapping, href link for canceled actions.
|
||||
*/
|
||||
public static final String TARGET_V1_ACTION_STATUS = "status";
|
||||
@JsonProperty(required = true)
|
||||
@Schema(description = "Controller ID", example = "123")
|
||||
private String controllerId;
|
||||
|
||||
@@ -48,6 +48,14 @@ import org.springframework.hateoas.RepresentationModel;
|
||||
}""")
|
||||
public class MgmtTargetAutoConfirm extends RepresentationModel<MgmtTargetAutoConfirm> {
|
||||
|
||||
/**
|
||||
* The target URL mapping, href link activate auto-confirm on a target.
|
||||
*/
|
||||
public static final String ACTIVATE = "activate";
|
||||
/**
|
||||
* The target URL mapping, href link deactivate auto-confirm on a target.
|
||||
*/
|
||||
public static final String DEACTIVATE = "deactivate";
|
||||
@NotNull
|
||||
@Schema(description = "Flag if auto confirm is active", example = "true")
|
||||
private boolean active;
|
||||
|
||||
@@ -10,9 +10,17 @@
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.ACTION_ORDER;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetIfExistResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -24,8 +32,6 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.PagedList;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.action.MgmtAction;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -37,11 +43,12 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
* REST API providing (read-only) access to actions.
|
||||
*/
|
||||
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
|
||||
@Tag(
|
||||
name = "Actions", description = "REST API providing (read-only) access to actions.",
|
||||
@Tag(name = "Actions", description = "REST API providing (read-only) access to actions.",
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = ACTION_ORDER)))
|
||||
public interface MgmtActionRestApi {
|
||||
|
||||
String ACTIONS_V1 = MgmtRestConstants.REST_V1 + "/actions";
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving all actions.
|
||||
*
|
||||
@@ -56,33 +63,23 @@ public interface MgmtActionRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return all actions", description = "Handles the GET request of retrieving all actions.")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.ACTION_V1_REQUEST_MAPPING, produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = ACTIONS_V1, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtAction>> getActions(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_REPRESENTATION_MODE, defaultValue = REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT)
|
||||
@Schema(description = """
|
||||
The representation mode. Can be "full" or "compact". Defaults to "compact"
|
||||
""")
|
||||
@@ -94,11 +91,9 @@ public interface MgmtActionRestApi {
|
||||
* @param actionId The ID of the requested action
|
||||
* @return the {@link MgmtAction}
|
||||
*/
|
||||
@Operation(summary = "Return action by id",
|
||||
description = "Handles the GET request of retrieving a single action by actionId.")
|
||||
@Operation(summary = "Return action by id", description = "Handles the GET request of retrieving a single action by actionId.")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.ACTION_V1_REQUEST_MAPPING + "/{actionId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = ACTIONS_V1 + "/{actionId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtAction> getAction(@PathVariable("actionId") Long actionId);
|
||||
|
||||
/**
|
||||
@@ -109,7 +104,7 @@ public interface MgmtActionRestApi {
|
||||
*/
|
||||
@Operation(summary = "Delete a single action by id", description = "Handles the DELETE request for single action within Bosch IoT Rollouts. Required Permission: DELETE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.ACTION_V1_REQUEST_MAPPING + "/{actionId}")
|
||||
@DeleteMapping(value = ACTIONS_V1 + "/{actionId}")
|
||||
ResponseEntity<Void> deleteAction(@PathVariable("actionId") Long actionId);
|
||||
|
||||
/**
|
||||
@@ -121,12 +116,10 @@ public interface MgmtActionRestApi {
|
||||
*/
|
||||
@Operation(summary = "Delete multiple actions by list OR rsql filter", description = "Handles the DELETE request for multiple actions within Bosch IoT Rollouts. Either action id list OR rsql filter SHOULD be provided. Required Permission: DELETE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.ACTION_V1_REQUEST_MAPPING)
|
||||
@DeleteMapping(value = ACTIONS_V1)
|
||||
ResponseEntity<Void> deleteActions(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false, defaultValue = "")
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@Schema(description = "List of action ids to be deleted", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "[253, 255]")
|
||||
@RequestBody(required = false)
|
||||
|
||||
@@ -11,33 +11,34 @@ package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.BASIC_AUTH_ORDER;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
|
||||
import io.swagger.v3.oas.annotations.extensions.Extension;
|
||||
import io.swagger.v3.oas.annotations.extensions.ExtensionProperty;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.auth.MgmtUserInfo;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
/**
|
||||
* Api for handling basic authentication user validation
|
||||
* REST API for handling basic authentication user validation
|
||||
*/
|
||||
@SuppressWarnings("squid:S1609")
|
||||
@Tag(
|
||||
name = "Basic Authentication", description = "API for basic authentication user validation.",
|
||||
@Tag(name = "Basic Authentication", description = "API for basic authentication user validation.",
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = BASIC_AUTH_ORDER)))
|
||||
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
|
||||
public interface MgmtBasicAuthRestApi {
|
||||
|
||||
String USERINFO_V1 = MgmtRestConstants.REST_V1 + "/userinfo";
|
||||
|
||||
/**
|
||||
* Handles the GET request of basic auth.
|
||||
*
|
||||
* @return the userinfo with status OK.
|
||||
*/
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.AUTH_V1_REQUEST_MAPPING, produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = USERINFO_V1, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtUserInfo> validateBasicAuth();
|
||||
}
|
||||
@@ -10,6 +10,10 @@
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.DISTRIBUTION_SET_ORDER;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetIfExistResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetResponses;
|
||||
@@ -19,6 +23,8 @@ import static org.eclipse.hawkbit.rest.ApiResponsesConstants.NOT_FOUND_404;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PostCreateResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutNoContentResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -49,8 +55,6 @@ import org.eclipse.hawkbit.mgmt.json.model.targetfilter.MgmtTargetFilterQuery;
|
||||
import org.eclipse.hawkbit.rest.ApiResponsesConstants.PostUpdateNoContentResponses;
|
||||
import org.eclipse.hawkbit.rest.ApiResponsesConstants.PostUpdateResponses;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -61,14 +65,15 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* REST Resource handling for DistributionSet CRUD operations.
|
||||
* REST API for DistributionSet CRUD operations.
|
||||
*/
|
||||
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
|
||||
@Tag(
|
||||
name = "Distribution Sets", description = "REST Resource handling for DistributionSet CRUD operations.",
|
||||
@Tag(name = "Distribution Sets", description = "REST Resource handling for DistributionSet CRUD operations.",
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = DISTRIBUTION_SET_ORDER)))
|
||||
public interface MgmtDistributionSetRestApi {
|
||||
|
||||
String DISTRIBUTIONSETS_V1 = MgmtRestConstants.REST_V1 + "/distributionsets";
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving all DistributionSets .
|
||||
*
|
||||
@@ -80,33 +85,24 @@ public interface MgmtDistributionSetRestApi {
|
||||
* @return a list of all set for a defined or default page request with status OK. The response is always paged. In any failure the
|
||||
* JsonResponseExceptionHandler is handling the response.
|
||||
*/
|
||||
@Operation(summary = "Return all Distribution Sets", description = "Handles the GET request of retrieving all " +
|
||||
"distribution sets. Required permission: READ_REPOSITORY")
|
||||
@Operation(summary = "Return all Distribution Sets",
|
||||
description = "Handles the GET request of retrieving all distribution sets. Required permission: READ_REPOSITORY")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETS_V1, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtDistributionSet>> getDistributionSets(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -115,11 +111,10 @@ public interface MgmtDistributionSetRestApi {
|
||||
* @param distributionSetId the ID of the set to retrieve
|
||||
* @return a single DistributionSet with status OK.
|
||||
*/
|
||||
@Operation(summary = "Return single Distribution Set", description = "Handles the GET request of retrieving a " +
|
||||
"single distribution set. Required permission: READ_REPOSITORY")
|
||||
@Operation(summary = "Return single Distribution Set",
|
||||
description = "Handles the GET request of retrieving a single distribution set. Required permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtDistributionSet> getDistributionSet(@PathVariable("distributionSetId") Long distributionSetId);
|
||||
|
||||
/**
|
||||
@@ -133,9 +128,8 @@ public interface MgmtDistributionSetRestApi {
|
||||
"distribution sets within Hawkbit. The request body must always be a list of sets. " +
|
||||
"Required permission: CREATE_REPOSITORY")
|
||||
@PostCreateResponses
|
||||
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = DISTRIBUTIONSETS_V1,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtDistributionSet>> createDistributionSets(@RequestBody List<MgmtDistributionSetRequestBodyPost> sets);
|
||||
|
||||
/**
|
||||
@@ -144,10 +138,10 @@ public interface MgmtDistributionSetRestApi {
|
||||
* @param distributionSetId the ID of the DistributionSet to delete
|
||||
* @return status OK if delete as successful.
|
||||
*/
|
||||
@Operation(summary = "Delete Distribution Set by Id", description = "Handles the DELETE request for a single " +
|
||||
"Distribution Set. Required permission: DELETE_REPOSITORY")
|
||||
@Operation(summary = "Delete Distribution Set by Id",
|
||||
description = "Handles the DELETE request for a single Distribution Set. Required permission: DELETE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}")
|
||||
@DeleteMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}")
|
||||
ResponseEntity<Void> deleteDistributionSet(@PathVariable("distributionSetId") Long distributionSetId);
|
||||
|
||||
/**
|
||||
@@ -157,12 +151,11 @@ public interface MgmtDistributionSetRestApi {
|
||||
* @param toUpdate with the data that needs updating
|
||||
* @return status OK if update as successful with updated content.
|
||||
*/
|
||||
@Operation(summary = "Update Distribution Set", description = "Handles the UPDATE request for a single " +
|
||||
"Distribution Set. Required permission: UPDATE_REPOSITORY")
|
||||
@Operation(summary = "Update Distribution Set",
|
||||
description = "Handles the UPDATE request for a single Distribution Set. Required permission: UPDATE_REPOSITORY")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaType.APPLICATION_JSON_VALUE, MediaTypes.HAL_JSON_VALUE })
|
||||
@PutMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { APPLICATION_JSON_VALUE, HAL_JSON_VALUE })
|
||||
ResponseEntity<MgmtDistributionSet> updateDistributionSet(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@RequestBody MgmtDistributionSetRequestBodyPut toUpdate);
|
||||
@@ -182,31 +175,23 @@ public interface MgmtDistributionSetRestApi {
|
||||
"request for retrieving assigned targets of a single distribution set. " +
|
||||
"Required permissions: READ_REPOSITORY and READ_TARGET")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/assignedTargets",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/assignedTargets",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtTarget>> getAssignedTargets(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -224,31 +209,23 @@ public interface MgmtDistributionSetRestApi {
|
||||
"request for retrieving installed targets of a single distribution set. " +
|
||||
"Required permissions: READ_REPOSITORY and READ_TARGET")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/installedTargets",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/installedTargets",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtTarget>> getInstalledTargets(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -266,31 +243,23 @@ public interface MgmtDistributionSetRestApi {
|
||||
description = "Handles the GET request for retrieving assigned target filter queries of a single " +
|
||||
"distribution set. Required permissions: READ_REPOSITORY and READ_TARGET")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/autoAssignTargetFilters",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/autoAssignTargetFilters",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtTargetFilterQuery>> getAutoAssignTargetFilterQueries(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -307,10 +276,8 @@ public interface MgmtDistributionSetRestApi {
|
||||
"target IDs. Non-existing targets are silently ignored resulting in a valid response. " +
|
||||
"Required permissions: READ_REPOSITORY and UPDATE_TARGET")
|
||||
@PostUpdateResponses
|
||||
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING
|
||||
+ "/{distributionSetId}/assignedTargets", consumes = { MediaTypes.HAL_JSON_VALUE,
|
||||
MediaType.APPLICATION_JSON_VALUE }, produces = { MediaTypes.HAL_JSON_VALUE,
|
||||
MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/assignedTargets",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTargetAssignmentResponseBody> createAssignedTarget(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@RequestBody List<MgmtTargetAssignmentRequestBody> assignments,
|
||||
@@ -329,8 +296,7 @@ public interface MgmtDistributionSetRestApi {
|
||||
@ApiResponse(responseCode = NOT_FOUND_404, description = "Distribution Set not found.",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata",
|
||||
consumes = { MediaType.APPLICATION_JSON_VALUE, MediaTypes.HAL_JSON_VALUE })
|
||||
@PostMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/metadata", consumes = { APPLICATION_JSON_VALUE, HAL_JSON_VALUE })
|
||||
ResponseEntity<Void> createMetadata(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@RequestBody List<MgmtMetadata> metadataRest);
|
||||
@@ -344,8 +310,7 @@ public interface MgmtDistributionSetRestApi {
|
||||
@Operation(summary = "Return meta data for Distribution Set", description = "Get a paged list of meta data for a " +
|
||||
"distribution set. Required permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/metadata", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtMetadata>> getMetadata(@PathVariable("distributionSetId") Long distributionSetId);
|
||||
|
||||
/**
|
||||
@@ -358,8 +323,7 @@ public interface MgmtDistributionSetRestApi {
|
||||
@Operation(summary = "Return single meta data value for a specific key of a Distribution Set",
|
||||
description = "Get a single meta data value for a meta data key. Required permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata/{metadataKey}",
|
||||
produces = { MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/metadata/{metadataKey}", produces = { APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtMetadata> getMetadataValue(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@PathVariable("metadataKey") String metadataKey);
|
||||
@@ -367,30 +331,30 @@ public interface MgmtDistributionSetRestApi {
|
||||
/**
|
||||
* Updates a single meta-data value of a distribution set.
|
||||
*
|
||||
* @param distributionSetId the ID of the distribution set to update the meta data entry
|
||||
* @param distributionSetId the ID of the distribution set to update the meta-data entry
|
||||
* @param metadataKey the key of the meta-data to update the value
|
||||
* @param metadata update body
|
||||
*/
|
||||
@Operation(summary = "Update single meta data value of a distribution set", description = "Update a single meta " +
|
||||
"data value for speficic key. Required permission: UPDATE_REPOSITORY")
|
||||
@Operation(summary = "Update single meta data value of a distribution set",
|
||||
description = "Update a single meta data value for speficic key. Required permission: UPDATE_REPOSITORY")
|
||||
@PutNoContentResponses
|
||||
@PutMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata/{metadataKey}",
|
||||
consumes = { MediaType.APPLICATION_JSON_VALUE, MediaTypes.HAL_JSON_VALUE })
|
||||
@PutMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/metadata/{metadataKey}",
|
||||
consumes = { APPLICATION_JSON_VALUE, HAL_JSON_VALUE })
|
||||
ResponseEntity<Void> updateMetadata(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@PathVariable("metadataKey") String metadataKey,
|
||||
@RequestBody MgmtMetadataBodyPut metadata);
|
||||
|
||||
/**
|
||||
* Deletes a single meta data entry from the distribution set.
|
||||
* Deletes a single meta-data entry from the distribution set.
|
||||
*
|
||||
* @param distributionSetId the ID of the distribution set to delete the meta data entry
|
||||
* @param metadataKey the key of the meta data to delete
|
||||
* @param distributionSetId the ID of the distribution set to delete the meta-data entry
|
||||
* @param metadataKey the key of the meta-data to delete
|
||||
*/
|
||||
@Operation(summary = "Delete a single meta data entry from the distribution set", description = "Delete a single " +
|
||||
"meta data. Required permission: UPDATE_REPOSITORY")
|
||||
@Operation(summary = "Delete a single meta data entry from the distribution set",
|
||||
description = "Delete a single meta data. Required permission: UPDATE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata/{metadataKey}")
|
||||
@DeleteMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/metadata/{metadataKey}")
|
||||
ResponseEntity<Void> deleteMetadata(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@PathVariable("metadataKey") String metadataKey);
|
||||
@@ -408,11 +372,11 @@ public interface MgmtDistributionSetRestApi {
|
||||
""")
|
||||
@PostUpdateNoContentResponses
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = LOCKED_423, description = "Software module is locked", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
@ApiResponse(responseCode = LOCKED_423, description = "Software module is locked",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/assignedSM",
|
||||
consumes = { MediaType.APPLICATION_JSON_VALUE, MediaTypes.HAL_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/assignedSM",
|
||||
consumes = { APPLICATION_JSON_VALUE, HAL_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> assignSoftwareModules(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@RequestBody List<MgmtSoftwareModuleAssignment> softwareModuleIDs);
|
||||
@@ -428,9 +392,10 @@ public interface MgmtDistributionSetRestApi {
|
||||
description = "Delete an assignment. Required permission: UPDATE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = LOCKED_423, description = "Distribution set is locked", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
@ApiResponse(responseCode = LOCKED_423, description = "Distribution set is locked",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@DeleteMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/assignedSM/{softwareModuleId}")
|
||||
@DeleteMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/assignedSM/{softwareModuleId}")
|
||||
ResponseEntity<Void> deleteAssignSoftwareModules(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@PathVariable("softwareModuleId") Long softwareModuleId);
|
||||
@@ -447,29 +412,21 @@ public interface MgmtDistributionSetRestApi {
|
||||
* @return a list of the assigned software modules of a distribution set with status OK, if none is assigned than {@code null}
|
||||
*/
|
||||
@Operation(summary = "Return the assigned software modules of a specific distribution set",
|
||||
description = "Handles the GET request of retrieving a single distribution set. " +
|
||||
"Required permission: READ_REPOSITORY")
|
||||
description = "Handles the GET request of retrieving a single distribution set. Required permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/assignedSM",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/assignedSM", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtSoftwareModule>> getAssignedSoftwareModules(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -478,26 +435,25 @@ public interface MgmtDistributionSetRestApi {
|
||||
* @param distributionSetId the ID of the set to retrieve
|
||||
* @return a DistributionSetStatistics with status OK.
|
||||
*/
|
||||
@Operation(summary = "Return Rollouts count by status for Distribution Set", description = "Handles the GET " +
|
||||
"request of retrieving Rollouts count by Status for Distribution Set")
|
||||
@Operation(summary = "Return Rollouts count by status for Distribution Set",
|
||||
description = "Handles the GET request of retrieving Rollouts count by Status for Distribution Set")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/statistics/rollouts",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/statistics/rollouts",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtDistributionSetStatistics> getRolloutsCountByStatusForDistributionSet(
|
||||
@PathVariable("distributionSetId") Long distributionSetId);
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving Actions count by Status
|
||||
* for Distribution Set.
|
||||
* Handles the GET request of retrieving Actions count by Status for Distribution Set.
|
||||
*
|
||||
* @param distributionSetId the ID of the set to retrieve
|
||||
* @return a DistributionSetStatistics with status OK.
|
||||
*/
|
||||
@Operation(summary = "Return Actions count by status for Distribution Set", description = "Handles the GET " +
|
||||
"request of retrieving Actions count by Status for Distribution Set")
|
||||
@Operation(summary = "Return Actions count by status for Distribution Set",
|
||||
description = "Handles the GET request of retrieving Actions count by Status for Distribution Set")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/statistics/actions",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/statistics/actions",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtDistributionSetStatistics> getActionsCountByStatusForDistributionSet(
|
||||
@PathVariable("distributionSetId") Long distributionSetId);
|
||||
|
||||
@@ -507,11 +463,11 @@ public interface MgmtDistributionSetRestApi {
|
||||
* @param distributionSetId the ID of the set to retrieve
|
||||
* @return a DistributionSetStatistics with status OK.
|
||||
*/
|
||||
@Operation(summary = "Return Auto Assignments count for Distribution Set", description = "Handles the GET " +
|
||||
"request of retrieving Auto Assignments count for Distribution Set")
|
||||
@Operation(summary = "Return Auto Assignments count for Distribution Set",
|
||||
description = "Handles the GET request of retrieving Auto Assignments count for Distribution Set")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/statistics/autoassignments",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/statistics/autoassignments",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtDistributionSetStatistics> getAutoAssignmentsCountForDistributionSet(
|
||||
@PathVariable("distributionSetId") Long distributionSetId);
|
||||
|
||||
@@ -522,11 +478,9 @@ public interface MgmtDistributionSetRestApi {
|
||||
* @return a DistributionSetStatistics with status OK.
|
||||
*/
|
||||
@Operation(summary = "Return Rollouts, Actions and Auto Assignments counts by Status for Distribution Set",
|
||||
description = "Handles the GET request of retrieving Rollouts, Actions and Auto Assignments counts by " +
|
||||
"Status for Distribution Set")
|
||||
description = "Handles the GET request of retrieving Rollouts, Actions and Auto Assignments counts by Status for Distribution Set")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/statistics",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/statistics", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtDistributionSetStatistics> getStatisticsForDistributionSet(@PathVariable("distributionSetId") Long distributionSetId);
|
||||
|
||||
/**
|
||||
@@ -544,12 +498,13 @@ public interface MgmtDistributionSetRestApi {
|
||||
""")
|
||||
@PostUpdateNoContentResponses
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = METHOD_NOT_ALLOWED_405, description = "Software module is locked", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
|
||||
@ApiResponse(responseCode = LOCKED_423, description = "Distribution set is locked", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
@ApiResponse(responseCode = METHOD_NOT_ALLOWED_405, description = "Software module is locked",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
|
||||
@ApiResponse(responseCode = LOCKED_423, description = "Distribution set is locked",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/invalidate",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = DISTRIBUTIONSETS_V1 + "/{distributionSetId}/invalidate",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> invalidateDistributionSet(
|
||||
@PathVariable("distributionSetId") Long distributionSetId,
|
||||
@Valid @RequestBody MgmtInvalidateDistributionSetRequestBody invalidateRequestBody);
|
||||
|
||||
@@ -10,12 +10,18 @@
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.DISTRIBUTION_SET_TAG_ORDER;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetIfExistResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PostCreateNoContentResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PostCreateResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -30,8 +36,6 @@ import org.eclipse.hawkbit.mgmt.json.model.tag.MgmtTag;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.tag.MgmtTagRequestBodyPut;
|
||||
import org.eclipse.hawkbit.rest.ApiResponsesConstants.PostUpdateNoContentResponses;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -42,14 +46,16 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* REST Resource handling for DistributionSetTag CRUD operations.
|
||||
* REST API for DistributionSetTag CRUD operations.
|
||||
*/
|
||||
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
|
||||
@Tag(
|
||||
name = "Distribution Set Tags", description = "REST Resource handling for DistributionSetTag CRUD operations.",
|
||||
@Tag(name = "Distribution Set Tags", description = "REST Resource handling for DistributionSetTag CRUD operations.",
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = DISTRIBUTION_SET_TAG_ORDER)))
|
||||
public interface MgmtDistributionSetTagRestApi {
|
||||
|
||||
String DISTRIBUTIONSETTAGS_V1 = MgmtRestConstants.REST_V1 + "/distributionsettags";
|
||||
String DISTRIBUTIONSET_TAG_ID_ASSIGNED = "/{distributionsetTagId}/assigned";
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving all DistributionSet tags.
|
||||
*
|
||||
@@ -61,33 +67,24 @@ public interface MgmtDistributionSetTagRestApi {
|
||||
* @return a list of all target tags for a defined or default page request with status OK. The response is always paged. In any failure the
|
||||
* JsonResponseExceptionHandler is handling the response.
|
||||
*/
|
||||
@Operation(summary = "Return all Distribution Set Tags", description = "Handles the GET request of retrieving " +
|
||||
"all distribution set tags.")
|
||||
@Operation(summary = "Return all Distribution Set Tags",
|
||||
description = "Handles the GET request of retrieving all distribution set tags.")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETTAGS_V1, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtTag>> getDistributionSetTags(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -99,8 +96,7 @@ public interface MgmtDistributionSetTagRestApi {
|
||||
@Operation(summary = "Return single Distribution Set Tag",
|
||||
description = "Handles the GET request of retrieving a single distribution set tag.")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/{distributionsetTagId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETTAGS_V1 + "/{distributionsetTagId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTag> getDistributionSetTag(@PathVariable("distributionsetTagId") Long distributionsetTagId);
|
||||
|
||||
/**
|
||||
@@ -113,9 +109,8 @@ public interface MgmtDistributionSetTagRestApi {
|
||||
@Operation(summary = "Creates new Distribution Set Tags", description = "Handles the POST request of creating " +
|
||||
"new distribution set tag. The request body must always be a list of distribution set tags.")
|
||||
@PostCreateResponses
|
||||
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = DISTRIBUTIONSETTAGS_V1,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtTag>> createDistributionSetTags(@RequestBody List<MgmtTagRequestBodyPut> tags);
|
||||
|
||||
/**
|
||||
@@ -128,9 +123,8 @@ public interface MgmtDistributionSetTagRestApi {
|
||||
@Operation(summary = "Update Distribution Set Tag",
|
||||
description = "Handles the PUT request of updating a distribution set tag.")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/{distributionsetTagId}",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PutMapping(value = DISTRIBUTIONSETTAGS_V1 + "/{distributionsetTagId}",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTag> updateDistributionSetTag(
|
||||
@PathVariable("distributionsetTagId") Long distributionsetTagId,
|
||||
@RequestBody MgmtTagRequestBodyPut restDSTagRest);
|
||||
@@ -144,7 +138,7 @@ public interface MgmtDistributionSetTagRestApi {
|
||||
@Operation(summary = "Delete a single distribution set tag",
|
||||
description = "Handles the DELETE request of deleting a single distribution set tag.")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/{distributionsetTagId}")
|
||||
@DeleteMapping(value = DISTRIBUTIONSETTAGS_V1 + "/{distributionsetTagId}")
|
||||
ResponseEntity<Void> deleteDistributionSetTag(@PathVariable("distributionsetTagId") Long distributionsetTagId);
|
||||
|
||||
/**
|
||||
@@ -161,31 +155,22 @@ public interface MgmtDistributionSetTagRestApi {
|
||||
@Operation(summary = "Return all assigned distribution sets by given tag Id",
|
||||
description = "Handles the GET request of retrieving a list of assigned distributions.")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + MgmtRestConstants.DISTRIBUTIONSET_TAG_ID_ASSIGNED,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETTAGS_V1 + DISTRIBUTIONSET_TAG_ID_ASSIGNED, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtDistributionSet>> getAssignedDistributionSets(
|
||||
@PathVariable("distributionsetTagId") Long distributionsetTagId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -198,7 +183,7 @@ public interface MgmtDistributionSetTagRestApi {
|
||||
@Operation(summary = "Assign distribution set to the given tag id",
|
||||
description = "Handles the POST request of distribution assignment. Already assigned distribution will be ignored.")
|
||||
@PostCreateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + MgmtRestConstants.DISTRIBUTIONSET_TAG_ID_ASSIGNED + "/{distributionsetId}")
|
||||
@PostMapping(value = DISTRIBUTIONSETTAGS_V1 + DISTRIBUTIONSET_TAG_ID_ASSIGNED + "/{distributionsetId}")
|
||||
ResponseEntity<Void> assignDistributionSet(
|
||||
@PathVariable("distributionsetTagId") Long distributionsetTagId,
|
||||
@PathVariable("distributionsetId") Long distributionsetId);
|
||||
@@ -213,9 +198,8 @@ public interface MgmtDistributionSetTagRestApi {
|
||||
@Operation(summary = "Assign distribution sets to the given tag id",
|
||||
description = "Handles the POST request of distribution assignment. Already assigned distribution will be ignored.")
|
||||
@PostUpdateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + MgmtRestConstants.DISTRIBUTIONSET_TAG_ID_ASSIGNED,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = DISTRIBUTIONSETTAGS_V1 + DISTRIBUTIONSET_TAG_ID_ASSIGNED,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> assignDistributionSets(
|
||||
@PathVariable("distributionsetTagId") Long distributionsetTagId,
|
||||
@RequestBody List<Long> distributionsetIds);
|
||||
@@ -230,8 +214,7 @@ public interface MgmtDistributionSetTagRestApi {
|
||||
@Operation(summary = "Unassign one distribution set from the given tag id",
|
||||
description = "Handles the DELETE request of unassign the given distribution.")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING +
|
||||
MgmtRestConstants.DISTRIBUTIONSET_TAG_ID_ASSIGNED + "/{distributionsetId}")
|
||||
@DeleteMapping(value = DISTRIBUTIONSETTAGS_V1 + DISTRIBUTIONSET_TAG_ID_ASSIGNED + "/{distributionsetId}")
|
||||
ResponseEntity<Void> unassignDistributionSet(
|
||||
@PathVariable("distributionsetTagId") Long distributionsetTagId,
|
||||
@PathVariable("distributionsetId") Long distributionsetId);
|
||||
@@ -246,8 +229,7 @@ public interface MgmtDistributionSetTagRestApi {
|
||||
@Operation(summary = "Unassign multiple distribution sets from the given tag id",
|
||||
description = "Handles the DELETE request of unassign the given distribution.")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING +
|
||||
MgmtRestConstants.DISTRIBUTIONSET_TAG_ID_ASSIGNED)
|
||||
@DeleteMapping(value = DISTRIBUTIONSETTAGS_V1 + DISTRIBUTIONSET_TAG_ID_ASSIGNED)
|
||||
ResponseEntity<Void> unassignDistributionSets(
|
||||
@PathVariable("distributionsetTagId") Long distributionsetTagId,
|
||||
@RequestBody List<Long> distributionsetIds);
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.DISTRIBUTION_SET_TYPE_ORDER;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetIfExistResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetResponses;
|
||||
@@ -17,6 +21,8 @@ import static org.eclipse.hawkbit.rest.ApiResponsesConstants.NOT_FOUND_404;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PostCreateNoContentResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PostCreateResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -35,8 +41,6 @@ import org.eclipse.hawkbit.mgmt.json.model.distributionsettype.MgmtDistributionS
|
||||
import org.eclipse.hawkbit.mgmt.json.model.distributionsettype.MgmtDistributionSetTypeRequestBodyPut;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModuleType;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -47,14 +51,17 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* REST Resource handling for DistributionSetType CRUD operations.
|
||||
* REST API for DistributionSetType CRUD operations.
|
||||
*/
|
||||
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
|
||||
@Tag(
|
||||
name = "Distribution Set Types", description = "REST Resource handling for DistributionSetType CRUD operations.",
|
||||
@Tag(name = "Distribution Set Types", description = "REST Resource handling for DistributionSetType CRUD operations.",
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = DISTRIBUTION_SET_TYPE_ORDER)))
|
||||
public interface MgmtDistributionSetTypeRestApi {
|
||||
|
||||
String DISTRIBUTIONSETTYPES_V1 = MgmtRestConstants.REST_V1 + "/distributionsettypes";
|
||||
String MANDATORYMODULETYPES = "mandatorymoduletypes";
|
||||
String OPTIONALMODULETYPES = "optionalmoduletypes";
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving all DistributionSetTypes.
|
||||
*
|
||||
@@ -69,30 +76,21 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
@Operation(summary = "Return all Distribution Set Types", description = "Handles the GET request of " +
|
||||
"retrieving all distribution set types. Required Permission: READ_REPOSITORY")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETTYPES_V1, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtDistributionSetType>> getDistributionSetTypes(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -104,8 +102,7 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
@Operation(summary = "Return single Distribution Set Type", description = "Handles the GET request of retrieving a " +
|
||||
"single distribution set type. Required Permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETTYPES_V1 + "/{distributionSetTypeId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtDistributionSetType> getDistributionSetType(
|
||||
@PathVariable("distributionSetTypeId") Long distributionSetTypeId);
|
||||
|
||||
@@ -115,10 +112,10 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
* @param distributionSetTypeId the ID of the module to retrieve
|
||||
* @return status OK if delete is successful.
|
||||
*/
|
||||
@Operation(summary = "Delete Distribution Set Type by Id", description = "Handles the DELETE request for a single" +
|
||||
" distribution set type. Required Permission: DELETE_REPOSITORY")
|
||||
@Operation(summary = "Delete Distribution Set Type by Id",
|
||||
description = "Handles the DELETE request for a single distribution set type. Required Permission: DELETE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}")
|
||||
@DeleteMapping(value = DISTRIBUTIONSETTYPES_V1 + "/{distributionSetTypeId}")
|
||||
ResponseEntity<Void> deleteDistributionSetType(@PathVariable("distributionSetTypeId") Long distributionSetTypeId);
|
||||
|
||||
/**
|
||||
@@ -128,12 +125,11 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
* @param restDistributionSetType the DS type to be updated.
|
||||
* @return status OK if update is successful
|
||||
*/
|
||||
@Operation(summary = "Update Distribution Set Type", description = "Handles the PUT request for a single " +
|
||||
"distribution set type. Required Permission: UPDATE_REPOSITORY")
|
||||
@Operation(summary = "Update Distribution Set Type",
|
||||
description = "Handles the PUT request for a single distribution set type. Required Permission: UPDATE_REPOSITORY")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PutMapping(value = DISTRIBUTIONSETTYPES_V1 + "/{distributionSetTypeId}",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtDistributionSetType> updateDistributionSetType(
|
||||
@PathVariable("distributionSetTypeId") Long distributionSetTypeId,
|
||||
@RequestBody MgmtDistributionSetTypeRequestBodyPut restDistributionSetType);
|
||||
@@ -149,9 +145,8 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
"new distribution set types. The request body must always be a list of types. " +
|
||||
"Required Permission: CREATE_REPOSITORY")
|
||||
@PostCreateResponses
|
||||
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = DISTRIBUTIONSETTYPES_V1,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtDistributionSetType>> createDistributionSetTypes(
|
||||
@RequestBody List<MgmtDistributionSetTypeRequestBodyPost> distributionSetTypes);
|
||||
|
||||
@@ -165,9 +160,8 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
description = "Handles the GET request of retrieving the list of mandatory software module types in that " +
|
||||
"distribution set type. Required Permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/" +
|
||||
MgmtRestConstants.MANDATORYMODULETYPES,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETTYPES_V1 + "/{distributionSetTypeId}/" + MANDATORYMODULETYPES,
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtSoftwareModuleType>> getMandatoryModules(
|
||||
@PathVariable("distributionSetTypeId") Long distributionSetTypeId);
|
||||
|
||||
@@ -183,9 +177,8 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
description = "Handles the GET request of retrieving the single mandatory software module type in that " +
|
||||
"distribution set type. Required Permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/" +
|
||||
MgmtRestConstants.MANDATORYMODULETYPES + "/{softwareModuleTypeId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETTYPES_V1 + "/{distributionSetTypeId}/" + MANDATORYMODULETYPES + "/{softwareModuleTypeId}",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtSoftwareModuleType> getMandatoryModule(
|
||||
@PathVariable("distributionSetTypeId") Long distributionSetTypeId,
|
||||
@PathVariable("softwareModuleTypeId") Long softwareModuleTypeId);
|
||||
@@ -201,9 +194,8 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
description = "Handles the GET request of retrieving the single optional software module type in that " +
|
||||
"distribution set type. Required Permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/" +
|
||||
MgmtRestConstants.OPTIONALMODULETYPES + "/{softwareModuleTypeId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETTYPES_V1 + "/{distributionSetTypeId}/" + OPTIONALMODULETYPES + "/{softwareModuleTypeId}",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtSoftwareModuleType> getOptionalModule(
|
||||
@PathVariable("distributionSetTypeId") Long distributionSetTypeId,
|
||||
@PathVariable("softwareModuleTypeId") Long softwareModuleTypeId);
|
||||
@@ -218,9 +210,8 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
description = "Handles the GET request of retrieving the list of optional software module types in that " +
|
||||
"distribution set type. Required Permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/" +
|
||||
MgmtRestConstants.OPTIONALMODULETYPES,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = DISTRIBUTIONSETTYPES_V1 + "/{distributionSetTypeId}/" + OPTIONALMODULETYPES,
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtSoftwareModuleType>> getOptionalModules(
|
||||
@PathVariable("distributionSetTypeId") Long distributionSetTypeId);
|
||||
|
||||
@@ -235,8 +226,7 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
description = "Handles the DELETE request for removing a software module type from a single " +
|
||||
"distribution set type. Required Permission: DELETE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/" +
|
||||
MgmtRestConstants.MANDATORYMODULETYPES + "/{softwareModuleTypeId}")
|
||||
@DeleteMapping(value = DISTRIBUTIONSETTYPES_V1 + "/{distributionSetTypeId}/" + MANDATORYMODULETYPES + "/{softwareModuleTypeId}")
|
||||
ResponseEntity<Void> removeMandatoryModule(
|
||||
@PathVariable("distributionSetTypeId") Long distributionSetTypeId,
|
||||
@PathVariable("softwareModuleTypeId") Long softwareModuleTypeId);
|
||||
@@ -253,8 +243,7 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
"Note that a DS type cannot be changed after it has been used by a DS. " +
|
||||
"Required Permission: UPDATE_REPOSITORY and READ_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/" +
|
||||
MgmtRestConstants.OPTIONALMODULETYPES + "/{softwareModuleTypeId}")
|
||||
@DeleteMapping(value = DISTRIBUTIONSETTYPES_V1 + "/{distributionSetTypeId}/" + OPTIONALMODULETYPES + "/{softwareModuleTypeId}")
|
||||
ResponseEntity<Void> removeOptionalModule(
|
||||
@PathVariable("distributionSetTypeId") Long distributionSetTypeId,
|
||||
@PathVariable("softwareModuleTypeId") Long softwareModuleTypeId);
|
||||
@@ -275,9 +264,8 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
@ApiResponse(responseCode = NOT_FOUND_404, description = "Distribution Set Type not found.",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/" +
|
||||
MgmtRestConstants.MANDATORYMODULETYPES,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = DISTRIBUTIONSETTYPES_V1 + "/{distributionSetTypeId}/" + MANDATORYMODULETYPES,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> addMandatoryModule(
|
||||
@PathVariable("distributionSetTypeId") Long distributionSetTypeId,
|
||||
@RequestBody MgmtId smtId);
|
||||
@@ -298,9 +286,8 @@ public interface MgmtDistributionSetTypeRestApi {
|
||||
@ApiResponse(responseCode = NOT_FOUND_404, description = "Distribution Set Type not found.",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}/" +
|
||||
MgmtRestConstants.OPTIONALMODULETYPES,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = DISTRIBUTIONSETTYPES_V1 + "/{distributionSetTypeId}/" + OPTIONALMODULETYPES,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> addOptionalModule(
|
||||
@PathVariable("distributionSetTypeId") Long distributionSetTypeId,
|
||||
@RequestBody MgmtId smtId);
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
/**
|
||||
* API to download artifacts
|
||||
* REST API to download artifacts
|
||||
*/
|
||||
@FunctionalInterface
|
||||
@Tag(
|
||||
@@ -50,7 +50,7 @@ public interface MgmtDownloadArtifactRestApi {
|
||||
@ApiResponse(responseCode = INTERNAL_SERVER_ERROR_500, description = "Artifact download or decryption failed",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@GetMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts/{artifactId}/download")
|
||||
@GetMapping(value = MgmtSoftwareModuleRestApi.SOFTWAREMODULES_V1 + "/{softwareModuleId}/artifacts/{artifactId}/download")
|
||||
@ResponseBody
|
||||
ResponseEntity<InputStream> downloadArtifact(
|
||||
@PathVariable("softwareModuleId") Long softwareModuleId,
|
||||
|
||||
@@ -18,7 +18,6 @@ import java.util.Optional;
|
||||
public enum MgmtRepresentationMode {
|
||||
|
||||
FULL("full"),
|
||||
|
||||
COMPACT("compact");
|
||||
|
||||
private final String mode;
|
||||
|
||||
@@ -18,158 +18,41 @@ import lombok.NoArgsConstructor;
|
||||
@NoArgsConstructor(access = AccessLevel.PRIVATE)
|
||||
public final class MgmtRestConstants {
|
||||
|
||||
/**
|
||||
* The base URL mapping of the rest resources.
|
||||
*/
|
||||
public static final String REST = "/rest";
|
||||
/**
|
||||
* API version definition. We are using only major versions.
|
||||
*/
|
||||
public static final String API_VERSION = "v1";
|
||||
public static final String API_VERSION_1 = "v1";
|
||||
/**
|
||||
* The base URL mapping of the SP rest resources.
|
||||
* The base URL mapping of the rest V1 resources.
|
||||
*/
|
||||
public static final String BASE_REST_MAPPING = "/rest";
|
||||
public static final String REST_V1 = REST + "/" + API_VERSION_1;
|
||||
|
||||
/**
|
||||
* The base URL mapping of the SP rest resources.
|
||||
* The request parameter for searching. The value of the search parameter must be in the FIQL syntax.
|
||||
*/
|
||||
public static final String BASE_V1_REQUEST_MAPPING = BASE_REST_MAPPING + "/v1";
|
||||
public static final String REQUEST_PARAMETER_SEARCH = "q";
|
||||
/**
|
||||
* The software module URL mapping rest resource.
|
||||
* The request parameter for specifying the representation mode. The value of this parameter can either be "full" or "compact".
|
||||
*/
|
||||
public static final String SOFTWAREMODULE_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/softwaremodules";
|
||||
public static final String REQUEST_PARAMETER_REPRESENTATION_MODE = "representation";
|
||||
/**
|
||||
* The target URL mapping rest resource.
|
||||
* The default representation mode.
|
||||
*/
|
||||
public static final String TARGET_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/targets";
|
||||
public static final String REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT = "compact";
|
||||
/**
|
||||
* The tag URL mapping rest resource.
|
||||
*/
|
||||
public static final String TARGET_TAG_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/targettags";
|
||||
/**
|
||||
* The target type URL mapping rest resource.
|
||||
*/
|
||||
public static final String TARGETTYPE_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/targettypes";
|
||||
/**
|
||||
* The target group URL mapping rest resource.
|
||||
*/
|
||||
public static final String TARGET_GROUP_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/targetgroups";
|
||||
/**
|
||||
* The tag URL mapping rest resource.
|
||||
*/
|
||||
public static final String DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING
|
||||
+ "/distributionsettags";
|
||||
/**
|
||||
* The target URL mapping rest resource.
|
||||
*/
|
||||
public static final String TARGET_FILTER_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/targetfilters";
|
||||
/**
|
||||
* The action URL mapping rest resource.
|
||||
*/
|
||||
public static final String ACTION_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/actions";
|
||||
/**
|
||||
* The software module type URL mapping rest resource.
|
||||
*/
|
||||
public static final String SOFTWAREMODULETYPE_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/softwaremoduletypes";
|
||||
/**
|
||||
* The distributon set base resource.
|
||||
*/
|
||||
public static final String DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING
|
||||
+ "/distributionsettypes";
|
||||
/**
|
||||
* The software module URL mapping rest resource.
|
||||
*/
|
||||
public static final String DISTRIBUTIONSET_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/distributionsets";
|
||||
/**
|
||||
* The rollout URL mapping rest resource.
|
||||
*/
|
||||
public static final String ROLLOUT_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/rollouts";
|
||||
/**
|
||||
* The basic authentication validation mapping
|
||||
*/
|
||||
public static final String AUTH_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + "/userinfo";
|
||||
/**
|
||||
* String representation of
|
||||
* {@link #REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE}.
|
||||
* String representation of {@link #REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE}.
|
||||
*/
|
||||
public static final String REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT = "50";
|
||||
/**
|
||||
* The default limit parameter in case the limit parameter is not present in
|
||||
* the request.
|
||||
* The default limit parameter in case the limit parameter is not present in the request.
|
||||
*
|
||||
* @see #REQUEST_PARAMETER_PAGING_LIMIT
|
||||
*/
|
||||
public static final int REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE = Integer
|
||||
.parseInt(REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT);
|
||||
/**
|
||||
* The base URL mapping for the spring acuator management context path.
|
||||
*/
|
||||
public static final String BASE_SYSTEM_MAPPING = "/system";
|
||||
public static final String SYSTEM_V1_REQUEST_MAPPING = BASE_V1_REQUEST_MAPPING + BASE_SYSTEM_MAPPING;
|
||||
/**
|
||||
* URL mapping for system admin operations.
|
||||
*/
|
||||
public static final String SYSTEM_ADMIN_MAPPING = BASE_SYSTEM_MAPPING + "/admin";
|
||||
/**
|
||||
* The target URL mapping, href link for assigned target type.
|
||||
*/
|
||||
public static final String TARGET_V1_ASSIGNED_TARGET_TYPE = "targetType";
|
||||
/**
|
||||
* The target URL mapping, href link for autoConfirm state of a target.
|
||||
*/
|
||||
public static final String TARGET_V1_AUTO_CONFIRM = "autoConfirm";
|
||||
/**
|
||||
* The target URL mapping, href link activate auto-confirm on a target.
|
||||
*/
|
||||
public static final String TARGET_V1_ACTIVATE_AUTO_CONFIRM = "activate";
|
||||
/**
|
||||
* The target URL mapping, href link deactivate auto-confirm on a target.
|
||||
*/
|
||||
public static final String TARGET_V1_DEACTIVATE_AUTO_CONFIRM = "deactivate";
|
||||
/**
|
||||
* The target URL mapping, href link for assigned distribution set.
|
||||
*/
|
||||
public static final String TARGET_V1_ASSIGNED_DISTRIBUTION_SET = "assignedDS";
|
||||
/**
|
||||
* The target URL mapping, href link for installed distribution set.
|
||||
*/
|
||||
public static final String TARGET_V1_INSTALLED_DISTRIBUTION_SET = "installedDS";
|
||||
/**
|
||||
* The target URL mapping, href link for target attributes.
|
||||
*/
|
||||
public static final String TARGET_V1_ATTRIBUTES = "attributes";
|
||||
/**
|
||||
* The target URL mapping, href link for target actions.
|
||||
*/
|
||||
public static final String TARGET_V1_ACTIONS = "actions";
|
||||
/**
|
||||
* The target URL mapping, href link for canceled actions.
|
||||
*/
|
||||
public static final String TARGET_V1_CANCELED_ACTION = "canceledaction";
|
||||
/**
|
||||
* The target URL mapping, href link for canceled actions.
|
||||
*/
|
||||
public static final String TARGET_V1_ACTION_STATUS = "status";
|
||||
/**
|
||||
* The target URL mapping, href link for a rollout.
|
||||
*/
|
||||
public static final String TARGET_V1_ROLLOUT = "rollout";
|
||||
/**
|
||||
* The target URL mapping rest resource.
|
||||
*/
|
||||
public static final String TARGET_TARGET_ID_TARGETTYPE = "/{targetId}/targettype";
|
||||
/**
|
||||
* The target type URL mapping rest resource.
|
||||
*/
|
||||
public static final String COMPATIBLEDISTRIBUTIONSETTYPES = "compatibledistributionsettypes";
|
||||
/**
|
||||
* The tag URL mapping rest resource.
|
||||
*/
|
||||
public static final String TARGET_TAG_ID_ASSIGNED = "/{targetTagId}/assigned";
|
||||
/**
|
||||
* The tag URL mapping rest resource.
|
||||
*/
|
||||
public static final String DISTRIBUTIONSET_TAG_ID_ASSIGNED = "/{distributionsetTagId}/assigned";
|
||||
/**
|
||||
* Target group URL mapping rest resource
|
||||
*/
|
||||
public static final String GROUP_ASSIGNED = "/{group}/assigned";
|
||||
public static final int REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE = Integer.parseInt(REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT);
|
||||
/**
|
||||
* The default offset parameter in case the offset parameter is not present in the request.
|
||||
*
|
||||
@@ -195,48 +78,12 @@ public final class MgmtRestConstants {
|
||||
*/
|
||||
public static final String REQUEST_PARAMETER_PAGING_OFFSET = "offset";
|
||||
/**
|
||||
* The request parameter for sorting. The value of the sort parameter must be in the following pattern. Example:
|
||||
* http://www.bosch.com/iap/sp/rest/targets?sort=field_1:ASC,field_2:DESC,field_3:ASC
|
||||
* The request parameter for sorting. The value of the sort parameter must be in the following pattern.<br/>
|
||||
* Example: <code>https://www.foo.com/iap/sp/rest/targets?sort=field_1:ASC,field_2:DESC,field_3:ASC</code>
|
||||
*/
|
||||
public static final String REQUEST_PARAMETER_SORTING = "sort";
|
||||
/**
|
||||
* The request parameter for searching. The value of the search parameter must be in the FIQL syntax.
|
||||
*/
|
||||
public static final String REQUEST_PARAMETER_SEARCH = "q";
|
||||
/**
|
||||
* The request parameter for specifying the representation mode. The value of this parameter can either be "full" or "compact".
|
||||
*/
|
||||
public static final String REQUEST_PARAMETER_REPRESENTATION_MODE = "representation";
|
||||
/**
|
||||
* The default representation mode.
|
||||
*/
|
||||
public static final String REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT = "compact";
|
||||
/**
|
||||
* Request parameter for async
|
||||
*/
|
||||
public static final String REQUEST_PARAMETER_ASYNC = "async";
|
||||
/**
|
||||
* The target URL mapping, href link for artifact download.
|
||||
*/
|
||||
public static final String SOFTWAREMODULE_V1_ARTIFACT = "artifacts";
|
||||
/**
|
||||
* The target URL mapping, href link for software module access.
|
||||
*/
|
||||
public static final String DISTRIBUTIONSET_V1_MODULE = "modules";
|
||||
/**
|
||||
* The target URL mapping, href link for type information.
|
||||
*/
|
||||
public static final String SOFTWAREMODULE_V1_TYPE = "type";
|
||||
public static final String OPTIONALMODULES = "optionalmodules";
|
||||
public static final String MANDATORYMODULES = "mandatorymodules";
|
||||
public static final String OPTIONALMODULETYPES = "optionalmoduletypes";
|
||||
public static final String MANDATORYMODULETYPES = "mandatorymoduletypes";
|
||||
/**
|
||||
* Request parameter if the artifact url handler should be used
|
||||
*/
|
||||
public static final String REQUEST_PARAMETER_USE_ARTIFACT_URL_HANDLER = "useartifacturlhandler";
|
||||
|
||||
// Orders
|
||||
// API Orders (used for sorting in OpenAPI doc / Swagger UI)
|
||||
public static final String TARGET_ORDER = "1000";
|
||||
public static final String TARGET_TAG_ORDER = "2000";
|
||||
public static final String TARGET_TYPE_ORDER = "3000";
|
||||
|
||||
@@ -9,6 +9,12 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.ROLLOUT_ORDER;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetIfExistResponses;
|
||||
@@ -17,6 +23,8 @@ import static org.eclipse.hawkbit.rest.ApiResponsesConstants.NOT_FOUND_404;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PostCreateNoContentResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PostCreateResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.extensions.Extension;
|
||||
@@ -34,8 +42,6 @@ import org.eclipse.hawkbit.mgmt.json.model.rolloutgroup.MgmtRolloutGroupResponse
|
||||
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
|
||||
import org.eclipse.hawkbit.rest.ApiResponsesConstants.PostUpdateNoContentResponses;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -46,14 +52,15 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* REST Resource handling rollout CRUD operations.
|
||||
* REST API for Rollout CRUD operations.
|
||||
*/
|
||||
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
|
||||
@Tag(
|
||||
name = "Rollouts", description = "REST API for Rollout CRUD operations.",
|
||||
@Tag(name = "Rollouts", description = "REST API for Rollout CRUD operations.",
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = ROLLOUT_ORDER)))
|
||||
public interface MgmtRolloutRestApi {
|
||||
|
||||
String ROLLOUTS_V1 = MgmtRestConstants.REST_V1 + "/rollouts";
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving all rollouts.
|
||||
*
|
||||
@@ -66,36 +73,26 @@ public interface MgmtRolloutRestApi {
|
||||
* @return a list of all rollouts for a defined or default page request with status OK. The response is always paged. In any failure the
|
||||
* JsonResponseExceptionHandler is handling the response.
|
||||
*/
|
||||
@Operation(summary = "Return all Rollouts", description = "Handles the GET request of retrieving all rollouts. " +
|
||||
"Required Permission: READ_ROLLOUT")
|
||||
@Operation(summary = "Return all Rollouts",
|
||||
description = "Handles the GET request of retrieving all rollouts. Required Permission: READ_ROLLOUT")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = ROLLOUTS_V1, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtRolloutResponseBody>> getRollouts(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_REPRESENTATION_MODE, defaultValue = REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT)
|
||||
String representationModeParam);
|
||||
|
||||
/**
|
||||
@@ -104,11 +101,10 @@ public interface MgmtRolloutRestApi {
|
||||
* @param rolloutId the ID of the rollout to retrieve
|
||||
* @return a single rollout with status OK.
|
||||
*/
|
||||
@Operation(summary = "Return single Rollout", description = "Handles the GET request of retrieving a single " +
|
||||
"rollout. Required Permission: READ_ROLLOUT")
|
||||
@Operation(summary = "Return single Rollout",
|
||||
description = "Handles the GET request of retrieving a single rollout. Required Permission: READ_ROLLOUT")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = ROLLOUTS_V1 + "/{rolloutId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtRolloutResponseBody> getRollout(@PathVariable("rolloutId") Long rolloutId);
|
||||
|
||||
/**
|
||||
@@ -121,9 +117,8 @@ public interface MgmtRolloutRestApi {
|
||||
@Operation(summary = "Create a new Rollout",
|
||||
description = "Handles the POST request of creating new rollout. Required Permission: CREATE_ROLLOUT")
|
||||
@PostCreateResponses
|
||||
@PostMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = ROLLOUTS_V1,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtRolloutResponseBody> create(
|
||||
@RequestBody MgmtRolloutRestRequestBodyPost rolloutRequestBody);
|
||||
|
||||
@@ -134,12 +129,11 @@ public interface MgmtRolloutRestApi {
|
||||
* @return In case rollout could successful updated the ResponseEntity with status code 200 with the successfully created rollout. In any
|
||||
* failure the JsonResponseExceptionHandler is handling the response.
|
||||
*/
|
||||
@Operation(summary = "Update Rollout", description = "Handles the UPDATE request for a single " +
|
||||
"Rollout. Required permission: UPDATE_ROLLOUT")
|
||||
@Operation(summary = "Update Rollout",
|
||||
description = "Handles the UPDATE request for a single Rollout. Required permission: UPDATE_ROLLOUT")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaType.APPLICATION_JSON_VALUE, MediaTypes.HAL_JSON_VALUE })
|
||||
@PutMapping(value = ROLLOUTS_V1 + "/{rolloutId}",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { APPLICATION_JSON_VALUE, HAL_JSON_VALUE })
|
||||
ResponseEntity<MgmtRolloutResponseBody> update(
|
||||
@PathVariable("rolloutId") Long rolloutId,
|
||||
@RequestBody MgmtRolloutRestRequestBodyPut rolloutUpdateBody);
|
||||
@@ -156,8 +150,7 @@ public interface MgmtRolloutRestApi {
|
||||
"workflow is enabled in system configuration and rollout is in state WAITING_FOR_APPROVAL. " +
|
||||
"Required Permission: APPROVE_ROLLOUT")
|
||||
@PostCreateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/approve",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = ROLLOUTS_V1 + "/{rolloutId}/approve", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> approve(
|
||||
@PathVariable("rolloutId") Long rolloutId,
|
||||
@RequestParam(value = "remark", required = false) String remark);
|
||||
@@ -173,8 +166,7 @@ public interface MgmtRolloutRestApi {
|
||||
"Only possible if approval workflow is enabled in system configuration and rollout is in state " +
|
||||
"WAITING_FOR_APPROVAL. Required Permission: APPROVE_ROLLOUT")
|
||||
@PostCreateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/deny",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = ROLLOUTS_V1 + "/{rolloutId}/deny", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> deny(
|
||||
@PathVariable("rolloutId") Long rolloutId,
|
||||
@RequestParam(value = "remark", required = false) String remark);
|
||||
@@ -185,11 +177,10 @@ public interface MgmtRolloutRestApi {
|
||||
* @param rolloutId the ID of the rollout to be started.
|
||||
* @return OK response (200) if rollout could be started. In case of any exception the corresponding errors occur.
|
||||
*/
|
||||
@Operation(summary = "Start a Rollout", description = "Handles the POST request of starting a created rollout. " +
|
||||
"Required Permission: HANDLE_ROLLOUT")
|
||||
@Operation(summary = "Start a Rollout",
|
||||
description = "Handles the POST request of starting a created rollout. Required Permission: HANDLE_ROLLOUT")
|
||||
@PostCreateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/start",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = ROLLOUTS_V1 + "/{rolloutId}/start", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> start(@PathVariable("rolloutId") Long rolloutId);
|
||||
|
||||
/**
|
||||
@@ -198,11 +189,10 @@ public interface MgmtRolloutRestApi {
|
||||
* @param rolloutId the ID of the rollout to be paused.
|
||||
* @return OK response (200) if rollout could be paused. In case of any exception the corresponding errors occur.
|
||||
*/
|
||||
@Operation(summary = "Pause a Rollout", description = "Handles the POST request of pausing a running rollout. " +
|
||||
"Required Permission: HANDLE_ROLLOUT")
|
||||
@Operation(summary = "Pause a Rollout",
|
||||
description = "Handles the POST request of pausing a running rollout. Required Permission: HANDLE_ROLLOUT")
|
||||
@PostCreateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/pause",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = ROLLOUTS_V1 + "/{rolloutId}/pause", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> pause(@PathVariable("rolloutId") Long rolloutId);
|
||||
|
||||
/**
|
||||
@@ -211,25 +201,22 @@ public interface MgmtRolloutRestApi {
|
||||
* @param rolloutId the ID of the rollout to be paused.
|
||||
* @return OK response (200) if rollout could be stopped. In case of any exception the corresponding errors occur.
|
||||
*/
|
||||
@Operation(summary = "Stop a Rollout", description = "Handles the POST request of stopping a running rollout. " +
|
||||
"Required Permission: HANDLE_ROLLOUT")
|
||||
@Operation(summary = "Stop a Rollout",
|
||||
description = "Handles the POST request of stopping a running rollout. Required Permission: HANDLE_ROLLOUT")
|
||||
@PostUpdateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/stop",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = ROLLOUTS_V1 + "/{rolloutId}/stop", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> stop(@PathVariable("rolloutId") Long rolloutId);
|
||||
|
||||
/**
|
||||
* Handles the DELETE request for deleting a rollout.
|
||||
*
|
||||
* @param rolloutId the ID of the rollout to be deleted.
|
||||
* @return OK response (200) if rollout could be deleted. In case of any
|
||||
* exception the corresponding errors occur.
|
||||
* @return OK response (200) if rollout could be deleted. In case of any exception the corresponding errors occur.
|
||||
*/
|
||||
@Operation(summary = "Delete a Rollout", description = "Handles the DELETE request of deleting a rollout. " +
|
||||
"Required Permission: DELETE_ROLLOUT")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@DeleteMapping(value = ROLLOUTS_V1 + "/{rolloutId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> delete(@PathVariable("rolloutId") Long rolloutId);
|
||||
|
||||
/**
|
||||
@@ -241,8 +228,7 @@ public interface MgmtRolloutRestApi {
|
||||
@Operation(summary = "Resume a Rollout", description = "Handles the POST request of resuming a paused rollout. " +
|
||||
"Required Permission: HANDLE_ROLLOUT")
|
||||
@PostCreateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/resume",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = ROLLOUTS_V1 + "/{rolloutId}/resume", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> resume(@PathVariable("rolloutId") Long rolloutId);
|
||||
|
||||
/**
|
||||
@@ -257,37 +243,27 @@ public interface MgmtRolloutRestApi {
|
||||
* @return a list of all rollout groups referred to a rollout for a defined or default page request with status OK. The response is always
|
||||
* paged. In any failure the JsonResponseExceptionHandler is handling the response.
|
||||
*/
|
||||
@Operation(summary = "Return all rollout groups referred to a Rollout", description = "Handles the GET request of " +
|
||||
"retrieving all deploy groups of a specific rollout. Required Permission: READ_ROLLOUT")
|
||||
@Operation(summary = "Return all rollout groups referred to a Rollout",
|
||||
description = "Handles the GET request of retrieving all deploy groups of a specific rollout. Required Permission: READ_ROLLOUT")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/deploygroups",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = ROLLOUTS_V1 + "/{rolloutId}/deploygroups", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtRolloutGroupResponseBody>> getRolloutGroups(
|
||||
@PathVariable("rolloutId") Long rolloutId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_REPRESENTATION_MODE, defaultValue = REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT)
|
||||
String representationModeParam);
|
||||
|
||||
/**
|
||||
@@ -297,11 +273,10 @@ public interface MgmtRolloutRestApi {
|
||||
* @param groupId the groupId to retrieve the rollout group
|
||||
* @return the OK response containing the MgmtRolloutGroupResponseBody
|
||||
*/
|
||||
@Operation(summary = "Return single rollout group", description = "Handles the GET request of a single deploy " +
|
||||
"group of a specific rollout. Required Permission: READ_ROLLOUT")
|
||||
@Operation(summary = "Return single rollout group",
|
||||
description = "Handles the GET request of a single deploy group of a specific rollout. Required Permission: READ_ROLLOUT")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/deploygroups/{groupId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = ROLLOUTS_V1 + "/{rolloutId}/deploygroups/{groupId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtRolloutGroupResponseBody> getRolloutGroup(
|
||||
@PathVariable("rolloutId") Long rolloutId,
|
||||
@PathVariable("groupId") Long groupId);
|
||||
@@ -322,32 +297,23 @@ public interface MgmtRolloutRestApi {
|
||||
description = "Handles the GET request of retrieving all targets of a single deploy group of a specific " +
|
||||
"rollout. Required Permissions: READ_ROLLOUT, READ_TARGET.")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/deploygroups/{groupId}/targets",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = ROLLOUTS_V1 + "/{rolloutId}/deploygroups/{groupId}/targets", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtTarget>> getRolloutGroupTargets(
|
||||
@PathVariable("rolloutId") Long rolloutId,
|
||||
@PathVariable("groupId") Long groupId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -359,8 +325,7 @@ public interface MgmtRolloutRestApi {
|
||||
@Operation(summary = "Force trigger processing next group of a Rollout", description = "Handles the POST request " +
|
||||
"of triggering the next group of a rollout. Required Permission: UPDATE_ROLLOUT")
|
||||
@PostCreateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/triggerNextGroup",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = ROLLOUTS_V1 + "/{rolloutId}/triggerNextGroup", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> triggerNextGroup(@PathVariable("rolloutId") Long rolloutId);
|
||||
|
||||
/**
|
||||
@@ -376,7 +341,6 @@ public interface MgmtRolloutRestApi {
|
||||
@ApiResponse(responseCode = NOT_FOUND_404, description = "Rollout not found.",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/retry",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = ROLLOUTS_V1 + "/{rolloutId}/retry", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtRolloutResponseBody> retryRollout(@PathVariable("rolloutId") Long rolloutId);
|
||||
}
|
||||
@@ -9,6 +9,10 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.SOFTWARE_MODULE_ORDER;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GONE_410;
|
||||
@@ -19,6 +23,9 @@ import static org.eclipse.hawkbit.rest.ApiResponsesConstants.LOCKED_423;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.NOT_FOUND_404;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PostCreateResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -38,8 +45,6 @@ import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleMeta
|
||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleRequestBodyPost;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleRequestBodyPut;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -53,15 +58,16 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* REST Resource handling for SoftwareModule and related Artifact CRUD
|
||||
* operations.
|
||||
* REST API for SoftwareModule and related Artifact CRUD operations.
|
||||
*/
|
||||
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
|
||||
@Tag(
|
||||
name = "Software Modules", description = "REST API for SoftwareModule and related Artifact CRUD operations.",
|
||||
@Tag(name = "Software Modules", description = "REST API for SoftwareModule and related Artifact CRUD operations.",
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = SOFTWARE_MODULE_ORDER)))
|
||||
public interface MgmtSoftwareModuleRestApi {
|
||||
|
||||
String SOFTWAREMODULES_V1 = MgmtRestConstants.REST_V1 + "/softwaremodules";
|
||||
String REQUEST_PARAMETER_USE_ARTIFACT_URL_HANDLER = "useartifacturlhandler";
|
||||
|
||||
/**
|
||||
* Handles POST request for artifact upload.
|
||||
*
|
||||
@@ -83,10 +89,11 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
|
||||
@ApiResponse(responseCode = LOCKED_423, description = "Software module is locked",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
|
||||
@ApiResponse(responseCode = INTERNAL_SERVER_ERROR_500, description = "Upload / store to storage or encryption failed", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
@ApiResponse(responseCode = INTERNAL_SERVER_ERROR_500, description = "Upload / store to storage or encryption failed",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts",
|
||||
consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}/artifacts",
|
||||
consumes = MULTIPART_FORM_DATA_VALUE, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtArtifact> uploadArtifact(
|
||||
@PathVariable("softwareModuleId") Long softwareModuleId,
|
||||
@RequestPart("file") MultipartFile file,
|
||||
@@ -107,14 +114,14 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
"software module. Required Permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = GONE_410, description = "Artifact binary no longer exists", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
@ApiResponse(responseCode = GONE_410, description = "Artifact binary no longer exists",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@GetMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}/artifacts", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtArtifact>> getArtifacts(
|
||||
@PathVariable("softwareModuleId") Long softwareModuleId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT) String representationModeParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_USE_ARTIFACT_URL_HANDLER, required = false) Boolean useArtifactUrlHandler);
|
||||
@RequestParam(value = REQUEST_PARAMETER_USE_ARTIFACT_URL_HANDLER, required = false) Boolean useArtifactUrlHandler);
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving a single Artifact metadata request.
|
||||
@@ -123,18 +130,20 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
* @param artifactId of the related artifact
|
||||
* @return responseEntity with status ok if successful
|
||||
*/
|
||||
@Operation(summary = "Return single Artifact metadata", description = "Handles the GET request of retrieving a single Artifact metadata request. Required Permission: READ_REPOSITORY")
|
||||
@Operation(summary = "Return single Artifact metadata",
|
||||
description = "Handles the GET request of retrieving a single Artifact metadata request. Required Permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = GONE_410, description = "Artifact binary no longer exists", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
@ApiResponse(responseCode = GONE_410, description = "Artifact binary no longer exists",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@GetMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts/{artifactId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}/artifacts/{artifactId}",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
@ResponseBody
|
||||
ResponseEntity<MgmtArtifact> getArtifact(
|
||||
@PathVariable("softwareModuleId") Long softwareModuleId,
|
||||
@PathVariable("artifactId") Long artifactId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_USE_ARTIFACT_URL_HANDLER, required = false) Boolean useArtifactUrlHandler);
|
||||
@RequestParam(value = REQUEST_PARAMETER_USE_ARTIFACT_URL_HANDLER, required = false) Boolean useArtifactUrlHandler);
|
||||
|
||||
/**
|
||||
* Handles the DELETE request for a single SoftwareModule.
|
||||
@@ -143,7 +152,8 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
* @param artifactId of the artifact to be deleted
|
||||
* @return status OK if delete as successful.
|
||||
*/
|
||||
@Operation(summary = "Delete artifact by Id", description = "Handles the DELETE request for a single Artifact assigned to a SoftwareModule. Required Permission: DELETE_REPOSITORY")
|
||||
@Operation(summary = "Delete artifact by Id",
|
||||
description = "Handles the DELETE request for a single Artifact assigned to a SoftwareModule. Required Permission: DELETE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = LOCKED_423, description = "Software module is locked",
|
||||
@@ -151,7 +161,7 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
@ApiResponse(responseCode = INTERNAL_SERVER_ERROR_500, description = "Artifact delete failed with internal server error",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@DeleteMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts/{artifactId}")
|
||||
@DeleteMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}/artifacts/{artifactId}")
|
||||
@ResponseBody
|
||||
ResponseEntity<Void> deleteArtifact(
|
||||
@PathVariable("softwareModuleId") Long softwareModuleId,
|
||||
@@ -168,32 +178,24 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
* @return a list of all modules for a defined or default page request with status OK. The response is always paged. In any failure the
|
||||
* JsonResponseExceptionHandler is handling the response.
|
||||
*/
|
||||
@Operation(summary = "Return all Software modules", description = "Handles the GET request of retrieving all softwaremodules. Required Permission: READ_REPOSITORY")
|
||||
@Operation(summary = "Return all Software modules",
|
||||
description = "Handles the GET request of retrieving all softwaremodules. Required Permission: READ_REPOSITORY")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = SOFTWAREMODULES_V1, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtSoftwareModule>> getSoftwareModules(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -204,8 +206,7 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return Software Module by id", description = "Handles the GET request of retrieving a single softwaremodule. Required Permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtSoftwareModule> getSoftwareModule(@PathVariable("softwareModuleId") Long softwareModuleId);
|
||||
|
||||
/**
|
||||
@@ -215,15 +216,15 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
* @return In case all modules could successful created the ResponseEntity with status code 201 - Created but without ResponseBody. In any
|
||||
* failure the JsonResponseExceptionHandler is handling the response.
|
||||
*/
|
||||
@Operation(summary = "Create Software Module(s)", description = "Handles the POST request of creating new software modules. The request body must always be a list of modules. Required Permission: CREATE_REPOSITORY")
|
||||
@Operation(summary = "Create Software Module(s)",
|
||||
description = "Handles the POST request of creating new software modules. The request body must always be a list of modules. Required Permission: CREATE_REPOSITORY")
|
||||
@PostCreateResponses
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = INTERNAL_SERVER_ERROR_500, description = "Artifact encryption failed",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = SOFTWAREMODULES_V1,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtSoftwareModule>> createSoftwareModules(@RequestBody List<MgmtSoftwareModuleRequestBodyPost> softwareModules);
|
||||
|
||||
/**
|
||||
@@ -233,11 +234,11 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
* @param restSoftwareModule the modules to be updated.
|
||||
* @return status OK if update was successful
|
||||
*/
|
||||
@Operation(summary = "Update Software Module", description = "Handles the PUT request for a single softwaremodule within Hawkbit. Required Permission: UPDATE_REPOSITORY")
|
||||
@Operation(summary = "Update Software Module",
|
||||
description = "Handles the PUT request for a single softwaremodule within Hawkbit. Required Permission: UPDATE_REPOSITORY")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PutMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtSoftwareModule> updateSoftwareModule(
|
||||
@PathVariable("softwareModuleId") Long softwareModuleId,
|
||||
@RequestBody MgmtSoftwareModuleRequestBodyPut restSoftwareModule);
|
||||
@@ -248,9 +249,10 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
* @param softwareModuleId the ID of the module to retrieve
|
||||
* @return status OK if delete was successful.
|
||||
*/
|
||||
@Operation(summary = "Delete Software Module by Id", description = "Handles the DELETE request for a single softwaremodule within Hawkbit. Required Permission: DELETE_REPOSITORY")
|
||||
@Operation(summary = "Delete Software Module by Id",
|
||||
description = "Handles the DELETE request for a single softwaremodule within Hawkbit. Required Permission: DELETE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}")
|
||||
@DeleteMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}")
|
||||
ResponseEntity<Void> deleteSoftwareModule(@PathVariable("softwareModuleId") Long softwareModuleId);
|
||||
|
||||
/**
|
||||
@@ -260,14 +262,14 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
* @param metadataRest the list of metadata entries to create
|
||||
* @return status created if post request is successful with the value of the created metadata
|
||||
*/
|
||||
@Operation(summary = "Creates a list of metadata for a specific Software Module", description = "Create a list of metadata entries Required Permission: UPDATE_REPOSITORY")
|
||||
@Operation(summary = "Creates a list of metadata for a specific Software Module",
|
||||
description = "Create a list of metadata entries Required Permission: UPDATE_REPOSITORY")
|
||||
@PostCreateResponses
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = NOT_FOUND_404, description = "Software Module not found",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/metadata",
|
||||
consumes = { MediaType.APPLICATION_JSON_VALUE, MediaTypes.HAL_JSON_VALUE })
|
||||
@PostMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}/metadata", consumes = { APPLICATION_JSON_VALUE, HAL_JSON_VALUE })
|
||||
ResponseEntity<Void> createMetadata(@PathVariable("softwareModuleId") Long softwareModuleId,
|
||||
@RequestBody List<MgmtSoftwareModuleMetadata> metadataRest);
|
||||
|
||||
@@ -279,8 +281,7 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return metadata for a Software Module", description = "Get a paged list of metadata for a software module. Required Permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/metadata",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}/metadata", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtSoftwareModuleMetadata>> getMetadata(@PathVariable("softwareModuleId") Long softwareModuleId);
|
||||
|
||||
/**
|
||||
@@ -290,10 +291,11 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
* @param metadataKey the key of the metadata entry to retrieve the value from
|
||||
* @return status OK if get request is successful with the value of the metadata
|
||||
*/
|
||||
@Operation(summary = "Return single metadata value for a specific key of a Software Module", description = "Get a single metadata value for a metadata key. Required Permission: READ_REPOSITORY")
|
||||
@Operation(summary = "Return single metadata value for a specific key of a Software Module",
|
||||
description = "Get a single metadata value for a metadata key. Required Permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/metadata/{metadataKey}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}/metadata/{metadataKey}",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtSoftwareModuleMetadata> getMetadataValue(
|
||||
@PathVariable("softwareModuleId") Long softwareModuleId,
|
||||
@PathVariable("metadataKey") String metadataKey);
|
||||
@@ -305,9 +307,10 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
* @param metadataKey the key of the metadata to update the value
|
||||
* @param metadata body to update
|
||||
*/
|
||||
@Operation(summary = "Update a single metadata value of a Software Module", description = "Update a single metadata value for speficic key. Required Permission: UPDATE_REPOSITORY")
|
||||
@Operation(summary = "Update a single metadata value of a Software Module",
|
||||
description = "Update a single metadata value for specific key. Required Permission: UPDATE_REPOSITORY")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/metadata/{metadataKey}")
|
||||
@PutMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}/metadata/{metadataKey}")
|
||||
ResponseEntity<Void> updateMetadata(
|
||||
@PathVariable("softwareModuleId") Long softwareModuleId,
|
||||
@PathVariable("metadataKey") String metadataKey,
|
||||
@@ -319,9 +322,10 @@ public interface MgmtSoftwareModuleRestApi {
|
||||
* @param softwareModuleId the ID of the software module to delete the metadata entry
|
||||
* @param metadataKey the key of the metadata to delete
|
||||
*/
|
||||
@Operation(summary = "Delete single metadata entry from the software module", description = "Delete a single metadata. Required Permission: UPDATE_REPOSITORY")
|
||||
@Operation(summary = "Delete single metadata entry from the software module",
|
||||
description = "Delete a single metadata. Required Permission: UPDATE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/metadata/{metadataKey}")
|
||||
@DeleteMapping(value = SOFTWAREMODULES_V1 + "/{softwareModuleId}/metadata/{metadataKey}")
|
||||
ResponseEntity<Void> deleteMetadata(@PathVariable("softwareModuleId") Long softwareModuleId,
|
||||
@PathVariable("metadataKey") String metadataKey);
|
||||
}
|
||||
@@ -9,6 +9,10 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.SOFTWARE_MODULE_TYPE_ORDER;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetIfExistResponses;
|
||||
@@ -44,15 +48,15 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* REST Resource handling for SoftwareModule and related Artifact CRUD
|
||||
* operations.
|
||||
* REST API for SoftwareModule and related Artifact CRUD operations.
|
||||
*/
|
||||
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
|
||||
@Tag(
|
||||
name = "Software Module Types", description = "REST API for SoftwareModuleTypes CRUD operations.",
|
||||
@Tag(name = "Software Module Types", description = "REST API for SoftwareModuleTypes CRUD operations.",
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = SOFTWARE_MODULE_TYPE_ORDER)))
|
||||
public interface MgmtSoftwareModuleTypeRestApi {
|
||||
|
||||
String SOFTWAREMODULETYPES_V1 = MgmtRestConstants.REST_V1 + "/softwaremoduletypes";
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving all SoftwareModuleTypes .
|
||||
*
|
||||
@@ -67,30 +71,21 @@ public interface MgmtSoftwareModuleTypeRestApi {
|
||||
@Operation(summary = "Return all Software Module Types",
|
||||
description = "Handles the GET request of retrieving all software module types. Required Permission: READ_REPOSITORY")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = SOFTWAREMODULETYPES_V1, produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtSoftwareModuleType>> getTypes(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -102,7 +97,7 @@ public interface MgmtSoftwareModuleTypeRestApi {
|
||||
@Operation(summary = "Return single Software Module Type",
|
||||
description = "Handles the GET request of retrieving a single software module type. Required Permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING + "/{softwareModuleTypeId}",
|
||||
@GetMapping(value = SOFTWAREMODULETYPES_V1 + "/{softwareModuleTypeId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtSoftwareModuleType> getSoftwareModuleType(
|
||||
@PathVariable("softwareModuleTypeId") Long softwareModuleTypeId);
|
||||
@@ -116,7 +111,7 @@ public interface MgmtSoftwareModuleTypeRestApi {
|
||||
@Operation(summary = "Delete Software Module Type by Id",
|
||||
description = "Handles the DELETE request for a single software module type. Required Permission: DELETE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING + "/{softwareModuleTypeId}")
|
||||
@DeleteMapping(value = SOFTWAREMODULETYPES_V1 + "/{softwareModuleTypeId}")
|
||||
ResponseEntity<Void> deleteSoftwareModuleType(
|
||||
@PathVariable("softwareModuleTypeId") Long softwareModuleTypeId);
|
||||
|
||||
@@ -130,7 +125,7 @@ public interface MgmtSoftwareModuleTypeRestApi {
|
||||
@Operation(summary = "Update Software Module Type",
|
||||
description = "Handles the PUT request for a single software module type. Required Permission: UPDATE_REPOSITORY")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING + "/{softwareModuleTypeId}",
|
||||
@PutMapping(value = SOFTWAREMODULETYPES_V1 + "/{softwareModuleTypeId}",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtSoftwareModuleType> updateSoftwareModuleType(
|
||||
@@ -152,7 +147,7 @@ public interface MgmtSoftwareModuleTypeRestApi {
|
||||
@ApiResponse(responseCode = NOT_FOUND_404, description = "Software Module not found",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING,
|
||||
@PostMapping(value = SOFTWAREMODULETYPES_V1,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtSoftwareModuleType>> createSoftwareModuleTypes(
|
||||
|
||||
@@ -9,12 +9,20 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.TARGET_FILTER_ORDER;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetIfExistResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PostCreateResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.extensions.Extension;
|
||||
@@ -28,8 +36,6 @@ import org.eclipse.hawkbit.mgmt.json.model.targetfilter.MgmtTargetFilterQuery;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.targetfilter.MgmtTargetFilterQueryRequestBody;
|
||||
import org.eclipse.hawkbit.rest.ApiResponsesConstants.PostUpdateResponses;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -40,14 +46,15 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* Api for handling target operations.
|
||||
* REST API for target operations.
|
||||
*/
|
||||
// no request mapping specified here to avoid CVE-2021-22044 in Feign client
|
||||
@Tag(
|
||||
name = "Target Filter Queries", description = "REST API for Target Filter Queries CRUD operations.",
|
||||
@Tag(name = "Target Filter Queries", description = "REST API for Target Filter Queries CRUD operations.",
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = TARGET_FILTER_ORDER)))
|
||||
public interface MgmtTargetFilterQueryRestApi {
|
||||
|
||||
String TARGETFILTERS_V1 = MgmtRestConstants.REST_V1 + "/targetfilters";
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving a single target filter.
|
||||
*
|
||||
@@ -55,11 +62,10 @@ public interface MgmtTargetFilterQueryRestApi {
|
||||
* @return a single target with status OK.
|
||||
*/
|
||||
|
||||
@Operation(summary = "Return target filter query by id", description = "Handles the GET request of retrieving a " +
|
||||
"single target filter query. Required permission: READ_TARGET")
|
||||
@Operation(summary = "Return target filter query by id",
|
||||
description = "Handles the GET request of retrieving a single target filter query. Required permission: READ_TARGET")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/{filterId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETFILTERS_V1 + "/{filterId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTargetFilterQuery> getFilter(@PathVariable("filterId") Long filterId);
|
||||
|
||||
/**
|
||||
@@ -73,34 +79,27 @@ public interface MgmtTargetFilterQueryRestApi {
|
||||
* @return a list of all targets for a defined or default page reque status OK. The response is always paged. In any failure the
|
||||
* JsonResponseExceptionHandler is handling the response.
|
||||
*/
|
||||
@Operation(summary = "Return all target filter queries", description = "Handles the GET request of retrieving all target filter queries. Required permission: READ_TARGET")
|
||||
@Operation(summary = "Return all target filter queries",
|
||||
description = "Handles the GET request of retrieving all target filter queries. Required permission: READ_TARGET")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETFILTERS_V1, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtTargetFilterQuery>> getFilters(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT) String representationModeParam);
|
||||
@RequestParam(value = REQUEST_PARAMETER_REPRESENTATION_MODE, defaultValue = REQUEST_PARAMETER_REPRESENTATION_MODE_DEFAULT)
|
||||
String representationModeParam);
|
||||
|
||||
/**
|
||||
* Handles the POST request of creating new target filters. The request body must always be a list of target filters.
|
||||
@@ -109,11 +108,11 @@ public interface MgmtTargetFilterQueryRestApi {
|
||||
* @return In case all filters were successfully created the ResponseEntity with status code 201 with a list of successfully created entities
|
||||
* is returned. In any failure the JsonResponseExceptionHandler is handling the response.
|
||||
*/
|
||||
@Operation(summary = "Create target filter", description = "Handles the POST request to create a new target filter query. Required permission: CREATE_TARGET")
|
||||
@Operation(summary = "Create target filter",
|
||||
description = "Handles the POST request to create a new target filter query. Required permission: CREATE_TARGET")
|
||||
@PostCreateResponses
|
||||
@PostMapping(value = MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = TARGETFILTERS_V1,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTargetFilterQuery> createFilter(
|
||||
@RequestBody MgmtTargetFilterQueryRequestBody filter);
|
||||
|
||||
@@ -128,9 +127,8 @@ public interface MgmtTargetFilterQueryRestApi {
|
||||
*/
|
||||
@Operation(summary = "Updates target filter query by id", description = "Handles the PUT request of updating a target filter query. Required permission: UPDATE_TARGET")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/{filterId}", consumes = {
|
||||
MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE }, produces = { MediaTypes.HAL_JSON_VALUE,
|
||||
MediaType.APPLICATION_JSON_VALUE })
|
||||
@PutMapping(value = TARGETFILTERS_V1 + "/{filterId}",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTargetFilterQuery> updateFilter(
|
||||
@PathVariable("filterId") Long filterId,
|
||||
@RequestBody MgmtTargetFilterQueryRequestBody targetFilterRest);
|
||||
@@ -144,8 +142,7 @@ public interface MgmtTargetFilterQueryRestApi {
|
||||
*/
|
||||
@Operation(summary = "Delete target filter by id", description = "Handles the DELETE request of deleting a target filter query. Required permission: DELETE_TARGET")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/{filterId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@DeleteMapping(value = TARGETFILTERS_V1 + "/{filterId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> deleteFilter(@PathVariable("filterId") Long filterId);
|
||||
|
||||
/**
|
||||
@@ -156,8 +153,7 @@ public interface MgmtTargetFilterQueryRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return distribution set for auto assignment of a specific target filter", description = "Handles the GET request of retrieving the auto assign distribution set. Required permission: READ_TARGET")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/{filterId}/autoAssignDS",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETFILTERS_V1 + "/{filterId}/autoAssignDS", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtDistributionSet> getAssignedDistributionSet(@PathVariable("filterId") Long filterId);
|
||||
|
||||
/**
|
||||
@@ -171,9 +167,8 @@ public interface MgmtTargetFilterQueryRestApi {
|
||||
description = "Handles the POST request of setting the auto assign distribution set for a target filter " +
|
||||
"query. Required permissions: UPDATE_TARGET and READ_REPOSITORY")
|
||||
@PostUpdateResponses
|
||||
@PostMapping(value = MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/{filterId}/autoAssignDS",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = TARGETFILTERS_V1 + "/{filterId}/autoAssignDS",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTargetFilterQuery> postAssignedDistributionSet(
|
||||
@PathVariable("filterId") Long filterId,
|
||||
@RequestBody MgmtDistributionSetAutoAssignment autoAssignRequest);
|
||||
@@ -188,6 +183,6 @@ public interface MgmtTargetFilterQueryRestApi {
|
||||
description = "Removes the auto assign distribution set from the target filter query. " +
|
||||
"Required permission: UPDATE_TARGET")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/{filterId}/autoAssignDS")
|
||||
@DeleteMapping(value = TARGETFILTERS_V1 + "/{filterId}/autoAssignDS")
|
||||
ResponseEntity<Void> deleteAssignedDistributionSet(@PathVariable("filterId") Long filterId);
|
||||
}
|
||||
@@ -9,10 +9,16 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.TARGET_GROUP_ORDER;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetIfExistResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutNoContentResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -24,8 +30,6 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.PagedList;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -34,11 +38,12 @@ import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@Tag(
|
||||
name = "Target Groups", description = "REST API for Target Groups operations.",
|
||||
@Tag(name = "Target Groups", description = "REST API for Target Groups operations.",
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = TARGET_GROUP_ORDER)))
|
||||
public interface MgmtTargetGroupRestApi {
|
||||
|
||||
String TARGETGROUPS_V1 = MgmtRestConstants.REST_V1 + "/targetgroups";
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving a list of assigned targets for a specific group. Complex grouping (subgroups) not supported here.
|
||||
* For complex grouping use the analogical resource with query parameter for target group.
|
||||
@@ -55,28 +60,21 @@ public interface MgmtTargetGroupRestApi {
|
||||
description = "Handles the GET request of retrieving a list of assigned targets for a specific group. Complex grouping (subgroups) not supported here." +
|
||||
"For complex grouping use the analogical resource with query parameter for target group.")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + MgmtRestConstants.GROUP_ASSIGNED,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETGROUPS_V1 + "/{group}/assigned", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtTarget>> getAssignedTargets(
|
||||
@PathVariable
|
||||
@Schema(description = "The target group of the targets")
|
||||
String group,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam
|
||||
);
|
||||
|
||||
@@ -97,7 +95,7 @@ public interface MgmtTargetGroupRestApi {
|
||||
description = "Handles the GET request of retrieving a list of assigned targets for a specific group. Complex grouping (subgroups) is supported here." +
|
||||
"Search could be for specific group, complex group e.g Parent/Child or also for groups including its subgroups")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/assigned")
|
||||
@GetMapping(value = TARGETGROUPS_V1 + "/assigned")
|
||||
ResponseEntity<PagedList<MgmtTarget>> getAssignedTargetsWithSubgroups(
|
||||
@RequestParam(value = "group")
|
||||
@Schema(description = "Target Group or Filter based on target groups. ")
|
||||
@@ -105,22 +103,16 @@ public interface MgmtTargetGroupRestApi {
|
||||
@RequestParam(value = "subgroups", defaultValue = "false")
|
||||
@Schema(description = " Possibility to search for subgroups with wildcard or not - e.g. ParentGroup/*")
|
||||
boolean subgroups,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam
|
||||
);
|
||||
|
||||
@@ -136,7 +128,7 @@ public interface MgmtTargetGroupRestApi {
|
||||
description = "Handles the POST request of target assignment. Already assigned target will be ignored. " +
|
||||
"For complex groups use analogical method with query parameters.")
|
||||
@PutNoContentResponses
|
||||
@PutMapping(value = MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/assigned")
|
||||
@PutMapping(value = TARGETGROUPS_V1 + "/assigned")
|
||||
ResponseEntity<Void> assignTargetsToGroupWithSubgroups(
|
||||
@RequestParam("group")
|
||||
@Schema(description = "The target group to be set. Sub-grouping is allowed here - '/' could be used for subgroups") String group,
|
||||
@@ -154,7 +146,7 @@ public interface MgmtTargetGroupRestApi {
|
||||
description = "Handles the PUT request of target assignment." +
|
||||
"Subgroups are NOT allowed here - e.g. Parent/Child")
|
||||
@PutNoContentResponses
|
||||
@PutMapping(value = MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + MgmtRestConstants.GROUP_ASSIGNED)
|
||||
@PutMapping(value = TARGETGROUPS_V1 + "/{group}/assigned")
|
||||
ResponseEntity<Void> assignTargetsToGroup(
|
||||
@PathVariable(value = "group")
|
||||
@Schema(description = "The target group to be set. Sub-grouping not allowed here, for sub-grouping use the analogical method with query parameter.")
|
||||
@@ -173,17 +165,14 @@ public interface MgmtTargetGroupRestApi {
|
||||
*
|
||||
*/
|
||||
@Operation(summary = "Assign target(s) to given group by rsql",
|
||||
description = "Handles the PUT request of target group assignment." +
|
||||
"Subgroups are NOT allowed here - e.g. Parent/Child")
|
||||
description = "Handles the PUT request of target group assignment. Subgroups are NOT allowed here - e.g. Parent/Child")
|
||||
@PutNoContentResponses
|
||||
@PutMapping(value = MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/{group}")
|
||||
@PutMapping(value = TARGETGROUPS_V1 + "/{group}")
|
||||
ResponseEntity<Void> assignTargetsToGroupWithRsql(
|
||||
@PathVariable
|
||||
String group,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsql
|
||||
);
|
||||
|
||||
@@ -195,7 +184,7 @@ public interface MgmtTargetGroupRestApi {
|
||||
@Operation(summary = "Unassign targets from their target groups",
|
||||
description = "Handles the DELETE request to unassign the given target(s).")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/assigned")
|
||||
@DeleteMapping(value = TARGETGROUPS_V1 + "/assigned")
|
||||
ResponseEntity<Void> unassignTargetsFromGroup(
|
||||
@RequestBody(required = false)
|
||||
@Schema(description = "List of controller ids to be unassigned from their groups", example = "[\"controllerId1\", \"controllerId2\"]")
|
||||
@@ -210,12 +199,10 @@ public interface MgmtTargetGroupRestApi {
|
||||
@Operation(summary = "Unassign targets from their target groups by filter",
|
||||
description = "Handles the DELETE request to unassign targets by RSQL filter.")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING)
|
||||
@DeleteMapping(value = TARGETGROUPS_V1)
|
||||
ResponseEntity<Void> unassignTargetsFromGroupByRsql(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsql
|
||||
);
|
||||
|
||||
@@ -226,8 +213,7 @@ public interface MgmtTargetGroupRestApi {
|
||||
@Operation(summary = "Return all assigned target groups",
|
||||
description = "Handles the GET request of retrieving a list of all target groups.")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETGROUPS_V1, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<String>> getTargetGroups();
|
||||
|
||||
/**
|
||||
@@ -240,14 +226,12 @@ public interface MgmtTargetGroupRestApi {
|
||||
description = "Assign targets matching a rsql filter to a provided target group" +
|
||||
"Subgroups are allowed - e.g. Parent/Child")
|
||||
@PutNoContentResponses
|
||||
@PutMapping(value = MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING)
|
||||
@PutMapping(value = TARGETGROUPS_V1)
|
||||
ResponseEntity<Void> assignTargetsToGroup(
|
||||
@RequestParam(name = "group")
|
||||
@Schema(description = "The target group to be set. Sub-grouping is allowed here - '/' could be used for subgroups")
|
||||
String group,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam);
|
||||
}
|
||||
@@ -9,6 +9,10 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.TARGET_ORDER;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GONE_410;
|
||||
@@ -19,6 +23,8 @@ import static org.eclipse.hawkbit.rest.ApiResponsesConstants.NOT_FOUND_404;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PostCreateResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutNoContentResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -52,8 +58,6 @@ import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTargetRequestBody;
|
||||
import org.eclipse.hawkbit.rest.ApiResponsesConstants.PostUpdateNoContentResponses;
|
||||
import org.eclipse.hawkbit.rest.ApiResponsesConstants.PostUpdateResponses;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -72,6 +76,9 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = TARGET_ORDER)))
|
||||
public interface MgmtTargetRestApi {
|
||||
|
||||
String TARGETS_V1 = MgmtRestConstants.REST_V1 + "/targets";
|
||||
String TARGET_ID_TARGETTYPE = "/{targetId}/targettype";
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving a single target.
|
||||
*
|
||||
@@ -81,8 +88,7 @@ public interface MgmtTargetRestApi {
|
||||
@Operation(summary = "Return target by id", description = "Handles the GET request of retrieving a single target. " +
|
||||
"Required Permission: READ_TARGET.")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETS_V1 + "/{targetId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTarget> getTarget(@PathVariable("targetId") String targetId);
|
||||
|
||||
/**
|
||||
@@ -98,30 +104,21 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return all targets", description = "Handles the GET request of retrieving all targets. Required permission: READ_TARGET")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETS_V1, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtTarget>> getTargets(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -133,9 +130,8 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Create target(s)", description = "Handles the POST request of creating new targets. The request body must always be a list of targets. Required Permission: CREATE_TARGET")
|
||||
@PostCreateResponses
|
||||
@PostMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = TARGETS_V1,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtTarget>> createTargets(@RequestBody List<MgmtTargetRequestBody> targets);
|
||||
|
||||
/**
|
||||
@@ -149,9 +145,8 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Update target by id", description = "Handles the PUT request of updating a target. Required Permission: UPDATE_TARGET")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PutMapping(value = TARGETS_V1 + "/{targetId}",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTarget> updateTarget(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@RequestBody MgmtTargetRequestBody targetRest);
|
||||
@@ -165,7 +160,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Delete target by id", description = "Handles the DELETE request of deleting a single target. Required Permission: DELETE_TARGET")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}")
|
||||
@DeleteMapping(value = TARGETS_V1 + "/{targetId}")
|
||||
ResponseEntity<Void> deleteTarget(@PathVariable("targetId") String targetId);
|
||||
|
||||
/**
|
||||
@@ -177,7 +172,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Unassign target type from target.", description = "Remove the target type from a target. The target type will be set to null. Required permission: UPDATE_TARGET")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + MgmtRestConstants.TARGET_TARGET_ID_TARGETTYPE)
|
||||
@DeleteMapping(value = TARGETS_V1 + TARGET_ID_TARGETTYPE)
|
||||
ResponseEntity<Void> unassignTargetType(@PathVariable("targetId") String targetId);
|
||||
|
||||
/**
|
||||
@@ -190,8 +185,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Assign target type to a target", description = "Assign or update the target type of a target. Required permission: UPDATE_TARGET")
|
||||
@PostUpdateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + MgmtRestConstants.TARGET_TARGET_ID_TARGETTYPE,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = TARGETS_V1 + TARGET_ID_TARGETTYPE, consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> assignTargetType(@PathVariable("targetId") String targetId, @RequestBody MgmtId targetTypeId);
|
||||
|
||||
/**
|
||||
@@ -202,8 +196,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return attributes of a specific target", description = "Handles the GET request of retrieving the attributes of a specific target. Reponse is a key/value list. Required Permission: READ_TARGET")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/attributes",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETS_V1 + "/{targetId}/attributes", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTargetAttributes> getAttributes(@PathVariable("targetId") String targetId);
|
||||
|
||||
/**
|
||||
@@ -220,31 +213,22 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return actions for a specific target", description = "Handles the GET request of retrieving the full action history of a specific target. Required Permission: READ_TARGET")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/actions",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETS_V1 + "/{targetId}/actions", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtAction>> getActionHistory(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -258,8 +242,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Deletes all actions for the provided target EXCEPT the latest N actions OR by provided action IDs list.", description = "Deletes/Purges the action history of the target except the last N actions OR deletes only the actions in the provided action ids list. Required Permission: DELETE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/actions",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@DeleteMapping(value = TARGETS_V1 + "/{targetId}/actions", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> deleteActionsForTarget(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@RequestParam(name = "keepLast", required = false, defaultValue = "-1") int keepLast,
|
||||
@@ -273,10 +256,10 @@ public interface MgmtTargetRestApi {
|
||||
* @param actionId to load
|
||||
* @return the action
|
||||
*/
|
||||
@Operation(summary = "Return action by id of a specific target", description = "Handles the GET request of retrieving a specific action on a specific target. Required Permission: READ_TARGET")
|
||||
@Operation(summary = "Return action by id of a specific target",
|
||||
description = "Handles the GET request of retrieving a specific action on a specific target. Required Permission: READ_TARGET")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/actions/{actionId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETS_V1 + "/{targetId}/actions/{actionId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtAction> getAction(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@PathVariable("actionId") Long actionId);
|
||||
@@ -289,12 +272,14 @@ public interface MgmtTargetRestApi {
|
||||
* @param force optional parameter, which indicates a force cancel
|
||||
* @return status no content in case cancellation was successful
|
||||
*/
|
||||
@Operation(summary = "Cancel action for a specific target", description = "Cancels an active action, only active actions can be deleted. Required Permission: UPDATE_TARGET")
|
||||
@Operation(summary = "Cancel action for a specific target",
|
||||
description = "Cancels an active action, only active actions can be deleted. Required Permission: UPDATE_TARGET")
|
||||
@DeleteResponses
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = METHOD_NOT_ALLOWED_405, description = "Software module is locked", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
@ApiResponse(responseCode = METHOD_NOT_ALLOWED_405, description = "Software module is locked",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@DeleteMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/actions/{actionId}")
|
||||
@DeleteMapping(value = TARGETS_V1 + "/{targetId}/actions/{actionId}")
|
||||
ResponseEntity<Void> cancelAction(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@PathVariable("actionId") Long actionId,
|
||||
@@ -310,9 +295,8 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Switch an action from soft to forced", description = "Handles the PUT request to switch an action from soft to forced. Required Permission: UPDATE_TARGET.")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/actions/{actionId}",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PutMapping(value = TARGETS_V1 + "/{targetId}/actions/{actionId}",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtAction> updateAction(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@PathVariable("actionId") Long actionId,
|
||||
@@ -332,9 +316,9 @@ public interface MgmtTargetRestApi {
|
||||
@ApiResponse(responseCode = GONE_410, description = "Action is not active anymore.",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true))),
|
||||
})
|
||||
@PutMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/actions/{actionId}/confirmation",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PutMapping(value = TARGETS_V1 + "/{targetId}/actions/{actionId}/confirmation",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE },
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> updateActionConfirmation(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@PathVariable("actionId") Long actionId,
|
||||
@@ -352,16 +336,20 @@ public interface MgmtTargetRestApi {
|
||||
* @return a list of all ActionStatus for a defined or default page request with status OK. The response is always paged. In any failure the
|
||||
* JsonResponseExceptionHandler is handling the response.
|
||||
*/
|
||||
@Operation(summary = "Return status of a specific action on a specific target", description = "Handles the GET request of retrieving a specific action on a specific target. Required Permission: READ_TARGET")
|
||||
@Operation(summary = "Return status of a specific action on a specific target",
|
||||
description = "Handles the GET request of retrieving a specific action on a specific target. Required Permission: READ_TARGET")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/actions/{actionId}/status",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETS_V1 + "/{targetId}/actions/{actionId}/status",
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtActionStatus>> getActionStatusList(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@PathVariable("actionId") Long actionId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) int pagingOffsetParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false) String sortParam);
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving the assigned distribution set of a specific target.
|
||||
@@ -371,8 +359,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return the assigned distribution set of a specific target", description = "Handles the GET request of retrieving the assigned distribution set of an specific target. Required Permission: READ_TARGET")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/assignedDS",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETS_V1 + "/{targetId}/assignedDS", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtDistributionSet> getAssignedDistributionSet(@PathVariable("targetId") String targetId);
|
||||
|
||||
/**
|
||||
@@ -386,9 +373,8 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Assigns a distribution set to a specific target", description = "Handles the POST request for assigning a distribution set to a specific target. Required Permission: READ_REPOSITORY and UPDATE_TARGET")
|
||||
@PostUpdateResponses
|
||||
@PostMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/assignedDS",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = TARGETS_V1 + "/{targetId}/assignedDS",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTargetAssignmentResponseBody> postAssignedDistributionSet(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@RequestBody @Valid MgmtDistributionSetAssignments dsAssignments,
|
||||
@@ -408,8 +394,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return installed distribution set of a specific target", description = "Handles the GET request of retrieving the installed distribution set of an specific target. Required Permission: READ_TARGET")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/installedDS",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETS_V1 + "/{targetId}/installedDS", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtDistributionSet> getInstalledDistributionSet(@PathVariable("targetId") String targetId);
|
||||
|
||||
/**
|
||||
@@ -419,8 +404,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return tags for specific target", description = "Get a paged list of tags for a target. Required permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/tags",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETS_V1 + "/{targetId}/tags", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtTag>> getTags(@PathVariable("targetId") String targetId);
|
||||
|
||||
/**
|
||||
@@ -432,10 +416,11 @@ public interface MgmtTargetRestApi {
|
||||
@Operation(summary = "Create a list of metadata for a specific target", description = "Create a list of metadata entries Required permissions: READ_REPOSITORY and UPDATE_TARGET")
|
||||
@PostCreateResponses
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = NOT_FOUND_404, description = "Target not found", content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
@ApiResponse(responseCode = NOT_FOUND_404, description = "Target not found",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata",
|
||||
consumes = { MediaType.APPLICATION_JSON_VALUE, MediaTypes.HAL_JSON_VALUE })
|
||||
@PostMapping(value = TARGETS_V1 + "/{targetId}/metadata",
|
||||
consumes = { APPLICATION_JSON_VALUE, HAL_JSON_VALUE })
|
||||
ResponseEntity<Void> createMetadata(@PathVariable("targetId") String targetId, @RequestBody List<MgmtMetadata> metadataRest);
|
||||
|
||||
/**
|
||||
@@ -446,8 +431,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return metadata for specific target", description = "Get a paged list of metadata for a target. Required permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETS_V1 + "/{targetId}/metadata", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtMetadata>> getMetadata(@PathVariable("targetId") String targetId);
|
||||
|
||||
/**
|
||||
@@ -457,10 +441,10 @@ public interface MgmtTargetRestApi {
|
||||
* @param metadataKey the key of the metadata entry to retrieve the value from
|
||||
* @return status OK if get request is successful with the value of the metadata
|
||||
*/
|
||||
@Operation(summary = "Return single metadata value for a specific key of a target", description = "Get a single metadata value for a metadata key. Required permission: READ_REPOSITORY")
|
||||
@Operation(summary = "Return single metadata value for a specific key of a target",
|
||||
description = "Get a single metadata value for a metadata key. Required permission: READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata/{metadataKey}",
|
||||
produces = { MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETS_V1 + "/{targetId}/metadata/{metadataKey}", produces = { APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtMetadata> getMetadataValue(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@PathVariable("metadataKey") String metadataKey);
|
||||
@@ -472,9 +456,10 @@ public interface MgmtTargetRestApi {
|
||||
* @param metadataKey the key of the metadata to update the value
|
||||
* @param metadata update body
|
||||
*/
|
||||
@Operation(summary = "Updates a single metadata value of a target", description = "Update a single metadata value for speficic key. Required permission: UPDATE_REPOSITORY")
|
||||
@Operation(summary = "Updates a single metadata value of a target",
|
||||
description = "Update a single metadata value for speficic key. Required permission: UPDATE_REPOSITORY")
|
||||
@PutNoContentResponses
|
||||
@PutMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata/{metadataKey}")
|
||||
@PutMapping(value = TARGETS_V1 + "/{targetId}/metadata/{metadataKey}")
|
||||
ResponseEntity<Void> updateMetadata(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@PathVariable("metadataKey") String metadataKey,
|
||||
@@ -489,7 +474,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Deletes a single metadata entry from a target", description = "Delete a single metadata. Required permission: UPDATE_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/metadata/{metadataKey}")
|
||||
@DeleteMapping(value = TARGETS_V1 + "/{targetId}/metadata/{metadataKey}")
|
||||
ResponseEntity<Void> deleteMetadata(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@PathVariable("metadataKey") String metadataKey);
|
||||
@@ -502,8 +487,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return the current auto-confitm state for a specific target", description = "Handles the GET request to check the current auto-confirmation state of a target. Required Permission: READ_TARGET")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/autoConfirm",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETS_V1 + "/{targetId}/autoConfirm", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTargetAutoConfirm> getAutoConfirmStatus(
|
||||
@PathVariable("targetId") String targetId);
|
||||
|
||||
@@ -516,7 +500,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Activate auto-confirm on a specific target", description = "Handles the POST request to activate auto-confirmation for a specific target. As a result all current active as well as future actions will automatically be confirmed by mentioning the initiator as triggered person. Actions will be automatically confirmed, as long as auto-confirmation is active. Required Permission: UPDATE_TARGET")
|
||||
@PostUpdateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/autoConfirm/activate")
|
||||
@PostMapping(value = TARGETS_V1 + "/{targetId}/autoConfirm/activate")
|
||||
ResponseEntity<Void> activateAutoConfirm(
|
||||
@PathVariable("targetId") String targetId,
|
||||
@RequestBody(required = false) MgmtTargetAutoConfirmUpdate update);
|
||||
@@ -529,7 +513,7 @@ public interface MgmtTargetRestApi {
|
||||
*/
|
||||
@Operation(summary = "Deactivate auto-confirm on a specific target", description = "Handles the POST request to deactivate auto-confirmation for a specific target. All active actions will remain unchanged while all future actions need to be confirmed, before processing with the deployment. Required Permission: UPDATE_TARGET")
|
||||
@PostUpdateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/{targetId}/autoConfirm/deactivate")
|
||||
@PostMapping(value = TARGETS_V1 + "/{targetId}/autoConfirm/deactivate")
|
||||
ResponseEntity<Void> deactivateAutoConfirm(
|
||||
@PathVariable("targetId") String targetId);
|
||||
}
|
||||
@@ -9,13 +9,18 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.TARGET_TAG_ORDER;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetIfExistResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PostCreateResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -30,8 +35,6 @@ import org.eclipse.hawkbit.mgmt.json.model.tag.MgmtTagRequestBodyPut;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
|
||||
import org.eclipse.hawkbit.rest.ApiResponsesConstants.PostUpdateNoContentResponses;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -50,6 +53,9 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = TARGET_TAG_ORDER)))
|
||||
public interface MgmtTargetTagRestApi {
|
||||
|
||||
String TARGETTAGS_V1 = MgmtRestConstants.REST_V1 + "/targettags";
|
||||
String TARGET_TAG_ID_ASSIGNED = "/{targetTagId}/assigned";
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving all target tags.
|
||||
*
|
||||
@@ -61,33 +67,23 @@ public interface MgmtTargetTagRestApi {
|
||||
* @return a list of all target tags for a defined or default page request with status OK. The response is always paged. In any failure the
|
||||
* JsonResponseExceptionHandler is handling the response.
|
||||
*/
|
||||
@Operation(summary = "Return all target tags",
|
||||
description = "Handles the GET request of retrieving all target tags.")
|
||||
@Operation(summary = "Return all target tags", description = "Handles the GET request of retrieving all target tags.")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = TARGET_TAG_V1_REQUEST_MAPPING,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETTAGS_V1, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtTag>> getTargetTags(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -96,11 +92,9 @@ public interface MgmtTargetTagRestApi {
|
||||
* @param targetTagId the ID of the target tag to retrieve
|
||||
* @return a single target tag with status OK.
|
||||
*/
|
||||
@Operation(summary = "Return target tag by id",
|
||||
description = "Handles the GET request of retrieving a single target tag.")
|
||||
@Operation(summary = "Return target tag by id", description = "Handles the GET request of retrieving a single target tag.")
|
||||
@GetResponses
|
||||
@GetMapping(value = TARGET_TAG_V1_REQUEST_MAPPING + "/{targetTagId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETTAGS_V1 + "/{targetTagId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTag> getTargetTag(@PathVariable("targetTagId") Long targetTagId);
|
||||
|
||||
/**
|
||||
@@ -113,9 +107,8 @@ public interface MgmtTargetTagRestApi {
|
||||
@Operation(summary = "Create target tag(s)", description = "Handles the POST request of creating new target tag. " +
|
||||
"The request body must always be a list of target tags.")
|
||||
@PostCreateResponses
|
||||
@PostMapping(value = TARGET_TAG_V1_REQUEST_MAPPING,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = TARGETTAGS_V1,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtTag>> createTargetTags(@RequestBody List<MgmtTagRequestBodyPut> tags);
|
||||
|
||||
/**
|
||||
@@ -127,9 +120,8 @@ public interface MgmtTargetTagRestApi {
|
||||
*/
|
||||
@Operation(summary = "Update target tag by id", description = "Handles the PUT request of updating a target tag.")
|
||||
@PutResponses
|
||||
@PutMapping(value = TARGET_TAG_V1_REQUEST_MAPPING + "/{targetTagId}",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PutMapping(value = TARGETTAGS_V1 + "/{targetTagId}",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTag> updateTargetTag(
|
||||
@PathVariable("targetTagId") Long targetTagId,
|
||||
@RequestBody MgmtTagRequestBodyPut restTargetTagRest);
|
||||
@@ -140,10 +132,9 @@ public interface MgmtTargetTagRestApi {
|
||||
* @param targetTagId the ID of the target tag
|
||||
* @return status OK if delete as successfully.
|
||||
*/
|
||||
@Operation(summary = "Delete target tag by id",
|
||||
description = "Handles the DELETE request of deleting a single target tag.")
|
||||
@Operation(summary = "Delete target tag by id", description = "Handles the DELETE request of deleting a single target tag.")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = TARGET_TAG_V1_REQUEST_MAPPING + "/{targetTagId}")
|
||||
@DeleteMapping(value = TARGETTAGS_V1 + "/{targetTagId}")
|
||||
ResponseEntity<Void> deleteTargetTag(@PathVariable("targetTagId") Long targetTagId);
|
||||
|
||||
/**
|
||||
@@ -160,31 +151,22 @@ public interface MgmtTargetTagRestApi {
|
||||
@Operation(summary = "Return assigned targets for tag",
|
||||
description = "Handles the GET request of retrieving a list of assigned targets.")
|
||||
@GetResponses
|
||||
@GetMapping(value = TARGET_TAG_V1_REQUEST_MAPPING + MgmtRestConstants.TARGET_TAG_ID_ASSIGNED,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETTAGS_V1 + TARGET_TAG_ID_ASSIGNED, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtTarget>> getAssignedTargets(
|
||||
@PathVariable("targetTagId") Long targetTagId,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -197,7 +179,7 @@ public interface MgmtTargetTagRestApi {
|
||||
@Operation(summary = "Assign target(s) to given tagId",
|
||||
description = "Handles the POST request of target assignment. Already assigned target will be ignored.")
|
||||
@PostUpdateNoContentResponses
|
||||
@PostMapping(value = TARGET_TAG_V1_REQUEST_MAPPING + MgmtRestConstants.TARGET_TAG_ID_ASSIGNED + "/{controllerId}")
|
||||
@PostMapping(value = TARGETTAGS_V1 + TARGET_TAG_ID_ASSIGNED + "/{controllerId}")
|
||||
ResponseEntity<Void> assignTarget(
|
||||
@PathVariable("targetTagId") Long targetTagId,
|
||||
@PathVariable("controllerId") String controllerId);
|
||||
@@ -212,9 +194,7 @@ public interface MgmtTargetTagRestApi {
|
||||
@Operation(summary = "Assign target(s) to given tagId",
|
||||
description = "Handles the POST request of target assignment. Already assigned target will be ignored.")
|
||||
@PostUpdateNoContentResponses
|
||||
@PostMapping(
|
||||
value = TARGET_TAG_V1_REQUEST_MAPPING + MgmtRestConstants.TARGET_TAG_ID_ASSIGNED,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = TARGETTAGS_V1 + TARGET_TAG_ID_ASSIGNED, consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> assignTargets(
|
||||
@PathVariable("targetTagId") Long targetTagId,
|
||||
@Schema(description = "List of controller ids to be assigned", example = "[\"controllerId1\", \"controllerId2\"]")
|
||||
@@ -228,11 +208,9 @@ public interface MgmtTargetTagRestApi {
|
||||
* @param controllerId the ID of the target to unassign
|
||||
* @return http status code
|
||||
*/
|
||||
@Operation(summary = "Unassign target from a given tagId",
|
||||
description = "Handles the DELETE request to unassign the given target.")
|
||||
@Operation(summary = "Unassign target from a given tagId", description = "Handles the DELETE request to unassign the given target.")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = TARGET_TAG_V1_REQUEST_MAPPING +
|
||||
MgmtRestConstants.TARGET_TAG_ID_ASSIGNED + "/{controllerId}")
|
||||
@DeleteMapping(value = TARGETTAGS_V1 + TARGET_TAG_ID_ASSIGNED + "/{controllerId}")
|
||||
ResponseEntity<Void> unassignTarget(
|
||||
@PathVariable("targetTagId") Long targetTagId,
|
||||
@PathVariable("controllerId") String controllerId);
|
||||
@@ -244,11 +222,9 @@ public interface MgmtTargetTagRestApi {
|
||||
* @param controllerId the ID of the target to unassign
|
||||
* @return http status code
|
||||
*/
|
||||
@Operation(summary = "Unassign targets from a given tagId",
|
||||
description = "Handles the DELETE request to unassign the given targets.")
|
||||
@Operation(summary = "Unassign targets from a given tagId", description = "Handles the DELETE request to unassign the given targets.")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = TARGET_TAG_V1_REQUEST_MAPPING + MgmtRestConstants.TARGET_TAG_ID_ASSIGNED,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@DeleteMapping(value = TARGETTAGS_V1 + TARGET_TAG_ID_ASSIGNED, consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> unassignTargets(
|
||||
@PathVariable("targetTagId") Long targetTagId,
|
||||
@RequestParam(value = "onNotFoundPolicy", required = false, defaultValue = "FAIL") OnNotFoundPolicy onNotFoundPolicy,
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.mgmt.rest.api;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.TARGET_TYPE_ORDER;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetIfExistResponses;
|
||||
@@ -16,6 +20,8 @@ import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.NOT_FOUND_404;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PostCreateResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -35,8 +41,6 @@ import org.eclipse.hawkbit.mgmt.json.model.targettype.MgmtTargetTypeRequestBodyP
|
||||
import org.eclipse.hawkbit.mgmt.json.model.targettype.MgmtTargetTypeRequestBodyPut;
|
||||
import org.eclipse.hawkbit.rest.ApiResponsesConstants.PostUpdateNoContentResponses;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -55,6 +59,9 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = TARGET_TYPE_ORDER)))
|
||||
public interface MgmtTargetTypeRestApi {
|
||||
|
||||
String TARGETTYPES_V1 = MgmtRestConstants.REST_V1 + "/targettypes";
|
||||
String COMPATIBLEDISTRIBUTIONSETTYPES = "compatibledistributionsettypes";
|
||||
|
||||
/**
|
||||
* Handles the GET request of retrieving all TargetTypes.
|
||||
*
|
||||
@@ -68,30 +75,21 @@ public interface MgmtTargetTypeRestApi {
|
||||
*/
|
||||
@Operation(summary = "Return all target types", description = "Handles the GET request of retrieving all target types.")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGETTYPE_V1_REQUEST_MAPPING,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETTYPES_V1, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<PagedList<MgmtTargetType>> getTargetTypes(
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false)
|
||||
@Schema(description = """
|
||||
Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for
|
||||
available fields.""")
|
||||
@Schema(description = "Query fields based on the Feed Item Query Language (FIQL). See Entity Definitions for available fields.")
|
||||
String rsqlParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET)
|
||||
@Schema(description = "The paging offset (default is 0)")
|
||||
int pagingOffsetParam,
|
||||
@RequestParam(
|
||||
value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT,
|
||||
defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@RequestParam(value = REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT)
|
||||
@Schema(description = "The maximum number of entries in a page (default is 50)")
|
||||
int pagingLimitParam,
|
||||
@RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false)
|
||||
@Schema(description = """
|
||||
The query parameter sort allows to define the sort order for the result of a query. A sort criteria
|
||||
consists of the name of a field and the sort direction (ASC for ascending and DESC descending).
|
||||
The sequence of the sort criteria (multiple can be used) defines the sort order of the entities
|
||||
in the result.""")
|
||||
@Schema(description = "The query parameter sort allows to define the sort order for the result of a query. " +
|
||||
"A sort criteria consists of the name of a field and the sort direction (ASC for ascending and DESC descending)." +
|
||||
"The sequence of the sort criteria (multiple can be used) defines the sort order of the entities in the result.")
|
||||
String sortParam);
|
||||
|
||||
/**
|
||||
@@ -100,11 +98,9 @@ public interface MgmtTargetTypeRestApi {
|
||||
* @param targetTypeId the ID of the target type to retrieve
|
||||
* @return a single target type with status OK.
|
||||
*/
|
||||
@Operation(summary = "Return target type by id",
|
||||
description = "Handles the GET request of retrieving a single target type")
|
||||
@Operation(summary = "Return target type by id", description = "Handles the GET request of retrieving a single target type")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGETTYPE_V1_REQUEST_MAPPING + "/{targetTypeId}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETTYPES_V1 + "/{targetTypeId}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTargetType> getTargetType(@PathVariable("targetTypeId") Long targetTypeId);
|
||||
|
||||
/**
|
||||
@@ -116,7 +112,7 @@ public interface MgmtTargetTypeRestApi {
|
||||
@Operation(summary = "Delete target type by id",
|
||||
description = "Handles the DELETE request for a single target type. Required Permission: DELETE_TARGET")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.TARGETTYPE_V1_REQUEST_MAPPING + "/{targetTypeId}")
|
||||
@DeleteMapping(value = TARGETTYPES_V1 + "/{targetTypeId}")
|
||||
ResponseEntity<Void> deleteTargetType(@PathVariable("targetTypeId") Long targetTypeId);
|
||||
|
||||
/**
|
||||
@@ -129,9 +125,8 @@ public interface MgmtTargetTypeRestApi {
|
||||
@Operation(summary = "Update target type by id",
|
||||
description = "Handles the PUT request for a single target type. Required Permission: UPDATE_TARGET")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.TARGETTYPE_V1_REQUEST_MAPPING + "/{targetTypeId}",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PutMapping(value = TARGETTYPES_V1 + "/{targetTypeId}",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtTargetType> updateTargetType(
|
||||
@PathVariable("targetTypeId") Long targetTypeId,
|
||||
@RequestBody MgmtTargetTypeRequestBodyPut restTargetType);
|
||||
@@ -143,16 +138,16 @@ public interface MgmtTargetTypeRestApi {
|
||||
* @return In case all target types could be successfully created the ResponseEntity with status code 201 - Created but without
|
||||
* ResponseBody. In any failure the JsonResponseExceptionHandler is handling the response.
|
||||
*/
|
||||
@Operation(summary = "Create target types", description = "Handles the POST request for creating new target " +
|
||||
"types. The request body must always be a list of types. Required Permission: CREATE_TARGET")
|
||||
@Operation(summary = "Create target types",
|
||||
description = "Handles the POST request for creating new target types. The request body must always be a list of types. " +
|
||||
"Required Permission: CREATE_TARGET")
|
||||
@PostCreateResponses
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = NOT_FOUND_404, description = "Target type not found.",
|
||||
content = @Content(mediaType = "application/json", schema = @Schema(hidden = true)))
|
||||
})
|
||||
@PostMapping(value = MgmtRestConstants.TARGETTYPE_V1_REQUEST_MAPPING,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = TARGETTYPES_V1,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtTargetType>> createTargetTypes(@RequestBody List<MgmtTargetTypeRequestBodyPost> targetTypes);
|
||||
|
||||
/**
|
||||
@@ -165,8 +160,8 @@ public interface MgmtTargetTypeRestApi {
|
||||
"of retrieving the list of compatible distribution set types in that target type. " +
|
||||
"Required Permission: READ_TARGET, READ_REPOSITORY")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.TARGETTYPE_V1_REQUEST_MAPPING + "/{targetTypeId}/" + MgmtRestConstants.COMPATIBLEDISTRIBUTIONSETTYPES,
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = TARGETTYPES_V1 + "/{targetTypeId}/" + COMPATIBLEDISTRIBUTIONSETTYPES,
|
||||
produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<MgmtDistributionSetType>> getCompatibleDistributionSets(@PathVariable("targetTypeId") Long targetTypeId);
|
||||
|
||||
/**
|
||||
@@ -180,8 +175,7 @@ public interface MgmtTargetTypeRestApi {
|
||||
description = "Handles the DELETE request for removing a distribution set type from a single target type. " +
|
||||
"Required Permission: UPDATE_TARGET and READ_REPOSITORY")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.TARGETTYPE_V1_REQUEST_MAPPING + "/{targetTypeId}/" +
|
||||
MgmtRestConstants.COMPATIBLEDISTRIBUTIONSETTYPES + "/{distributionSetTypeId}")
|
||||
@DeleteMapping(value = TARGETTYPES_V1 + "/{targetTypeId}/" + COMPATIBLEDISTRIBUTIONSETTYPES + "/{distributionSetTypeId}")
|
||||
ResponseEntity<Void> removeCompatibleDistributionSet(
|
||||
@PathVariable("targetTypeId") Long targetTypeId,
|
||||
@PathVariable("distributionSetTypeId") Long distributionSetTypeId);
|
||||
@@ -197,8 +191,8 @@ public interface MgmtTargetTypeRestApi {
|
||||
description = "Handles the POST request for adding compatible distribution set types to a target type. " +
|
||||
"Required Permission: UPDATE_TARGET and READ_REPOSITORY")
|
||||
@PostUpdateNoContentResponses
|
||||
@PostMapping(value = MgmtRestConstants.TARGETTYPE_V1_REQUEST_MAPPING + "/{targetTypeId}/" + MgmtRestConstants.COMPATIBLEDISTRIBUTIONSETTYPES,
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PostMapping(value = TARGETTYPES_V1 + "/{targetTypeId}/" + COMPATIBLEDISTRIBUTIONSETTYPES,
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Void> addCompatibleDistributionSets(
|
||||
@PathVariable("targetTypeId") Long targetTypeId,
|
||||
@RequestBody List<MgmtDistributionSetTypeAssignment> distributionSetTypeIds);
|
||||
|
||||
@@ -14,6 +14,8 @@ import static org.eclipse.hawkbit.rest.ApiResponsesConstants.DeleteResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetIfExistResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.GetResponses;
|
||||
import static org.eclipse.hawkbit.rest.ApiResponsesConstants.PutResponses;
|
||||
import static org.springframework.hateoas.MediaTypes.HAL_JSON_VALUE;
|
||||
import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -24,9 +26,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.system.MgmtSystemTenantConfigurationValue;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.system.MgmtSystemTenantConfigurationValueRequest;
|
||||
import org.eclipse.hawkbit.rest.OpenApi;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -44,16 +44,17 @@ import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
extensions = @Extension(name = OpenApi.X_HAWKBIT, properties = @ExtensionProperty(name = "order", value = TENANT_ORDER)))
|
||||
public interface MgmtTenantManagementRestApi {
|
||||
|
||||
String SYSTEM_V1 = MgmtRestConstants.REST_V1 + "/system";
|
||||
|
||||
/**
|
||||
* Handles the GET request for receiving all tenant specific configuration values.
|
||||
*
|
||||
* @return a map of all configuration values.
|
||||
*/
|
||||
@Operation(summary = "Return all tenant specific configuration values", description = "The GET request returns " +
|
||||
"a list of all possible configuration keys for the tenant. Required Permission: READ_TENANT_CONFIGURATION")
|
||||
@Operation(summary = "Return all tenant specific configuration values",
|
||||
description = "The GET request returns a list of all possible configuration keys for the tenant. Required Permission: READ_TENANT_CONFIGURATION")
|
||||
@GetIfExistResponses
|
||||
@GetMapping(value = MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING + "/configs",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = SYSTEM_V1 + "/configs", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<Map<String, MgmtSystemTenantConfigurationValue>> getTenantConfiguration();
|
||||
|
||||
/**
|
||||
@@ -67,8 +68,7 @@ public interface MgmtTenantManagementRestApi {
|
||||
"configuration value of a specific configuration key for the tenant. " +
|
||||
"Required Permission: READ_TENANT_CONFIGURATION")
|
||||
@GetResponses
|
||||
@GetMapping(value = MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@GetMapping(value = SYSTEM_V1 + "/configs/{keyName}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<MgmtSystemTenantConfigurationValue> getTenantConfigurationValue(@PathVariable("keyName") String keyName);
|
||||
|
||||
/**
|
||||
@@ -77,13 +77,12 @@ public interface MgmtTenantManagementRestApi {
|
||||
* @param keyName the name of the configuration key
|
||||
* @param configurationValueRest the new value for the configuration
|
||||
*/
|
||||
@Operation(summary = "Update a tenant specific configuration value.", description = "The PUT request changes a " +
|
||||
"configuration value of a specific configuration key for the tenant. " +
|
||||
@Operation(summary = "Update a tenant specific configuration value.",
|
||||
description = "The PUT request changes a configuration value of a specific configuration key for the tenant. " +
|
||||
"Required Permission: TENANT_CONFIGURATION")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PutMapping(value = SYSTEM_V1 + "/configs/{keyName}",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
@ResponseStatus(HttpStatus.NO_CONTENT)
|
||||
void updateTenantConfigurationValue(
|
||||
@PathVariable("keyName") String keyName,
|
||||
@@ -94,12 +93,11 @@ public interface MgmtTenantManagementRestApi {
|
||||
*
|
||||
* @param configurationValueMap a Map of name - value pairs for the configurations
|
||||
*/
|
||||
@Operation(summary = "Batch update of tenant configuration.", description = "The PUT request updates the whole " +
|
||||
"configuration for the tenant. Required Permission: TENANT_CONFIGURATION")
|
||||
@Operation(summary = "Batch update of tenant configuration.",
|
||||
description = "The PUT request updates the whole configuration for the tenant. Required Permission: TENANT_CONFIGURATION")
|
||||
@PutResponses
|
||||
@PutMapping(value = MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING + "/configs",
|
||||
consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE },
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@PutMapping(value = SYSTEM_V1 + "/configs",
|
||||
consumes = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE }, produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
@ResponseStatus(HttpStatus.NO_CONTENT)
|
||||
void updateTenantConfiguration(@RequestBody Map<String, Object> configurationValueMap);
|
||||
|
||||
@@ -108,12 +106,11 @@ public interface MgmtTenantManagementRestApi {
|
||||
*
|
||||
* @param keyName the Name of the configuration key
|
||||
*/
|
||||
@Operation(summary = "Delete a tenant specific configuration value", description = "The DELETE request removes a " +
|
||||
"tenant specific configuration value for the tenant. Afterwards the global default value is used. " +
|
||||
"Required Permission: TENANT_CONFIGURATION")
|
||||
@Operation(summary = "Delete a tenant specific configuration value",
|
||||
description = "The DELETE request removes a tenant specific configuration value for the tenant. " +
|
||||
"Afterwards the global default value is used. Required Permission: TENANT_CONFIGURATION")
|
||||
@DeleteResponses
|
||||
@DeleteMapping(value = MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}",
|
||||
produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
|
||||
@DeleteMapping(value = SYSTEM_V1 + "/configs/{keyName}", produces = { HAL_JSON_VALUE, APPLICATION_JSON_VALUE })
|
||||
@ResponseStatus(HttpStatus.NO_CONTENT)
|
||||
void deleteTenantConfigurationValue(@PathVariable("keyName") String keyName);
|
||||
}
|
||||
@@ -109,7 +109,7 @@ public class MgmtDistributionSetMapper {
|
||||
response.add(linkTo(methodOn(MgmtDistributionSetRestApi.class).getAssignedSoftwareModules(response.getId(),
|
||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET_VALUE,
|
||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE, null))
|
||||
.withRel(MgmtRestConstants.DISTRIBUTIONSET_V1_MODULE).expand());
|
||||
.withRel("modules").expand());
|
||||
|
||||
response.add(linkTo(methodOn(MgmtDistributionSetTypeRestApi.class)
|
||||
.getDistributionSetType(distributionSet.getType().getId())).withRel("type").expand());
|
||||
|
||||
@@ -24,7 +24,6 @@ import org.eclipse.hawkbit.mgmt.json.model.distributionsettype.MgmtDistributionS
|
||||
import org.eclipse.hawkbit.mgmt.json.model.distributionsettype.MgmtDistributionSetTypeRequestBodyPost;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModuleTypeAssignment;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDistributionSetTypeRestApi;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
@@ -76,10 +75,10 @@ public final class MgmtDistributionSetTypeMapper {
|
||||
public static void addLinks(final MgmtDistributionSetType result) {
|
||||
|
||||
result.add(linkTo(methodOn(MgmtDistributionSetTypeRestApi.class).getMandatoryModules(result.getId()))
|
||||
.withRel(MgmtRestConstants.MANDATORYMODULES).expand());
|
||||
.withRel("mandatorymodules").expand());
|
||||
|
||||
result.add(linkTo(methodOn(MgmtDistributionSetTypeRestApi.class).getOptionalModules(result.getId()))
|
||||
.withRel(MgmtRestConstants.OPTIONALMODULES).expand());
|
||||
.withRel("optionalmodules").expand());
|
||||
}
|
||||
|
||||
private DistributionSetTypeManagement.Create fromRequest(final MgmtDistributionSetTypeRequestBodyPost smsRest) {
|
||||
|
||||
@@ -28,7 +28,6 @@ import org.eclipse.hawkbit.mgmt.json.model.artifact.MgmtArtifactHash;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModule;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleMetadata;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleRequestBodyPost;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleRestApi;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleTypeRestApi;
|
||||
import org.eclipse.hawkbit.mgmt.rest.resource.MgmtDownloadArtifactResource;
|
||||
@@ -118,9 +117,9 @@ public final class MgmtSoftwareModuleMapper {
|
||||
|
||||
public static void addLinks(final SoftwareModule softwareModule, final MgmtSoftwareModule response) {
|
||||
response.add(linkTo(methodOn(MgmtSoftwareModuleRestApi.class).getArtifacts(response.getId(), null, null))
|
||||
.withRel(MgmtRestConstants.SOFTWAREMODULE_V1_ARTIFACT).expand());
|
||||
.withRel("artifacts").expand());
|
||||
response.add(linkTo(methodOn(MgmtSoftwareModuleTypeRestApi.class).getSoftwareModuleType(softwareModule.getType().getId()))
|
||||
.withRel(MgmtRestConstants.SOFTWAREMODULE_V1_TYPE).expand());
|
||||
.withRel("type").expand());
|
||||
response.add(WebMvcLinkBuilder.linkTo(methodOn(MgmtSoftwareModuleResource.class).getMetadata(response.getId()))
|
||||
.withRel("metadata").expand());
|
||||
}
|
||||
|
||||
@@ -81,24 +81,24 @@ public final class MgmtTargetMapper {
|
||||
*/
|
||||
public static void addTargetLinks(final MgmtTarget response) {
|
||||
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getAssignedDistributionSet(response.getControllerId()))
|
||||
.withRel(MgmtRestConstants.TARGET_V1_ASSIGNED_DISTRIBUTION_SET).expand());
|
||||
.withRel("assignedDS").expand());
|
||||
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getInstalledDistributionSet(response.getControllerId()))
|
||||
.withRel(MgmtRestConstants.TARGET_V1_INSTALLED_DISTRIBUTION_SET).expand());
|
||||
.withRel("installedDS").expand());
|
||||
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getAttributes(response.getControllerId()))
|
||||
.withRel(MgmtRestConstants.TARGET_V1_ATTRIBUTES).expand());
|
||||
.withRel("attributes").expand());
|
||||
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getActionHistory(response.getControllerId(), null, 0,
|
||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE,
|
||||
ActionFields.ID.getName() + ":" + SortDirection.DESC))
|
||||
.withRel(MgmtRestConstants.TARGET_V1_ACTIONS).expand());
|
||||
.withRel(MgmtTarget.TARGET_V1_ACTIONS).expand());
|
||||
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getMetadata(response.getControllerId()))
|
||||
.withRel("metadata").expand());
|
||||
if (response.getTargetType() != null) {
|
||||
response.add(linkTo(methodOn(MgmtTargetTypeRestApi.class).getTargetType(response.getTargetType()))
|
||||
.withRel(MgmtRestConstants.TARGET_V1_ASSIGNED_TARGET_TYPE).expand());
|
||||
.withRel(MgmtTarget.TARGET_TYPE).expand());
|
||||
}
|
||||
if (response.getAutoConfirmActive() != null) {
|
||||
response.add(linkTo(methodOn(MgmtTargetRestApi.class).getAutoConfirmStatus(response.getControllerId()))
|
||||
.withRel(MgmtRestConstants.TARGET_V1_AUTO_CONFIRM).expand());
|
||||
.withRel(MgmtTarget.AUTO_CONFIRM).expand());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,11 +110,11 @@ public final class MgmtTargetMapper {
|
||||
response.setInitiator(status.getInitiator());
|
||||
response.setRemark(status.getRemark());
|
||||
response.add(linkTo(methodOn(MgmtTargetRestApi.class).deactivateAutoConfirm(target.getControllerId()))
|
||||
.withRel(MgmtRestConstants.TARGET_V1_DEACTIVATE_AUTO_CONFIRM).expand());
|
||||
.withRel(MgmtTargetAutoConfirm.DEACTIVATE).expand());
|
||||
} else {
|
||||
response = MgmtTargetAutoConfirm.disabled();
|
||||
response.add(linkTo(methodOn(MgmtTargetRestApi.class).activateAutoConfirm(target.getControllerId(), null))
|
||||
.withRel(MgmtRestConstants.TARGET_V1_ACTIVATE_AUTO_CONFIRM).expand());
|
||||
.withRel(MgmtTargetAutoConfirm.ACTIVATE).expand());
|
||||
}
|
||||
return response;
|
||||
}
|
||||
@@ -263,7 +263,7 @@ public final class MgmtTargetMapper {
|
||||
|
||||
if (action.isCancelingOrCanceled()) {
|
||||
result.add(linkTo(methodOn(MgmtTargetRestApi.class).getAction(controllerId, action.getId()))
|
||||
.withRel(MgmtRestConstants.TARGET_V1_CANCELED_ACTION).expand());
|
||||
.withRel("canceledaction").expand());
|
||||
}
|
||||
|
||||
result.add(linkTo(methodOn(MgmtTargetRestApi.class).getTarget(controllerId)).withRel("target")
|
||||
@@ -277,12 +277,12 @@ public final class MgmtTargetMapper {
|
||||
result.add(linkTo(methodOn(MgmtTargetRestApi.class).getActionStatusList(controllerId, action.getId(), 0,
|
||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT_VALUE,
|
||||
ActionStatusFields.ID.getName() + ":" + SortDirection.DESC))
|
||||
.withRel(MgmtRestConstants.TARGET_V1_ACTION_STATUS).expand());
|
||||
.withRel(MgmtTarget.TARGET_V1_ACTION_STATUS).expand());
|
||||
|
||||
final Rollout rollout = action.getRollout();
|
||||
if (rollout != null) {
|
||||
result.add(linkTo(methodOn(MgmtRolloutRestApi.class).getRollout(rollout.getId()))
|
||||
.withRel(MgmtRestConstants.TARGET_V1_ROLLOUT).withName(rollout.getName()).expand());
|
||||
.withRel("rollout").withName(rollout.getName()).expand());
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -22,7 +22,6 @@ import java.util.stream.Collectors;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.distributionsettype.MgmtDistributionSetTypeAssignment;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.targettype.MgmtTargetType;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.targettype.MgmtTargetTypeRequestBodyPost;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetTypeRestApi;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetTypeManagement;
|
||||
@@ -74,7 +73,7 @@ public final class MgmtTargetTypeMapper {
|
||||
|
||||
public static void addLinks(final MgmtTargetType result) {
|
||||
result.add(linkTo(methodOn(MgmtTargetTypeRestApi.class).getCompatibleDistributionSets(result.getId()))
|
||||
.withRel(MgmtRestConstants.COMPATIBLEDISTRIBUTIONSETTYPES).expand());
|
||||
.withRel(MgmtTargetTypeRestApi.COMPATIBLEDISTRIBUTIONSETTYPES).expand());
|
||||
}
|
||||
|
||||
private TargetTypeManagement.Create fromRequest(final MgmtTargetTypeRequestBodyPost targetTypesRest) {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.ACTION_V1_REQUEST_MAPPING;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtActionRestApi.ACTIONS_V1;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.REQUEST_PARAMETER_SEARCH;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
@@ -27,9 +27,12 @@ import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.mgmt.json.model.target.MgmtTarget;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtActionRestApi;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDistributionSetRestApi;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRepresentationMode;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetRestApi;
|
||||
import org.eclipse.hawkbit.repository.model.Action;
|
||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
@@ -91,7 +94,7 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
final String rsqlPendingOrFinishedStatus = rsqlFinishedStatus + "," + rsqlPendingStatus;
|
||||
|
||||
// pending status one result
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "?q=" + rsqlPendingStatus))
|
||||
mvc.perform(get(ACTIONS_V1 + "?q=" + rsqlPendingStatus))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("total", equalTo(1)))
|
||||
@@ -99,14 +102,14 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
.andExpect(jsonPath("content[0].active", equalTo(true)));
|
||||
|
||||
// finished status none result
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "?q=" + rsqlFinishedStatus))
|
||||
mvc.perform(get(ACTIONS_V1 + "?q=" + rsqlFinishedStatus))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("total", equalTo(0)))
|
||||
.andExpect(jsonPath("size", equalTo(0)));
|
||||
|
||||
// pending or finished status one result
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "?q=" + rsqlPendingOrFinishedStatus))
|
||||
mvc.perform(get(ACTIONS_V1 + "?q=" + rsqlPendingOrFinishedStatus))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("total", equalTo(1)))
|
||||
@@ -129,7 +132,7 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
final String rsqlPendingOrFinishedStatus = rsqlFinishedStatus + "," + rsqlPendingStatus;
|
||||
|
||||
// running status one result
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "?q=" + rsqlPendingStatus))
|
||||
mvc.perform(get(ACTIONS_V1 + "?q=" + rsqlPendingStatus))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("total", equalTo(1)))
|
||||
@@ -138,14 +141,14 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
.andExpect(jsonPath("content[0].status", equalTo("running")));
|
||||
|
||||
// finished status none result
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "?q=" + rsqlFinishedStatus))
|
||||
mvc.perform(get(ACTIONS_V1 + "?q=" + rsqlFinishedStatus))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("total", equalTo(0)))
|
||||
.andExpect(jsonPath("size", equalTo(0)));
|
||||
|
||||
// running or finished status one result
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "?q=" + rsqlPendingOrFinishedStatus))
|
||||
mvc.perform(get(ACTIONS_V1 + "?q=" + rsqlPendingOrFinishedStatus))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("total", equalTo(1)))
|
||||
@@ -177,7 +180,7 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
final String rsqlExtRefNoMatch = "externalref==234extRef";
|
||||
|
||||
// pending status one result
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "?q=" + rsqlExtRef))
|
||||
mvc.perform(get(ACTIONS_V1 + "?q=" + rsqlExtRef))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("total", equalTo(1)))
|
||||
@@ -185,14 +188,14 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
.andExpect(jsonPath("content[0].externalRef", equalTo(externalRefs.get(0))));
|
||||
|
||||
// finished status none result
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "?q=" + rsqlExtRefWildcard))
|
||||
mvc.perform(get(ACTIONS_V1 + "?q=" + rsqlExtRefWildcard))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("total", equalTo(2)))
|
||||
.andExpect(jsonPath("size", equalTo(2)));
|
||||
|
||||
// pending or finished status one result
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "?q=" + rsqlExtRefNoMatch))
|
||||
mvc.perform(get(ACTIONS_V1 + "?q=" + rsqlExtRefNoMatch))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("total", equalTo(0)))
|
||||
@@ -218,7 +221,7 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
|
||||
// verify that one result is returned if the actions are filtered for status code 200
|
||||
final String rsqlStatusCode = "lastStatusCode==200";
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "?q=" + rsqlStatusCode))
|
||||
mvc.perform(get(ACTIONS_V1 + "?q=" + rsqlStatusCode))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("total", equalTo(1)))
|
||||
@@ -227,7 +230,7 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
|
||||
// verify no result is returned if we filter for a non-existing status code
|
||||
final String rsqlWrongStatusCode = "lastStatusCode==999";
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "?q=" + rsqlWrongStatusCode))
|
||||
mvc.perform(get(ACTIONS_V1 + "?q=" + rsqlWrongStatusCode))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("total", equalTo(0)))
|
||||
@@ -247,7 +250,7 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
final String rsqlDsVersion = "distributionSet.version==" + ds.getVersion();
|
||||
final String rsqlDsId = "distributionSet.id==" + ds.getId();
|
||||
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "?q=" + rsqlDsName)
|
||||
mvc.perform(get(ACTIONS_V1 + "?q=" + rsqlDsName)
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE, MgmtRepresentationMode.FULL.toString()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -256,25 +259,25 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
.andExpect(jsonPath("content.[0]._links.distributionset.name",
|
||||
equalTo(ds.getName() + ":" + ds.getVersion())));
|
||||
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "?q=" + rsqlDsVersion))
|
||||
mvc.perform(get(ACTIONS_V1 + "?q=" + rsqlDsVersion))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("total", equalTo(1)))
|
||||
.andExpect(jsonPath("size", equalTo(1)));
|
||||
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "?q=" + rsqlDsName + "," + rsqlDsVersion))
|
||||
mvc.perform(get(ACTIONS_V1 + "?q=" + rsqlDsName + "," + rsqlDsVersion))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("total", equalTo(1)))
|
||||
.andExpect(jsonPath("size", equalTo(1)));
|
||||
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "?q=distributionSet.name==FooBar"))
|
||||
mvc.perform(get(ACTIONS_V1 + "?q=distributionSet.name==FooBar"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("total", equalTo(0)))
|
||||
.andExpect(jsonPath("size", equalTo(0)));
|
||||
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "?q=" + rsqlDsId))
|
||||
mvc.perform(get(ACTIONS_V1 + "?q=" + rsqlDsId))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("total", equalTo(1)))
|
||||
@@ -303,7 +306,7 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
final String rsqlRolloutName = "rollout.name==" + rollout.getName();
|
||||
final String rsqlRolloutId = "rollout.id==" + rollout.getId();
|
||||
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "?q=" + rsqlRolloutName)
|
||||
mvc.perform(get(ACTIONS_V1 + "?q=" + rsqlRolloutName)
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE, MgmtRepresentationMode.FULL.toString()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -313,7 +316,7 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
.andExpect(jsonPath(
|
||||
"content.[0]._links.distributionset.name", equalTo(ds.getName() + ":" + ds.getVersion())));
|
||||
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "?q=" + rsqlRolloutId)
|
||||
mvc.perform(get(ACTIONS_V1 + "?q=" + rsqlRolloutId)
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE, MgmtRepresentationMode.FULL.toString()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -365,7 +368,7 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
|
||||
final Action action0 = actions.get(0);
|
||||
final Action action1 = actions.get(1);
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING)
|
||||
mvc.perform(get(ACTIONS_V1)
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "ID:ASC")
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE, MgmtRepresentationMode.FULL.toString()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -403,7 +406,7 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
*/
|
||||
@Test
|
||||
void getActionsWithEmptyResult() throws Exception {
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING))
|
||||
mvc.perform(get(ACTIONS_V1))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("size", equalTo(0)))
|
||||
@@ -421,7 +424,7 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
|
||||
// page 1: one entry
|
||||
final Action action0 = actions.get(0);
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING)
|
||||
mvc.perform(get(ACTIONS_V1)
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, String.valueOf(1))
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "ID:ASC"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -442,7 +445,7 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
|
||||
// page 2: one entry
|
||||
final Action action1 = actions.get(1);
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING)
|
||||
mvc.perform(get(ACTIONS_V1)
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, String.valueOf(1))
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET, String.valueOf(1))
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET, String.valueOf(1))
|
||||
@@ -473,8 +476,8 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
generateTargetWithTwoUpdatesWithOneOverride(knownTargetId);
|
||||
|
||||
// not allowed methods
|
||||
mvc.perform(post(ACTION_V1_REQUEST_MAPPING)).andDo(MockMvcResultPrinter.print()).andExpect(status().isMethodNotAllowed());
|
||||
mvc.perform(put(ACTION_V1_REQUEST_MAPPING)).andDo(MockMvcResultPrinter.print()).andExpect(status().isMethodNotAllowed());
|
||||
mvc.perform(post(ACTIONS_V1)).andDo(MockMvcResultPrinter.print()).andExpect(status().isMethodNotAllowed());
|
||||
mvc.perform(put(ACTIONS_V1)).andDo(MockMvcResultPrinter.print()).andExpect(status().isMethodNotAllowed());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -487,7 +490,7 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
final List<Action> actions = generateTargetWithTwoUpdatesWithOneOverride(knownTargetId);
|
||||
final Long actionId = actions.get(0).getId();
|
||||
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "/" + actionId))
|
||||
mvc.perform(get(ACTIONS_V1 + "/" + actionId))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath(JSON_PATH_ACTION_ID, equalTo(actionId.intValue())));
|
||||
@@ -498,7 +501,7 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
*/
|
||||
@Test
|
||||
void requestActionThatDoesNotExistsLeadsToNotFound() throws Exception {
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "/" + 101)).andDo(MockMvcResultPrinter.print()).andExpect(status().isNotFound());
|
||||
mvc.perform(get(ACTIONS_V1 + "/" + 101)).andDo(MockMvcResultPrinter.print()).andExpect(status().isNotFound());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -507,18 +510,18 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
Action action1 = assignmentResults.get(0).getAssignedEntity().get(0);
|
||||
Action action2 = assignmentResults.get(1).getAssignedEntity().get(0);
|
||||
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING).param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "ID:ASC"))
|
||||
mvc.perform(get(ACTIONS_V1).param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "ID:ASC"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
// verify action 1
|
||||
.andExpect(jsonPath("content.[0].id", equalTo(action1.getId().intValue())))
|
||||
.andExpect(jsonPath("content.[1].id", equalTo(action2.getId().intValue())));
|
||||
|
||||
mvc.perform(delete(ACTION_V1_REQUEST_MAPPING + "/" + action1.getId()))
|
||||
mvc.perform(delete(ACTIONS_V1 + "/" + action1.getId()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "/" + action1.getId()))
|
||||
mvc.perform(get(ACTIONS_V1 + "/" + action1.getId()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNotFound());
|
||||
}
|
||||
@@ -527,7 +530,7 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
void shouldSuccessfullyDeleteMultipleActions() throws Exception {
|
||||
final List<DistributionSetAssignmentResult> assignmentResults = createTargetsAndPerformAssignment(4);
|
||||
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING).param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "ID:ASC"))
|
||||
mvc.perform(get(ACTIONS_V1).param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "ID:ASC"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
// verify action 1
|
||||
@@ -542,28 +545,28 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
final long deletedActionId2 = assignmentResults.get(3).getAssignedEntity().get(0).getId();
|
||||
actionIdsToDelete.add(deletedActionId2);
|
||||
|
||||
mvc.perform(delete(MgmtRestConstants.ACTION_V1_REQUEST_MAPPING)
|
||||
mvc.perform(delete(MgmtActionRestApi.ACTIONS_V1)
|
||||
.content(toJson(actionIdsToDelete)).contentType(APPLICATION_JSON))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "/" + deletedActionId1))
|
||||
mvc.perform(get(ACTIONS_V1 + "/" + deletedActionId1))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNotFound());
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "/" + deletedActionId2))
|
||||
mvc.perform(get(ACTIONS_V1 + "/" + deletedActionId2))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNotFound());
|
||||
final Action deletedAction3 = assignmentResults.get(1).getAssignedEntity().get(0);
|
||||
final String rsql = "target.name==" + deletedAction3.getTarget().getName();
|
||||
|
||||
mvc.perform(delete(MgmtRestConstants.ACTION_V1_REQUEST_MAPPING)
|
||||
mvc.perform(delete(MgmtActionRestApi.ACTIONS_V1)
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_SEARCH, rsql).contentType(APPLICATION_JSON))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "/" + deletedAction3.getId()))
|
||||
mvc.perform(get(ACTIONS_V1 + "/" + deletedAction3.getId()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNotFound());
|
||||
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "/" + assignmentResults.get(0).getAssignedEntity().get(0).getId()))
|
||||
mvc.perform(get(ACTIONS_V1 + "/" + assignmentResults.get(0).getAssignedEntity().get(0).getId()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk());
|
||||
}
|
||||
@@ -571,10 +574,10 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
@Test
|
||||
void shouldReceiveBadRequestWhenNeeded() throws Exception {
|
||||
// bad request on both empty parameters
|
||||
mvc.perform(delete(ACTION_V1_REQUEST_MAPPING).contentType(APPLICATION_JSON)).andExpect(status().isBadRequest());
|
||||
mvc.perform(delete(ACTIONS_V1).contentType(APPLICATION_JSON)).andExpect(status().isBadRequest());
|
||||
|
||||
// bad request when both parameters are present
|
||||
mvc.perform(delete(ACTION_V1_REQUEST_MAPPING).contentType(APPLICATION_JSON)
|
||||
mvc.perform(delete(ACTIONS_V1).contentType(APPLICATION_JSON)
|
||||
.param(REQUEST_PARAMETER_SEARCH, "target.name==test")
|
||||
.content(toJson(List.of(1, 2, 3)))
|
||||
.contentType(APPLICATION_JSON))
|
||||
@@ -582,16 +585,16 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
}
|
||||
|
||||
private static String generateActionLink(final String targetId, final Long actionId) {
|
||||
return "http://localhost" + MgmtRestConstants.TARGET_V1_REQUEST_MAPPING +
|
||||
"/" + targetId + "/" + MgmtRestConstants.TARGET_V1_ACTIONS + "/" + actionId;
|
||||
return "http://localhost" + MgmtTargetRestApi.TARGETS_V1 +
|
||||
"/" + targetId + "/" + MgmtTarget.TARGET_V1_ACTIONS + "/" + actionId;
|
||||
}
|
||||
|
||||
private static String generateTargetLink(final String targetId) {
|
||||
return "http://localhost" + MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/" + targetId;
|
||||
return "http://localhost" + MgmtTargetRestApi.TARGETS_V1 + "/" + targetId;
|
||||
}
|
||||
|
||||
private static String generateDistributionSetLink(final Action action) {
|
||||
return "http://localhost" + MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + action.getDistributionSet().getId();
|
||||
return "http://localhost" + MgmtDistributionSetRestApi.DISTRIBUTIONSETS_V1 + "/" + action.getDistributionSet().getId();
|
||||
}
|
||||
|
||||
private List<DistributionSetAssignmentResult> createTargetsAndPerformAssignment(int n) {
|
||||
@@ -611,7 +614,7 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
private void verifyResultsByTargetPropertyFilter(final Target target, final DistributionSet ds, final String rsqlTargetFilter)
|
||||
throws Exception {
|
||||
// pending status one result
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "?q=" + rsqlTargetFilter)
|
||||
mvc.perform(get(ACTIONS_V1 + "?q=" + rsqlTargetFilter)
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_REPRESENTATION_MODE, MgmtRepresentationMode.FULL.toString()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -637,7 +640,7 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
}
|
||||
|
||||
final ResultActions resultActions =
|
||||
mvc.perform(get(ACTION_V1_REQUEST_MAPPING).param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "ID:ASC"))
|
||||
mvc.perform(get(ACTIONS_V1).param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "ID:ASC"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
// verify action 1
|
||||
@@ -683,7 +686,7 @@ class MgmtActionResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
controllerManagement.updateActionExternalRef(actions.get(0).getId(), externalRef);
|
||||
}
|
||||
|
||||
final ResultActions resultActions = mvc.perform(get(ACTION_V1_REQUEST_MAPPING + "/{actionId}", actions.get(0).getId()))
|
||||
final ResultActions resultActions = mvc.perform(get(ACTIONS_V1 + "/{actionId}", actions.get(0).getId()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk());
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
|
||||
import java.util.Base64;
|
||||
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtBasicAuthRestApi;
|
||||
import org.eclipse.hawkbit.repository.jpa.JpaRepositoryConfiguration;
|
||||
import org.eclipse.hawkbit.repository.test.TestConfiguration;
|
||||
import org.eclipse.hawkbit.repository.test.matcher.EventVerifier;
|
||||
@@ -84,7 +84,7 @@ class MgmtBasicAuthResourceTest {
|
||||
@Test
|
||||
@WithUser(principal = TEST_USER, authorities = { "READ", "WRITE", "DELETE" })
|
||||
void validateBasicAuthWithUserDetails() throws Exception {
|
||||
withSecurityMock().perform(get(MgmtRestConstants.AUTH_V1_REQUEST_MAPPING))
|
||||
withSecurityMock().perform(get(MgmtBasicAuthRestApi.USERINFO_V1))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -100,7 +100,7 @@ class MgmtBasicAuthResourceTest {
|
||||
*/
|
||||
@Test
|
||||
void validateBasicAuthFailsWithInvalidCredentials() throws Exception {
|
||||
defaultMock.perform(get(MgmtRestConstants.AUTH_V1_REQUEST_MAPPING)
|
||||
defaultMock.perform(get(MgmtBasicAuthRestApi.USERINFO_V1)
|
||||
.header(HttpHeaders.AUTHORIZATION, getBasicAuth("wrongUser", "wrongSecret")))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isUnauthorized());
|
||||
|
||||
@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtDistributionSetRestApi.DISTRIBUTIONSETS_V1;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.Matchers.contains;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
@@ -100,7 +100,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
void getSoftwareModules() throws Exception {
|
||||
// Create DistributionSet with three software modules
|
||||
final DistributionSet set = testdataFactory.createDistributionSet("SMTest");
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + set.getId() + "/assignedSM"))
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/" + set.getId() + "/assignedSM"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.size", equalTo(set.getModules().size())));
|
||||
@@ -114,7 +114,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
final DistributionSet set = testdataFactory.createUpdatedDistributionSet();
|
||||
|
||||
// post assignment
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + set.getId() + "/assignedSM")
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/" + set.getId() + "/assignedSM")
|
||||
.param("offset", "1").param("limit", "2").param("sort", "version:DESC").param("q", "name==one*")
|
||||
.accept(APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -137,7 +137,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
smList.put(new JSONObject().put("id", smID));
|
||||
}
|
||||
// post assignment
|
||||
mvc.perform(post(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + disSet.getId() + "/assignedSM")
|
||||
mvc.perform(post(DISTRIBUTIONSETS_V1 + "/" + disSet.getId() + "/assignedSM")
|
||||
.contentType(APPLICATION_JSON).content(smList.toString()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNoContent());
|
||||
@@ -150,7 +150,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
list.put(new JSONObject().put("id", Long.valueOf(targetId)));
|
||||
}
|
||||
assignDistributionSet(disSet.getId(), knownTargetIds[0]);
|
||||
mvc.perform(post(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + disSet.getId() + "/assignedTargets")
|
||||
mvc.perform(post(DISTRIBUTIONSETS_V1 + "/" + disSet.getId() + "/assignedTargets")
|
||||
.contentType(APPLICATION_JSON).content(list.toString()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -159,7 +159,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
.andExpect(jsonPath("$.total", equalTo(knownTargetIds.length)));
|
||||
|
||||
// try to delete the Software Module from DistSet that has been assigned to the target - hence locked.
|
||||
mvc.perform(delete(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + disSet.getId() + "/assignedSM/" + smIDs.get(0))
|
||||
mvc.perform(delete(DISTRIBUTIONSETS_V1 + "/" + disSet.getId() + "/assignedSM/" + smIDs.get(0))
|
||||
.contentType(APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isLocked())
|
||||
@@ -181,7 +181,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
smList.put(new JSONObject().put("id", smID));
|
||||
}
|
||||
// post assignment
|
||||
mvc.perform(post(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + disSet.getId() + "/assignedSM")
|
||||
mvc.perform(post(DISTRIBUTIONSETS_V1 + "/" + disSet.getId() + "/assignedSM")
|
||||
.contentType(APPLICATION_JSON).content(smList.toString()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNoContent());
|
||||
@@ -191,7 +191,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
final JSONArray list = createTargetAndJsonArray(null, null, null, null, null, knownTargetIds);
|
||||
// assign DisSet to target and test assignment
|
||||
assignDistributionSet(disSet.getId(), knownTargetIds[0]);
|
||||
mvc.perform(post(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + disSet.getId() + "/assignedTargets")
|
||||
mvc.perform(post(DISTRIBUTIONSETS_V1 + "/" + disSet.getId() + "/assignedTargets")
|
||||
.contentType(APPLICATION_JSON).content(list.toString()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -205,7 +205,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
smList2.put(new JSONObject().put("id", sm2.getId()));
|
||||
|
||||
// fail because locked
|
||||
mvc.perform(post(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + disSet.getId() + "/assignedSM")
|
||||
mvc.perform(post(DISTRIBUTIONSETS_V1 + "/" + disSet.getId() + "/assignedSM")
|
||||
.contentType(APPLICATION_JSON).content(smList2.toString()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isLocked())
|
||||
@@ -220,7 +220,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
// create DisSet
|
||||
final DistributionSet disSet = testdataFactory.createDistributionSetWithNoSoftwareModules("Jupiter", "398,88");
|
||||
// Test if size is 0
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + disSet.getId() + "/assignedSM"))
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/" + disSet.getId() + "/assignedSM"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.size", equalTo(disSet.getModules().size())));
|
||||
@@ -229,12 +229,12 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
testdataFactory.createSoftwareModuleApp().getId());
|
||||
|
||||
// post assignment
|
||||
mvc.perform(post(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + disSet.getId() + "/assignedSM")
|
||||
mvc.perform(post(DISTRIBUTIONSETS_V1 + "/" + disSet.getId() + "/assignedSM")
|
||||
.contentType(APPLICATION_JSON).content(toJson(smIDs.stream().map(MgmtId::new).toList())))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNoContent());
|
||||
// Test if size is 3
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + disSet.getId() + "/assignedSM"))
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/" + disSet.getId() + "/assignedSM"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.size", equalTo(smIDs.size())));
|
||||
@@ -248,18 +248,18 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
|
||||
// post assignment
|
||||
final String jsonIDs = toJson(moduleIDs.subList(0, maxSoftwareModules - smIDs.size()).stream().map(MgmtId::new).toList());
|
||||
mvc.perform(post(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + disSet.getId() + "/assignedSM")
|
||||
mvc.perform(post(DISTRIBUTIONSETS_V1 + "/" + disSet.getId() + "/assignedSM")
|
||||
.contentType(APPLICATION_JSON).content(jsonIDs))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNoContent());
|
||||
// test if size corresponds with quota
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + disSet.getId() + "/assignedSM?limit={limit}", maxSoftwareModules * 2))
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/" + disSet.getId() + "/assignedSM?limit={limit}", maxSoftwareModules * 2))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.size", equalTo(maxSoftwareModules)));
|
||||
|
||||
// post one more to cause the quota to be exceeded
|
||||
mvc.perform(post(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + disSet.getId() + "/assignedSM")
|
||||
mvc.perform(post(DISTRIBUTIONSETS_V1 + "/" + disSet.getId() + "/assignedSM")
|
||||
.contentType(APPLICATION_JSON)
|
||||
.content(toJson(Stream.of(moduleIDs.get(moduleIDs.size() - 1)).map(MgmtId::new).toList())))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -269,7 +269,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
|
||||
// verify quota is also enforced for bulk uploads
|
||||
final DistributionSet disSet2 = testdataFactory.createDistributionSetWithNoSoftwareModules("Saturn", "4.0");
|
||||
mvc.perform(post(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + disSet2.getId() + "/assignedSM")
|
||||
mvc.perform(post(DISTRIBUTIONSETS_V1 + "/" + disSet2.getId() + "/assignedSM")
|
||||
.contentType(APPLICATION_JSON).content(toJson(moduleIDs.stream().map(MgmtId::new).toList())))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isTooManyRequests())
|
||||
@@ -277,7 +277,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
.andExpect(jsonPath("$.errorCode", equalTo(SpServerError.SP_QUOTA_EXCEEDED.getKey())));
|
||||
|
||||
// verify size is still 0
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + disSet2.getId() + "/assignedSM"))
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/" + disSet2.getId() + "/assignedSM"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.size", equalTo(0)));
|
||||
@@ -291,16 +291,16 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
// Create DistributionSet with three software modules
|
||||
final DistributionSet set = testdataFactory.createDistributionSet("Venus");
|
||||
int amountOfSM = set.getModules().size();
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + set.getId() + "/assignedSM"))
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/" + set.getId() + "/assignedSM"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.size", equalTo(amountOfSM)));
|
||||
// test the removal of all software modules one by one
|
||||
for (final SoftwareModule softwareModule : set.getModules()) {
|
||||
final Long smId = softwareModule.getId();
|
||||
mvc.perform(delete(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + set.getId() + "/assignedSM/" + smId))
|
||||
mvc.perform(delete(DISTRIBUTIONSETS_V1 + "/" + set.getId() + "/assignedSM/" + smId))
|
||||
.andExpect(status().isNoContent());
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + set.getId() + "/assignedSM"))
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/" + set.getId() + "/assignedSM"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.size", equalTo(--amountOfSM)));
|
||||
@@ -320,7 +320,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
// assign already one target to DS
|
||||
assignDistributionSet(createdDs.getId(), knownTargetIds[0]);
|
||||
|
||||
mvc.perform(post(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + createdDs.getId() + "/assignedTargets")
|
||||
mvc.perform(post(DISTRIBUTIONSETS_V1 + "/" + createdDs.getId() + "/assignedTargets")
|
||||
.contentType(APPLICATION_JSON).content(list.toString()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.assigned", equalTo(knownTargetIds.length - 1)))
|
||||
@@ -349,7 +349,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
list.put(new JSONObject().put("id", targetId).put("type", "forced"));
|
||||
}
|
||||
|
||||
mvc.perform(post(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + createdDs.getId() + "/assignedTargets")
|
||||
mvc.perform(post(DISTRIBUTIONSETS_V1 + "/" + createdDs.getId() + "/assignedTargets")
|
||||
.contentType(APPLICATION_JSON).content(list.toString()))
|
||||
.andExpect(status().isOk());
|
||||
// we just need to make sure that no error 500 is returned
|
||||
@@ -413,7 +413,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
}
|
||||
});
|
||||
|
||||
mvc.perform(post(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + ds.getId() + "/assignedTargets")
|
||||
mvc.perform(post(DISTRIBUTIONSETS_V1 + "/" + ds.getId() + "/assignedTargets")
|
||||
.contentType(APPLICATION_JSON).content(payload.toString()))
|
||||
.andExpect(status().isTooManyRequests());
|
||||
|
||||
@@ -442,7 +442,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
// assign our test target to another distribution set and verify that
|
||||
// the 'max actions per target' quota is exceeded
|
||||
final String json = new JSONArray().put(new JSONObject().put("id", testTarget.getControllerId())).toString();
|
||||
mvc.perform(post(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + ds3.getId() + "/assignedTargets")
|
||||
mvc.perform(post(DISTRIBUTIONSETS_V1 + "/" + ds3.getId() + "/assignedTargets")
|
||||
.contentType(APPLICATION_JSON).content(json))
|
||||
.andExpect(status().isTooManyRequests());
|
||||
}
|
||||
@@ -466,7 +466,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
// assign already one target to DS
|
||||
assignDistributionSet(createdDs.getId(), targets.get(0).getControllerId());
|
||||
|
||||
mvc.perform(post(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + createdDs.getId()
|
||||
mvc.perform(post(DISTRIBUTIONSETS_V1 + "/" + createdDs.getId()
|
||||
+ "/assignedTargets?offline=true").contentType(APPLICATION_JSON).content(list.toString()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.assigned", equalTo(targets.size() - 1)))
|
||||
@@ -492,7 +492,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
// assign already one target to DS
|
||||
assignDistributionSet(createdDs.getId(), knownTargetIds[0]);
|
||||
|
||||
mvc.perform(post(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + createdDs.getId() + "/assignedTargets")
|
||||
mvc.perform(post(DISTRIBUTIONSETS_V1 + "/" + createdDs.getId() + "/assignedTargets")
|
||||
.contentType(APPLICATION_JSON).content(list.toString()))
|
||||
.andExpect(status().isBadRequest());
|
||||
}
|
||||
@@ -510,7 +510,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
// assign already one target to DS
|
||||
assignDistributionSet(createdDs.getId(), knownTargetIds[0]);
|
||||
|
||||
mvc.perform(post(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + createdDs.getId() + "/assignedTargets")
|
||||
mvc.perform(post(DISTRIBUTIONSETS_V1 + "/" + createdDs.getId() + "/assignedTargets")
|
||||
.contentType(APPLICATION_JSON).content(list.toString()))
|
||||
.andExpect(status().isBadRequest());
|
||||
}
|
||||
@@ -529,7 +529,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
// assign already one target to DS
|
||||
assignDistributionSet(createdDs.getId(), knownTargetIds[0]);
|
||||
|
||||
mvc.perform(post(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + createdDs.getId() + "/assignedTargets")
|
||||
mvc.perform(post(DISTRIBUTIONSETS_V1 + "/" + createdDs.getId() + "/assignedTargets")
|
||||
.contentType(APPLICATION_JSON).content(list.toString()))
|
||||
.andExpect(status().isOk());
|
||||
}
|
||||
@@ -548,7 +548,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
// assign already one target to DS
|
||||
assignDistributionSet(createdDs.getId(), knownTargetIds[0]);
|
||||
|
||||
mvc.perform(post(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + createdDs.getId() + "/assignedTargets")
|
||||
mvc.perform(post(DISTRIBUTIONSETS_V1 + "/" + createdDs.getId() + "/assignedTargets")
|
||||
.contentType(APPLICATION_JSON).content(list.toString()))
|
||||
.andExpect(status().isBadRequest());
|
||||
}
|
||||
@@ -576,7 +576,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
// assign already one target to DS
|
||||
assignDistributionSet(createdDs.getId(), knownTargetIds[0]);
|
||||
|
||||
mvc.perform(post(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + createdDs.getId() + "/assignedTargets")
|
||||
mvc.perform(post(DISTRIBUTIONSETS_V1 + "/" + createdDs.getId() + "/assignedTargets")
|
||||
.contentType(APPLICATION_JSON).content(list.toString()))
|
||||
.andExpect(status().isOk());
|
||||
}
|
||||
@@ -594,7 +594,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
|
||||
assignTargetJson.put(new JSONObject().put("id", "notexistingtarget").put("type", "forced"));
|
||||
|
||||
mvc.perform(post(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + createdDs.getId() + "/assignedTargets")
|
||||
mvc.perform(post(DISTRIBUTIONSETS_V1 + "/" + createdDs.getId() + "/assignedTargets")
|
||||
.contentType(APPLICATION_JSON).content(assignTargetJson.toString()))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.alreadyAssigned", equalTo(1)))
|
||||
@@ -613,7 +613,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
testdataFactory.createTarget(knownTargetId);
|
||||
assignDistributionSet(createdDs.getId(), knownTargetId);
|
||||
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + createdDs.getId() + "/assignedTargets"))
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/" + createdDs.getId() + "/assignedTargets"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.size", equalTo(1)))
|
||||
.andExpect(jsonPath("$.content[0].controllerId", equalTo(knownTargetId)));
|
||||
@@ -629,7 +629,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
assignDistributionSet(set, testdataFactory.createTargets(5, "targetMisc", "Test targets for query"))
|
||||
.getAssignedEntity();
|
||||
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + set.getId() + "/assignedTargets")
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/" + set.getId() + "/assignedTargets")
|
||||
.param("offset", "1").param("limit", "2").param("sort", "name:DESC")
|
||||
.param("q", "controllerId==target*").accept(APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -644,7 +644,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
@Test
|
||||
void getAssignedTargetsOfDistributionSetIsEmpty() throws Exception {
|
||||
final DistributionSet createdDs = testdataFactory.createDistributionSet();
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + createdDs.getId() + "/assignedTargets"))
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/" + createdDs.getId() + "/assignedTargets"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.size", equalTo(0)))
|
||||
.andExpect(jsonPath("$.total", equalTo(0)));
|
||||
@@ -668,7 +668,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
testdataFactory.sendUpdateActionStatusToTargets(Collections.singletonList(createTarget), Status.FINISHED,
|
||||
Collections.singletonList("some message"));
|
||||
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + createdDs.getId() + "/installedTargets"))
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/" + createdDs.getId() + "/installedTargets"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.size", equalTo(1)))
|
||||
.andExpect(jsonPath("$.content[0].controllerId", equalTo(knownTargetId)));
|
||||
@@ -686,7 +686,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
.map(Action::getTarget).toList();
|
||||
testdataFactory.sendUpdateActionStatusToTargets(targets, Status.FINISHED, "some message");
|
||||
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + set.getId() + "/installedTargets")
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/" + set.getId() + "/installedTargets")
|
||||
.param("offset", "1").param("limit", "2").param("sort", "name:DESC")
|
||||
.param("q", "controllerId==target*").accept(APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -710,7 +710,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
targetFilterQueryManagement.create(Create.builder().name("b").query("name==y").build());
|
||||
targetFilterQueryManagement.create(Create.builder().name("c").query("name==y").build());
|
||||
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + createdDs.getId() + "/autoAssignTargetFilters"))
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/" + createdDs.getId() + "/autoAssignTargetFilters"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.size", equalTo(1)))
|
||||
.andExpect(jsonPath("$.content[0].name", equalTo(knownFilterName)));
|
||||
@@ -724,7 +724,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
final DistributionSet set = testdataFactory.createUpdatedDistributionSet();
|
||||
targetFilterQueryManagement.create(Create.builder().name("filter1").query("name==a").autoAssignDistributionSet(set).build());
|
||||
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + set.getId() + "/autoAssignTargetFilters")
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/" + set.getId() + "/autoAssignTargetFilters")
|
||||
.param("offset", "1").param("limit", "2").param("sort", "name:DESC").param("q", "name==*1")
|
||||
.accept(APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -741,7 +741,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
final DistributionSet createdDs = testdataFactory.createDistributionSet();
|
||||
final String invalidQuery = "unknownField=le=42";
|
||||
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + createdDs.getId() + "/autoAssignTargetFilters")
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/" + createdDs.getId() + "/autoAssignTargetFilters")
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_SEARCH, invalidQuery))
|
||||
.andExpect(status().isBadRequest());
|
||||
}
|
||||
@@ -757,7 +757,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
|
||||
prepareTestFilters(filterNamePrefix, createdDs);
|
||||
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + createdDs.getId() + "/autoAssignTargetFilters")
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/" + createdDs.getId() + "/autoAssignTargetFilters")
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_SEARCH, query))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.size", equalTo(2)))
|
||||
@@ -776,7 +776,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
|
||||
prepareTestFilters(filterNamePrefix, createdDs);
|
||||
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + createdDs.getId() + "/autoAssignTargetFilters")
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/" + createdDs.getId() + "/autoAssignTargetFilters")
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_SEARCH, query))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.size", equalTo(0)));
|
||||
@@ -789,7 +789,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
void getDistributionSetsWithoutAdditionalRequestParameters() throws Exception {
|
||||
final int sets = 5;
|
||||
createDistributionSetsAlphabetical(sets);
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING))
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath(MgmtTargetResourceTest.JSON_PATH_PAGED_LIST_TOTAL, equalTo(sets)))
|
||||
@@ -805,7 +805,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
final int sets = 5;
|
||||
final int limitSize = 1;
|
||||
createDistributionSetsAlphabetical(sets);
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING).param(MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, String.valueOf(limitSize)))
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1).param(MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, String.valueOf(limitSize)))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath(MgmtTargetResourceTest.JSON_PATH_PAGED_LIST_TOTAL, equalTo(sets)))
|
||||
@@ -822,7 +822,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
final int offsetParam = 2;
|
||||
final int expectedSize = sets - offsetParam;
|
||||
createDistributionSetsAlphabetical(sets);
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING)
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1)
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET, String.valueOf(offsetParam))
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, String.valueOf(sets)))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -1296,7 +1296,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
distributionSetManagement.createMetadata(testDS.getId(), Map.of(knownKeyPrefix + index, knownValuePrefix + index));
|
||||
}
|
||||
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{distributionSetId}/metadata", testDS.getId()))
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/{distributionSetId}/metadata", testDS.getId()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentType(MediaTypes.HAL_JSON));
|
||||
@@ -1377,7 +1377,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
|
||||
final String rsqlFindTargetId1 = "controllerId==1";
|
||||
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + createdDs.getId() + "/assignedTargets?q=" + rsqlFindTargetId1)
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/" + createdDs.getId() + "/assignedTargets?q=" + rsqlFindTargetId1)
|
||||
.contentType(APPLICATION_JSON))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("total", equalTo(1)))
|
||||
@@ -1553,7 +1553,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
rolloutManagement.start(rollout.getId());
|
||||
rolloutHandler.handleAll();
|
||||
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{ds}/statistics/rollouts", ds1.getId()).contentType(
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/{ds}/statistics/rollouts", ds1.getId()).contentType(
|
||||
APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -1563,7 +1563,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
.andExpect(jsonPath("actions").doesNotExist())
|
||||
.andExpect(jsonPath("totalAutoAssignments").doesNotExist());
|
||||
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{ds}/statistics/rollouts", ds2.getId())
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/{ds}/statistics/rollouts", ds2.getId())
|
||||
.contentType(APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -1587,7 +1587,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
rolloutManagement.start(rollout.getId());
|
||||
rolloutHandler.handleAll();
|
||||
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{ds}/statistics/actions", ds1.getId())
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/{ds}/statistics/actions", ds1.getId())
|
||||
.contentType(APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -1596,7 +1596,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
.andExpect(jsonPath("rollouts").doesNotExist())
|
||||
.andExpect(jsonPath("totalAutoAssignments").doesNotExist());
|
||||
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{ds}/statistics/actions", ds2.getId())
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/{ds}/statistics/actions", ds2.getId())
|
||||
.contentType(APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -1620,7 +1620,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
targetFilterQueryManagement.create(
|
||||
Create.builder().name("test filter 2").autoAssignDistributionSet(ds1).query("name==targets*").build());
|
||||
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{ds}/statistics/autoassignments", ds1.getId()).contentType(
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/{ds}/statistics/autoassignments", ds1.getId()).contentType(
|
||||
APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -1628,7 +1628,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
.andExpect(jsonPath("rollouts").doesNotExist())
|
||||
.andExpect(jsonPath("actions").doesNotExist());
|
||||
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{ds}/statistics/autoassignments", ds2.getId()).contentType(
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/{ds}/statistics/autoassignments", ds2.getId()).contentType(
|
||||
APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -1654,7 +1654,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
rolloutManagement.start(rollout.getId());
|
||||
rolloutHandler.handleAll();
|
||||
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{ds}/statistics", ds1.getId())
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/{ds}/statistics", ds1.getId())
|
||||
.contentType(APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -1664,7 +1664,7 @@ class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegrationTe
|
||||
.andExpect(jsonPath("rollouts.RUNNING", equalTo(1)))
|
||||
.andExpect(jsonPath("rollouts.total", equalTo(1)));
|
||||
|
||||
mvc.perform(get(DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/{ds}/statistics/autoassignments", ds2.getId())
|
||||
mvc.perform(get(DISTRIBUTIONSETS_V1 + "/{ds}/statistics/autoassignments", ds2.getId())
|
||||
.contentType(APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDistributionSetTagRestApi;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||
import org.eclipse.hawkbit.mgmt.rest.resource.util.ResourceUtility;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetTagManagement;
|
||||
@@ -52,7 +53,7 @@ import org.springframework.test.web.servlet.ResultActions;
|
||||
*/
|
||||
class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
|
||||
private static final String DISTRIBUTIONSETTAGS_ROOT = "http://localhost" + MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/";
|
||||
private static final String DISTRIBUTIONSETTAGS_ROOT = "http://localhost" + MgmtDistributionSetTagRestApi.DISTRIBUTIONSETTAGS_V1 + "/";
|
||||
|
||||
/**
|
||||
* Verifies that a paged result list of DS tags reflects the content on the repository side.
|
||||
@@ -64,7 +65,7 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
final DistributionSetTag assigned = tags.get(0);
|
||||
final DistributionSetTag unassigned = tags.get(1);
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON))
|
||||
mvc.perform(get(MgmtDistributionSetTagRestApi.DISTRIBUTIONSETTAGS_V1).accept(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
|
||||
@@ -83,7 +84,7 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
@Test
|
||||
void getDistributionSetTagsWithParameters() throws Exception {
|
||||
testdataFactory.createDistributionSetTags(2);
|
||||
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "?limit=10&sort=name:ASC&offset=0&q=name==DsTag"))
|
||||
mvc.perform(get(MgmtDistributionSetTagRestApi.DISTRIBUTIONSETTAGS_V1 + "?limit=10&sort=name:ASC&offset=0&q=name==DsTag"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk());
|
||||
}
|
||||
@@ -102,7 +103,7 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
distributionSetManagement.assignTag(List.of(distributionSet1.getId(), distributionSet2.getId()), tag1.getId());
|
||||
distributionSetManagement.assignTag(List.of(distributionSet1.getId()), tag2.getId());
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING)
|
||||
mvc.perform(get(MgmtDistributionSetTagRestApi.DISTRIBUTIONSETTAGS_V1)
|
||||
.queryParam(MgmtRestConstants.REQUEST_PARAMETER_SEARCH, "distributionset.id==" + distributionSet1.getId())
|
||||
.accept(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -116,7 +117,7 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
.andExpect(jsonPath(MgmtTargetResourceTest.JSON_PATH_PAGED_LIST_SIZE, equalTo(2)))
|
||||
.andExpect(jsonPath(MgmtTargetResourceTest.JSON_PATH_PAGED_LIST_CONTENT, hasSize(2)));
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING)
|
||||
mvc.perform(get(MgmtDistributionSetTagRestApi.DISTRIBUTIONSETTAGS_V1)
|
||||
.queryParam(MgmtRestConstants.REQUEST_PARAMETER_SEARCH, "distributionset.id==" + distributionSet2.getId())
|
||||
.accept(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -145,7 +146,7 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
|
||||
// pass here q directly as a pure string because .queryParam method delimiters the parameters in q with ,
|
||||
// which is logical OR, we want AND here
|
||||
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING
|
||||
mvc.perform(get(MgmtDistributionSetTagRestApi.DISTRIBUTIONSETTAGS_V1
|
||||
+ "?" + MgmtRestConstants.REQUEST_PARAMETER_SEARCH +
|
||||
"=distributionset.id==" + distributionSet1.getId() + ";description==" + tag1.getDescription())
|
||||
.accept(MediaType.APPLICATION_JSON))
|
||||
@@ -168,7 +169,7 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
final List<DistributionSetTag> tags = testdataFactory.createDistributionSetTags(2);
|
||||
final DistributionSetTag assigned = tags.get(0);
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/" + assigned.getId())
|
||||
mvc.perform(get(MgmtDistributionSetTagRestApi.DISTRIBUTIONSETTAGS_V1 + "/" + assigned.getId())
|
||||
.accept(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -193,7 +194,7 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
.build();
|
||||
|
||||
final ResultActions result = mvc
|
||||
.perform(post(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING)
|
||||
.perform(post(MgmtDistributionSetTagRestApi.DISTRIBUTIONSETTAGS_V1)
|
||||
.content(toJson(List.of(tagOne, tagTwo)))
|
||||
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -228,7 +229,7 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
.build();
|
||||
|
||||
final ResultActions result = mvc
|
||||
.perform(put(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/" + original.getId())
|
||||
.perform(put(MgmtDistributionSetTagRestApi.DISTRIBUTIONSETTAGS_V1 + "/" + original.getId())
|
||||
.content(toJson(update)).contentType(MediaType.APPLICATION_JSON)
|
||||
.accept(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -255,7 +256,7 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
final List<DistributionSetTag> tags = testdataFactory.createDistributionSetTags(1);
|
||||
final DistributionSetTag original = tags.get(0);
|
||||
|
||||
mvc.perform(delete(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/" + original.getId()))
|
||||
mvc.perform(delete(MgmtDistributionSetTagRestApi.DISTRIBUTIONSETTAGS_V1 + "/" + original.getId()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
@@ -276,7 +277,7 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
final List<DistributionSet> sets = testdataFactory.createDistributionSetsWithoutModules(setsAssigned);
|
||||
distributionSetManagement.assignTag(sets.stream().map(BaseEntity::getId).toList(), tag.getId());
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned"))
|
||||
mvc.perform(get(MgmtDistributionSetTagRestApi.DISTRIBUTIONSETTAGS_V1 + "/" + tag.getId() + "/assigned"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath(MgmtTargetResourceTest.JSON_PATH_PAGED_LIST_TOTAL, equalTo(setsAssigned)))
|
||||
@@ -299,7 +300,7 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
final List<DistributionSet> sets = testdataFactory.createDistributionSetsWithoutModules(setsAssigned);
|
||||
distributionSetManagement.assignTag(sets.stream().map(BaseEntity::getId).toList(), tag.getId());
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned")
|
||||
mvc.perform(get(MgmtDistributionSetTagRestApi.DISTRIBUTIONSETTAGS_V1 + "/" + tag.getId() + "/assigned")
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, String.valueOf(limitSize)))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -325,7 +326,7 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
final List<DistributionSet> sets = testdataFactory.createDistributionSetsWithoutModules(setsAssigned);
|
||||
distributionSetManagement.assignTag(sets.stream().map(BaseEntity::getId).toList(), tag.getId());
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned")
|
||||
mvc.perform(get(MgmtDistributionSetTagRestApi.DISTRIBUTIONSETTAGS_V1 + "/" + tag.getId() + "/assigned")
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET, String.valueOf(offsetParam))
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, String.valueOf(setsAssigned)))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -347,7 +348,7 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
final DistributionSetTag tag = testdataFactory.createDistributionSetTags(1).get(0);
|
||||
final DistributionSet set = testdataFactory.createDistributionSetsWithoutModules(1).get(0);
|
||||
|
||||
mvc.perform(post(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned/" +
|
||||
mvc.perform(post(MgmtDistributionSetTagRestApi.DISTRIBUTIONSETTAGS_V1 + "/" + tag.getId() + "/assigned/" +
|
||||
set.getId()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNoContent());
|
||||
@@ -368,7 +369,7 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
final DistributionSetTag tag = testdataFactory.createDistributionSetTags(1).get(0);
|
||||
final List<DistributionSet> sets = testdataFactory.createDistributionSetsWithoutModules(2);
|
||||
|
||||
mvc.perform(post(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned")
|
||||
mvc.perform(post(MgmtDistributionSetTagRestApi.DISTRIBUTIONSETTAGS_V1 + "/" + tag.getId() + "/assigned")
|
||||
.content(toJson(sets.stream().map(DistributionSet::getId).toList()))
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -396,7 +397,7 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
|
||||
distributionSetManagement.assignTag(sets.stream().map(BaseEntity::getId).toList(), tag.getId());
|
||||
|
||||
mvc.perform(delete(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned/" +
|
||||
mvc.perform(delete(MgmtDistributionSetTagRestApi.DISTRIBUTIONSETTAGS_V1 + "/" + tag.getId() + "/assigned/" +
|
||||
unassigned.getId()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNoContent());
|
||||
@@ -423,7 +424,7 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
|
||||
distributionSetManagement.assignTag(sets.stream().map(DistributionSet::getId).toList(), tag.getId());
|
||||
|
||||
mvc.perform(delete(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned")
|
||||
mvc.perform(delete(MgmtDistributionSetTagRestApi.DISTRIBUTIONSETTAGS_V1 + "/" + tag.getId() + "/assigned")
|
||||
.content(toJson(List.of(unassigned0.getId(), unassigned1.getId())))
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -459,7 +460,7 @@ class MgmtDistributionSetTagResourceTest extends AbstractManagementApiIntegratio
|
||||
withMissing.addAll(missing);
|
||||
|
||||
mvc.perform(
|
||||
post(MgmtRestConstants.DISTRIBUTIONSET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned")
|
||||
post(MgmtDistributionSetTagRestApi.DISTRIBUTIONSETTAGS_V1 + "/" + tag.getId() + "/assigned")
|
||||
.content(toJson(withMissing))
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.jayway.jsonpath.JsonPath;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.distributionsettype.MgmtDistributionSetTypeRequestBodyPost;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremoduletype.MgmtSoftwareModuleTypeAssignment;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDistributionSetTypeRestApi;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetTypeManagement;
|
||||
@@ -420,7 +421,7 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
|
||||
*/
|
||||
@Test
|
||||
void getDistributionSetTypesWithParameter() throws Exception {
|
||||
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING
|
||||
mvc.perform(get(MgmtDistributionSetTypeRestApi.DISTRIBUTIONSETTYPES_V1
|
||||
+ "?limit=10&sort=name:ASC&offset=0&q=name==a"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk());
|
||||
@@ -528,7 +529,7 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
|
||||
.put("colour", "rgb(106,178,83)").toString();
|
||||
|
||||
mvc
|
||||
.perform(put(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/{distributionSetTypeId}",
|
||||
.perform(put(MgmtDistributionSetTypeRestApi.DISTRIBUTIONSETTYPES_V1 + "/{distributionSetTypeId}",
|
||||
testType.getId()).content(body).contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk());
|
||||
@@ -560,7 +561,7 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
|
||||
|
||||
// 4 types overall (3 hawkbit tenant default, 1 test default
|
||||
final int types = 4;
|
||||
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING))
|
||||
mvc.perform(get(MgmtDistributionSetTypeRestApi.DISTRIBUTIONSETTYPES_V1))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath(MgmtTargetResourceTest.JSON_PATH_PAGED_LIST_TOTAL, equalTo(types)))
|
||||
@@ -576,7 +577,7 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
|
||||
|
||||
final int types = DEFAULT_DS_TYPES;
|
||||
final int limitSize = 1;
|
||||
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING)
|
||||
mvc.perform(get(MgmtDistributionSetTypeRestApi.DISTRIBUTIONSETTYPES_V1)
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, String.valueOf(limitSize)))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -593,7 +594,7 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
|
||||
final int types = DEFAULT_DS_TYPES;
|
||||
final int offsetParam = 2;
|
||||
final int expectedSize = types - offsetParam;
|
||||
mvc.perform(get(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING)
|
||||
mvc.perform(get(MgmtDistributionSetTypeRestApi.DISTRIBUTIONSETTYPES_V1)
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET, String.valueOf(offsetParam))
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, String.valueOf(types)))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.awaitility.core.ConditionFactory;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.rollout.MgmtRolloutResponseBody;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRolloutRestApi;
|
||||
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtRestModelMapper;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
||||
@@ -125,7 +126,7 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
|
||||
rolloutManagement.approveOrDeny(rollout.getId(), Rollout.ApprovalDecision.APPROVED, "Approved remark.");
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}", rollout.getId())
|
||||
mvc.perform(get(MgmtRolloutRestApi.ROLLOUTS_V1 + "/{rolloutId}", rollout.getId())
|
||||
.accept(MediaTypes.HAL_JSON_VALUE))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -146,7 +147,7 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
final RolloutGroup firstRolloutGroup = rolloutGroupManagement
|
||||
.findByRollout(rollout.getId(), PageRequest.of(0, 1)).getContent().get(0);
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/deploygroups/{deployGroupId}/targets",
|
||||
mvc.perform(get(MgmtRolloutRestApi.ROLLOUTS_V1 + "/{rolloutId}/deploygroups/{deployGroupId}/targets",
|
||||
rollout.getId(), firstRolloutGroup.getId()).param("offset", "0").param("limit", "2")
|
||||
.param("sort", "name:ASC").param("q", "controllerId==exampleTarget0")
|
||||
.accept(MediaTypes.HAL_JSON_VALUE))
|
||||
@@ -165,7 +166,7 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
testdataFactory.createTargets(4, "rollout", "description");
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
||||
final Rollout rollout = createRollout("rollout1", 3, dsA, "controllerId==rollout*", false);
|
||||
mvc.perform(post(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/approve", rollout.getId())
|
||||
mvc.perform(post(MgmtRolloutRestApi.ROLLOUTS_V1 + "/{rolloutId}/approve", rollout.getId())
|
||||
.accept(MediaTypes.HAL_JSON_VALUE))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNoContent());
|
||||
@@ -184,7 +185,7 @@ class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
testdataFactory.createTargets(4, "rollout", "description");
|
||||
final DistributionSet dsA = testdataFactory.createDistributionSet("");
|
||||
final Rollout rollout = createRollout("rollout1", 3, dsA, "controllerId==rollout*", false);
|
||||
mvc.perform(post(MgmtRestConstants.ROLLOUT_V1_REQUEST_MAPPING + "/{rolloutId}/deny", rollout.getId())
|
||||
mvc.perform(post(MgmtRolloutRestApi.ROLLOUTS_V1 + "/{rolloutId}/deny", rollout.getId())
|
||||
.accept(MediaTypes.HAL_JSON_VALUE))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
@@ -47,6 +47,7 @@ import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModule;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleRequestBodyPost;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRepresentationMode;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleRestApi;
|
||||
import org.eclipse.hawkbit.mgmt.rest.resource.util.ResourceUtility;
|
||||
import org.eclipse.hawkbit.repository.Constants;
|
||||
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
|
||||
@@ -145,7 +146,7 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
|
||||
artifactManagement.create(new ArtifactUpload(new ByteArrayInputStream(random), null, 0, null, sm.getId(), "file1", false));
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/artifacts", sm.getId())
|
||||
mvc.perform(get(MgmtSoftwareModuleRestApi.SOFTWAREMODULES_V1 + "/{softwareModuleId}/artifacts", sm.getId())
|
||||
.param("representation", MgmtRepresentationMode.FULL.toString())
|
||||
.param("useartifacturlhandler", Boolean.TRUE.toString()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -167,7 +168,7 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
softwareModuleManagement.createMetadata(module.getId(), knownKeyPrefix + index, new MetadataValueCreate(knownValuePrefix + index));
|
||||
}
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/metadata",
|
||||
mvc.perform(get(MgmtSoftwareModuleRestApi.SOFTWAREMODULES_V1 + "/{softwareModuleId}/metadata",
|
||||
module.getId()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -188,7 +189,7 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
softwareModuleManagement.createMetadata(module.getId(), knownKeyPrefix + index, new MetadataValueCreate(knownValuePrefix + index));
|
||||
}
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/metadata",
|
||||
mvc.perform(get(MgmtSoftwareModuleRestApi.SOFTWAREMODULES_V1 + "/{softwareModuleId}/metadata",
|
||||
module.getId()).param("offset", "1").param("limit", "2").param("sort", "key:DESC").param("q",
|
||||
"key==known*"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -208,7 +209,7 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
final SoftwareModule module = findFirstModuleByType(testdataFactory.createDistributionSet("one"), osType).orElseThrow();
|
||||
softwareModuleManagement.createMetadata(module.getId(), knownKey, new MetadataValueCreate(knownValue));
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING + "/{softwareModuleId}/metadata/{metadataKey}",
|
||||
mvc.perform(get(MgmtSoftwareModuleRestApi.SOFTWAREMODULES_V1 + "/{softwareModuleId}/metadata/{metadataKey}",
|
||||
module.getId(), knownKey))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk());
|
||||
@@ -1056,7 +1057,7 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
void getSoftwareModulesWithoutAdditionalRequestParameters() throws Exception {
|
||||
final int modules = 5;
|
||||
createSoftwareModulesAlphabetical(modules);
|
||||
mvc.perform(get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING))
|
||||
mvc.perform(get(MgmtSoftwareModuleRestApi.SOFTWAREMODULES_V1))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath(MgmtTargetResourceTest.JSON_PATH_PAGED_LIST_TOTAL, equalTo(modules)))
|
||||
@@ -1072,7 +1073,7 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
final int modules = 5;
|
||||
final int limitSize = 1;
|
||||
createSoftwareModulesAlphabetical(modules);
|
||||
mvc.perform(get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING).param(
|
||||
mvc.perform(get(MgmtSoftwareModuleRestApi.SOFTWAREMODULES_V1).param(
|
||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, String.valueOf(limitSize)))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -1090,7 +1091,7 @@ class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegrationTes
|
||||
final int offsetParam = 2;
|
||||
final int expectedSize = modules - offsetParam;
|
||||
createSoftwareModulesAlphabetical(modules);
|
||||
mvc.perform(get(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING).param(
|
||||
mvc.perform(get(MgmtSoftwareModuleRestApi.SOFTWAREMODULES_V1).param(
|
||||
MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET, String.valueOf(offsetParam))
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, String.valueOf(modules)))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.util.List;
|
||||
|
||||
import com.jayway.jsonpath.JsonPath;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleTypeRestApi;
|
||||
import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
|
||||
import org.eclipse.hawkbit.repository.SoftwareModuleTypeManagement;
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
@@ -104,7 +105,7 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
|
||||
.update(SoftwareModuleTypeManagement.Update.builder().id(testType.getId()).description("Desc1234").colour("rgb(106,178,83)")
|
||||
.build());
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING + "?limit=10&sort=name:ASC&offset=0&q=name==a")
|
||||
mvc.perform(get(MgmtSoftwareModuleTypeRestApi.SOFTWAREMODULETYPES_V1 + "?limit=10&sort=name:ASC&offset=0&q=name==a")
|
||||
.accept(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk());
|
||||
@@ -359,7 +360,7 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
|
||||
@Test
|
||||
void getSoftwareModuleTypesWithoutAddtionalRequestParameters() throws Exception {
|
||||
final int types = 3;
|
||||
mvc.perform(get(MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING))
|
||||
mvc.perform(get(MgmtSoftwareModuleTypeRestApi.SOFTWAREMODULETYPES_V1))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath(MgmtTargetResourceTest.JSON_PATH_PAGED_LIST_TOTAL, equalTo(types)))
|
||||
@@ -374,7 +375,7 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
|
||||
void getSoftwareModuleTypesWithPagingLimitRequestParameter() throws Exception {
|
||||
final int types = 3;
|
||||
final int limitSize = 1;
|
||||
mvc.perform(get(MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING)
|
||||
mvc.perform(get(MgmtSoftwareModuleTypeRestApi.SOFTWAREMODULETYPES_V1)
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, String.valueOf(limitSize)))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -391,7 +392,7 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
|
||||
final int types = 3;
|
||||
final int offsetParam = 2;
|
||||
final int expectedSize = types - offsetParam;
|
||||
mvc.perform(get(MgmtRestConstants.SOFTWAREMODULETYPE_V1_REQUEST_MAPPING)
|
||||
mvc.perform(get(MgmtSoftwareModuleTypeRestApi.SOFTWAREMODULETYPES_V1)
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET, String.valueOf(offsetParam))
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, String.valueOf(types)))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
|
||||
@@ -28,7 +28,9 @@ import java.util.stream.Stream;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtActionType;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDistributionSetRestApi;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetFilterQueryRestApi;
|
||||
import org.eclipse.hawkbit.mgmt.rest.resource.mapper.MgmtRestModelMapper;
|
||||
import org.eclipse.hawkbit.mgmt.rest.resource.util.ResourceUtility;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
@@ -101,7 +103,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
void getTargetFilterQueries() throws Exception {
|
||||
final String filterName = "filter_01";
|
||||
createSingleTargetFilterQuery(filterName, "name==test_01");
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING))
|
||||
mvc.perform(get(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1))
|
||||
.andExpect(status().isOk())
|
||||
.andDo(MockMvcResultPrinter.print());
|
||||
}
|
||||
@@ -111,7 +113,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
*/
|
||||
@Test
|
||||
void getTargetFilterQueriesWithParameters() throws Exception {
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "?limit=10&sort=name:ASC&offset=0&q=name==*1"))
|
||||
mvc.perform(get(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "?limit=10&sort=name:ASC&offset=0&q=name==*1"))
|
||||
.andExpect(status().isOk())
|
||||
.andDo(MockMvcResultPrinter.print());
|
||||
}
|
||||
@@ -127,7 +129,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
.put("name", name)
|
||||
.put("query", filterQuery).toString();
|
||||
|
||||
mvc.perform(post(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING)
|
||||
mvc.perform(post(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1)
|
||||
.contentType(MediaType.APPLICATION_JSON).content(body))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isCreated());
|
||||
@@ -141,7 +143,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
final String filterName = "filter_01";
|
||||
final TargetFilterQuery filterQuery = createSingleTargetFilterQuery(filterName, "name==test_01");
|
||||
|
||||
mvc.perform(delete(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + filterQuery.getId()))
|
||||
mvc.perform(delete(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/" + filterQuery.getId()))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
assertThat(targetFilterQueryManagement.find(filterQuery.getId())).isNotPresent();
|
||||
@@ -154,7 +156,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
void deleteTargetWhichDoesNotExistsLeadsToEntityNotFound() throws Exception {
|
||||
final String notExistingId = "4395";
|
||||
|
||||
mvc.perform(delete(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + notExistingId))
|
||||
mvc.perform(delete(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/" + notExistingId))
|
||||
.andExpect(status().isNotFound());
|
||||
}
|
||||
|
||||
@@ -164,7 +166,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
@Test
|
||||
void updateTargetWhichDoesNotExistsLeadsToEntityNotFound() throws Exception {
|
||||
final String notExistingId = "4395";
|
||||
mvc.perform(put(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + notExistingId).content("{}")
|
||||
mvc.perform(put(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/" + notExistingId).content("{}")
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(print())
|
||||
.andExpect(status().isNotFound());
|
||||
@@ -183,7 +185,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
// prepare
|
||||
final TargetFilterQuery tfq = createSingleTargetFilterQuery(filterName, filterQuery);
|
||||
|
||||
mvc.perform(put(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + tfq.getId()).content(body)
|
||||
mvc.perform(put(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/" + tfq.getId()).content(body)
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -210,7 +212,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
// prepare
|
||||
final TargetFilterQuery tfq = targetFilterQueryManagement.create(Create.builder().name(filterName).query(filterQuery).build());
|
||||
|
||||
mvc.perform(put(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + tfq.getId()).content(body)
|
||||
mvc.perform(put(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/" + tfq.getId()).content(body)
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -239,7 +241,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
createSingleTargetFilterQuery(idB, testQuery);
|
||||
createSingleTargetFilterQuery(idC, testQuery);
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING))
|
||||
mvc.perform(get(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1))
|
||||
.andExpect(status().isOk())
|
||||
.andDo(print())
|
||||
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_TOTAL, equalTo(knownTargetAmount)))
|
||||
@@ -272,7 +274,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
createSingleTargetFilterQuery(idB, testQuery);
|
||||
createSingleTargetFilterQuery(idC, testQuery);
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING)
|
||||
mvc.perform(get(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1)
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, String.valueOf(limitSize)))
|
||||
.andExpect(status().isOk())
|
||||
.andDo(print())
|
||||
@@ -290,25 +292,25 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
|
||||
final DistributionSet set = testdataFactory.createDistributionSet();
|
||||
final TargetFilterQuery filterQuery = createSingleTargetFilterQuery("a", testQuery);
|
||||
final String hrefPrefix = "http://localhost" + MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/"
|
||||
final String hrefPrefix = "http://localhost" + MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/"
|
||||
+ filterQuery.getId();
|
||||
final String distributionsetHrefPrefix = "http://localhost" + MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING;
|
||||
final String distributionsetHrefPrefix = "http://localhost" + MgmtDistributionSetRestApi.DISTRIBUTIONSETS_V1;
|
||||
|
||||
final String dsQuery = "?q=name==" + set.getName() + ";" + "version==" + set.getVersion() + "&offset=0&limit=50";
|
||||
mvc.perform(
|
||||
post(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + filterQuery.getId() + "/autoAssignDS")
|
||||
post(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/" + filterQuery.getId() + "/autoAssignDS")
|
||||
.content("{\"id\":" + set.getId() + "}").contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(print())
|
||||
.andExpect(status().isOk());
|
||||
|
||||
final String result = mvc.perform(
|
||||
get(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + filterQuery.getId()))
|
||||
get(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/" + filterQuery.getId()))
|
||||
.andExpect(jsonPath("$._links.autoAssignDS.href", equalTo(hrefPrefix + "/autoAssignDS")))
|
||||
.andExpect(jsonPath("$._links.DS.href", startsWith(distributionsetHrefPrefix)))
|
||||
.andReturn().getResponse().getContentAsString();
|
||||
|
||||
final String multipleResult = mvc.perform(
|
||||
get(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "?representation=full"))
|
||||
get(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "?representation=full"))
|
||||
.andExpect(jsonPath("$.content", hasSize(1)))
|
||||
.andExpect(jsonPath("$.total", equalTo(1)))
|
||||
.andExpect(jsonPath("$.content[0]._links.DS.href", startsWith(distributionsetHrefPrefix)))
|
||||
@@ -345,7 +347,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
createSingleTargetFilterQuery(idD, testQuery);
|
||||
createSingleTargetFilterQuery(idE, testQuery);
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING)
|
||||
mvc.perform(get(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1)
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET, String.valueOf(offsetParam))
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, String.valueOf(knownTargetAmount)))
|
||||
.andExpect(status().isOk())
|
||||
@@ -373,10 +375,10 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
final String knownQuery = "name==test01";
|
||||
final String knownName = "someName";
|
||||
final TargetFilterQuery tfq = createSingleTargetFilterQuery(knownName, knownQuery);
|
||||
final String hrefPrefix = "http://localhost" + MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/"
|
||||
final String hrefPrefix = "http://localhost" + MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/"
|
||||
+ tfq.getId();
|
||||
// test
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + tfq.getId()))
|
||||
mvc.perform(get(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/" + tfq.getId()))
|
||||
.andDo(print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath(JSON_PATH_NAME, equalTo(knownName)))
|
||||
@@ -395,7 +397,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
// test
|
||||
|
||||
final MvcResult mvcResult = mvc
|
||||
.perform(get(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + targetIdNotExists))
|
||||
.perform(get(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/" + targetIdNotExists))
|
||||
.andExpect(status().isNotFound())
|
||||
.andReturn();
|
||||
|
||||
@@ -413,7 +415,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
final String notJson = "abc";
|
||||
|
||||
final MvcResult mvcResult = mvc
|
||||
.perform(post(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING).content(notJson)
|
||||
.perform(post(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1).content(notJson)
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(print())
|
||||
.andExpect(status().isBadRequest())
|
||||
@@ -436,7 +438,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
final String invalidQuery = "name=abc";
|
||||
final String body = new JSONObject().put("query", invalidQuery).put("name", "invalidFilter").toString();
|
||||
|
||||
mvc.perform(post(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING).content(body)
|
||||
mvc.perform(post(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1).content(body)
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(print())
|
||||
.andExpect(status().isBadRequest())
|
||||
@@ -461,7 +463,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
final TargetFilterQuery filterQuery = createSingleTargetFilterQuery("1", "controllerId==target*");
|
||||
|
||||
mvc.perform(
|
||||
post(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + filterQuery.getId() + "/autoAssignDS")
|
||||
post(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/" + filterQuery.getId() + "/autoAssignDS")
|
||||
.content("{\"id\":" + set.getId() + "}").contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(print())
|
||||
.andExpect(status().isTooManyRequests())
|
||||
@@ -487,7 +489,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
|
||||
// assign the auto-assign distribution set, this should work
|
||||
mvc.perform(
|
||||
post(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + filterQuery.getId() + "/autoAssignDS")
|
||||
post(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/" + filterQuery.getId() + "/autoAssignDS")
|
||||
.content("{\"id\":" + set.getId() + "}").contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(print())
|
||||
.andExpect(status().isOk());
|
||||
@@ -499,7 +501,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
assertThat(updatedFilterQuery.getAutoAssignActionType()).isEqualTo(ActionType.FORCED);
|
||||
|
||||
// update the query of the filter query to trigger a quota hit
|
||||
mvc.perform(put(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + filterQuery.getId())
|
||||
mvc.perform(put(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/" + filterQuery.getId())
|
||||
.content("{\"query\":\"controllerId==target*\"}").contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(print())
|
||||
.andExpect(status().isTooManyRequests())
|
||||
@@ -547,7 +549,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("ds");
|
||||
targetFilterQueryManagement.updateAutoAssignDS(new AutoAssignDistributionSetUpdate(filterQuery.getId()).ds(ds.getId()));
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/{targetFilterQueryId}/autoAssignDS",
|
||||
mvc.perform(get(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/{targetFilterQueryId}/autoAssignDS",
|
||||
filterQuery.getId()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk());
|
||||
@@ -568,7 +570,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
.put("type", MgmtActionType.SOFT.getName()).put("weight", 200).toString();
|
||||
|
||||
mvc
|
||||
.perform(post(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/{targetFilterQueryId}/autoAssignDS",
|
||||
.perform(post(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/{targetFilterQueryId}/autoAssignDS",
|
||||
filterQuery.getId()).contentType(MediaType.APPLICATION_JSON).content(autoAssignBody))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk());
|
||||
@@ -583,7 +585,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
final TargetFilterQuery filterQuery = createSingleTargetFilterQuery(filterName, "name==test_01");
|
||||
mvc
|
||||
.perform(delete(
|
||||
MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/{targetFilterQueryId}/autoAssignDS",
|
||||
MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/{targetFilterQueryId}/autoAssignDS",
|
||||
filterQuery.getId()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNoContent());
|
||||
@@ -608,11 +610,11 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
assertThat(updatedFilterQuery.getAutoAssignDistributionSet()).isEqualTo(set);
|
||||
assertThat(updatedFilterQuery.getAutoAssignActionType()).isEqualTo(ActionType.FORCED);
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + tfq.getId() + "/autoAssignDS"))
|
||||
mvc.perform(get(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/" + tfq.getId() + "/autoAssignDS"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath(JSON_PATH_NAME, equalTo(dsName)));
|
||||
|
||||
mvc.perform(delete(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + tfq.getId() + "/autoAssignDS"))
|
||||
mvc.perform(delete(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/" + tfq.getId() + "/autoAssignDS"))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
final TargetFilterQuery filterQueryWithDeletedDs = targetFilterQueryManagement.find(tfq.getId()).get();
|
||||
@@ -620,7 +622,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
assertThat(filterQueryWithDeletedDs.getAutoAssignDistributionSet()).isNull();
|
||||
assertThat(filterQueryWithDeletedDs.getAutoAssignActionType()).isNull();
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + tfq.getId() + "/autoAssignDS"))
|
||||
mvc.perform(get(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/" + tfq.getId() + "/autoAssignDS"))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
}
|
||||
@@ -637,17 +639,17 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
.toString();
|
||||
final String valideWeightRequest = new JSONObject().put("id", dsId).put("weight", 45).toString();
|
||||
|
||||
mvc.perform(post(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/{targetFilterQueryId}/autoAssignDS",
|
||||
mvc.perform(post(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/{targetFilterQueryId}/autoAssignDS",
|
||||
filterId).content(valideWeightRequest).contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(print())
|
||||
.andExpect(status().isOk());
|
||||
enableMultiAssignments();
|
||||
mvc.perform(post(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/{targetFilterQueryId}/autoAssignDS",
|
||||
mvc.perform(post(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/{targetFilterQueryId}/autoAssignDS",
|
||||
filterId).content(invalideWeightRequest).contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(print())
|
||||
.andExpect(status().isBadRequest())
|
||||
.andExpect(jsonPath("$.errorCode", equalTo("hawkbit.server.error.repo.constraintViolation")));
|
||||
mvc.perform(post(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/{targetFilterQueryId}/autoAssignDS",
|
||||
mvc.perform(post(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/{targetFilterQueryId}/autoAssignDS",
|
||||
filterId).content(valideWeightRequest).contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(print())
|
||||
.andExpect(status().isOk());
|
||||
@@ -702,7 +704,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
|
||||
private void verifyAutoAssignmentByActionType(final TargetFilterQuery tfq, final DistributionSet set,
|
||||
final MgmtActionType actionType, final Boolean confirmationRequired) throws Exception {
|
||||
final String hrefPrefix = "http://localhost" + MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/"
|
||||
final String hrefPrefix = "http://localhost" + MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/"
|
||||
+ tfq.getId();
|
||||
|
||||
final JSONObject jsonObject = new JSONObject();
|
||||
@@ -714,7 +716,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
jsonObject.put("confirmationRequired", confirmationRequired);
|
||||
}
|
||||
|
||||
mvc.perform(post(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + tfq.getId() + "/autoAssignDS")
|
||||
mvc.perform(post(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/" + tfq.getId() + "/autoAssignDS")
|
||||
.content(jsonObject.toString()).contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(print())
|
||||
.andExpect(status().isOk());
|
||||
@@ -727,7 +729,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
assertThat(updatedFilterQuery.getAutoAssignActionType())
|
||||
.isEqualTo(MgmtRestModelMapper.convertActionType(expectedActionType));
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + tfq.getId()))
|
||||
mvc.perform(get(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/" + tfq.getId()))
|
||||
.andDo(print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath(JSON_PATH_NAME, equalTo(tfq.getName())))
|
||||
@@ -744,7 +746,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
|
||||
private void verifyAutoAssignmentWithTimeForcedActionType(final TargetFilterQuery tfq, final DistributionSet set)
|
||||
throws Exception {
|
||||
mvc.perform(post(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + tfq.getId() + "/autoAssignDS")
|
||||
mvc.perform(post(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/" + tfq.getId() + "/autoAssignDS")
|
||||
.content("{\"id\":" + set.getId() + ", \"type\":\"" + MgmtActionType.TIMEFORCED.getName() + "\"}")
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(print())
|
||||
@@ -762,7 +764,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
|
||||
private void verifyAutoAssignmentWithUnknownActionType(final TargetFilterQuery tfq, final DistributionSet set)
|
||||
throws Exception {
|
||||
mvc.perform(post(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + tfq.getId() + "/autoAssignDS")
|
||||
mvc.perform(post(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/" + tfq.getId() + "/autoAssignDS")
|
||||
.content("{\"id\":" + set.getId() + ", \"type\":\"unknown\"}").contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(print())
|
||||
.andExpect(status().isBadRequest())
|
||||
@@ -777,7 +779,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
.name("incomplete").version("1")
|
||||
.build());
|
||||
|
||||
mvc.perform(post(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + tfq.getId() + "/autoAssignDS")
|
||||
mvc.perform(post(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/" + tfq.getId() + "/autoAssignDS")
|
||||
.content("{\"id\":" + incompleteDistributionSet.getId() + "}").contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(print())
|
||||
.andExpect(status().isBadRequest())
|
||||
@@ -791,7 +793,7 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
|
||||
assignDistributionSet(softDeletedDs, testdataFactory.createTarget("forSoftDeletedDs"));
|
||||
distributionSetManagement.delete(softDeletedDs.getId());
|
||||
|
||||
mvc.perform(post(MgmtRestConstants.TARGET_FILTER_V1_REQUEST_MAPPING + "/" + tfq.getId() + "/autoAssignDS")
|
||||
mvc.perform(post(MgmtTargetFilterQueryRestApi.TARGETFILTERS_V1 + "/" + tfq.getId() + "/autoAssignDS")
|
||||
.content("{\"id\":" + softDeletedDs.getId() + "}").contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(print())
|
||||
.andExpect(status().isNotFound())
|
||||
|
||||
@@ -21,6 +21,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetGroupRestApi;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.http.MediaType;
|
||||
@@ -35,7 +36,7 @@ public class MgmtTargetGroupResourceTest extends AbstractManagementApiIntegratio
|
||||
targetManagement.create(builder().controllerId("target2").group("Asia").build());
|
||||
targetManagement.create(builder().controllerId("target3").group("Europe").build());
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING)
|
||||
mvc.perform(get(MgmtTargetGroupRestApi.TARGETGROUPS_V1)
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.[0]", Matchers.in(expectedGroups)))
|
||||
@@ -48,14 +49,14 @@ public class MgmtTargetGroupResourceTest extends AbstractManagementApiIntegratio
|
||||
targetManagement.create(builder().controllerId("target2").group("Europe/East").build());
|
||||
targetManagement.create(builder().controllerId("target3").group("Europe").build());
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/assigned")
|
||||
mvc.perform(get(MgmtTargetGroupRestApi.TARGETGROUPS_V1 + "/assigned")
|
||||
.param("group", "Europe/East")
|
||||
.param("subgroups", "false"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("content", Matchers.hasSize(1)))
|
||||
.andExpect(jsonPath("content.[0].controllerId", Matchers.equalTo("target2")));
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/assigned")
|
||||
mvc.perform(get(MgmtTargetGroupRestApi.TARGETGROUPS_V1 + "/assigned")
|
||||
.param("group", "Europe")
|
||||
.param("subgroups", "true")
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "ID:ASC"))
|
||||
@@ -72,7 +73,7 @@ public class MgmtTargetGroupResourceTest extends AbstractManagementApiIntegratio
|
||||
targetManagement.create(builder().controllerId("target2").group("US").build());
|
||||
targetManagement.create(builder().controllerId("target3").group("Europe").build());
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/Europe/assigned")
|
||||
mvc.perform(get(MgmtTargetGroupRestApi.TARGETGROUPS_V1 + "/Europe/assigned")
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "ID:ASC"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("content", Matchers.hasSize(2)))
|
||||
@@ -86,12 +87,12 @@ public class MgmtTargetGroupResourceTest extends AbstractManagementApiIntegratio
|
||||
targetManagement.create(builder().controllerId("target2").build());
|
||||
targetManagement.create(builder().controllerId("target3").group("Europe").build());
|
||||
|
||||
mvc.perform(put(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/newGroup/assigned")
|
||||
mvc.perform(put(MgmtTargetGroupRestApi.TARGETGROUPS_V1 + "/newGroup/assigned")
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(toJson(Arrays.asList("target1", "target2", "target3"))))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/newGroup/assigned")
|
||||
mvc.perform(get(MgmtTargetGroupRestApi.TARGETGROUPS_V1 + "/newGroup/assigned")
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "ID:ASC")
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk())
|
||||
@@ -103,7 +104,7 @@ public class MgmtTargetGroupResourceTest extends AbstractManagementApiIntegratio
|
||||
|
||||
@Test
|
||||
void shouldReturnBadRequestWhenProvidingAnEmptyListOfControllerIds() throws Exception {
|
||||
mvc.perform(put(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/someGroup/assigned")
|
||||
mvc.perform(put(MgmtTargetGroupRestApi.TARGETGROUPS_V1 + "/someGroup/assigned")
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(toJson(Collections.emptyList())))
|
||||
.andExpect(status().isBadRequest());
|
||||
@@ -115,13 +116,13 @@ public class MgmtTargetGroupResourceTest extends AbstractManagementApiIntegratio
|
||||
targetManagement.create(builder().controllerId("target2").build());
|
||||
targetManagement.create(builder().controllerId("target3").group("US").build());
|
||||
|
||||
mvc.perform(put(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/assigned")
|
||||
mvc.perform(put(MgmtTargetGroupRestApi.TARGETGROUPS_V1 + "/assigned")
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(toJson(Arrays.asList("target1", "target2", "target3")))
|
||||
.param("group", "Europe/East"))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/assigned")
|
||||
mvc.perform(get(MgmtTargetGroupRestApi.TARGETGROUPS_V1 + "/assigned")
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "ID:ASC")
|
||||
.param("group", "Europe/East")
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
@@ -132,7 +133,7 @@ public class MgmtTargetGroupResourceTest extends AbstractManagementApiIntegratio
|
||||
.andExpect(jsonPath("content.[2].controllerId", Matchers.equalTo("target3")));
|
||||
|
||||
// expect bad request if empty controllerIds
|
||||
mvc.perform(put(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/assigned")
|
||||
mvc.perform(put(MgmtTargetGroupRestApi.TARGETGROUPS_V1 + "/assigned")
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(toJson(Collections.emptyList()))
|
||||
.param("group", "doesNotMatter"))
|
||||
@@ -145,12 +146,12 @@ public class MgmtTargetGroupResourceTest extends AbstractManagementApiIntegratio
|
||||
targetManagement.create(builder().controllerId("target2").build());
|
||||
targetManagement.create(builder().controllerId("shouldNotAssign").group("B").build());
|
||||
|
||||
mvc.perform(put(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/C")
|
||||
mvc.perform(put(MgmtTargetGroupRestApi.TARGETGROUPS_V1 + "/C")
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.param("q", "controllerId==target*"))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/assigned")
|
||||
mvc.perform(get(MgmtTargetGroupRestApi.TARGETGROUPS_V1 + "/assigned")
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "ID:ASC")
|
||||
.param("group", "C")
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
@@ -165,12 +166,12 @@ public class MgmtTargetGroupResourceTest extends AbstractManagementApiIntegratio
|
||||
targetManagement.create(builder().controllerId("target1").group("Europe").build());
|
||||
targetManagement.create(builder().controllerId("target2").group("Europe").build());
|
||||
|
||||
mvc.perform(delete(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/assigned")
|
||||
mvc.perform(delete(MgmtTargetGroupRestApi.TARGETGROUPS_V1 + "/assigned")
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(toJson(Arrays.asList("target1", "target2"))))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/assigned")
|
||||
mvc.perform(get(MgmtTargetGroupRestApi.TARGETGROUPS_V1 + "/assigned")
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "ID:ASC")
|
||||
.param("group", "Europe")
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
@@ -178,7 +179,7 @@ public class MgmtTargetGroupResourceTest extends AbstractManagementApiIntegratio
|
||||
.andExpect(jsonPath("content", Matchers.hasSize(0)));
|
||||
|
||||
// expect bad request if empty
|
||||
mvc.perform(delete(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/assigned")
|
||||
mvc.perform(delete(MgmtTargetGroupRestApi.TARGETGROUPS_V1 + "/assigned")
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(toJson(Collections.emptyList())))
|
||||
.andExpect(status().isBadRequest());
|
||||
@@ -190,12 +191,12 @@ public class MgmtTargetGroupResourceTest extends AbstractManagementApiIntegratio
|
||||
targetManagement.create(builder().controllerId("target2").group("Europe").build());
|
||||
targetManagement.create(builder().controllerId("nonMatchingTarget").group("Europe").build());
|
||||
|
||||
mvc.perform(delete(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING)
|
||||
mvc.perform(delete(MgmtTargetGroupRestApi.TARGETGROUPS_V1)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.param("q", "controllerId==target*"))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/assigned")
|
||||
mvc.perform(get(MgmtTargetGroupRestApi.TARGETGROUPS_V1 + "/assigned")
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "ID:ASC")
|
||||
.param("group", "Europe")
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
@@ -212,13 +213,13 @@ public class MgmtTargetGroupResourceTest extends AbstractManagementApiIntegratio
|
||||
targetManagement.create(builder().controllerId("shouldNotBeUpdated1").group("Europe").build());
|
||||
targetManagement.create(builder().controllerId("shouldNotBeUpdated2").group("Europe").build());
|
||||
|
||||
mvc.perform(put(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING)
|
||||
mvc.perform(put(MgmtTargetGroupRestApi.TARGETGROUPS_V1)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.param("group", "Europe/East")
|
||||
.param("q", "controllerId==target*"))
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_GROUP_V1_REQUEST_MAPPING + "/assigned")
|
||||
mvc.perform(get(MgmtTargetGroupRestApi.TARGETGROUPS_V1 + "/assigned")
|
||||
.param("group", "Europe/East")
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_SORTING, "ID:ASC")
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -55,7 +55,7 @@ import org.springframework.test.web.servlet.ResultActions;
|
||||
*/
|
||||
public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
|
||||
private static final String TARGETTAGS_ROOT = "http://localhost" + MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/";
|
||||
private static final String TARGETTAGS_ROOT = "http://localhost" + MgmtTargetTagRestApi.TARGETTAGS_V1 + "/";
|
||||
|
||||
/**
|
||||
* Verifies that a paged result list of target tags reflects the content on the repository side.
|
||||
@@ -67,7 +67,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
final TargetTag assigned = tags.get(0);
|
||||
final TargetTag unassigned = tags.get(1);
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING).accept(MediaType.APPLICATION_JSON))
|
||||
mvc.perform(get(MgmtTargetTagRestApi.TARGETTAGS_V1).accept(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
|
||||
@@ -87,7 +87,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
@Test
|
||||
void getTargetTagsWithParameters() throws Exception {
|
||||
testdataFactory.createTargetTags(2, "");
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "?limit=10&sort=name:ASC&offset=0&q=name==targetTag"))
|
||||
mvc.perform(get(MgmtTargetTagRestApi.TARGETTAGS_V1 + "?limit=10&sort=name:ASC&offset=0&q=name==targetTag"))
|
||||
.andExpect(status().isOk())
|
||||
.andDo(MockMvcResultPrinter.print());
|
||||
}
|
||||
@@ -111,7 +111,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
|
||||
// pass here q directly as a pure string because .queryParam method delimiters the parameters in q with ,
|
||||
// which is logical OR, we want AND here
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING +
|
||||
mvc.perform(get(MgmtTargetTagRestApi.TARGETTAGS_V1 +
|
||||
"?" + MgmtRestConstants.REQUEST_PARAMETER_SEARCH + "=colour==" + tag2.getColour())
|
||||
.accept(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -133,7 +133,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
final List<? extends TargetTag> tags = testdataFactory.createTargetTags(2, "");
|
||||
final TargetTag assigned = tags.get(0);
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/" + assigned.getId())
|
||||
mvc.perform(get(MgmtTargetTagRestApi.TARGETTAGS_V1 + "/" + assigned.getId())
|
||||
.accept(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -159,7 +159,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
.build();
|
||||
|
||||
final ResultActions result = mvc
|
||||
.perform(post(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING)
|
||||
.perform(post(MgmtTargetTagRestApi.TARGETTAGS_V1)
|
||||
.content(toJson(List.of(tagOne, tagTwo)))
|
||||
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -194,7 +194,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
.build();
|
||||
|
||||
final ResultActions result = mvc
|
||||
.perform(put(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/" + original.getId())
|
||||
.perform(put(MgmtTargetTagRestApi.TARGETTAGS_V1 + "/" + original.getId())
|
||||
.content(toJson(update)).contentType(MediaType.APPLICATION_JSON)
|
||||
.accept(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -221,7 +221,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
final List<? extends TargetTag> tags = testdataFactory.createTargetTags(1, "");
|
||||
final TargetTag original = tags.get(0);
|
||||
|
||||
mvc.perform(delete(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/" + original.getId()))
|
||||
mvc.perform(delete(MgmtTargetTagRestApi.TARGETTAGS_V1 + "/" + original.getId()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
@@ -242,7 +242,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
final List<Target> targets = testdataFactory.createTargets(targetsAssigned);
|
||||
targetManagement.assignTag(targets.stream().map(Target::getControllerId).toList(), tag.getId());
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned"))
|
||||
mvc.perform(get(MgmtTargetTagRestApi.TARGETTAGS_V1 + "/" + tag.getId() + "/assigned"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath(MgmtTargetResourceTest.JSON_PATH_PAGED_LIST_TOTAL, equalTo(targetsAssigned)))
|
||||
@@ -265,7 +265,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
final List<Target> targets = testdataFactory.createTargets(targetsAssigned);
|
||||
targetManagement.assignTag(targets.stream().map(Target::getControllerId).toList(), tag.getId());
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned")
|
||||
mvc.perform(get(MgmtTargetTagRestApi.TARGETTAGS_V1 + "/" + tag.getId() + "/assigned")
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, String.valueOf(limitSize)))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
@@ -291,7 +291,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
final List<Target> targets = testdataFactory.createTargets(targetsAssigned);
|
||||
targetManagement.assignTag(targets.stream().map(Target::getControllerId).toList(), tag.getId());
|
||||
|
||||
mvc.perform(get(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned")
|
||||
mvc.perform(get(MgmtTargetTagRestApi.TARGETTAGS_V1 + "/" + tag.getId() + "/assigned")
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET, String.valueOf(offsetParam))
|
||||
.param(MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, String.valueOf(targetsAssigned)))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -313,7 +313,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
final TargetTag tag = testdataFactory.createTargetTags(1, "").get(0);
|
||||
final Target assigned = testdataFactory.createTargets(1).get(0);
|
||||
|
||||
mvc.perform(post(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned/" +
|
||||
mvc.perform(post(MgmtTargetTagRestApi.TARGETTAGS_V1 + "/" + tag.getId() + "/assigned/" +
|
||||
assigned.getControllerId()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNoContent());
|
||||
@@ -336,7 +336,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
final Target assigned0 = targets.get(0);
|
||||
final Target assigned1 = targets.get(1);
|
||||
|
||||
mvc.perform(post(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned")
|
||||
mvc.perform(post(MgmtTargetTagRestApi.TARGETTAGS_V1 + "/" + tag.getId() + "/assigned")
|
||||
.content(toJson(List.of(assigned0.getControllerId(), assigned1.getControllerId())))
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -371,7 +371,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
final List<String> withMissing = new ArrayList<>(targets);
|
||||
withMissing.addAll(missing);
|
||||
|
||||
mvc.perform(post(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned")
|
||||
mvc.perform(post(MgmtTargetTagRestApi.TARGETTAGS_V1 + "/" + tag.getId() + "/assigned")
|
||||
.content(toJson(withMissing))
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -413,7 +413,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
final List<String> withMissing = new ArrayList<>(targets);
|
||||
withMissing.addAll(missing);
|
||||
|
||||
mvc.perform(post(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned")
|
||||
mvc.perform(post(MgmtTargetTagRestApi.TARGETTAGS_V1 + "/" + tag.getId() + "/assigned")
|
||||
.param("onNotFoundPolicy", MgmtTargetTagRestApi.OnNotFoundPolicy.ON_WHAT_FOUND_AND_FAIL.name())
|
||||
.content(toJson(withMissing))
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
@@ -457,7 +457,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
final List<String> withMissing = new ArrayList<>(targets);
|
||||
withMissing.addAll(missing);
|
||||
|
||||
mvc.perform(post(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned")
|
||||
mvc.perform(post(MgmtTargetTagRestApi.TARGETTAGS_V1 + "/" + tag.getId() + "/assigned")
|
||||
.param("onNotFoundPolicy", MgmtTargetTagRestApi.OnNotFoundPolicy.ON_WHAT_FOUND_AND_SUCCESS.name())
|
||||
.content(toJson(withMissing))
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
@@ -483,7 +483,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
|
||||
targetManagement.assignTag(targets.stream().map(Target::getControllerId).toList(), tag.getId());
|
||||
|
||||
mvc.perform(delete(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned/" +
|
||||
mvc.perform(delete(MgmtTargetTagRestApi.TARGETTAGS_V1 + "/" + tag.getId() + "/assigned/" +
|
||||
unassigned.getControllerId()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNoContent());
|
||||
@@ -510,7 +510,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
|
||||
targetManagement.assignTag(targets.stream().map(Target::getControllerId).toList(), tag.getId());
|
||||
|
||||
mvc.perform(delete(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned")
|
||||
mvc.perform(delete(MgmtTargetTagRestApi.TARGETTAGS_V1 + "/" + tag.getId() + "/assigned")
|
||||
.content(toJson(Arrays.asList(unassigned0.getControllerId(), unassigned1.getControllerId())))
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -548,7 +548,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
|
||||
targetManagement.assignTag(targets, tag.getId());
|
||||
|
||||
mvc.perform(delete(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned")
|
||||
mvc.perform(delete(MgmtTargetTagRestApi.TARGETTAGS_V1 + "/" + tag.getId() + "/assigned")
|
||||
.content(toJson(withMissing))
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -593,7 +593,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
|
||||
targetManagement.assignTag(targets, tag.getId());
|
||||
|
||||
mvc.perform(delete(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned")
|
||||
mvc.perform(delete(MgmtTargetTagRestApi.TARGETTAGS_V1 + "/" + tag.getId() + "/assigned")
|
||||
.param("onNotFoundPolicy", MgmtTargetTagRestApi.OnNotFoundPolicy.ON_WHAT_FOUND_AND_FAIL.name())
|
||||
.content(toJson(withMissing))
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
@@ -638,7 +638,7 @@ public class MgmtTargetTagResourceTest extends AbstractManagementApiIntegrationT
|
||||
|
||||
targetManagement.assignTag(targets, tag.getId());
|
||||
|
||||
mvc.perform(delete(MgmtRestConstants.TARGET_TAG_V1_REQUEST_MAPPING + "/" + tag.getId() + "/assigned")
|
||||
mvc.perform(delete(MgmtTargetTagRestApi.TARGETTAGS_V1 + "/" + tag.getId() + "/assigned")
|
||||
.param("onNotFoundPolicy", MgmtTargetTagRestApi.OnNotFoundPolicy.ON_WHAT_FOUND_AND_SUCCESS.name())
|
||||
.content(toJson(withMissing))
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
|
||||
@@ -33,7 +33,9 @@ import com.jayway.jsonpath.JsonPath;
|
||||
import org.eclipse.hawkbit.auth.SpPermission;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.MgmtId;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtDistributionSetTypeRestApi;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtTargetTypeRestApi;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetTypeManagement.Create;
|
||||
import org.eclipse.hawkbit.repository.TargetTypeManagement.Update;
|
||||
@@ -57,9 +59,9 @@ import org.springframework.test.web.servlet.ResultActions;
|
||||
*/
|
||||
class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
|
||||
private static final String TARGETTYPES_ENDPOINT = MgmtRestConstants.TARGETTYPE_V1_REQUEST_MAPPING;
|
||||
private static final String TARGETTYPE_SINGLE_ENDPOINT = MgmtRestConstants.TARGETTYPE_V1_REQUEST_MAPPING + "/{typeid}";
|
||||
private static final String TARGETTYPE_DSTYPES_ENDPOINT = TARGETTYPE_SINGLE_ENDPOINT + "/" + MgmtRestConstants.COMPATIBLEDISTRIBUTIONSETTYPES;
|
||||
private static final String TARGETTYPES_ENDPOINT = MgmtTargetTypeRestApi.TARGETTYPES_V1;
|
||||
private static final String TARGETTYPE_SINGLE_ENDPOINT = MgmtTargetTypeRestApi.TARGETTYPES_V1 + "/{typeid}";
|
||||
private static final String TARGETTYPE_DSTYPES_ENDPOINT = TARGETTYPE_SINGLE_ENDPOINT + "/" + MgmtTargetTypeRestApi.COMPATIBLEDISTRIBUTIONSETTYPES;
|
||||
private static final String TARGETTYPE_DSTYPE_SINGLE_ENDPOINT = TARGETTYPE_DSTYPES_ENDPOINT + "/{dstypeid}";
|
||||
|
||||
private static final String TEST_USER = "targetTypeTester";
|
||||
@@ -423,7 +425,7 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
assertThat(testType.getDistributionSetTypes()).hasSize(1);
|
||||
assertThat(distributionSetTypeManagement.findByKey(standardDsType.getKey())).isNotEmpty();
|
||||
|
||||
mvc.perform(delete(MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_REQUEST_MAPPING + "/" + standardDsType.getId()))
|
||||
mvc.perform(delete(MgmtDistributionSetTypeRestApi.DISTRIBUTIONSETTYPES_V1 + "/" + standardDsType.getId()))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.mgmt.rest.resource;
|
||||
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants.SYSTEM_V1_REQUEST_MAPPING;
|
||||
import static org.eclipse.hawkbit.mgmt.rest.api.MgmtTenantManagementRestApi.SYSTEM_V1;
|
||||
import static org.eclipse.hawkbit.repository.test.util.SecurityContextSwitch.callAs;
|
||||
import static org.eclipse.hawkbit.repository.test.util.SecurityContextSwitch.getAs;
|
||||
import static org.eclipse.hawkbit.repository.test.util.SecurityContextSwitch.withUser;
|
||||
@@ -52,7 +52,7 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
*/
|
||||
@Test
|
||||
void getTenantConfigurations() throws Exception {
|
||||
mvc.perform(get(SYSTEM_V1_REQUEST_MAPPING + "/configs"))
|
||||
mvc.perform(get(SYSTEM_V1 + "/configs"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
// check for TenantMetadata additional properties
|
||||
@@ -66,7 +66,7 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
@Test
|
||||
void getTenantConfiguration() throws Exception {
|
||||
// test TenantConfiguration property
|
||||
mvc.perform(get(SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}", AUTHENTICATION_GATEWAY_SECURITY_TOKEN_KEY))
|
||||
mvc.perform(get(SYSTEM_V1 + "/configs/{keyName}", AUTHENTICATION_GATEWAY_SECURITY_TOKEN_KEY))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk());
|
||||
}
|
||||
@@ -77,7 +77,7 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
@Test
|
||||
void getTenantMetadata() throws Exception {
|
||||
// test TenantMetadata property
|
||||
mvc.perform(get(SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}", DEFAULT_DISTRIBUTION_SET_TYPE_KEY))
|
||||
mvc.perform(get(SYSTEM_V1 + "/configs/{keyName}", DEFAULT_DISTRIBUTION_SET_TYPE_KEY))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.value", equalTo(getActualDefaultDsType().intValue())));
|
||||
@@ -93,7 +93,7 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
final ObjectMapper mapper = new ObjectMapper();
|
||||
final String json = mapper.writeValueAsString(bodyPut);
|
||||
|
||||
mvc.perform(put(SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}", AUTHENTICATION_GATEWAY_SECURITY_TOKEN_KEY)
|
||||
mvc.perform(put(SYSTEM_V1 + "/configs/{keyName}", AUTHENTICATION_GATEWAY_SECURITY_TOKEN_KEY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(json))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -113,7 +113,7 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
final ObjectMapper mapper = new ObjectMapper();
|
||||
final String json = mapper.writeValueAsString(bodyPut);
|
||||
|
||||
mvc.perform(put(SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}", DEFAULT_DISTRIBUTION_SET_TYPE_KEY)
|
||||
mvc.perform(put(SYSTEM_V1 + "/configs/{keyName}", DEFAULT_DISTRIBUTION_SET_TYPE_KEY)
|
||||
.contentType(MediaType.APPLICATION_JSON)
|
||||
.content(json))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -149,13 +149,13 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
final String bodyActivate = new JSONObject().put("value", true).toString();
|
||||
final String bodyDeactivate = new JSONObject().put("value", false).toString();
|
||||
|
||||
mvc.perform(put(SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}", MULTI_ASSIGNMENTS_ENABLED)
|
||||
mvc.perform(put(SYSTEM_V1 + "/configs/{keyName}", MULTI_ASSIGNMENTS_ENABLED)
|
||||
.content(bodyActivate)
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
mvc.perform(put(SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}", MULTI_ASSIGNMENTS_ENABLED)
|
||||
mvc.perform(put(SYSTEM_V1 + "/configs/{keyName}", MULTI_ASSIGNMENTS_ENABLED)
|
||||
.content(bodyDeactivate)
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -232,7 +232,7 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
|
||||
final String body = configuration.toString();
|
||||
|
||||
mvc.perform(put(SYSTEM_V1_REQUEST_MAPPING + "/configs").content(body).contentType(MediaType.APPLICATION_JSON))
|
||||
mvc.perform(put(SYSTEM_V1 + "/configs").content(body).contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
@@ -258,21 +258,21 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
final String bodyDeactivate = new JSONObject().put("value", false).toString();
|
||||
|
||||
// enable Multi-Assignments
|
||||
mvc.perform(put(SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}", MULTI_ASSIGNMENTS_ENABLED)
|
||||
mvc.perform(put(SYSTEM_V1 + "/configs/{keyName}", MULTI_ASSIGNMENTS_ENABLED)
|
||||
.content(bodyActivate)
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNoContent());
|
||||
|
||||
// try to enable Auto-Close
|
||||
mvc.perform(put(SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}", REPOSITORY_ACTIONS_AUTOCLOSE_ENABLED)
|
||||
mvc.perform(put(SYSTEM_V1 + "/configs/{keyName}", REPOSITORY_ACTIONS_AUTOCLOSE_ENABLED)
|
||||
.content(bodyActivate)
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isForbidden());
|
||||
|
||||
// try to disable Auto-Close
|
||||
mvc.perform(put(SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}", REPOSITORY_ACTIONS_AUTOCLOSE_ENABLED)
|
||||
mvc.perform(put(SYSTEM_V1 + "/configs/{keyName}", REPOSITORY_ACTIONS_AUTOCLOSE_ENABLED)
|
||||
.content(bodyDeactivate)
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -284,7 +284,7 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
*/
|
||||
@Test
|
||||
void deleteTenantConfiguration() throws Exception {
|
||||
mvc.perform(delete(SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}", AUTHENTICATION_GATEWAY_SECURITY_TOKEN_KEY))
|
||||
mvc.perform(delete(SYSTEM_V1 + "/configs/{keyName}", AUTHENTICATION_GATEWAY_SECURITY_TOKEN_KEY))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNoContent());
|
||||
}
|
||||
@@ -294,7 +294,7 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
*/
|
||||
@Test
|
||||
void deleteTenantMetadataFail() throws Exception {
|
||||
mvc.perform(delete(SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}", DEFAULT_DISTRIBUTION_SET_TYPE_KEY))
|
||||
mvc.perform(delete(SYSTEM_V1 + "/configs/{keyName}", DEFAULT_DISTRIBUTION_SET_TYPE_KEY))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isNotFound());
|
||||
}
|
||||
@@ -312,7 +312,7 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
// TODO - should be able to read with TENANT_CONFIGURATION but somehow here the role hierarchy doesn't play
|
||||
// checked in mgmt / update server runtime PreAuthorizeEnabledTest
|
||||
callAs(withUser("tenant_admin", SpPermission.READ_TENANT_CONFIGURATION, SpPermission.READ_GATEWAY_SECURITY_TOKEN), () -> {
|
||||
mvc.perform(get(SYSTEM_V1_REQUEST_MAPPING + "/configs"))
|
||||
mvc.perform(get(SYSTEM_V1 + "/configs"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andDo(m -> System.out.println("-> 1: " + m.getResponse().getContentAsString()))
|
||||
.andExpect(status().isOk())
|
||||
@@ -322,7 +322,7 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
});
|
||||
|
||||
callAs(withUser("tenant_read", SpPermission.READ_TENANT_CONFIGURATION), () -> {
|
||||
mvc.perform(get(SYSTEM_V1_REQUEST_MAPPING + "/configs"))
|
||||
mvc.perform(get(SYSTEM_V1 + "/configs"))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andDo(m -> System.out.println("-> 2: " + m.getResponse().getContentAsString()))
|
||||
.andExpect(status().isOk())
|
||||
@@ -342,7 +342,7 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
private void assertDefaultDsTypeUpdateBadRequestFails(
|
||||
final String newDefaultDsType, final long oldDefaultDsType, final ResultMatcher resultMatchers)
|
||||
throws Exception {
|
||||
mvc.perform(put(SYSTEM_V1_REQUEST_MAPPING + "/configs/{keyName}", DEFAULT_DISTRIBUTION_SET_TYPE_KEY)
|
||||
mvc.perform(put(SYSTEM_V1 + "/configs/{keyName}", DEFAULT_DISTRIBUTION_SET_TYPE_KEY)
|
||||
.content(newDefaultDsType)
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
@@ -369,7 +369,7 @@ public class MgmtTenantManagementResourceTest extends AbstractManagementApiInteg
|
||||
configuration.put(DEFAULT_DISTRIBUTION_SET_TYPE_KEY, newDistributionSetTypeId);
|
||||
String body = configuration.toString();
|
||||
|
||||
mvc.perform(put(SYSTEM_V1_REQUEST_MAPPING + "/configs").content(body).contentType(MediaType.APPLICATION_JSON))
|
||||
mvc.perform(put(SYSTEM_V1 + "/configs").content(body).contentType(MediaType.APPLICATION_JSON))
|
||||
.andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(resultMatchers);
|
||||
//Check if TenantMetadata and TenantConfiguration is not changed as Batch config failed
|
||||
|
||||
@@ -60,14 +60,14 @@ class CorsTest extends AbstractSecurityTest {
|
||||
assertThat(invalidOriginResponseBody).isEqualTo(INVALID_CORS_REQUEST);
|
||||
|
||||
final String invalidCorsUrlResponseBody = performOptionsRequestToUrlWithOrigin(
|
||||
MgmtRestConstants.BASE_SYSTEM_MAPPING, ALLOWED_ORIGIN_FIRST).andExpect(status().isForbidden())
|
||||
"/some_uri", ALLOWED_ORIGIN_FIRST).andExpect(status().isForbidden())
|
||||
.andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)).andReturn()
|
||||
.getResponse().getContentAsString();
|
||||
assertThat(invalidCorsUrlResponseBody).isEqualTo(INVALID_CORS_REQUEST);
|
||||
}
|
||||
|
||||
private ResultActions performOptionsRequestToRestWithOrigin(final String origin) throws Exception {
|
||||
return performOptionsRequestToUrlWithOrigin(MgmtRestConstants.BASE_V1_REQUEST_MAPPING, origin);
|
||||
return performOptionsRequestToUrlWithOrigin(MgmtRestConstants.REST_V1, origin);
|
||||
}
|
||||
|
||||
private ResultActions performOptionsRequestToUrlWithOrigin(final String url, final String origin) throws Exception {
|
||||
|
||||
@@ -85,8 +85,8 @@ public class MgmtSecurityConfiguration {
|
||||
final FilterRegistrationBean<DosFilter> filterRegBean = SecurityManagedConfiguration.dosFilter(null,
|
||||
securityProperties.getDos().getFilter(), securityProperties.getClients());
|
||||
filterRegBean.setUrlPatterns(List.of(
|
||||
MgmtRestConstants.BASE_REST_MAPPING + "/*",
|
||||
MgmtRestConstants.BASE_SYSTEM_MAPPING + "/admin/*"));
|
||||
MgmtRestConstants.REST + "/*",
|
||||
"/system/admin/*"));
|
||||
filterRegBean.setOrder(SecurityManagedConfiguration.DOS_FILTER_ORDER);
|
||||
filterRegBean.setName("dosMgmtFilter");
|
||||
|
||||
@@ -111,9 +111,9 @@ public class MgmtSecurityConfiguration {
|
||||
@Autowired(required = false) @Qualifier("hawkbitHttpSecurityCustomizer") final Customizer<HttpSecurity> httpSecurityCustomizer,
|
||||
final SystemManagement systemManagement) throws Exception {
|
||||
http
|
||||
.securityMatcher(MgmtRestConstants.BASE_REST_MAPPING + "/**", MgmtRestConstants.BASE_SYSTEM_MAPPING + "/admin/**")
|
||||
.securityMatcher(MgmtRestConstants.REST + "/**", "/system/admin/**")
|
||||
.authorizeHttpRequests(amrmRegistry -> amrmRegistry
|
||||
.requestMatchers(MgmtRestConstants.BASE_SYSTEM_MAPPING + "/admin/**")
|
||||
.requestMatchers("/system/admin/**")
|
||||
.hasAnyAuthority(SpPermission.SYSTEM_ADMIN)
|
||||
.anyRequest()
|
||||
.authenticated())
|
||||
|
||||
@@ -60,14 +60,14 @@ class CorsTest extends AbstractSecurityTest {
|
||||
assertThat(invalidOriginResponseBody).isEqualTo(INVALID_CORS_REQUEST);
|
||||
|
||||
final String invalidCorsUrlResponseBody = performOptionsRequestToUrlWithOrigin(
|
||||
MgmtRestConstants.BASE_SYSTEM_MAPPING, ALLOWED_ORIGIN_FIRST).andExpect(status().isForbidden())
|
||||
"/some_uri", ALLOWED_ORIGIN_FIRST).andExpect(status().isForbidden())
|
||||
.andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)).andReturn()
|
||||
.getResponse().getContentAsString();
|
||||
assertThat(invalidCorsUrlResponseBody).isEqualTo(INVALID_CORS_REQUEST);
|
||||
}
|
||||
|
||||
private ResultActions performOptionsRequestToRestWithOrigin(final String origin) throws Exception {
|
||||
return performOptionsRequestToUrlWithOrigin(MgmtRestConstants.BASE_V1_REQUEST_MAPPING, origin);
|
||||
return performOptionsRequestToUrlWithOrigin(MgmtRestConstants.REST_V1, origin);
|
||||
}
|
||||
|
||||
private ResultActions performOptionsRequestToUrlWithOrigin(final String url, final String origin) throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user