コード例 #1
0
  @Override
  public Long getIdPublicAddressOfVM(VirtualMachine vm) {
    if (vm.publicIpAddress() != null) {
      return vm.publicIpAddress().get().getId();
    }

    return null;
  }
コード例 #2
0
  @Override
  public RemoteConnection apply(VirtualMachine virtualMachine) {

    checkArgument(virtualMachine.publicIpAddress().isPresent());
    checkArgument(virtualMachine.loginName().isPresent());
    checkArgument(virtualMachine.loginPassword().isPresent());
    int remotePort = virtualMachine.remotePort();
    OSFamily osFamily = virtualMachine.osFamily();

    return connectionService.getRemoteConnection(
        HostAndPort.fromParts(virtualMachine.publicIpAddress().get().getIp(), remotePort),
        osFamily,
        LoginCredentialBuilder.newBuilder()
            .password(virtualMachine.loginPassword().get())
            .username(virtualMachine.loginName().get())
            .build());
  }