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.CommandConfigResource.java

/**
 * Get all the tags for a given command.
 *
 * @param id The id of the command to get the tags for. Not
 *           NULL/empty/blank./* w ww . j  a v a2 s.  c  om*/
 * @return The active set of tags.
 * @throws GenieException For any error
 */
@GET
@Path("/{id}/tags")
@ApiOperation(value = "Get the tags for a command", notes = "Get the tags for 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> getTagsForCommand(
        @ApiParam(value = "Id of the command to get tags for.", required = true) @PathParam("id") final String id)
        throws GenieException {
    LOG.info("Called with id " + id);
    return this.commandConfigService.getTagsForCommand(id);
}

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

/**
 * Get all the jar files for a given application.
 *
 * @param id The id of the application to get the jar files for. Not
 *           NULL/empty/blank./*from w w w.j  a v  a2 s  .  c  om*/
 * @return The set of jar files.
 * @throws GenieException For any error
 */
@GET
@Path("/{id}/jars")
@ApiOperation(value = "Get the jars for an application", notes = "Get the jars for 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> getJarsForApplication(
        @ApiParam(value = "Id of the application to get the jars for.", required = true) @PathParam("id") final String id)
        throws GenieException {
    LOG.info("Called with id " + id);
    return this.applicationConfigService.getJarsForApplication(id);
}

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

/**
 * Update the commands for a given cluster.
 *
 * @param id       The id of the cluster to update the configuration files for.
 *                 Not null/empty/blank.
 * @param commands The commands to replace existing applications with. Not
 *                 null/empty/blank./*www . ja  va 2  s .  co m*/
 * @return The new set of commands for the cluster.
 * @throws GenieException For any error
 */
@PUT
@Path("/{id}/commands")
@Consumes(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Update the commands for an cluster", notes = "Replace the existing commands for cluster with given id.", response = Command.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<Command> updateCommandsForCluster(
        @ApiParam(value = "Id of the cluster to update commands for.", required = true) @PathParam("id") final String id,
        @ApiParam(value = "The commands to replace existing with. Should already be created", required = true) final List<Command> commands)
        throws GenieException {
    LOG.info("Called with id " + id + " and commands " + commands);
    return this.clusterConfigService.updateCommandsForCluster(id, commands);
}

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

/**
 * Update the tags for a given command./*from  ww w .  j  a v a 2 s. c o m*/
 *
 * @param id   The id of the command to update the tags for.
 *             Not null/empty/blank.
 * @param tags The tags to replace existing configuration
 *             files with. Not null/empty/blank.
 * @return The new set of command tags.
 * @throws GenieException For any error
 */
