Example usage for java.net HttpURLConnection HTTP_PRECON_FAILED

List of usage examples for java.net HttpURLConnection HTTP_PRECON_FAILED

Introduction

In this page you can find the example usage for java.net HttpURLConnection HTTP_PRECON_FAILED.

Prototype

int HTTP_PRECON_FAILED

To view the source code for java.net HttpURLConnection HTTP_PRECON_FAILED.

Click Source Link

Document

HTTP Status-Code 412: Precondition Failed.

Usage

From source file:com.netflix.genie.server.resources.ApplicationConfigResource.java

/**
 * Update application.//w  w w .  j a v  a2  s  .com
 *
 * @param id        unique id for configuration to update
 * @param updateApp contains the application information to update
 * @return successful response, or one with an HTTP error code
 * @throws GenieException For any error
 */
@PUT
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Update an application", notes = "Update an application from the supplied information.", response = Application.class)
@ApiResponses(value = {
        @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Application to update not found"),
        @ApiResponse(code = HttpURLConnection.HTTP_PRECON_FAILED, message = "Invalid ID supplied"),
        @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Genie Server Error due to Unknown Exception") })
public Application updateApplication(
        @ApiParam(value = "Id of the application to update.", required = true) @PathParam("id") final String id,
        @ApiParam(value = "The application information to update.", required = true) final Application updateApp)
        throws GenieException {
    LOG.info("called to update application config with info " + updateApp.toString());
    return this.applicationConfigService.updateApplication(id, updateApp);
}

From source file:com.netflix.genie.server.resources.ClusterConfigResource.java

/**
 * Update a cluster configuration./*  w  w  w.  j a  v  a  2s.  co  m*/
 *
 * @param id            unique if for cluster to update
 * @param updateCluster contains the cluster information to update
 * @return the updated cluster
 * @throws GenieException For any error
 */
@PUT
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Update a cluster", notes = "Update a cluster from the supplied information.", response = Cluster.class)
@ApiResponses(value = {
        @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Cluster to update not found"),
        @ApiResponse(code = HttpURLConnection.HTTP_PRECON_FAILED, message = "Invalid required parameter supplied"),
        @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Genie Server Error due to Unknown Exception") })
public Cluster updateCluster(
        @ApiParam(value = "Id of the cluster to update.", required = true) @PathParam("id") final String id,
        @ApiParam(value = "The cluster information to update with.", required = true) final Cluster updateCluster)
        throws GenieException {
    LOG.info("Called to update cluster with id " + id + " update fields " + updateCluster);
    return this.clusterConfigService.updateCluster(id, updateCluster);
}

From source file:com.netflix.genie.server.resources.CommandConfigResource.java

/**
 * Delete all applications from database.
 *
 * @return All The deleted comamnd//from w w  w .  j av a 2s. com
 * @throws GenieException For any error
 */
@DELETE
@ApiOperation(value = "Delete all commands", notes = "Delete all available commands and get them back.", response = Command.class, responseContainer = "List")
@ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Command not found"),
        @ApiResponse(code = HttpURLConnection.HTTP_PRECON_FAILED, message = "Invalid required parameter supplied"),
        @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Genie Server Error due to Unknown Exception") })
public List<Command> deleteAllCommands() throws GenieException {
    LOG.info("called to delete all commands.");
    return this.commandConfigService.deleteAllCommands();
}

From source file:com.netflix.genie.server.resources.ClusterConfigResource.java

/**
 * Delete a cluster configuration./*w w  w. j ava  2 s.com*/
 *
 * @param id unique id for cluster to delete
 * @return the deleted cluster
 * @throws GenieException For any error
 */
@DELETE
@Path("/{id}")
@ApiOperation(value = "Delete a cluster", notes = "Delete a cluster with the supplied id.", response = Cluster.class)
@ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Cluster not found"),
        @ApiResponse(code = HttpURLConnection.HTTP_PRECON_FAILED, message = "Invalid required parameter supplied"),
        @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Genie Server Error due to Unknown Exception") })
public Cluster deleteCluster(
        @ApiParam(value = "Id of the cluster to delete.", required = true) @PathParam("id") final String id)
        throws GenieException {
    LOG.info("Delete called for id: " + id);
    return this.clusterConfigService.deleteCluster(id);
}

From source file:com.netflix.genie.server.resources.CommandConfigResource.java

/**
 * Delete a command./*  w w w  .  j a  va  2 s  . c  o m*/
 *
 * @param id unique id for configuration to delete
 * @return The deleted configuration
 * @throws GenieException For any error
 */
@DELETE
@Path("/{id}")
@ApiOperation(value = "Delete an comamnd", notes = "Delete an command with the supplied id.", response = Command.class)
@ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Command not found"),
        @ApiResponse(code = HttpURLConnection.HTTP_PRECON_FAILED, message = "Invalid required parameter supplied"),
        @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Genie Server Error due to Unknown Exception") })
public Command deleteCommand(
        @ApiParam(value = "Id of the command to delete.", required = true) @PathParam("id") final String id)
        throws GenieException {
    LOG.info("Called to delete command with id " + id);
    return this.commandConfigService.deleteCommand(id);
}

From source file:com.netflix.genie.server.resources.ApplicationConfigResource.java

/**
 * Delete an application configuration from database.
 *
 * @param id unique id of configuration to delete
 * @return The deleted application configuration
 * @throws GenieException For any error//  w  ww .j a v  a2 s .  c o  m
 */
@DELETE
@Path("/{id}")
@ApiOperation(value = "Delete an application", notes = "Delete an application with the supplied id.", response = Application.class)
@ApiResponses(value = {
        @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Application not found"),
        @ApiResponse(code = HttpURLConnection.HTTP_PRECON_FAILED, message = "Invalid ID supplied"),
        @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Genie Server Error due to Unknown Exception") })
public Application deleteApplication(
        @ApiParam(value = "Id of the application to delete.", required = true) @PathParam("id") final String id)
        throws GenieException {
    LOG.info("Delete an application with id " + id);
    return this.applicationConfigService.deleteApplication(id);
}

From source file:com.netflix.genie.server.resources.ClusterConfigResource.java

/**
 * Delete all clusters from database.//  w ww . jav  a  2 s.c om
 *
 * @return All The deleted clusters
 * @throws GenieException For any error
 */
@DELETE
@ApiOperation(value = "Delete all clusters", notes = "Delete all available clusters and get them back.", response = Cluster.class, responseContainer = "List")
@ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Cluster not found"),
        @ApiResponse(code = HttpURLConnection.HTTP_PRECON_FAILED, message = "Invalid required parameter supplied"),
        @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Genie Server Error due to Unknown Exception") })
public List<Cluster> deleteAllClusters() throws GenieException {
    LOG.info("called");
    return this.clusterConfigService.deleteAllClusters();
}

From source file:com.netflix.genie.server.resources.JobResource.java

/**
 * Kill job based on given job ID./*from   ww  w  .ja  va 2  s . co  m*/
 *
 * @param id id for job to kill
 * @return The job that was killed
 * @throws GenieException For any error
 */
@DELETE
@Path("/{id}")
@ApiOperation(value = "Delete a job", notes = "Delete the job with the id specified.", response = Job.class)
@ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Job not found"),
        @ApiResponse(code = HttpURLConnection.HTTP_PRECON_FAILED, message = "Invalid id supplied"),
        @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Genie Server Error due to Unknown Exception") })
public Job killJob(@ApiParam(value = "Id of the job.", required = true) @PathParam("id") final String id)
        throws GenieException {
    LOG.info("Called for job id: " + id);
    return this.executionService.killJob(id);
}

From source file:com.netflix.genie.server.resources.CommandConfigResource.java

/**
 * Add new configuration files to a given command.
 *
 * @param id      The id of the command to add the configuration file to. Not
 *                null/empty/blank.//from  ww w .  j  a  v  a  2s. c  o  m
 * @param configs The configuration files to add. Not null/empty/blank.
 * @return The active configurations for this command.
 * @throws GenieException For any error
 */
@POST
@Path("/{id}/configs")
@Consumes(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Add new configuration files to a command", notes = "Add the supplied configuration files to the command with the supplied id.", response = String.class, responseContainer = "List")
@ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Command not found"),
        @ApiResponse(code = HttpURLConnection.HTTP_PRECON_FAILED, message = "Invalid required parameter supplied"),
        @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Genie Server Error due to Unknown Exception") })
public Set<String> addConfigsForCommand(
        @ApiParam(value = "Id of the command to add configuration to.", required = true) @PathParam("id") final String id,
        @ApiParam(value = "The configuration files to add.", required = true) final Set<String> configs)
        throws GenieException {
    LOG.info("Called with id " + id + " and config " + configs);
    return this.commandConfigService.addConfigsForCommand(id, configs);
}

From source file:com.netflix.genie.server.resources.ApplicationConfigResource.java

/**
 * Add new configuration files to a given application.
 *
 * @param id      The id of the application to add the configuration file to. Not
 *                null/empty/blank./*from   w  ww .j  a v a2  s . c  o m*/
 * @param configs The configuration files to add. Not null/empty/blank.
 * @return The active configurations for this application.
 * @throws GenieException For any error
 */
@POST
@Path("/{id}/configs")
@Consumes(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Add new configuration files to an application", notes = "Add the supplied configuration files to the application with the supplied id.", response = String.class, responseContainer = "List")
@ApiResponses(value = {
        @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Application not found"),
        @ApiResponse(code = HttpURLConnection.HTTP_PRECON_FAILED, message = "Invalid ID supplied"),
        @ApiResponse(code = HttpURLConnection.HTTP_INTERNAL_ERROR, message = "Genie Server Error due to Unknown Exception") })
public Set<String> addConfigsToApplication(
        @ApiParam(value = "Id of the application to add configuration to.", required = true) @PathParam("id") final String id,
        @ApiParam(value = "The configuration files to add.", required = true) final Set<String> configs)
        throws GenieException {
    LOG.info("Called with id " + id + " and config " + configs);
    return this.applicationConfigService.addConfigsToApplication(id, configs);
}