Skip to content

Commit

Permalink
Add new repository query APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
ligangty committed Jan 15, 2024
1 parent 56f7148 commit bf22f11
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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 );
}

}

0 comments on commit bf22f11

Please sign in to comment.