Skip to content

Commit af1ab5e

Browse files
committed
Ref #27576: allow proxies with external id
1 parent 7c9e195 commit af1ab5e

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

src/main/java/eu/openanalytics/containerproxy/backend/AbstractContainerBackend.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ public void initialize() throws ContainerProxyException {
120120

121121
@Override
122122
public SuccessOrFailure<Proxy> startProxy(Proxy proxy) throws ContainerProxyException {
123-
proxy.setId(UUID.randomUUID().toString());
124123
proxy.setStatus(ProxyStatus.Starting);
125124
proxy.setCreatedTimestamp(System.currentTimeMillis());
126125
setRuntimeValues(proxy);

src/main/java/eu/openanalytics/containerproxy/service/ProxyService.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.util.List;
2929
import java.util.Map.Entry;
3030
import java.util.Set;
31+
import java.util.UUID;
3132
import java.util.concurrent.ExecutorService;
3233
import java.util.concurrent.Executors;
3334
import java.util.function.BiConsumer;
@@ -250,7 +251,7 @@ public List<Proxy> getProxiesOfCurrentUser(Predicate<Proxy> filter) {
250251
* @throws ContainerProxyException If the proxy fails to start for any reason.
251252
*/
252253
public Proxy startProxy(ProxySpec spec, boolean ignoreAccessControl) throws ContainerProxyException {
253-
return startProxy(spec, ignoreAccessControl, null);
254+
return startProxy(spec, ignoreAccessControl, null, UUID.randomUUID().toString());
254255
}
255256

256257
/**
@@ -262,12 +263,13 @@ public Proxy startProxy(ProxySpec spec, boolean ignoreAccessControl) throws Cont
262263
* @return The newly launched proxy.
263264
* @throws ContainerProxyException If the proxy fails to start for any reason.
264265
*/
265-
public Proxy startProxy(ProxySpec spec, boolean ignoreAccessControl, List<RuntimeValue> runtimeValues) throws ContainerProxyException {
266+
public Proxy startProxy(ProxySpec spec, boolean ignoreAccessControl, List<RuntimeValue> runtimeValues, String proxyId) throws ContainerProxyException {
266267
if (!ignoreAccessControl && !userService.canAccess(spec)) {
267268
throw new AccessDeniedException(String.format("Cannot start proxy %s: access denied", spec.getId()));
268269
}
269270

270271
Proxy proxy = new Proxy();
272+
proxy.setId(proxyId);
271273
proxy.setStatus(ProxyStatus.New);
272274
proxy.setUserId(userService.getCurrentUserId());
273275
proxy.setSpec(spec);

0 commit comments

Comments
 (0)