Search in sources :

Example 16 with DELETE

use of javax.ws.rs.DELETE in project killbill by killbill.

the class PaymentResource method cancelScheduledPaymentTransactionByExternalKey.

@TimedResource(name = "cancelScheduledPaymentTransaction")
@DELETE
@Path("/" + CANCEL_SCHEDULED_PAYMENT_TRANSACTION)
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Cancels a scheduled payment attempt retry")
@ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid paymentTransactionExternalKey supplied") })
public Response cancelScheduledPaymentTransactionByExternalKey(@QueryParam(QUERY_TRANSACTION_EXTERNAL_KEY) final String paymentTransactionExternalKey, @HeaderParam(HDR_CREATED_BY) final String createdBy, @HeaderParam(HDR_REASON) final String reason, @HeaderParam(HDR_COMMENT) final String comment, @javax.ws.rs.core.Context final UriInfo uriInfo, @javax.ws.rs.core.Context final HttpServletRequest request) throws PaymentApiException, AccountApiException {
    final CallContext callContext = context.createContext(createdBy, reason, comment, request);
    paymentApi.cancelScheduledPaymentTransaction(paymentTransactionExternalKey, callContext);
    return Response.status(Status.OK).build();
}
Also used : CallContext(org.killbill.billing.util.callcontext.CallContext) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE) TimedResource(org.killbill.commons.metrics.TimedResource) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 17 with DELETE

use of javax.ws.rs.DELETE in project killbill by killbill.

the class PaymentMethodResource method deletePaymentMethod.

@TimedResource
@DELETE
@Produces(APPLICATION_JSON)
@Path("/{paymentMethodId:" + UUID_PATTERN + "}")
@ApiOperation(value = "Delete a payment method")
@ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid paymentMethodId supplied"), @ApiResponse(code = 404, message = "Account or payment method not found") })
public Response deletePaymentMethod(@PathParam("paymentMethodId") final String paymentMethodId, @QueryParam(QUERY_DELETE_DEFAULT_PM_WITH_AUTO_PAY_OFF) @DefaultValue("false") final Boolean deleteDefaultPaymentMethodWithAutoPayOff, @QueryParam(QUERY_FORCE_DEFAULT_PM_DELETION) @DefaultValue("false") final Boolean forceDefaultPaymentMethodDeletion, @QueryParam(QUERY_PLUGIN_PROPERTY) final List<String> pluginPropertiesString, @HeaderParam(HDR_CREATED_BY) final String createdBy, @HeaderParam(HDR_REASON) final String reason, @HeaderParam(HDR_COMMENT) final String comment, @javax.ws.rs.core.Context final HttpServletRequest request) throws PaymentApiException, AccountApiException {
    final Iterable<PluginProperty> pluginProperties = extractPluginProperties(pluginPropertiesString);
    final CallContext callContext = context.createContext(createdBy, reason, comment, request);
    final PaymentMethod paymentMethod = paymentApi.getPaymentMethodById(UUID.fromString(paymentMethodId), false, false, pluginProperties, callContext);
    final Account account = accountUserApi.getAccountById(paymentMethod.getAccountId(), callContext);
    paymentApi.deletePaymentMethod(account, UUID.fromString(paymentMethodId), deleteDefaultPaymentMethodWithAutoPayOff, forceDefaultPaymentMethodDeletion, pluginProperties, callContext);
    return Response.status(Status.OK).build();
}
Also used : PluginProperty(org.killbill.billing.payment.api.PluginProperty) Account(org.killbill.billing.account.api.Account) PaymentMethod(org.killbill.billing.payment.api.PaymentMethod) CallContext(org.killbill.billing.util.callcontext.CallContext) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE) TimedResource(org.killbill.commons.metrics.TimedResource) Produces(javax.ws.rs.Produces) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 18 with DELETE

use of javax.ws.rs.DELETE in project presto by prestodb.

the class TaskResource method deleteTask.

