From bf22f11ab652e6f823fa6f095f256e1090f16830 Mon Sep 17 00:00:00 2001 From: Gang Li Date: Mon, 15 Jan 2024 15:28:38 +0800 Subject: [PATCH] Add new repository query APIs --- .../RepositoryQueryServiceClient.java | 10 +++++++ .../repository/RepositoryQueryResource.java | 26 +++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/src/main/java/org/commonjava/indy/service/ui/client/repository/RepositoryQueryServiceClient.java b/src/main/java/org/commonjava/indy/service/ui/client/repository/RepositoryQueryServiceClient.java index c20899b..e5a3746 100644 --- a/src/main/java/org/commonjava/indy/service/ui/client/repository/RepositoryQueryServiceClient.java +++ b/src/main/java/org/commonjava/indy/service/ui/client/repository/RepositoryQueryServiceClient.java @@ -117,4 +117,14 @@ Response getRemoteRepositoryByUrl( @QueryParam( "packageType" ) final String pac @GET @Path( "/isEmpty" ) Response isStoreEmpty(); + + @GET + @Path( "/storekeys/{packageType}" ) + @Produces( APPLICATION_JSON ) + Response getStoreKeys( @PathParam( "packageType" ) final String pkgType ); + + @GET + @Path( "/endpoints/{packageType}" ) + @Produces( APPLICATION_JSON ) + Response getEndpoints( @PathParam( "packageType" ) final String pkgType ); } diff --git a/src/main/java/org/commonjava/indy/service/ui/jaxrs/repository/RepositoryQueryResource.java b/src/main/java/org/commonjava/indy/service/ui/jaxrs/repository/RepositoryQueryResource.java index c6120aa..995994c 100644 --- a/src/main/java/org/commonjava/indy/service/ui/jaxrs/repository/RepositoryQueryResource.java +++ b/src/main/java/org/commonjava/indy/service/ui/jaxrs/repository/RepositoryQueryResource.java @@ -19,6 +19,7 @@ import org.commonjava.indy.service.ui.models.repository.ArtifactStore; import org.commonjava.indy.service.ui.models.repository.SimpleBooleanResultDTO; import org.commonjava.indy.service.ui.models.repository.StoreListingDTO; +import org.commonjava.indy.service.ui.models.stats.EndpointViewListing; import org.eclipse.microprofile.openapi.annotations.Operation; import org.eclipse.microprofile.openapi.annotations.media.Content; import org.eclipse.microprofile.openapi.annotations.media.Schema; @@ -37,6 +38,7 @@ import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Response; +import java.util.Map; import static javax.ws.rs.core.MediaType.APPLICATION_JSON; import static org.eclipse.microprofile.openapi.annotations.enums.ParameterIn.PATH; @@ -250,4 +252,28 @@ public Response getStoreEmpty() return client.isStoreEmpty(); } + @Operation( + summary = "Retrieve a listing of the artifact stores available on the system. This is especially useful for setting up a network of Indy instances that reference one another" ) + @APIResponse( responseCode = "200", + content = @Content( schema = @Schema( implementation = EndpointViewListing.class ) ), + description = "The artifact store listing" ) + @Path( "/endpoints/{packageType}" ) + @GET + @Produces( APPLICATION_JSON ) + public Response getEndpoints( @PathParam( "packageType" ) final String pkgType ) + { + return client.getEndpoints( pkgType ); + } + + @Operation( summary = "Retrieve a listing of the artifact stores keys available on the system." ) + @APIResponse( responseCode = "200", content = @Content( schema = @Schema( implementation = Map.class ) ), + description = "The artifact store keys listing" ) + @Path( "/storekeys/{packageType}" ) + @GET + @Produces( APPLICATION_JSON ) + public Response getStoreKeys( @PathParam( "packageType" ) final String pkgType ) + { + return client.getStoreKeys( pkgType ); + } + }