Ejemplo n.º 1
0
  /**
   * Routes the rest of the URI to {@link VirtualSystemResource}.
   *
   * @param ipAddress IP address of the host
   * @return the {@link VirtualSystemResource} object
   */
  @GET
  @Path(VIRTUAL_SYSTEM)
  public VirtualSystemCollectionDto getVirtualSystemCollectionInfo(
      @PathParam("ip") @NotNull @Ip final String ip,
      @QueryParam("hyp") @NotNull final String hypervisorType,
      @QueryParam("user") @NotNull final String user,
      @QueryParam("passwd") @NotNull final String password,
      @QueryParam(AIMPORT) @DefaultValue("8889") @Port final Integer aimport)
      throws NodecollectorException {

    Long time = System.currentTimeMillis();
    HypervisorType hypType;
    try {
      hypType = HypervisorType.fromValue(hypervisorType);
    } catch (IllegalArgumentException e) {
      throw new BadRequestException(MessageValues.UNKNOWN_HYPERVISOR);
    }
    VirtualSystemCollectionDto dtos =
        virtualSystemService.getVirtualSystemList(ip, hypType, user, password, aimport);
    time = System.currentTimeMillis() - time;
    LOGGER.debug(
        "Retrieving virtual system collection info from host with ip: '"
            + ip
            + "' took "
            + time
            + " miliseconds.");
    return dtos;
  }
Ejemplo n.º 2
0
  /**
   * Routes the rest of the URI to {@link VirtualSystemResource}.
   *
   * @param ipAddress IP address of the host
   * @return the {@link VirtualSystemResource} object
   */
  @GET
  @Path(VIRTUAL_SYSTEM + "/by_name/{uuid}")
  public VirtualSystemDto getVirtualSystemByName(
      @PathParam("ip") @NotNull @Ip final String ip,
      @PathParam("uuid") @NotNull final String uuid,
      @QueryParam("hyp") @NotNull final String hypervisorType,
      @QueryParam("user") @NotNull final String user,
      @QueryParam("passwd") @NotNull final String password,
      @QueryParam(AIMPORT) @DefaultValue("8889") @Port final Integer aimport)
      throws NodecollectorException {

    HypervisorType hypType;
    try {
      hypType = HypervisorType.fromValue(hypervisorType);
    } catch (IllegalArgumentException e) {
      throw new BadRequestException(MessageValues.UNKNOWN_HYPERVISOR);
    }

    return virtualSystemService.getVirtualSystemByName(ip, hypType, user, password, aimport, uuid);
  }