diff --git a/src/main/java/io/cryostat/net/web/http/api/beta/RecordingDeleteFromPathHandler.java b/src/main/java/io/cryostat/net/web/http/api/beta/RecordingDeleteFromPathHandler.java index 493d676750..2feac0c86f 100644 --- a/src/main/java/io/cryostat/net/web/http/api/beta/RecordingDeleteFromPathHandler.java +++ b/src/main/java/io/cryostat/net/web/http/api/beta/RecordingDeleteFromPathHandler.java @@ -31,6 +31,7 @@ import io.cryostat.net.web.http.api.v2.ApiException; import io.cryostat.net.web.http.api.v2.IntermediateResponse; import io.cryostat.net.web.http.api.v2.RequestParameters; +import io.cryostat.recordings.JvmIdHelper; import io.cryostat.recordings.RecordingArchiveHelper; import io.cryostat.recordings.RecordingNotFoundException; import io.cryostat.rules.ArchivePathException; @@ -40,17 +41,20 @@ public class RecordingDeleteFromPathHandler extends AbstractV2RequestHandler { - static final String PATH = "fs/recordings/:subdirectoryName/:recordingName"; + static final String PATH = "fs/recordings/:jvmId/:recordingName"; private final RecordingArchiveHelper recordingArchiveHelper; + private final JvmIdHelper jvmIdHelper; @Inject RecordingDeleteFromPathHandler( AuthManager auth, CredentialsManager credentialsManager, Gson gson, + JvmIdHelper jvmIdHelper, RecordingArchiveHelper recordingArchiveHelper) { super(auth, credentialsManager, gson); + this.jvmIdHelper = jvmIdHelper; this.recordingArchiveHelper = recordingArchiveHelper; } @@ -91,9 +95,10 @@ public boolean isAsync() { @Override public IntermediateResponse handle(RequestParameters params) throws Exception { - String subdirectoryName = params.getPathParams().get("subdirectoryName"); String recordingName = params.getPathParams().get("recordingName"); + String jvmId = params.getPathParams().get("jvmId"); try { + String subdirectoryName = jvmIdHelper.jvmIdToSubdirectoryName(jvmId); recordingArchiveHelper.deleteRecordingFromPath(subdirectoryName, recordingName).get(); return new IntermediateResponse().body(null); } catch (ExecutionException e) { diff --git a/src/main/java/io/cryostat/net/web/http/api/beta/RecordingMetadataLabelsPostFromPathHandler.java b/src/main/java/io/cryostat/net/web/http/api/beta/RecordingMetadataLabelsPostFromPathHandler.java index 0a50c1cbc2..c538c89451 100644 --- a/src/main/java/io/cryostat/net/web/http/api/beta/RecordingMetadataLabelsPostFromPathHandler.java +++ b/src/main/java/io/cryostat/net/web/http/api/beta/RecordingMetadataLabelsPostFromPathHandler.java @@ -30,6 +30,7 @@ import io.cryostat.net.web.http.api.v2.ApiException; import io.cryostat.net.web.http.api.v2.IntermediateResponse; import io.cryostat.net.web.http.api.v2.RequestParameters; +import io.cryostat.recordings.JvmIdHelper; import io.cryostat.recordings.RecordingArchiveHelper; import io.cryostat.recordings.RecordingMetadataManager; import io.cryostat.recordings.RecordingMetadataManager.Metadata; @@ -41,21 +42,24 @@ public class RecordingMetadataLabelsPostFromPathHandler extends AbstractV2RequestHandler { - static final String PATH = "fs/recordings/:subdirectoryName/:recordingName/metadata/labels"; + static final String PATH = "fs/recordings/:jvmId/:recordingName/metadata/labels"; private final RecordingArchiveHelper recordingArchiveHelper; private final RecordingMetadataManager recordingMetadataManager; + private final JvmIdHelper jvmIdHelper; @Inject RecordingMetadataLabelsPostFromPathHandler( AuthManager auth, CredentialsManager credentialsManager, Gson gson, + JvmIdHelper jvmIdHelper, RecordingArchiveHelper recordingArchiveHelper, RecordingMetadataManager recordingMetadataManager) { super(auth, credentialsManager, gson); this.recordingArchiveHelper = recordingArchiveHelper; this.recordingMetadataManager = recordingMetadataManager; + this.jvmIdHelper = jvmIdHelper; } @Override @@ -96,9 +100,9 @@ public boolean requiresAuthentication() { @Override public IntermediateResponse handle(RequestParameters params) throws Exception { String recordingName = params.getPathParams().get("recordingName"); - String subdirectoryName = params.getPathParams().get("subdirectoryName"); - + String jvmId = params.getPathParams().get("jvmId"); try { + String subdirectoryName = jvmIdHelper.jvmIdToSubdirectoryName(jvmId); Metadata metadata = new Metadata(recordingMetadataManager.parseRecordingLabels(params.getBody())); diff --git a/src/main/java/io/cryostat/net/web/http/api/beta/RecordingUploadPostFromPathHandler.java b/src/main/java/io/cryostat/net/web/http/api/beta/RecordingUploadPostFromPathHandler.java index bbfc0840d1..6e5a7b2150 100644 --- a/src/main/java/io/cryostat/net/web/http/api/beta/RecordingUploadPostFromPathHandler.java +++ b/src/main/java/io/cryostat/net/web/http/api/beta/RecordingUploadPostFromPathHandler.java @@ -41,6 +41,7 @@ import io.cryostat.net.web.http.api.v2.ApiException; import io.cryostat.net.web.http.api.v2.IntermediateResponse; import io.cryostat.net.web.http.api.v2.RequestParameters; +import io.cryostat.recordings.JvmIdHelper; import io.cryostat.recordings.RecordingArchiveHelper; import io.cryostat.recordings.RecordingNotFoundException; import io.cryostat.rules.ArchivePathException; @@ -56,11 +57,12 @@ class RecordingUploadPostFromPathHandler extends AbstractV2RequestHandler { - static final String PATH = "fs/recordings/:subdirectoryName/:recordingName/upload"; + static final String PATH = "fs/recordings/:jvmId/:recordingName/upload"; private final Environment env; private final long httpTimeoutSeconds; private final WebClient webClient; + private final JvmIdHelper jvmIdHelper; private final RecordingArchiveHelper recordingArchiveHelper; @Inject @@ -70,12 +72,14 @@ class RecordingUploadPostFromPathHandler extends AbstractV2RequestHandler handle(RequestParameters params) throws Exception { - String subdirectoryName = params.getPathParams().get("subdirectoryName"); String recordingName = params.getPathParams().get("recordingName"); + String jvmId = params.getPathParams().get("jvmId"); try { + String subdirectoryName = jvmIdHelper.jvmIdToSubdirectoryName(jvmId); URL uploadUrl = new URL(env.getEnv(Variables.GRAFANA_DATASOURCE_ENV)); boolean isValidUploadUrl = new UrlValidator(UrlValidator.ALLOW_LOCAL_URLS).isValid(uploadUrl.toString());