@GET @Path("orders/{id}") @Produces(MediaType.APPLICATION_JSON) CoinbaseProOrder getOrder( @PathParam("id") String id, @HeaderParam("CB-ACCESS-KEY") String apiKey, @HeaderParam("CB-ACCESS-SIGN") ParamsDigest signer, @HeaderParam("CB-ACCESS-TIMESTAMP") SynchronizedValueFactory<Long> nonce, @HeaderParam("CB-ACCESS-PASSPHRASE") String passphrase) throws CoinbaseProException, IOException;
@DELETE @Path("orders") @Produces(MediaType.TEXT_PLAIN) String deleteAllOrders( @HeaderParam("AC-ACCESS-KEY") String accessKey, @HeaderParam("AC-ACCESS-SIGN") ParamsDigest sign, @HeaderParam("AC-ACCESS-PASSPHRASE") String passphrase, @HeaderParam("AC-ACCESS-TIMESTAMP") String timestamp) throws IOException;
@POST @Produces(MediaType.APPLICATION_JSON) LiquiAccountInfoResult getInfo( @HeaderParam("Key") String key, @HeaderParam("Sign") ParamsDigest signer, @FormParam("nonce") SynchronizedValueFactory<Long> nonce, @FormParam("method") String method);
@GET @Path("/echo_token") public String echoToken(@HeaderParam(TRACETOKEN_HEADER) String token) { return token; } }
@POST @Path("/worker") @Consumes(MediaType.APPLICATION_JSON) @ResourceFilters(ConfigResourceFilter.class) public Response setWorkerConfig( final WorkerBehaviorConfig workerBehaviorConfig, @HeaderParam(AuditManager.X_DRUID_AUTHOR) @DefaultValue("") final String author, @HeaderParam(AuditManager.X_DRUID_COMMENT) @DefaultValue("") final String comment, @Context final HttpServletRequest req ) { final SetResult setResult = configManager.set( WorkerBehaviorConfig.CONFIG_KEY, workerBehaviorConfig, new AuditInfo(author, comment, req.getRemoteAddr()) ); if (setResult.isOk()) { log.info("Updating Worker configs: %s", workerBehaviorConfig); return Response.ok().build(); } else { return Response.status(Response.Status.BAD_REQUEST).build(); } }
/** * Changes the status information of the ASG. * * @param asgName the name of the ASG for which the status needs to be changed. * @param newStatus the new status {@link ASGStatus} of the ASG. * @param isReplication a header parameter containing information whether this is replicated from other nodes. * * @return response which indicates if the operation succeeded or not. */ @PUT @Path("{asgName}/status") public Response statusUpdate(@PathParam("asgName") String asgName, @QueryParam("value") String newStatus, @HeaderParam(PeerEurekaNode.HEADER_REPLICATION) String isReplication) { if (awsAsgUtil == null) { return Response.status(400).build(); } try { logger.info("Trying to update ASG Status for ASG {} to {}", asgName, newStatus); ASGStatus asgStatus = ASGStatus.valueOf(newStatus.toUpperCase()); awsAsgUtil.setStatus(asgName, (!ASGStatus.DISABLED.equals(asgStatus))); registry.statusUpdate(asgName, asgStatus, Boolean.valueOf(isReplication)); logger.debug("Updated ASG Status for ASG {} to {}", asgName, asgStatus); } catch (Throwable e) { logger.error("Cannot update the status {} for the ASG {}", newStatus, asgName, e); return Response.serverError().build(); } return Response.ok().build(); }
@GET @Produces({ Constants.MIMETYPE_PROTOBUF, Constants.MIMETYPE_PROTOBUF_IETF }) public Response getProtobuf( final @Context UriInfo uriInfo, final @HeaderParam("Accept") String contentType) { if (LOG.isTraceEnabled()) { LOG.trace("GET " + uriInfo.getAbsolutePath() + " as " + MIMETYPE_BINARY); } servlet.getMetrics().incrementRequests(1); try { int fetchSize = this.servlet.getConfiguration().getInt(Constants.SCAN_FETCH_SIZE, 10); StreamingOutput stream = new ProtobufStreamingOutput(this.results, contentType, userRequestedLimit, fetchSize); servlet.getMetrics().incrementSucessfulScanRequests(1); ResponseBuilder response = Response.ok(stream); response.header("content-type", contentType); return response.build(); } catch (Exception exp) { servlet.getMetrics().incrementFailedScanRequests(1); processException(exp); LOG.warn(exp.toString(), exp); return null; } }
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) public Response update(@HeaderParam(Constants.SESSION_TOKEN_HEADER_NAME) String sessionToken, @PathParam("entityClass") String entityClassName, String input, @Context HttpHeaders headers) { sessionToken = sessionToken.replaceAll("^\"|\"$", ""); input = input.replaceAll("^\"|\"$", ""); } catch (Exception e) { log.error(e.getMessage()); return Response.serverError().build(); return Response.notModified().build(); return Response.ok(ResponseBuilder.buildOutput(entityClass, entityMetadata, output), mediaType).build(); } else { return Response.ok(output.toString(), mediaType).build();
@Path("status") public Response deleteStatusUpdate( @HeaderParam(PeerEurekaNode.HEADER_REPLICATION) String isReplication, @QueryParam("value") String newStatusValue, @QueryParam("lastDirtyTimestamp") String lastDirtyTimestamp) { if (registry.getInstanceByAppAndId(app.getName(), id) == null) { logger.warn("Instance not found: {}/{}", app.getName(), id); return Response.status(Status.NOT_FOUND).build(); return Response.ok().build(); } else { logger.warn("Unable to remove status override: {} - {}", app.getName(), id); return Response.serverError().build();
@GET public Response redirectIndexHtml( @HeaderParam(X_FORWARDED_PROTO) String proto, @Context UriInfo uriInfo) { if (isNullOrEmpty(proto)) { proto = uriInfo.getRequestUri().getScheme(); } return Response.status(MOVED_PERMANENTLY) .location(uriInfo.getRequestUriBuilder().scheme(proto).path("/ui/").build()) .build(); } }
/** * Handler for DELETE method requests for this resource Closes EMF and * removes application token along with from repository * * @param id * @return */ @DELETE @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON }) public Response closeApplication( @HeaderParam(Constants.APPLICATION_TOKEN_HEADER_NAME) String applicationToken, @Context HttpHeaders headers) { String mediaType = headers != null && headers.getRequestHeaders().containsKey("Content-type")? headers.getRequestHeader("Content-type").get(0) : MediaType.APPLICATION_JSON; mediaType = mediaType.equalsIgnoreCase(MediaType.APPLICATION_XML) ? MediaType.APPLICATION_XML : MediaType.APPLICATION_JSON; if (log.isDebugEnabled()) log.debug("DELETE: Application Token:" + applicationToken); EntityManagerFactory emf = EMFRepository.INSTANCE .getEMF(applicationToken); if (emf == null) { log.warn("DELETE: Application Token:" + applicationToken + " doesn't exist and hence can't be closed"); return Response.serverError().build();// ResponseCode.DELETE_AT_FAILED; } EMFRepository.INSTANCE.removeEMF(applicationToken); return Response.ok(new String(ResponseCode.DELETE_AT_SUCCESS), mediaType).build(); }
@GET @Path("accounts/{accountId}/withdrawals") Map getWithdrawals( @HeaderParam(CB_VERSION) String apiVersion, @HeaderParam(CB_ACCESS_KEY) String apiKey, @HeaderParam(CB_ACCESS_SIGN) ParamsDigest signature, @HeaderParam(CB_ACCESS_TIMESTAMP) BigDecimal timestamp, @PathParam("accountId") String accountId) throws IOException, CoinbaseException;
@OPTIONS @Produces(MediaType.APPLICATION_JSON + "; charset=UTF-8") @Path("/version") public Response corsPreflightVersion(@HeaderParam("Access-Control-Request-Headers") final String requestHeaders, @HeaderParam("Access-Control-Request-Method") final String requestMethod) { ResponseBuilder responseBuilder = getCorsPreflightResponseBuilder(requestHeaders, requestMethod); return (responseBuilder.build()); }
@POST @Produces(MediaType.APPLICATION_JSON) LiquiActiveOrdersResult activeOrders( @HeaderParam("Key") String key, @HeaderParam("Sign") ParamsDigest signer, @FormParam("nonce") SynchronizedValueFactory<Long> nonce, @FormParam("method") String method, @FormParam("pair") Pairs pair);
@POST @Path("/taskslots") @Consumes(MediaType.APPLICATION_JSON) public Response setCompactionTaskLimit( @QueryParam("ratio") Double compactionTaskSlotRatio, @QueryParam("max") Integer maxCompactionTaskSlots, @HeaderParam(AuditManager.X_DRUID_AUTHOR) @DefaultValue("") final String author, @HeaderParam(AuditManager.X_DRUID_COMMENT) @DefaultValue("") final String comment, @Context HttpServletRequest req ) { final CoordinatorCompactionConfig current = CoordinatorCompactionConfig.current(manager); final CoordinatorCompactionConfig newCompactionConfig = CoordinatorCompactionConfig.from( current, compactionTaskSlotRatio, maxCompactionTaskSlots ); final SetResult setResult = manager.set( CoordinatorCompactionConfig.CONFIG_KEY, newCompactionConfig, new AuditInfo(author, comment, req.getRemoteAddr()) ); if (setResult.isOk()) { return Response.ok().build(); } else { return Response.status(Response.Status.BAD_REQUEST) .entity(ImmutableMap.of("error", setResult.getException())) .build(); } }
@PUT @Timed @Path("/{sidecarId}") @ApiOperation(value = "Create/update a Sidecar registration", notes = "This is a stateless method which upserts a Sidecar registration") @NoAuditEvent("this is only a ping from Sidecars, and would overflow the audit log") public Response register(@ApiParam(name = "sidecarId", value = "The id this Sidecar is registering as.", required = true) @PathParam("sidecarId") @NotEmpty String sidecarId, @ApiParam(name = "JSON body", required = true) @Valid @NotNull RegistrationRequest request, @HeaderParam(value = "X-Graylog-Sidecar-Version") @NotEmpty String sidecarVersion) { final Sidecar newSidecar; final Sidecar oldSidecar = sidecarService.findByNodeId(sidecarId); collectorAction, assignments); return Response.accepted(sidecarRegistrationResponse).build();
@Path("status") public Response statusUpdate( @QueryParam("value") String newStatus, @HeaderParam(PeerEurekaNode.HEADER_REPLICATION) String isReplication, @QueryParam("lastDirtyTimestamp") String lastDirtyTimestamp) { try { if (registry.getInstanceByAppAndId(app.getName(), id) == null) { logger.warn("Instance not found: {}/{}", app.getName(), id); return Response.status(Status.NOT_FOUND).build(); return Response.ok().build(); } else { logger.warn("Unable to update status: {} - {} - {}", app.getName(), id, newStatus); return Response.serverError().build();
@GET @Path("accounts/{account-id}") AbucoinsAccount getAccount( @PathParam("account-id") String accountID, @HeaderParam("AC-ACCESS-KEY") String accessKey, @HeaderParam("AC-ACCESS-SIGN") ParamsDigest sign, @HeaderParam("AC-ACCESS-PASSPHRASE") String passphrase, @HeaderParam("AC-ACCESS-TIMESTAMP") String timestamp) throws IOException;
@OPTIONS @Produces(MediaType.APPLICATION_JSON + "; charset=UTF-8") @Path("check") public Response corsPreflightCheck(@HeaderParam("Access-Control-Request-Headers") String requestHeaders, @HeaderParam("Access-Control-Request-Method") String requestMethod) { Response.ResponseBuilder responseBuilder = MetricsResource.getCorsPreflightResponseBuilder(requestHeaders, requestMethod); return (responseBuilder.build()); }
@POST @Produces(MediaType.APPLICATION_JSON) LiquiOrderInfoResult orderInfo( @HeaderParam("Key") String key, @HeaderParam("Sign") ParamsDigest signer, @FormParam("nonce") SynchronizedValueFactory<Long> nonce, @FormParam("method") String method, @FormParam("order_id") long orderId);