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

/**
 * Add new configuration files to a given cluster.
 *
 * @param id      The id of the cluster to add the configuration file to. Not
 *                null/empty/blank.//  w ww  .  ja  va2s  . co  m
 * @param configs The configuration files to add. Not null/empty/blank.
 * @return The active configurations for this cluster.
 * @throws GenieException For any error
 */
@POST
@Path("/{id}/configs")
@Consumes(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Add new configuration files to a cluster", notes = "Add the supplied configuration files to the cluster with the supplied id.", response = String.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 Set<String> addConfigsForCluster(
        @ApiParam(value = "Id of the cluster 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.clusterConfigService.addConfigsForCluster(id, configs);
}

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

/**
 * Add new tags to a given job.//  w w  w  . j a  v a 2s.  co m
 *
 * @param id   The id of the job to add the tags to. Not
 *             null/empty/blank.
 * @param tags The tags to add. Not null/empty/blank.
 * @return The active tags for this job.
 * @throws GenieException For any error
 */
@POST
@Path("/{id}/tags")
@Consumes(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Add new tags to a job", notes = "Add the supplied tags to the job with the supplied id.", response = String.class, responseContainer = "List")
@ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_BAD_REQUEST, message = "Bad Request"),
        @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Job for id does not exist."),
        @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> addTagsForJob(
        @ApiParam(value = "Id of the job to add configuration to.", required = true) @PathParam("id") final String id,
        @ApiParam(value = "The tags to add.", required = true) final Set<String> tags) throws GenieException {
    LOG.info("Called with id " + id + " and tags " + tags);
    return this.jobService.addTagsForJob(id, tags);
}

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

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

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

/**
 * Get all the configuration files for a given application.
 *
 * @param id The id of the application to get the configuration files for.
 *           Not NULL/empty/blank.// ww w.  ja  va 2s . c o m
 * @return The active set of configuration files.
 * @throws GenieException For any error
 */
@GET
@Path("/{id}/configs")
@ApiOperation(value = "Get the configuration files for an application", notes = "Get the configuration files 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> getConfigsForApplication(
        @ApiParam(value = "Id of the application to get configurations for.", required = true) @PathParam("id") final String id)
        throws GenieException {
    LOG.info("Called with id " + id);
    return this.applicationConfigService.getConfigsForApplication(id);
}

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

/**
 * Get all the configuration files for a given cluster.
 *
 * @param id The id of the cluster to get the configuration files for. Not
 *           NULL/empty/blank.//from   w  w w.j av a2 s .  c  om
 * @return The active set of configuration files.
 * @throws GenieException For any error
 */
@GET
@Path("/{id}/configs")
@ApiOperation(value = "Get the configuration files for a cluster", notes = "Get the configuration files for the cluster with the supplied id.", response = String.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 Set<String> getConfigsForCluster(
        @ApiParam(value = "Id of the cluster to get configurations for.", required = true) @PathParam("id") final String id)
        throws GenieException {
    LOG.info("Called with id " + id);
    return this.clusterConfigService.getConfigsForCluster(id);
}

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

/**
 * Get all the tags for a given job.//from  ww w  . j  a va  2  s  . c om
 *
 * @param id The id of the job to get the tags for. Not
 *           NULL/empty/blank.
 * @return The active set of tags.
 * @throws GenieException For any error
 */
@GET
@Path("/{id}/tags")
@ApiOperation(value = "Get the tags for a job", notes = "Get the tags for the job with the supplied id.", response = String.class, responseContainer = "List")
@ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_BAD_REQUEST, message = "Bad Request"),
        @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Job for id does not exist."),
        @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> getTagsForJob(
        @ApiParam(value = "Id of the job to get tags for.", required = true) @PathParam("id") final String id)
        throws GenieException {
    LOG.info("Called with id " + id);
    return this.jobService.getTagsForJob(id);
}

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

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

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

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

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

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

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

/**
 * Update the tags for a given job.//from ww  w . j av a 2s .co  m
 *
 * @param id   The id of the job 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 job tags.
 * @throws GenieException For any error
 */
@PUT
@Path("/{id}/tags")
@Consumes(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Update tags for a job", notes = "Replace the existing tags for job with given id.", response = String.class, responseContainer = "List")
@ApiResponses(value = { @ApiResponse(code = HttpURLConnection.HTTP_BAD_REQUEST, message = "Bad Request"),
        @ApiResponse(code = HttpURLConnection.HTTP_NOT_FOUND, message = "Job for id does not exist."),
        @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> updateTagsForJob(
        @ApiParam(value = "Id of the job 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.jobService.updateTagsForJob(id, tags);
}