use of io.swagger.annotations.ApiResponse in project indy by Commonjava.
the class AutoProxCatalogResource method getRule.
@ApiOperation(value = "Retrieve a single AutoProx rule", response = RuleDTO.class)
@ApiResponses({ @ApiResponse(code = 404, message = "No rule by the specified name"), @ApiResponse(code = 200, message = "Rule spec sent") })
@GET
@Path("{name}")
public Response getRule(@PathParam("name") final String name) {
Response response = checkEnabled();
if (response != null) {
return response;
}
final RuleDTO dto = controller.getRule(name);
if (dto == null) {
return Response.status(Status.NOT_FOUND).build();
} else {
return formatOkResponseWithJsonEntity(dto, serializer);
}
}
use of io.swagger.annotations.ApiResponse in project indy by Commonjava.
the class AutoProxCatalogResource method getCatalog.
@ApiOperation(value = "Retrieve the AutoProx rule catalog", response = CatalogDTO.class)
@ApiResponses({ @ApiResponse(code = 404, message = "AutoProx is disabled or no rules are defined."), @ApiResponse(code = 200, message = "Catalog sent") })
@GET
@Produces(ApplicationContent.application_json)
public Response getCatalog() {
Response response = checkEnabled();
if (response != null) {
return response;
}
final CatalogDTO dto = controller.getCatalog();
if (dto == null) {
return Response.status(Status.NOT_FOUND).build();
}
return formatOkResponseWithJsonEntity(dto, serializer);
}
use of io.swagger.annotations.ApiResponse in project indy by Commonjava.
the class DeprecatedFoloContentAccessResource method doHead.
@ApiOperation("Store and track file/artifact content under the given artifact store (type/name) and path.")
@ApiResponses({ @ApiResponse(code = 404, message = "Content is not available"), @ApiResponse(code = 200, message = "Header metadata for content (or rendered listing when path ends with '/index.html' or '/'") })
@HEAD
@Path("/{path: (.*)}")
public Response doHead(@ApiParam("User-assigned tracking session key") @PathParam("id") final String id, @ApiParam(allowableValues = "hosted,group,remote", required = true) @PathParam("type") final String type, @PathParam("name") final String name, @PathParam("path") final String path, @QueryParam(CHECK_CACHE_ONLY) final Boolean cacheOnly, @Context final HttpServletRequest request, @Context final UriInfo uriInfo) {
final TrackingKey tk = new TrackingKey(id);
final String baseUri = uriInfo.getBaseUriBuilder().path(BASE_PATH).path(id).build().toString();
EventMetadata metadata = new EventMetadata().set(TRACKING_KEY, tk).set(ACCESS_CHANNEL, AccessChannel.MAVEN_REPO);
final Consumer<Response.ResponseBuilder> deprecation = builder -> {
String alt = Paths.get("/api/folo/track/", id, MAVEN_PKG_KEY, type, name, path).toString();
markDeprecated(builder, alt);
};
return handler.doHead(MAVEN_PKG_KEY, type, name, path, cacheOnly, baseUri, request, metadata, deprecation);
}
use of io.swagger.annotations.ApiResponse in project indy by Commonjava.
the class DeprecatedFoloContentAccessResource method doGet.
@ApiOperation("Retrieve and track file/artifact content under the given artifact store (type/name) and path.")
@ApiResponses({ @ApiResponse(code = 404, message = "Content is not available"), @ApiResponse(code = 200, response = String.class, message = "Rendered content listing (when path ends with '/index.html' or '/')"), @ApiResponse(code = 200, response = StreamingOutput.class, message = "Content stream") })
@GET
@Path("/{path: (.*)}")
public Response doGet(@ApiParam("User-assigned tracking session key") @PathParam("id") final String id, @ApiParam(allowableValues = "hosted,group,remote", required = true) @PathParam("type") final String type, @PathParam("name") final String name, @PathParam("path") final String path, @Context final HttpServletRequest request, @Context final UriInfo uriInfo) {
final TrackingKey tk = new TrackingKey(id);
final String baseUri = uriInfo.getBaseUriBuilder().path(BASE_PATH).path(id).build().toString();
EventMetadata metadata = new EventMetadata().set(TRACKING_KEY, tk).set(ACCESS_CHANNEL, AccessChannel.MAVEN_REPO);
final Consumer<Response.ResponseBuilder> deprecation = builder -> {
String alt = Paths.get("/api/folo/track/", id, MAVEN_PKG_KEY, type, name, path).toString();
markDeprecated(builder, alt);
};
return handler.doGet(MAVEN_PKG_KEY, type, name, path, baseUri, request, metadata, deprecation);
}
use of io.swagger.annotations.ApiResponse in project indy by Commonjava.
the class FoloAdminResource method getRecord.
@ApiOperation("Alias of /{id}/record, returns the tracking record for the specified key")
@ApiResponses({ @ApiResponse(code = 404, message = "No such tracking record exists."), @ApiResponse(code = 200, message = "Tracking record", response = TrackedContentDTO.class) })
@Path("/{id}/record")
@GET
public Response getRecord(@ApiParam("User-assigned tracking session key") @PathParam("id") final String id, @Context final UriInfo uriInfo) {
Response response;
try {
final String baseUrl = uriInfo.getBaseUriBuilder().path("api").build().toString();
final TrackedContentDTO record = controller.getRecord(id, baseUrl);
if (record == null) {
response = Response.status(Status.NOT_FOUND).build();
} else {
response = formatOkResponseWithJsonEntity(record, objectMapper);
}
} catch (final IndyWorkflowException e) {
logger.error(String.format("Failed to retrieve tracking report for: %s. Reason: %s", id, e.getMessage()), e);
response = formatResponse(e);
}
return response;
}
Aggregations