Add SSH command execution service

This commit is contained in:
litoral05
2026-05-05 11:13:51 +01:00
parent b71030dba8
commit 6b7b85da19
6 changed files with 135 additions and 0 deletions
@@ -78,4 +78,34 @@ public class RouterController {
return DeploymentResponse.from(failedDeployment);
}
}
@PostMapping("/{id}/remove")
public DeploymentResponse remove(@PathVariable UUID id) {
Router router = service.findById(id);
var deployment = deploymentService.startDeployment(router, DeploymentAction.REMOVE);
try {
service.forceStatus(id, RouterStatus.PROVISIONING); // or REMOVING if you want later
// simulate removal
var finished = deploymentService.finishSuccess(
deployment,
"Removal completed successfully"
);
service.forceStatus(id, RouterStatus.REMOVED);
return DeploymentResponse.from(finished);
} catch (Exception e) {
var failed = deploymentService.finishFailure(
deployment,
e.getMessage()
);
service.forceStatus(id, RouterStatus.FAILED);
return DeploymentResponse.from(failed);
}
}
}