From 0c82d9252a8e3dd23f1f9201b0a71df8a8492c17 Mon Sep 17 00:00:00 2001 From: LizBaldo Date: Tue, 11 Feb 2025 16:35:33 -0500 Subject: [PATCH] keep params as is until we fix disk and apps too --- .../workbench/leonardo/LeonardoTestUtils.scala | 2 +- .../http/service/RuntimeServiceInterp.scala | 2 +- .../http/service/RuntimeV2ServiceInterp.scala | 2 +- .../workbench/leonardo/http/service/package.scala | 14 +++++++++++--- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/automation/src/test/scala/org/broadinstitute/dsde/workbench/leonardo/LeonardoTestUtils.scala b/automation/src/test/scala/org/broadinstitute/dsde/workbench/leonardo/LeonardoTestUtils.scala index 96d2dd44eca..e6077c398dc 100644 --- a/automation/src/test/scala/org/broadinstitute/dsde/workbench/leonardo/LeonardoTestUtils.scala +++ b/automation/src/test/scala/org/broadinstitute/dsde/workbench/leonardo/LeonardoTestUtils.scala @@ -404,7 +404,7 @@ trait LeonardoTestUtils implicit val patienceConfig: PatienceConfig = clusterPatience eventually { val allStatus: Set[ClusterStatus] = Leonardo.cluster - .listIncludingDeletedRuntime(googleProject) + .listRuntime(googleProject) .filter(c => c.runtimeName == runtimeName && c.googleProject == googleProject) .map(_.status) .toSet diff --git a/http/src/main/scala/org/broadinstitute/dsde/workbench/leonardo/http/service/RuntimeServiceInterp.scala b/http/src/main/scala/org/broadinstitute/dsde/workbench/leonardo/http/service/RuntimeServiceInterp.scala index ec017f131ea..6df5e789be1 100644 --- a/http/src/main/scala/org/broadinstitute/dsde/workbench/leonardo/http/service/RuntimeServiceInterp.scala +++ b/http/src/main/scala/org/broadinstitute/dsde/workbench/leonardo/http/service/RuntimeServiceInterp.scala @@ -251,7 +251,7 @@ class RuntimeServiceInterp[F[_]: Parallel]( samResources <- samService.listResources(userInfo.accessToken.token, RuntimeSamResource.resourceType) - (labelMap, _) <- F.fromEither(processListParameters(params)) + (labelMap, _, _) <- F.fromEither(processListParameters(params)) excludeStatuses = List(RuntimeStatus.Deleted) creatorOnly <- F.fromEither(processCreatorOnlyParameter(userInfo.userEmail, params, ctx.traceId)) diff --git a/http/src/main/scala/org/broadinstitute/dsde/workbench/leonardo/http/service/RuntimeV2ServiceInterp.scala b/http/src/main/scala/org/broadinstitute/dsde/workbench/leonardo/http/service/RuntimeV2ServiceInterp.scala index d8a72d8802b..e2896512968 100644 --- a/http/src/main/scala/org/broadinstitute/dsde/workbench/leonardo/http/service/RuntimeV2ServiceInterp.scala +++ b/http/src/main/scala/org/broadinstitute/dsde/workbench/leonardo/http/service/RuntimeV2ServiceInterp.scala @@ -418,7 +418,7 @@ class RuntimeV2ServiceInterp[F[_]: Parallel]( ctx <- as.ask // Parameters: parse search filters from request - (labelMap, _) <- F.fromEither(processListParameters(params)) + (labelMap, _, _) <- F.fromEither(processListParameters(params)) excludeStatuses = List(RuntimeStatus.Deleted) creatorEmail <- F.fromEither(processCreatorOnlyParameter(userInfo.userEmail, params, ctx.traceId)) diff --git a/http/src/main/scala/org/broadinstitute/dsde/workbench/leonardo/http/service/package.scala b/http/src/main/scala/org/broadinstitute/dsde/workbench/leonardo/http/service/package.scala index 58ac3682f11..0120669bfc8 100644 --- a/http/src/main/scala/org/broadinstitute/dsde/workbench/leonardo/http/service/package.scala +++ b/http/src/main/scala/org/broadinstitute/dsde/workbench/leonardo/http/service/package.scala @@ -46,18 +46,26 @@ package object service { private[service] def processListParameters( params: LabelMap - ): Either[ParseLabelsException, (LabelMap, List[String])] = + ): Either[ParseLabelsException, (LabelMap, Boolean, List[String])] = // returns a tuple made of three elements: // 1) LabelMap - represents the labels to filter the request by + // 2) includeDeleted - Boolean which determines if we include deleted resources in the response // 3) includeLabels - List of label keys which represent the labels (key, value pairs) that will be returned in response // Note that optional parameter `role` or `creator` (represented by creatorOnlyKey and creatorOnlyValue) is omitted. for { - labelMap <- processLabelMap(params - includeLabelsKey - creatorOnlyKey - creatorOnlyValue) + labelMap <- processLabelMap(params - includeDeletedKey - includeLabelsKey - creatorOnlyKey - creatorOnlyValue) + includeDeleted = params.get(includeDeletedKey) match { + case Some(includeDeletedValue) => + if (includeDeletedValue.toLowerCase == "true") + true + else false + case None => false + } includeLabels <- params.get(includeLabelsKey) match { case Some(includeLabelsValue) => processLabelsToReturn(includeLabelsValue) case None => Either.right(List.empty[String]) } - } yield (labelMap, includeLabels) + } yield (labelMap, includeDeleted, includeLabels) /** * Top-level query string parameter for apps and disks: GET /api/apps?includeLabels=foo,bar