@DELETE
@Path("{taskId}")
@Produces(MediaType.APPLICATION_JSON)
public TaskInfo deleteTask(@PathParam("taskId") TaskId taskId, @QueryParam("abort") @DefaultValue("true") boolean abort, @Context UriInfo uriInfo) {
    requireNonNull(taskId, "taskId is null");
    TaskInfo taskInfo;
    if (abort) {
        taskInfo = taskManager.abortTask(taskId);
    } else {
        taskInfo = taskManager.cancelTask(taskId);
    }
    if (shouldSummarize(uriInfo)) {
        taskInfo = taskInfo.summarize();
    }
    return taskInfo;
}
Also used : TaskInfo(com.facebook.presto.execution.TaskInfo) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE) Produces(javax.ws.rs.Produces)

Example 19 with DELETE

use of javax.ws.rs.DELETE in project exhibitor by soabase.

the class IndexResource method deleteIndex.

@Path("{index-name}")
@DELETE
@Produces(MediaType.APPLICATION_JSON)
public Response deleteIndex(@PathParam("index-name") String indexName) {
    File indexFile = getLogFile(indexName);
    context.getExhibitor().getIndexCache().markForDeletion(indexFile);
    return Response.ok(new Result("OK", true)).build();
}
Also used : File(java.io.File) Result(com.netflix.exhibitor.core.entities.Result) SearchResult(com.netflix.exhibitor.core.entities.SearchResult) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE) Produces(javax.ws.rs.Produces)

Example 20 with DELETE

use of javax.ws.rs.DELETE in project keywhiz by square.

the class GroupResource method deleteGroup.

/**
   * Delete a group
   *
   * @excludeParams automationClient
   * @param name Group name to delete
   *
   * @responseMessage 204 Group deleted
   * @responseMessage 404 Group not found
   */
@Timed
@ExceptionMetered
@DELETE
@Path("{name}")
public Response deleteGroup(@Auth AutomationClient automationClient, @PathParam("name") String name) {
    Group group = groupDAOReadWrite.getGroup(name).orElseThrow(NotFoundException::new);
    // Group memberships are deleted automatically by DB cascading.
    groupDAOReadWrite.deleteGroup(group);
    auditLog.recordEvent(new Event(Instant.now(), EventTag.GROUP_DELETE, automationClient.getName(), group.getName()));
    return Response.noContent().build();
}
Also used : Group(keywhiz.api.model.Group) NotFoundException(javax.ws.rs.NotFoundException) Event(keywhiz.log.Event) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE) Timed(com.codahale.metrics.annotation.Timed) ExceptionMetered(com.codahale.metrics.annotation.ExceptionMetered)

Aggregations

DELETE (javax.ws.rs.DELETE)202 Path (javax.ws.rs.Path)186 ApiOperation (io.swagger.annotations.ApiOperation)59 ApiResponses (io.swagger.annotations.ApiResponses)48 Produces (javax.ws.rs.Produces)43 Timed (com.codahale.metrics.annotation.Timed)31 AuditEvent (org.graylog2.audit.jersey.AuditEvent)25 IOException (java.io.IOException)20 Response (javax.ws.rs.core.Response)20 WebApplicationException (javax.ws.rs.WebApplicationException)17 HashMap (java.util.HashMap)15 NotFoundException (javax.ws.rs.NotFoundException)15 RestException (com.yahoo.pulsar.broker.web.RestException)12 Consumes (javax.ws.rs.Consumes)12 KeeperException (org.apache.zookeeper.KeeperException)12 ExceptionMetered (com.codahale.metrics.annotation.ExceptionMetered)11 ApiResponse (io.swagger.annotations.ApiResponse)11 NamespaceId (co.cask.cdap.proto.id.NamespaceId)9 ResponseBuilder (javax.ws.rs.core.Response.ResponseBuilder)9 Event (keywhiz.log.Event)9