Exemplo 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 + "/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);
  }