@Test public void postVMDeploymentNotInDB() { DeploymentDAO deploymentDAO = mock(DeploymentDAO.class); when(deploymentDAO.getById(11)).thenReturn(null); String vmRequest = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<vm xmlns=\"http: + "<ovf-id>pepito</ovf-id>" + "</vm>"; VMRest vmRest = new VMRest(); vmRest.deploymentDAO = deploymentDAO; Response response = vmRest.postVM("", "aa", true, vmRequest); assertEquals(400, response.getStatus()); assertEquals("Invalid deploymentID number!!!", (String) response.getEntity()); response = vmRest.postVM("", "11", true, vmRequest); assertEquals(400, response.getStatus()); assertEquals("No deployment by that ID in the DB!!!", (String) response.getEntity()); }
@POST @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_XML) public Response postVM(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId, @DefaultValue("false") @QueryParam("force") boolean force, String payload) { logger.info("POST request to /applications/" + applicationName + "/deployments/" + deploymentId + "/vms?force=" + force); logger.info("With payload: " + payload); VM vm = ModelConverter.xmlVMToObject(payload); if(vm == null) { return buildResponse(Status.BAD_REQUEST, "Malformed XML request!!!"); } else if (vm.getOvfId() == null) { return buildResponse(Status.BAD_REQUEST, "Missing ovf-id!!!"); } int deploymentIdInt = 0; try { deploymentIdInt = Integer.parseInt(deploymentId); } catch(NumberFormatException ex) { return buildResponse(Status.BAD_REQUEST, "Invalid deploymentID number!!!"); } Deployment deployment = deploymentDAO.getById(deploymentIdInt); if(deployment == null) { return buildResponse(Status.BAD_REQUEST, "No deployment by that ID in the DB!!!"); } if(!deployment.getStatus().equals(APPLICATION_STATUS_DEPLOYED)) { return buildResponse(Status.BAD_REQUEST, "No Active deployment!!!"); } String ovf = deployment.getOvf(); boolean ovfIdPresentInOvf = OVFUtils.containsVMWithThatOvfId(ovf, vm.getOvfId()); if(!ovfIdPresentInOvf) { return buildResponse(Status.BAD_REQUEST, "No VM avaiblabe by that ovf-id for this deployment!!!"); } VMLimits vmLimits = OVFUtils.getUpperAndLowerVMlimits(OVFUtils.getVirtualSystemForOvfId(deployment.getOvf(), vm.getOvfId())); List<VM> vms = vmDAO.getVMsWithOVfIdForDeploymentNotDeleted(vm.getOvfId(), deploymentIdInt); if(vms.size() >= vmLimits.getUpperNumberOfVMs()) { return buildResponse(Status.BAD_REQUEST, vm.getOvfId() + " number of VMs already at its maximum!!!"); } if(force == true) { return createVM(ovf, vm, vms, applicationName, vmLimits, deployment); } else { Agreement agreement = agreementDAO.getAcceptedAgreement(deployment); if(agreement == null) { return createVM(ovf, vm, vms, applicationName, vmLimits, deployment); } SLAAgreementHelper helper = new SLAAgreementHelper(agreement.getSlaAgreement()); double slaPowerApp = helper.getPowerUsagePerApp(); double slaPowerVM = helper.getPowerUsagePerOVFId(vm.getOvfId()); if(slaPowerApp == 0.0 && slaPowerVM == 0.0) { return createVM(ovf, vm, vms, applicationName, vmLimits, deployment); } List<VM> activeVMs = vmDAO.getVMsWithOvfIdAndActive(deploymentIdInt, vm.getOvfId()); if(activeVMs.size() == 0) { return createVM(ovf, vm, vms, applicationName, vmLimits, deployment); } double powerEstimation = getEnergyOrPowerEstimation(applicationName, deploymentId, "" + activeVMs.get(0).getId(), null, Unit.POWER, 0l); if(powerEstimation > slaPowerApp) { return buildResponse(Status.FORBIDDEN, "Over the limit of the SLA agreement per this VM type... !!!"); } List<String> ids = getVmsIds(deployment); powerEstimation = energyModeller.estimate(deployment.getProviderId(), applicationName, deploymentId, ids, null, Unit.POWER, 0l); if(powerEstimation > slaPowerApp) { return buildResponse(Status.FORBIDDEN, "Over the limit of the SLA agreement per application... !!!"); } return createVM(ovf, vm, vms, applicationName, vmLimits, deployment); } }
VMRest extends AbstractRest { @POST @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_XML) public Response postVM(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId, @DefaultValue("false") @QueryParam("force") boolean force, String payload) { logger.info("POST request to /applications/" + applicationName + "/deployments/" + deploymentId + "/vms?force=" + force); logger.info("With payload: " + payload); VM vm = ModelConverter.xmlVMToObject(payload); if(vm == null) { return buildResponse(Status.BAD_REQUEST, "Malformed XML request!!!"); } else if (vm.getOvfId() == null) { return buildResponse(Status.BAD_REQUEST, "Missing ovf-id!!!"); } int deploymentIdInt = 0; try { deploymentIdInt = Integer.parseInt(deploymentId); } catch(NumberFormatException ex) { return buildResponse(Status.BAD_REQUEST, "Invalid deploymentID number!!!"); } Deployment deployment = deploymentDAO.getById(deploymentIdInt); if(deployment == null) { return buildResponse(Status.BAD_REQUEST, "No deployment by that ID in the DB!!!"); } if(!deployment.getStatus().equals(APPLICATION_STATUS_DEPLOYED)) { return buildResponse(Status.BAD_REQUEST, "No Active deployment!!!"); } String ovf = deployment.getOvf(); boolean ovfIdPresentInOvf = OVFUtils.containsVMWithThatOvfId(ovf, vm.getOvfId()); if(!ovfIdPresentInOvf) { return buildResponse(Status.BAD_REQUEST, "No VM avaiblabe by that ovf-id for this deployment!!!"); } VMLimits vmLimits = OVFUtils.getUpperAndLowerVMlimits(OVFUtils.getVirtualSystemForOvfId(deployment.getOvf(), vm.getOvfId())); List<VM> vms = vmDAO.getVMsWithOVfIdForDeploymentNotDeleted(vm.getOvfId(), deploymentIdInt); if(vms.size() >= vmLimits.getUpperNumberOfVMs()) { return buildResponse(Status.BAD_REQUEST, vm.getOvfId() + " number of VMs already at its maximum!!!"); } if(force == true) { return createVM(ovf, vm, vms, applicationName, vmLimits, deployment); } else { Agreement agreement = agreementDAO.getAcceptedAgreement(deployment); if(agreement == null) { return createVM(ovf, vm, vms, applicationName, vmLimits, deployment); } SLAAgreementHelper helper = new SLAAgreementHelper(agreement.getSlaAgreement()); double slaPowerApp = helper.getPowerUsagePerApp(); double slaPowerVM = helper.getPowerUsagePerOVFId(vm.getOvfId()); if(slaPowerApp == 0.0 && slaPowerVM == 0.0) { return createVM(ovf, vm, vms, applicationName, vmLimits, deployment); } List<VM> activeVMs = vmDAO.getVMsWithOvfIdAndActive(deploymentIdInt, vm.getOvfId()); if(activeVMs.size() == 0) { return createVM(ovf, vm, vms, applicationName, vmLimits, deployment); } double powerEstimation = getEnergyOrPowerEstimation(applicationName, deploymentId, "" + activeVMs.get(0).getId(), null, Unit.POWER, 0l); if(powerEstimation > slaPowerApp) { return buildResponse(Status.FORBIDDEN, "Over the limit of the SLA agreement per this VM type... !!!"); } List<String> ids = getVmsIds(deployment); powerEstimation = energyModeller.estimate(deployment.getProviderId(), applicationName, deploymentId, ids, null, Unit.POWER, 0l); if(powerEstimation > slaPowerApp) { return buildResponse(Status.FORBIDDEN, "Over the limit of the SLA agreement per application... !!!"); } return createVM(ovf, vm, vms, applicationName, vmLimits, deployment); } } }
VMRest extends AbstractRest { @POST @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_XML) public Response postVM(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId, @DefaultValue("false") @QueryParam("force") boolean force, String payload) { logger.info("POST request to /applications/" + applicationName + "/deployments/" + deploymentId + "/vms?force=" + force); logger.info("With payload: " + payload); VM vm = ModelConverter.xmlVMToObject(payload); if(vm == null) { return buildResponse(Status.BAD_REQUEST, "Malformed XML request!!!"); } else if (vm.getOvfId() == null) { return buildResponse(Status.BAD_REQUEST, "Missing ovf-id!!!"); } int deploymentIdInt = 0; try { deploymentIdInt = Integer.parseInt(deploymentId); } catch(NumberFormatException ex) { return buildResponse(Status.BAD_REQUEST, "Invalid deploymentID number!!!"); } Deployment deployment = deploymentDAO.getById(deploymentIdInt); if(deployment == null) { return buildResponse(Status.BAD_REQUEST, "No deployment by that ID in the DB!!!"); } if(!deployment.getStatus().equals(APPLICATION_STATUS_DEPLOYED)) { return buildResponse(Status.BAD_REQUEST, "No Active deployment!!!"); } String ovf = deployment.getOvf(); boolean ovfIdPresentInOvf = OVFUtils.containsVMWithThatOvfId(ovf, vm.getOvfId()); if(!ovfIdPresentInOvf) { return buildResponse(Status.BAD_REQUEST, "No VM avaiblabe by that ovf-id for this deployment!!!"); } VMLimits vmLimits = OVFUtils.getUpperAndLowerVMlimits(OVFUtils.getVirtualSystemForOvfId(deployment.getOvf(), vm.getOvfId())); List<VM> vms = vmDAO.getVMsWithOVfIdForDeploymentNotDeleted(vm.getOvfId(), deploymentIdInt); if(vms.size() >= vmLimits.getUpperNumberOfVMs()) { return buildResponse(Status.BAD_REQUEST, vm.getOvfId() + " number of VMs already at its maximum!!!"); } if(force == true) { return createVM(ovf, vm, vms, applicationName, vmLimits, deployment); } else { Agreement agreement = agreementDAO.getAcceptedAgreement(deployment); if(agreement == null) { return createVM(ovf, vm, vms, applicationName, vmLimits, deployment); } SLAAgreementHelper helper = new SLAAgreementHelper(agreement.getSlaAgreement()); double slaPowerApp = helper.getPowerUsagePerApp(); double slaPowerVM = helper.getPowerUsagePerOVFId(vm.getOvfId()); if(slaPowerApp == 0.0 && slaPowerVM == 0.0) { return createVM(ovf, vm, vms, applicationName, vmLimits, deployment); } List<VM> activeVMs = vmDAO.getVMsWithOvfIdAndActive(deploymentIdInt, vm.getOvfId()); if(activeVMs.size() == 0) { return createVM(ovf, vm, vms, applicationName, vmLimits, deployment); } double powerEstimation = getEnergyOrPowerEstimation(applicationName, deploymentId, "" + activeVMs.get(0).getId(), null, Unit.POWER, 0l); if(powerEstimation > slaPowerApp) { return buildResponse(Status.FORBIDDEN, "Over the limit of the SLA agreement per this VM type... !!!"); } List<String> ids = getVmsIds(deployment); powerEstimation = energyModeller.estimate(deployment.getProviderId(), applicationName, deploymentId, ids, null, Unit.POWER, 0l); if(powerEstimation > slaPowerApp) { return buildResponse(Status.FORBIDDEN, "Over the limit of the SLA agreement per application... !!!"); } return createVM(ovf, vm, vms, applicationName, vmLimits, deployment); } }  }
VMRest extends AbstractRest { @POST @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_XML) public Response postVM(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId, @DefaultValue("false") @QueryParam("force") boolean force, String payload) { logger.info("POST request to /applications/" + applicationName + "/deployments/" + deploymentId + "/vms?force=" + force); logger.info("With payload: " + payload); VM vm = ModelConverter.xmlVMToObject(payload); if(vm == null) { return buildResponse(Status.BAD_REQUEST, "Malformed XML request!!!"); } else if (vm.getOvfId() == null) { return buildResponse(Status.BAD_REQUEST, "Missing ovf-id!!!"); } int deploymentIdInt = 0; try { deploymentIdInt = Integer.parseInt(deploymentId); } catch(NumberFormatException ex) { return buildResponse(Status.BAD_REQUEST, "Invalid deploymentID number!!!"); } Deployment deployment = deploymentDAO.getById(deploymentIdInt); if(deployment == null) { return buildResponse(Status.BAD_REQUEST, "No deployment by that ID in the DB!!!"); } if(!deployment.getStatus().equals(APPLICATION_STATUS_DEPLOYED)) { return buildResponse(Status.BAD_REQUEST, "No Active deployment!!!"); } String ovf = deployment.getOvf(); boolean ovfIdPresentInOvf = OVFUtils.containsVMWithThatOvfId(ovf, vm.getOvfId()); if(!ovfIdPresentInOvf) { return buildResponse(Status.BAD_REQUEST, "No VM avaiblabe by that ovf-id for this deployment!!!"); } VMLimits vmLimits = OVFUtils.getUpperAndLowerVMlimits(OVFUtils.getVirtualSystemForOvfId(deployment.getOvf(), vm.getOvfId())); List<VM> vms = vmDAO.getVMsWithOVfIdForDeploymentNotDeleted(vm.getOvfId(), deploymentIdInt); if(vms.size() >= vmLimits.getUpperNumberOfVMs()) { return buildResponse(Status.BAD_REQUEST, vm.getOvfId() + " number of VMs already at its maximum!!!"); } if(force == true) { return createVM(ovf, vm, vms, applicationName, vmLimits, deployment); } else { Agreement agreement = agreementDAO.getAcceptedAgreement(deployment); if(agreement == null) { return createVM(ovf, vm, vms, applicationName, vmLimits, deployment); } SLAAgreementHelper helper = new SLAAgreementHelper(agreement.getSlaAgreement()); double slaPowerApp = helper.getPowerUsagePerApp(); double slaPowerVM = helper.getPowerUsagePerOVFId(vm.getOvfId()); if(slaPowerApp == 0.0 && slaPowerVM == 0.0) { return createVM(ovf, vm, vms, applicationName, vmLimits, deployment); } List<VM> activeVMs = vmDAO.getVMsWithOvfIdAndActive(deploymentIdInt, vm.getOvfId()); if(activeVMs.size() == 0) { return createVM(ovf, vm, vms, applicationName, vmLimits, deployment); } double powerEstimation = getEnergyOrPowerEstimation(applicationName, deploymentId, "" + activeVMs.get(0).getId(), null, Unit.POWER, 0l); if(powerEstimation > slaPowerApp) { return buildResponse(Status.FORBIDDEN, "Over the limit of the SLA agreement per this VM type... !!!"); } List<String> ids = getVmsIds(deployment); powerEstimation = energyModeller.estimate(deployment.getProviderId(), applicationName, deploymentId, ids, null, Unit.POWER, 0l); if(powerEstimation > slaPowerApp) { return buildResponse(Status.FORBIDDEN, "Over the limit of the SLA agreement per application... !!!"); } return createVM(ovf, vm, vms, applicationName, vmLimits, deployment); } }  @GET @Produces(MediaType.APPLICATION_XML) Response getVMs(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId); @POST @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_XML) Response postVM(@PathParam("application_name") String applicationName, 
						   @PathParam("deployment_id") String deploymentId,
						   @DefaultValue("false") @QueryParam("force") boolean force,
						   String payload); @DELETE @Path("{vm_id}") Response deleteVM(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId, @PathParam("vm_id") String vmId); @GET @Path("{vm_id}") @Produces(MediaType.APPLICATION_XML) Response getVM(@PathParam("application_name") String applicationName,  @PathParam("deployment_id") String deploymentId, @PathParam("vm_id") String vmId); @GET @Path("{vm_id}/energy-estimation") @Produces(MediaType.APPLICATION_XML) Response getEnergyEstimation(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId,
			                             @DefaultValue("0") @QueryParam("duration") long duration); @GET @Path("{vm_id}/events/{event_id}/energy-estimation") @Produces(MediaType.APPLICATION_XML) Response getEnergyEstimationForAnEvent(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId,
			                             @PathParam("event_id") String eventId,
			                             @DefaultValue("0") @QueryParam("duration") long duration); @GET @Path("{vm_id}/power-estimation") @Produces(MediaType.APPLICATION_XML) Response getPowerEstimation(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId); @GET @Path("{vm_id}/events/{event_id}/power-estimation") @Produces(MediaType.APPLICATION_XML) Response getPowerEstimationForAnEvent(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId,
			                             @PathParam("event_id") String eventId); @GET @Path("{vm_id}/events/{event_id}/cost-estimation") @Produces(MediaType.APPLICATION_XML) Response getCostEstimation(@PathParam("application_name") String applicationName, 
			                          @PathParam("deployment_id") String deploymentId,
			                          @PathParam("vm_id") String vmId,
			                          @PathParam("event_id") String eventId); @GET @Path("{vm_id}/events/{event_id}/energy-consumption") @Produces(MediaType.APPLICATION_XML) Response getEventEnergyConsumption(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId,
			                             @PathParam("event_id") String eventId,
			                             @DefaultValue("0") @QueryParam("startTime") long startTime,
			                             @DefaultValue("0") @QueryParam("endTime") long endTime); @GET @Path("{vm_id}/events/{event_id}/power-consumption") @Produces(MediaType.APPLICATION_XML) Response getEventPowerConsumption(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId,
			                             @PathParam("event_id") String eventId,
			                             @QueryParam("startTime") long startTime,
			                             @QueryParam("endTime") long endTime,
			                             @Context UriInfo uriInfo); @GET @Path("{vm_id}/energy-consumption") @Produces(MediaType.APPLICATION_XML) Response getEnergyConsumption(@PathParam("application_name") String applicationName, 
										@PathParam("deployment_id") String deploymentId,
										@PathParam("vm_id") String vmId,
										@DefaultValue("0") @QueryParam("startTime") long startTime,
										@DefaultValue("0") @QueryParam("endTime") long endTime); @GET @Path("{vm_id}/power-consumption") @Produces(MediaType.APPLICATION_XML) Response getPowerConsumption(@PathParam("application_name") String applicationName, 
										@PathParam("deployment_id") String deploymentId,
										@PathParam("vm_id") String vmId,
										@DefaultValue("0") @QueryParam("startTime") long startTime,
										@DefaultValue("0") @QueryParam("endTime") long endTime,
										@Context UriInfo uriInfo); @GET @Path("{vm_id}/events/{event_id}/energy-sample") @Produces(MediaType.APPLICATION_XML) Response getEnergySample(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId,
			                             @PathParam("event_id") String eventId,
			                             @DefaultValue("0") @QueryParam("startTime") long startTime,
			                             @DefaultValue("0") @QueryParam("endTime") long endTime,
			                             @DefaultValue("0") @QueryParam("interval") long interval); }