@PUT
@Path("/{id}/tags")
@Consumes(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Update tags for a command", notes = "Replace the existing tags for command with given 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> updateTagsForCommand(
        @ApiParam(value = "Id of the command to update tags for.", required = true) @PathParam("id") final String id,
        @ApiParam(value = "The tags to replace existing with.", required = true) final Set<String> tags)
        throws GenieException {
    LOG.info("Called with id " + id + " and tags " + tags);
    return this.commandConfigService.updateTagsForCommand(id, tags);
}

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

/**
 * Update the jar files for a given application.
 *
 * @param id   The id of the application to update the jar files for. Not
 *             null/empty/blank./*from www  .  j  av  a 2 s. c o m*/
 * @param jars The jar files to replace existing jar files with. Not
 *             null/empty/blank.
 * @return The active set of application jars
 * @throws GenieException For any error
 */
@PUT
@Path("/{id}/jars")
@Consumes(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Update jar files for an application", notes = "Replace the existing jar files for application with given 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> updateJarsForApplication(
        @ApiParam(value = "Id of the application to update configurations for.", required = true) @PathParam("id") final String id,
        @ApiParam(value = "The jar files to replace existing with.", required = true) final Set<String> jars)
        throws GenieException {
    LOG.info("Called with id " + id + " and jars " + jars);
    return this.applicationConfigService.updateJarsForApplication(id, jars);
}

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

/**
 * Remove the all commands from a given cluster.
 *
 * @param id The id of the cluster to delete the commands from. Not
 *           null/empty/blank./*from w ww.  jav a  2s. c  om*/
 * @return Empty set if successful
 * @throws GenieException For any error
 */
@DELETE
@Path("/{id}/commands")
@ApiOperation(value = "Remove all commands from an cluster", notes = "Remove all the commands from the cluster with given id.", response = Command.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<Command> removeAllCommandsForCluster(
        @ApiParam(value = "Id of the cluster to delete from.", required = true) @PathParam("id") final String id)
        throws GenieException {
    LOG.info("Called with id " + id);
    return this.clusterConfigService.removeAllCommandsForCluster(id);
}

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

/**
 * Delete the all tags from a given command.
 *
 * @param id The id of the command to delete the tags from.
 *           Not null/empty/blank.//from ww w.  j  a va 2  s  .  c o m
 * @return Empty set if successful
 * @throws GenieException For any error
 */
@DELETE
@Path("/{id}/tags")
@ApiOperation(value = "Remove all tags from a command", notes = "Remove all the tags from the command with given id.  Note that the genie name space tags"
        + "prefixed with genie.id and genie.name cannot be deleted.", 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> removeAllTagsForCommand(
        @ApiParam(value = "Id of the command to delete from.", required = true) @PathParam("id") final String id)
        throws GenieException {
    LOG.info("Called with id " + id);
    return this.commandConfigService.removeAllTagsForCommand(id);
}

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

/**
 * Delete the all jar files from a given application.
 *
 * @param id The id of the application to delete the jar files from. Not
 *           null/empty/blank.//from  w w w  .  jav  a2  s . c o  m
 * @return Empty set if successful
 * @throws GenieException For any error
 */
@DELETE
@Path("/{id}/jars")
@ApiOperation(value = "Remove all jar files from an application", notes = "Remove all the jar files from the application with given 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> removeAllJarsForApplication(
        @ApiParam(value = "Id of the application to delete from.", required = true) @PathParam("id") final String id)
        throws GenieException {
    LOG.info("Called with id " + id);
    return this.applicationConfigService.removeAllJarsForApplication(id);
}

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

/**
 * Remove an command from a given cluster.
 *
 * @param id    The id of the cluster to delete the command from. Not
 *              null/empty/blank./*from  ww  w.j av  a  2s. c o m*/
 * @param cmdId The id of the command to remove. Not null/empty/blank.
 * @return The active set of commands for the cluster.
 * @throws GenieException For any error
 */
@DELETE
@Path("/{id}/commands/{cmdId}")
@ApiOperation(value = "Remove a command from a cluster", notes = "Remove the given command from the cluster with given id.", response = Command.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<Command> removeCommandForCluster(
        @ApiParam(value = "Id of the cluster to delete from.", required = true) @PathParam("id") final String id,
        @ApiParam(value = "The id of the command to remove.", required = true) @PathParam("cmdId") final String cmdId)
        throws GenieException {
    LOG.info("Called with id " + id + " and command id " + cmdId);
    return this.clusterConfigService.removeCommandForCluster(id, cmdId);
}

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

/**
 * Set the application for the given command.
 *
 * @param id          The id of the command to add the applications to. Not
 *                    null/empty/blank./*from  www  .  j a  v  a  2  s . c  o  m*/
 * @param application The application to set. Not null.
 * @return The active applications for this command.
 * @throws GenieException For any error
 */
@POST
@Path("/{id}/application")
@Consumes(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Set the application for a command", notes = "Set the supplied application to the command "
        + "with the supplied id. Applications should already "
        + "have been created.", response = Application.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 Application setApplicationForCommand(
        @ApiParam(value = "Id of the command to set application for.", required = true) @PathParam("id") final String id,
        @ApiParam(value = "The application to add.", required = true) final Application application)
        throws GenieException {
    LOG.info("Called with id " + id + " and application " + application);
    return this.commandConfigService.setApplicationForCommand(id, application);
}