Newer
Older
CactusServer / src / main / java / cactusServer / resources / InstancesRest.java
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);
	}
	
	@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) {
//		
//	}
}