Add get deployment by id endpoint
This commit is contained in:
@@ -3,6 +3,7 @@ package com.litoralregas.openvpn.deployment;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/deployments")
|
@RequestMapping("/api/deployments")
|
||||||
@@ -21,4 +22,12 @@ public class DeploymentController {
|
|||||||
.map(DeploymentResponse::from)
|
.map(DeploymentResponse::from)
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public DeploymentResponse getById(@PathVariable UUID id) {
|
||||||
|
Deployment deployment = repository.findById(id)
|
||||||
|
.orElseThrow(() -> new IllegalArgumentException("Deployment not found: " + id));
|
||||||
|
|
||||||
|
return DeploymentResponse.from(deployment);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user