package cactusServer.resources;
import javax.ws.rs.DELETE;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import cactusServer.entities.Instance;
import cactusServer.models.Instances;
@Path("instances")
public class InstancesRest {
public InstancesRest() {
}
@Path("/test")
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hoge() {
return "deploy jenkins from tomcat";
}
@Path("/{instanceId}")
@GET
@Produces(MediaType.APPLICATION_JSON)
public Instance getInstance(@PathParam("instanceId") String instanceId) {
return Instances.getInstance().getInstance(instanceId);
}
// @Path("/areas")
// @GET
// @Produces(MediaType.APPLICATION_JSON)
// public Instance getArea(@QueryParam("areaId") String areaId) {
// return null;
// }
// @GET
// @Path("/characters")
// @Produces(MediaType.APPLICATION_JSON)
// public Instance getCharacter(@QueryParam("AccountUniqueId") String AccountUniqueId) {
// return Instances.getInstance().getCharacter(AccountUniqueId);
// }
//
//
// @POST
// @Path("/{createCharacter}")
// @Produces(MediaType.APPLICATION_JSON)
// public Instance createCharacter(@QueryParam("characterUniqueId") String characterUniqueId) {
// return Instances.getInstance().createCharacter(characterUniqueId);
// }
@POST
@Path("/createInstance")
@Produces(MediaType.APPLICATION_JSON)
public Instance create(@QueryParam("instanceId") String instanceId, @QueryParam("name") String name) {
return Instances.getInstance().createInstance(instanceId, name);
}
@DELETE
@Path("/destroyInstance")
@Produces(MediaType.APPLICATION_JSON)
public Instance destroy(@QueryParam("instanceId") String instanceId) {
return Instances.getInstance().destroyInstance(instanceId);
}
// @Path("/{instanceId}")
// @PUT
// public Instance putInstance(@PathParam("InstanceId") String instanceId, @FormParam("areaId") int areaId,
// @FormParam("objectId") int objectId, @FormParam("characterId") String characterId) {
//
// }
}