Package org.jclouds.domain

Examples of org.jclouds.domain.LoginCredentials


      }
      return started;
   }

   private void populateCredentials(Set<RunningInstance> input, TemplateOptions options) {
      LoginCredentials credentials = null;
      for (RunningInstance instance : input) {
         credentials = instanceToCredentials.getUnchecked(instance).orNull();
         if (credentials != null)
            break;
      }
View Full Code Here


      template = buildTemplate(client.templateBuilder());
      template.getOptions().blockOnPort(22, 120);
      try {
         Set<? extends NodeMetadata> nodes = client.createNodesInGroup(group, 1, template);
         NodeMetadata node = get(nodes, 0);
         LoginCredentials good = node.getCredentials();
         assert good.identity != null : nodes;

         for (Entry<? extends NodeMetadata, ExecResponse> response : client.runScriptOnNodesMatching(
               runningInGroup(group), "hostname",
               wrapInInitScript(false).runAsRoot(false).overrideLoginCredentials(good)).entrySet()) {
View Full Code Here

         serverLatestJobCompleted.apply(addedServer);
         client.getServerServices().power(addedServer.getName(), PowerCommand.START);
         serverLatestJobCompletedShort.apply(addedServer);
         addedServer = Iterables.getOnlyElement(client.getServerServices().getServersByName(addedServer.getName()));
      }
      LoginCredentials credentials = LoginCredentials.fromCredentials(client.getServerServices()
               .getServerCredentialsList().get(addedServer.getName()));
      return new NodeAndInitialCredentials<Server>(addedServer, addedServer.getId() + "", credentials);
   }
View Full Code Here

         NodeMetadata nodeMetadata = nodeMetaDataSet.toArray(new NodeMetadata[0])[0];

         // If we have multiple nodes we just want the headers, but not full details.
         printNodeInfo(service, nodeMetaDataSet, nodeMetaDataSet.size() == 1, System.out);

         LoginCredentials credentials = nodeMetadata.getCredentials();

         user = EnvHelper.getUser(user);
         password = EnvHelper.getPassword(password);

         if (user != null) {
            LoginCredentials.Builder loginBuilder;
            if (credentials == null) {
               loginBuilder = LoginCredentials.builder();
            } else {
               loginBuilder = credentials.toBuilder();
            }
            if (password != null) {
               credentials = loginBuilder.user(user).password(password).build();
            } else {
               credentials = loginBuilder.user(user).build();
View Full Code Here

      if (publicAddresses.size() > 0) {
        host = publicAddresses.get(0);
      }
    }
    int port = node.getLoginPort();
    LoginCredentials credentials = node.getCredentials();
    // TODO is there a better way to figure this out if there's no credentials?
    String user = "admin";
    String password = null;
    if (credentials != null) {
      user = credentials.getUser();
      password = credentials.getPassword();
    }

    // open the terminal view
    IViewPart vp = FabricPlugin.openTerminalView();
    if (vp == null || vp instanceof SshView == false) {
View Full Code Here

      @Override
      public ByteSource apply(Credentials from) {
         checkNotNull(from, "inputCredentials");
         if (from instanceof LoginCredentials) {
            LoginCredentials login = LoginCredentials.class.cast(from);
            JsonLoginCredentials val = new JsonLoginCredentials();
            val.user = login.getUser();
            val.password = login.getOptionalPassword().orNull();
            val.privateKey = login.getOptionalPrivateKey().orNull();
            if (login.shouldAuthenticateSudo())
               val.authenticateSudo = login.shouldAuthenticateSudo();
            return ByteSource.wrap(json.toJson(val).getBytes(Charsets.UTF_8));
         }
         return ByteSource.wrap(json.toJson(from).getBytes(Charsets.UTF_8));
      }
View Full Code Here

  private static SshjSshClient getSSHClient(URL url, String privateKey) {
    return getSSHClient(url.getHost(), privateKey);
  }

  private static SshjSshClient getSSHClient(String host, String privateKey) {
    final LoginCredentials credential = LoginCredentials
        .fromCredentials(new Credentials("ubuntu", privateKey));
    final HostAndPort socket = HostAndPort.fromParts(host, 22);
    final SshjSshClient client = new SshjSshClient(
        new BackoffLimitedRetryHandler(), socket, credential, 5000);
    return client;
View Full Code Here

      String loginUser = System.getProperty("loginUser", "toor");
     
      // note that you can check if a provider is present ahead of time
      checkArgument(contains(allKeys, provider), "provider %s not in supported list: %s", provider, allKeys);

      LoginCredentials login = (action != Action.DESTROY) ? getLoginForCommandExecution(action) : null;

      ComputeService compute = initComputeService(provider, identity, credential);

      try {
         switch (action) {
View Full Code Here

      String minRam = System.getProperty("minRam");

      // note that you can check if a provider is present ahead of time
      checkArgument(contains(allKeys, provider), "provider %s not in supported list: %s", provider, allKeys);

      LoginCredentials login = action != Action.DESTROY ? getLoginForCommandExecution(action) : null;

      ComputeService compute = initComputeService(provider, identity, credential);

      try {
         switch (action) {
View Full Code Here

      // Now we can get the password data, decrypt it, and get a LoginCredentials instance
      PasswordDataAndPrivateKey dataAndKey = new PasswordDataAndPrivateKey(
         ec2Client.getWindowsServices().getPasswordDataInRegion(region, node.getProviderId()),
         node.getCredentials().getPrivateKey());
      WindowsLoginCredentialsFromEncryptedData f = context.getUtils().getInjector().getInstance(WindowsLoginCredentialsFromEncryptedData.class);
      LoginCredentials credentials = f.apply(dataAndKey);

      // Send to the log the details you need to log in to the instance with RDP
      String publicIp = Iterables.getFirst(node.getPublicAddresses(), null);
      logger.info("IP address: %s", publicIp);
      logger.info("Login name: %s", credentials.getUser());
      logger.info("Password:   %s", credentials.getPassword());

      // Wait for Enter on the console
      logger.info("Hit Enter to shut down the node.");
      InputStreamReader converter = new InputStreamReader(System.in);
      BufferedReader in = new BufferedReader(converter);
View Full Code Here

TOP

Related Classes of org.jclouds.domain.LoginCredentials

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.