Merge pull request #291 from bsinno/fix_mgmt_feign
Adapt DDI interfaces to new feign version
This commit is contained in:
@@ -9,13 +9,12 @@
|
||||
package org.eclipse.hawkbit.ddi.client.resource;
|
||||
|
||||
import org.eclipse.hawkbit.ddi.dl.rest.api.DdiDlArtifactStoreControllerRestApi;
|
||||
import org.eclipse.hawkbit.ddi.dl.rest.api.DdiDlRestConstants;
|
||||
import org.springframework.cloud.netflix.feign.FeignClient;
|
||||
|
||||
/**
|
||||
* Client binding for the artifact store controller resource of the DDI-DL API.
|
||||
*/
|
||||
@FeignClient(url = "${hawkbit.url:localhost:8080}/" + DdiDlRestConstants.ARTIFACTS_V1_REQUEST_MAPPING)
|
||||
@FeignClient(name = "DdiDlArtifactStoreControllerClient", url = "${hawkbit.url:localhost:8080}")
|
||||
public interface DdiDlArtifactStoreControllerResourceClient extends DdiDlArtifactStoreControllerRestApi {
|
||||
|
||||
}
|
||||
|
||||
@@ -8,14 +8,13 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ddi.client.resource;
|
||||
|
||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRestConstants;
|
||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRootControllerRestApi;
|
||||
import org.springframework.cloud.netflix.feign.FeignClient;
|
||||
|
||||
/**
|
||||
* Client binding for the Rootcontroller resource of the DDI API.
|
||||
*/
|
||||
@FeignClient(url = "${hawkbit.url:localhost:8080}/" + DdiRestConstants.BASE_V1_REQUEST_MAPPING)
|
||||
@FeignClient(name = "RootControllerClient", url = "${hawkbit.url:localhost:8080}")
|
||||
public interface RootControllerResourceClient extends DdiRootControllerRestApi {
|
||||
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public interface DdiRootControllerRestApi {
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/{targetid}/softwaremodules/{softwareModuleId}/artifacts", produces = {
|
||||
"application/hal+json", MediaType.APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<List<org.eclipse.hawkbit.ddi.json.model.DdiArtifact>> getSoftwareModulesArtifacts(
|
||||
@PathVariable("targetid") final String targetid,
|
||||
@PathVariable("tenant") final String tenant, @PathVariable("targetid") final String targetid,
|
||||
@PathVariable("softwareModuleId") final Long softwareModuleId);
|
||||
|
||||
/**
|
||||
@@ -61,7 +61,8 @@ public interface DdiRootControllerRestApi {
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/{targetid}", produces = { "application/hal+json",
|
||||
MediaType.APPLICATION_JSON_VALUE })
|
||||
ResponseEntity<DdiControllerBase> getControllerBase(@PathVariable("targetid") final String targetid);
|
||||
ResponseEntity<DdiControllerBase> getControllerBase(@PathVariable("tenant") final String tenant,
|
||||
@PathVariable("targetid") final String targetid);
|
||||
|
||||
/**
|
||||
* Handles GET {@link DdiArtifact} download request. This could be full or
|
||||
@@ -83,7 +84,8 @@ public interface DdiRootControllerRestApi {
|
||||
* {@link HttpStatus#PARTIAL_CONTENT}.
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/{targetid}/softwaremodules/{softwareModuleId}/artifacts/{fileName}")
|
||||
ResponseEntity<InputStream> downloadArtifact(@PathVariable("targetid") final String targetid,
|
||||
ResponseEntity<InputStream> downloadArtifact(@PathVariable("tenant") final String tenant,
|
||||
@PathVariable("targetid") final String targetid,
|
||||
@PathVariable("softwareModuleId") final Long softwareModuleId,
|
||||
@PathVariable("fileName") final String fileName);
|
||||
|
||||
@@ -106,7 +108,8 @@ public interface DdiRootControllerRestApi {
|
||||
*/
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/{targetid}/softwaremodules/{softwareModuleId}/artifacts/{fileName}"
|
||||
+ DdiRestConstants.ARTIFACT_MD5_DWNL_SUFFIX, produces = MediaType.TEXT_PLAIN_VALUE)
|
||||
ResponseEntity<Void> downloadArtifactMd5(@PathVariable("targetid") final String targetid,
|
||||
ResponseEntity<Void> downloadArtifactMd5(@PathVariable("tenant") final String tenant,
|
||||
@PathVariable("targetid") final String targetid,
|
||||
@PathVariable("softwareModuleId") final Long softwareModuleId,
|
||||
@PathVariable("fileName") final String fileName);
|
||||
|
||||
@@ -128,7 +131,7 @@ public interface DdiRootControllerRestApi {
|
||||
*/
|
||||
@RequestMapping(value = "/{targetid}/" + DdiRestConstants.DEPLOYMENT_BASE_ACTION
|
||||
+ "/{actionId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
ResponseEntity<DdiDeploymentBase> getControllerBasedeploymentAction(
|
||||
ResponseEntity<DdiDeploymentBase> getControllerBasedeploymentAction(@PathVariable("tenant") final String tenant,
|
||||
@PathVariable("targetid") @NotEmpty final String targetid,
|
||||
@PathVariable("actionId") @NotEmpty final Long actionId,
|
||||
@RequestParam(value = "c", required = false, defaultValue = "-1") final int resource);
|
||||
@@ -149,8 +152,9 @@ public interface DdiRootControllerRestApi {
|
||||
*/
|
||||
@RequestMapping(value = "/{targetid}/" + DdiRestConstants.DEPLOYMENT_BASE_ACTION + "/{actionId}/"
|
||||
+ DdiRestConstants.FEEDBACK, method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
ResponseEntity<Void> postBasedeploymentActionFeedback(@Valid final DdiActionFeedback feedback,
|
||||
@PathVariable("targetid") final String targetid, @PathVariable("actionId") @NotEmpty final Long actionId);
|
||||
ResponseEntity<Void> postBasedeploymentActionFeedback(@PathVariable("tenant") final String tenant,
|
||||
@Valid final DdiActionFeedback feedback, @PathVariable("targetid") final String targetid,
|
||||
@PathVariable("actionId") @NotEmpty final Long actionId);
|
||||
|
||||
/**
|
||||
* This is the feedback channel for the config data action.
|
||||
@@ -166,8 +170,8 @@ public interface DdiRootControllerRestApi {
|
||||
*/
|
||||
@RequestMapping(value = "/{targetid}/"
|
||||
+ DdiRestConstants.CONFIG_DATA_ACTION, method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
ResponseEntity<Void> putConfigData(@Valid final DdiConfigData configData,
|
||||
@PathVariable("targetid") final String targetid);
|
||||
ResponseEntity<Void> putConfigData(@PathVariable("tenant") final String tenant,
|
||||
@Valid final DdiConfigData configData, @PathVariable("targetid") final String targetid);
|
||||
|
||||
/**
|
||||
* RequestMethod.GET method for the {@link DdiCancel} action.
|
||||
@@ -183,7 +187,8 @@ public interface DdiRootControllerRestApi {
|
||||
*/
|
||||
@RequestMapping(value = "/{targetid}/" + DdiRestConstants.CANCEL_ACTION
|
||||
+ "/{actionId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
ResponseEntity<DdiCancel> getControllerCancelAction(@PathVariable("targetid") @NotEmpty final String targetid,
|
||||
ResponseEntity<DdiCancel> getControllerCancelAction(@PathVariable("tenant") final String tenant,
|
||||
@PathVariable("targetid") @NotEmpty final String targetid,
|
||||
@PathVariable("actionId") @NotEmpty final Long actionId);
|
||||
|
||||
/**
|
||||
@@ -204,8 +209,8 @@ public interface DdiRootControllerRestApi {
|
||||
|
||||
@RequestMapping(value = "/{targetid}/" + DdiRestConstants.CANCEL_ACTION + "/{actionId}/"
|
||||
+ DdiRestConstants.FEEDBACK, method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
ResponseEntity<Void> postCancelActionFeedback(@Valid final DdiActionFeedback feedback,
|
||||
@PathVariable("targetid") @NotEmpty final String targetid,
|
||||
ResponseEntity<Void> postCancelActionFeedback(@PathVariable("tenant") final String tenant,
|
||||
@Valid final DdiActionFeedback feedback, @PathVariable("targetid") @NotEmpty final String targetid,
|
||||
@PathVariable("actionId") @NotEmpty final Long actionId);
|
||||
|
||||
}
|
||||
|
||||
@@ -40,8 +40,8 @@ public interface DdiDlArtifactStoreControllerRestApi {
|
||||
@RequestMapping(method = RequestMethod.GET, value = DdiDlRestConstants.ARTIFACT_DOWNLOAD_BY_FILENAME
|
||||
+ "/{fileName}")
|
||||
@ResponseBody
|
||||
public ResponseEntity<InputStream> downloadArtifactByFilename(@PathVariable("fileName") final String fileName,
|
||||
@AuthenticationPrincipal final String targetid);
|
||||
public ResponseEntity<InputStream> downloadArtifactByFilename(@PathVariable("tenant") final String tenant,
|
||||
@PathVariable("fileName") final String fileName, @AuthenticationPrincipal final String targetid);
|
||||
|
||||
/**
|
||||
* Handles GET MD5 checksum file download request.
|
||||
@@ -54,6 +54,7 @@ public interface DdiDlArtifactStoreControllerRestApi {
|
||||
@RequestMapping(method = RequestMethod.GET, value = DdiDlRestConstants.ARTIFACT_DOWNLOAD_BY_FILENAME + "/{fileName}"
|
||||
+ DdiDlRestConstants.ARTIFACT_MD5_DWNL_SUFFIX)
|
||||
@ResponseBody
|
||||
public ResponseEntity<Void> downloadArtifactMD5ByFilename(@PathVariable("fileName") final String fileName);
|
||||
public ResponseEntity<Void> downloadArtifactMD5ByFilename(@PathVariable("tenant") final String tenant,
|
||||
@PathVariable("fileName") final String fileName);
|
||||
|
||||
}
|
||||
|
||||
@@ -115,9 +115,10 @@ public final class DataConversionHelper {
|
||||
|
||||
if (action.isPresent()) {
|
||||
if (action.get().isCancelingOrCanceled()) {
|
||||
result.add(linkTo(methodOn(DdiRootController.class, tenantAware.getCurrentTenant())
|
||||
.getControllerCancelAction(target.getControllerId(), action.get().getId()))
|
||||
.withRel(DdiRestConstants.CANCEL_ACTION));
|
||||
result.add(linkTo(
|
||||
methodOn(DdiRootController.class, tenantAware.getCurrentTenant()).getControllerCancelAction(
|
||||
tenantAware.getCurrentTenant(), target.getControllerId(), action.get().getId()))
|
||||
.withRel(DdiRestConstants.CANCEL_ACTION));
|
||||
} else {
|
||||
// we need to add the hashcode here of the actionWithStatus
|
||||
// because the action might
|
||||
@@ -125,14 +126,16 @@ public final class DataConversionHelper {
|
||||
// change the payload of the
|
||||
// response because of eTags.
|
||||
result.add(linkTo(methodOn(DdiRootController.class, tenantAware.getCurrentTenant())
|
||||
.getControllerBasedeploymentAction(target.getControllerId(), action.get().getId(),
|
||||
calculateEtag(action.get()))).withRel(DdiRestConstants.DEPLOYMENT_BASE_ACTION));
|
||||
.getControllerBasedeploymentAction(tenantAware.getCurrentTenant(), target.getControllerId(),
|
||||
action.get().getId(), calculateEtag(action.get())))
|
||||
.withRel(DdiRestConstants.DEPLOYMENT_BASE_ACTION));
|
||||
}
|
||||
}
|
||||
|
||||
if (target.getTargetInfo().isRequestControllerAttributes()) {
|
||||
result.add(linkTo(methodOn(DdiRootController.class, tenantAware.getCurrentTenant()).putConfigData(null,
|
||||
target.getControllerId())).withRel(DdiRestConstants.CONFIG_DATA_ACTION));
|
||||
result.add(linkTo(methodOn(DdiRootController.class, tenantAware.getCurrentTenant())
|
||||
.putConfigData(tenantAware.getCurrentTenant(), null, target.getControllerId()))
|
||||
.withRel(DdiRestConstants.CONFIG_DATA_ACTION));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -69,8 +69,8 @@ public class DdiArtifactStoreController implements DdiDlArtifactStoreControllerR
|
||||
private EntityFactory entityFactory;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<InputStream> downloadArtifactByFilename(@PathVariable("fileName") final String fileName,
|
||||
@AuthenticationPrincipal final String targetid) {
|
||||
public ResponseEntity<InputStream> downloadArtifactByFilename(@PathVariable("tenant") final String tenant,
|
||||
@PathVariable("fileName") final String fileName, @AuthenticationPrincipal final String targetid) {
|
||||
final List<LocalArtifact> foundArtifacts = artifactManagement.findLocalArtifactByFilename(fileName);
|
||||
|
||||
if (foundArtifacts.isEmpty()) {
|
||||
@@ -110,7 +110,8 @@ public class DdiArtifactStoreController implements DdiDlArtifactStoreControllerR
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Void> downloadArtifactMD5ByFilename(@PathVariable("fileName") final String fileName) {
|
||||
public ResponseEntity<Void> downloadArtifactMD5ByFilename(@PathVariable("tenant") final String tenant,
|
||||
@PathVariable("fileName") final String fileName) {
|
||||
final List<LocalArtifact> foundArtifacts = artifactManagement.findLocalArtifactByFilename(fileName);
|
||||
|
||||
if (foundArtifacts.isEmpty()) {
|
||||
|
||||
@@ -99,7 +99,7 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
||||
|
||||
@Override
|
||||
public ResponseEntity<List<org.eclipse.hawkbit.ddi.json.model.DdiArtifact>> getSoftwareModulesArtifacts(
|
||||
@PathVariable("targetid") final String targetid,
|
||||
@PathVariable("tenant") final String tenant, @PathVariable("targetid") final String targetid,
|
||||
@PathVariable("softwareModuleId") final Long softwareModuleId) {
|
||||
LOG.debug("getSoftwareModulesArtifacts({})", targetid);
|
||||
|
||||
@@ -116,7 +116,8 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<DdiControllerBase> getControllerBase(@PathVariable("targetid") final String targetid) {
|
||||
public ResponseEntity<DdiControllerBase> getControllerBase(@PathVariable("tenant") final String tenant,
|
||||
@PathVariable("targetid") final String targetid) {
|
||||
LOG.debug("getControllerBase({})", targetid);
|
||||
|
||||
final Target target = controllerManagement.findOrRegisterTargetIfItDoesNotexist(targetid, IpUtil
|
||||
@@ -136,7 +137,8 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<InputStream> downloadArtifact(@PathVariable("targetid") final String targetid,
|
||||
public ResponseEntity<InputStream> downloadArtifact(@PathVariable("tenant") final String tenant,
|
||||
@PathVariable("targetid") final String targetid,
|
||||
@PathVariable("softwareModuleId") final Long softwareModuleId,
|
||||
@PathVariable("fileName") final String fileName) {
|
||||
ResponseEntity<InputStream> result;
|
||||
@@ -194,7 +196,8 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Void> downloadArtifactMd5(@PathVariable("targetid") final String targetid,
|
||||
public ResponseEntity<Void> downloadArtifactMd5(@PathVariable("tenant") final String tenant,
|
||||
@PathVariable("targetid") final String targetid,
|
||||
@PathVariable("softwareModuleId") final Long softwareModuleId,
|
||||
@PathVariable("fileName") final String fileName) {
|
||||
controllerManagement.updateLastTargetQuery(targetid, IpUtil
|
||||
@@ -220,7 +223,8 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
||||
|
||||
@Override
|
||||
public ResponseEntity<DdiDeploymentBase> getControllerBasedeploymentAction(
|
||||
@PathVariable("targetid") final String targetid, @PathVariable("actionId") final Long actionId,
|
||||
@PathVariable("tenant") final String tenant, @PathVariable("targetid") final String targetid,
|
||||
@PathVariable("actionId") final Long actionId,
|
||||
@RequestParam(value = "c", required = false, defaultValue = "-1") final int resource) {
|
||||
LOG.debug("getControllerBasedeploymentAction({},{})", targetid, resource);
|
||||
|
||||
@@ -254,8 +258,9 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Void> postBasedeploymentActionFeedback(@Valid @RequestBody final DdiActionFeedback feedback,
|
||||
@PathVariable("targetid") final String targetid, @PathVariable("actionId") @NotEmpty final Long actionId) {
|
||||
public ResponseEntity<Void> postBasedeploymentActionFeedback(@PathVariable("tenant") final String tenant,
|
||||
@Valid @RequestBody final DdiActionFeedback feedback, @PathVariable("targetid") final String targetid,
|
||||
@PathVariable("actionId") @NotEmpty final Long actionId) {
|
||||
LOG.debug("provideBasedeploymentActionFeedback for target [{},{}]: {}", targetid, actionId, feedback);
|
||||
|
||||
final Target target = controllerManagement.updateLastTargetQuery(targetid, IpUtil
|
||||
@@ -349,8 +354,8 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Void> putConfigData(@Valid @RequestBody final DdiConfigData configData,
|
||||
@PathVariable("targetid") final String targetid) {
|
||||
public ResponseEntity<Void> putConfigData(@PathVariable("tenant") final String tenant,
|
||||
@Valid @RequestBody final DdiConfigData configData, @PathVariable("targetid") final String targetid) {
|
||||
controllerManagement.updateLastTargetQuery(targetid, IpUtil
|
||||
.getClientIpFromRequest(requestResponseContextHolder.getHttpServletRequest(), securityProperties));
|
||||
|
||||
@@ -360,7 +365,7 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<DdiCancel> getControllerCancelAction(
|
||||
public ResponseEntity<DdiCancel> getControllerCancelAction(@PathVariable("tenant") final String tenant,
|
||||
@PathVariable("targetid") @NotEmpty final String targetid,
|
||||
@PathVariable("actionId") @NotEmpty final Long actionId) {
|
||||
LOG.debug("getControllerCancelAction({})", targetid);
|
||||
@@ -390,7 +395,8 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Void> postCancelActionFeedback(@Valid @RequestBody final DdiActionFeedback feedback,
|
||||
public ResponseEntity<Void> postCancelActionFeedback(@PathVariable("tenant") final String tenant,
|
||||
@Valid @RequestBody final DdiActionFeedback feedback,
|
||||
@PathVariable("targetid") @NotEmpty final String targetid,
|
||||
@PathVariable("actionId") @NotEmpty final Long actionId) {
|
||||
LOG.debug("provideCancelActionFeedback for target [{}]: {}", targetid, feedback);
|
||||
|
||||
Reference in New Issue
Block a user