VMRest extends AbstractRest { @POST @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_XML) public Response postVM(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId, @DefaultValue("false") @QueryParam("force") boolean force, String payload) { logger.info("POST request to /applications/" + applicationName + "/deployments/" + deploymentId + "/vms?force=" + force); logger.info("With payload: " + payload); VM vm = ModelConverter.xmlVMToObject(payload); if(vm == null) { return buildResponse(Status.BAD_REQUEST, "Malformed XML request!!!"); } else if (vm.getOvfId() == null) { return buildResponse(Status.BAD_REQUEST, "Missing ovf-id!!!"); } int deploymentIdInt = 0; try { deploymentIdInt = Integer.parseInt(deploymentId); } catch(NumberFormatException ex) { return buildResponse(Status.BAD_REQUEST, "Invalid deploymentID number!!!"); } Deployment deployment = deploymentDAO.getById(deploymentIdInt); if(deployment == null) { return buildResponse(Status.BAD_REQUEST, "No deployment by that ID in the DB!!!"); } if(!deployment.getStatus().equals(APPLICATION_STATUS_DEPLOYED)) { return buildResponse(Status.BAD_REQUEST, "No Active deployment!!!"); } String ovf = deployment.getOvf(); boolean ovfIdPresentInOvf = OVFUtils.containsVMWithThatOvfId(ovf, vm.getOvfId()); if(!ovfIdPresentInOvf) { return buildResponse(Status.BAD_REQUEST, "No VM avaiblabe by that ovf-id for this deployment!!!"); } VMLimits vmLimits = OVFUtils.getUpperAndLowerVMlimits(OVFUtils.getVirtualSystemForOvfId(deployment.getOvf(), vm.getOvfId())); List<VM> vms = vmDAO.getVMsWithOVfIdForDeploymentNotDeleted(vm.getOvfId(), deploymentIdInt); if(vms.size() >= vmLimits.getUpperNumberOfVMs()) { return buildResponse(Status.BAD_REQUEST, vm.getOvfId() + " number of VMs already at its maximum!!!"); } if(force == true) { return createVM(ovf, vm, vms, applicationName, vmLimits, deployment); } else { Agreement agreement = agreementDAO.getAcceptedAgreement(deployment); if(agreement == null) { return createVM(ovf, vm, vms, applicationName, vmLimits, deployment); } SLAAgreementHelper helper = new SLAAgreementHelper(agreement.getSlaAgreement()); double slaPowerApp = helper.getPowerUsagePerApp(); double slaPowerVM = helper.getPowerUsagePerOVFId(vm.getOvfId()); if(slaPowerApp == 0.0 && slaPowerVM == 0.0) { return createVM(ovf, vm, vms, applicationName, vmLimits, deployment); } List<VM> activeVMs = vmDAO.getVMsWithOvfIdAndActive(deploymentIdInt, vm.getOvfId()); if(activeVMs.size() == 0) { return createVM(ovf, vm, vms, applicationName, vmLimits, deployment); } double powerEstimation = getEnergyOrPowerEstimation(applicationName, deploymentId, "" + activeVMs.get(0).getId(), null, Unit.POWER, 0l); if(powerEstimation > slaPowerApp) { return buildResponse(Status.FORBIDDEN, "Over the limit of the SLA agreement per this VM type... !!!"); } List<String> ids = getVmsIds(deployment); powerEstimation = energyModeller.estimate(deployment.getProviderId(), applicationName, deploymentId, ids, null, Unit.POWER, 0l); if(powerEstimation > slaPowerApp) { return buildResponse(Status.FORBIDDEN, "Over the limit of the SLA agreement per application... !!!"); } return createVM(ovf, vm, vms, applicationName, vmLimits, deployment); } }  @GET @Produces(MediaType.APPLICATION_XML) Response getVMs(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId); @POST @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_XML) Response postVM(@PathParam("application_name") String applicationName, 
						   @PathParam("deployment_id") String deploymentId,
						   @DefaultValue("false") @QueryParam("force") boolean force,
						   String payload); @DELETE @Path("{vm_id}") Response deleteVM(@PathParam("application_name") String applicationName, @PathParam("deployment_id") String deploymentId, @PathParam("vm_id") String vmId); @GET @Path("{vm_id}") @Produces(MediaType.APPLICATION_XML) Response getVM(@PathParam("application_name") String applicationName,  @PathParam("deployment_id") String deploymentId, @PathParam("vm_id") String vmId); @GET @Path("{vm_id}/energy-estimation") @Produces(MediaType.APPLICATION_XML) Response getEnergyEstimation(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId,
			                             @DefaultValue("0") @QueryParam("duration") long duration); @GET @Path("{vm_id}/events/{event_id}/energy-estimation") @Produces(MediaType.APPLICATION_XML) Response getEnergyEstimationForAnEvent(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId,
			                             @PathParam("event_id") String eventId,
			                             @DefaultValue("0") @QueryParam("duration") long duration); @GET @Path("{vm_id}/power-estimation") @Produces(MediaType.APPLICATION_XML) Response getPowerEstimation(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId); @GET @Path("{vm_id}/events/{event_id}/power-estimation") @Produces(MediaType.APPLICATION_XML) Response getPowerEstimationForAnEvent(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId,
			                             @PathParam("event_id") String eventId); @GET @Path("{vm_id}/events/{event_id}/cost-estimation") @Produces(MediaType.APPLICATION_XML) Response getCostEstimation(@PathParam("application_name") String applicationName, 
			                          @PathParam("deployment_id") String deploymentId,
			                          @PathParam("vm_id") String vmId,
			                          @PathParam("event_id") String eventId); @GET @Path("{vm_id}/events/{event_id}/energy-consumption") @Produces(MediaType.APPLICATION_XML) Response getEventEnergyConsumption(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId,
			                             @PathParam("event_id") String eventId,
			                             @DefaultValue("0") @QueryParam("startTime") long startTime,
			                             @DefaultValue("0") @QueryParam("endTime") long endTime); @GET @Path("{vm_id}/events/{event_id}/power-consumption") @Produces(MediaType.APPLICATION_XML) Response getEventPowerConsumption(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId,
			                             @PathParam("event_id") String eventId,
			                             @QueryParam("startTime") long startTime,
			                             @QueryParam("endTime") long endTime,
			                             @Context UriInfo uriInfo); @GET @Path("{vm_id}/energy-consumption") @Produces(MediaType.APPLICATION_XML) Response getEnergyConsumption(@PathParam("application_name") String applicationName, 
										@PathParam("deployment_id") String deploymentId,
										@PathParam("vm_id") String vmId,
										@DefaultValue("0") @QueryParam("startTime") long startTime,
										@DefaultValue("0") @QueryParam("endTime") long endTime); @GET @Path("{vm_id}/power-consumption") @Produces(MediaType.APPLICATION_XML) Response getPowerConsumption(@PathParam("application_name") String applicationName, 
										@PathParam("deployment_id") String deploymentId,
										@PathParam("vm_id") String vmId,
										@DefaultValue("0") @QueryParam("startTime") long startTime,
										@DefaultValue("0") @QueryParam("endTime") long endTime,
										@Context UriInfo uriInfo); @GET @Path("{vm_id}/events/{event_id}/energy-sample") @Produces(MediaType.APPLICATION_XML) Response getEnergySample(@PathParam("application_name") String applicationName, 
			                             @PathParam("deployment_id") String deploymentId,
			                             @PathParam("vm_id") String vmId,
			                             @PathParam("event_id") String eventId,
			                             @DefaultValue("0") @QueryParam("startTime") long startTime,
			                             @DefaultValue("0") @QueryParam("endTime") long endTime,
			                             @DefaultValue("0") @QueryParam("interval") long interval);  }