Skip to content

Commit

Permalink
[backend] bring back deprecated routes to let agents upgrade (#2247)
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumejparis authored Jan 21, 2025
1 parent e5dfd5a commit 4ed0359
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,32 @@ public List<AssetAgentJob> getEndpointJobs(@RequestBody final EndpointRegisterIn
input.getExecutedByUser()));
}

@Deprecated(since = "1.11.0")
@LogExecutionTime
@GetMapping(ENDPOINT_URI + "/jobs/{endpointExternalReference}")
@PreAuthorize("isPlanner()")
@Transactional(rollbackFor = Exception.class)
public List<AssetAgentJob> getEndpointJobs(
@PathVariable @NotBlank final String endpointExternalReference) {
return this.assetAgentJobRepository.findAll(
AssetAgentJobSpecification.forEndpoint(endpointExternalReference));
}

@DeleteMapping(ENDPOINT_URI + "/jobs/{assetAgentJobId}")
@PreAuthorize("isPlanner()")
@Transactional(rollbackFor = Exception.class)
public void cleanupAssetAgentJob(@PathVariable @NotBlank final String assetAgentJobId) {
this.assetAgentJobRepository.deleteById(assetAgentJobId);
}

@Deprecated(since = "1.11.0")
@PostMapping(ENDPOINT_URI + "/jobs/{assetAgentJobId}")
@PreAuthorize("isPlanner()")
@Transactional(rollbackFor = Exception.class)
public void cleanupAssetAgentJobDepreacted(@PathVariable @NotBlank final String assetAgentJobId) {
this.assetAgentJobRepository.deleteById(assetAgentJobId);
}

@LogExecutionTime
@GetMapping(ENDPOINT_URI)
@PreAuthorize("isObserver()")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,10 @@ public int hashCode() {
public String getId() {
return id;
}

@Deprecated(since = "1.11.0")
@JsonProperty("asset_agent_asset")
public String getAgentId() {
return agent.getId();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,10 @@ public static Specification<AssetAgentJob> forEndpoint(
cb.equal(root.get("agent").get("privilege"), privilege),
cb.equal(root.get("agent").get("executedByUser"), executedByUser));
}

@Deprecated(since = "1.11.0")
public static Specification<AssetAgentJob> forEndpoint(String externalReference) {
return (root, query, cb) ->
cb.equal(root.get("agent").get("externalReference"), externalReference);
}
}

0 comments on commit 4ed0359

Please sign in to comment.