use of io.swagger.annotations.ApiResponse in project indy by Commonjava.
the class NfcResource method getStoreInfo.
@Path("/{packageType}/{type: (hosted|group|remote)}/{name}/info")
@ApiOperation("Get not-found cache information, e.g., size, etc")
@ApiResponses({ @ApiResponse(code = 200, response = NotFoundCacheInfoDTO.class, message = "The info of not-found cache") })
@GET
@Produces(ApplicationContent.application_json)
public Response getStoreInfo(@ApiParam(name = "packageType", required = true, value = "type of package (eg. maven, npm, generic-http)") @PathParam("packageType") final String packageType, @ApiParam(allowableValues = "hosted,group,remote", name = "type", required = true, value = "type of store") @PathParam("type") final String t, @ApiParam(name = "name", value = "name of the store") @PathParam("name") final String name) {
Response response;
final StoreType type = StoreType.get(t);
final StoreKey key = new StoreKey(packageType, type, name);
try {
NotFoundCacheInfoDTO dto = controller.getInfo(key);
response = responseHelper.formatOkResponseWithJsonEntity(dto);
} catch (final IndyWorkflowException e) {
response = responseHelper.formatResponse(e);
}
return response;
}
use of io.swagger.annotations.ApiResponse in project indy by Commonjava.
the class MaintenanceHandler method exportInfinispanCache.
@ApiOperation("Export the specified Infinispan cache.")
@ApiResponse(code = 200, message = "Export complete.")
@Produces("application/json")
@Path("/infinispan/cache/{name}{key: (/.+)?}")
@GET
public Response exportInfinispanCache(@ApiParam("The name of cache to export") @PathParam("name") final String name, @ApiParam("The cache key") @PathParam("key") final String key) {
Response response;
try {
String json = ispnCacheController.export(name, key);
response = Response.ok(json).build();
} catch (final Exception e) {
logger.error(String.format("Failed to export: %s. Reason: %s", name, e.getMessage()), e);
response = responseHelper.formatResponse(e);
}
return response;
}
use of io.swagger.annotations.ApiResponse in project indy by Commonjava.
the class MaintenanceHandler method rescan.
@ApiOperation("Rescan all content in the specified repository to re-initialize metadata, capture missing index keys, etc.")
@ApiResponse(code = 200, message = "Rescan was started successfully. (NOTE: There currently is no way to determine when rescanning is complete.)")
@Path("/rescan/{packageType}/{type: (hosted|group|remote)}/{name}")
@GET
public Response rescan(@ApiParam(value = "The package type (eg. maven, npm, generic-http)", required = true) @PathParam("packageType") final String packageType, @ApiParam(value = "The type of store / repository", allowableValues = "hosted,group,remote", required = true) @PathParam("type") final String type, @ApiParam("The name of the store / repository") @PathParam("name") final String name) {
final StoreKey key = new StoreKey(packageType, StoreType.get(type), name);
Response response;
try {
contentController.rescan(key);
response = Response.ok().build();
} catch (final IndyWorkflowException e) {
logger.error(String.format("Failed to rescan: %s. Reason: %s", key, e.getMessage()), e);
response = responseHelper.formatResponse(e);
}
return response;
}
use of io.swagger.annotations.ApiResponse in project indy by Commonjava.
the class MaintenanceHandler method getTombstoneStores.
@ApiOperation("Get tombstone stores that have no content and not in any group.")
@ApiResponse(code = 200, message = "Complete.")
@Produces(application_json)
@Path("/stores/tombstone/{packageType}/hosted")
@GET
public Response getTombstoneStores(@ApiParam("The packageType") @PathParam("packageType") final String packageType) {
Response response;
try {
Set<StoreKey> tombstoneStores = maintenanceController.getTombstoneStores(packageType);
response = Response.ok(mapper.writeValueAsString(tombstoneStores)).build();
} catch (final Exception e) {
logger.error(String.format("Failed to get tombstone stores. Reason: %s", e.getMessage()), e);
response = responseHelper.formatResponse(e);
}
return response;
}
use of io.swagger.annotations.ApiResponse in project indy by Commonjava.
the class MaintenanceHandler method deprecatedRescan.
@ApiOperation("[Deprecated] Rescan all content in the specified repository to re-initialize metadata, capture missing index keys, etc.")
@ApiResponse(code = 200, message = "Rescan was started successfully. (NOTE: There currently is no way to determine when rescanning is complete.)")
@Path("/rescan/{type: (hosted|group|remote)}/{name}")
@GET
@Deprecated
public Response deprecatedRescan(@ApiParam(value = "The type of store / repository", allowableValues = "hosted,group,remote", required = true) @PathParam("type") final String type, @ApiParam("The name of the store / repository") @PathParam("name") final String name) {
final StoreType storeType = StoreType.get(type);
String altPath = Paths.get("/api/admin/maint", MAVEN_PKG_KEY, type, name).toString();
final StoreKey key = new StoreKey(storeType, name);
Response response;
try {
contentController.rescan(key);
response = responseHelper.markDeprecated(Response.ok(), altPath).build();
} catch (final IndyWorkflowException e) {
logger.error(String.format("Failed to rescan: %s. Reason: %s", key, e.getMessage()), e);
response = responseHelper.formatResponse(e, rb -> responseHelper.markDeprecated(rb, altPath));
}
return response;
}
Aggregations