コード例 #1
0
  @DELETE
  @Path("action/deallocate")
  public synchronized void deallocate(
      @PathParam(VirtualApplianceResource.VIRTUAL_APPLIANCE) Integer virtualApplianceId,
      @PathParam(VirtualMachineResource.VIRTUAL_MACHINE) Integer virtualMachineId,
      @Context IRESTBuilder restBuilder)
      throws Exception {

    service.deallocateVirtualMachine(virtualMachineId);
  }
コード例 #2
0
  @PUT
  @Path("action/allocate")
  public synchronized VirtualMachineDto allocate(
      @PathParam(VirtualApplianceResource.VIRTUAL_APPLIANCE) Integer virtualApplianceId,
      @PathParam(VirtualMachineResource.VIRTUAL_MACHINE) Integer virtualMachineId,
      String forceEnterpriseLimitsStr,
      @Context IRESTBuilder restBuilder)
      throws Exception {

    Boolean forceEnterpriseLimits = Boolean.parseBoolean(forceEnterpriseLimitsStr);
    // get user form the authentication layer
    // User user = userService.getCurrentUser();

    VirtualMachine vmachine =
        service.allocateVirtualMachine(virtualMachineId, virtualApplianceId, forceEnterpriseLimits);

    service.updateVirtualMachineUse(virtualApplianceId, vmachine);

    return ModelTransformer.transportFromPersistence(VirtualMachineDto.class, vmachine);
  }
コード例 #3
0
  @PUT
  @Path("action/checkedit")
  public synchronized void checkEditAllocate(
      @PathParam(VirtualApplianceResource.VIRTUAL_APPLIANCE) Integer virtualApplianceId,
      @PathParam(VirtualMachineResource.VIRTUAL_MACHINE) Integer virtualMachineId,
      VirtualMachineDto vmachine,
      @Context IRESTBuilder restBuilder)
      throws Exception {
    // Boolean forceEnterpriseLimits = Boolean.parseBoolean(forceEnterpriseLimitsStr);
    // get user form the authentication layer
    // User user = userService.getCurrentUser();

    service.checkAllocate(virtualApplianceId, virtualMachineId, vmachine, true);
  }