Package org.jclouds.domain

Examples of org.jclouds.domain.LoginCredentials


      String group = "group";
      TerremarkVCloudTemplateOptions options = new TerremarkVCloudTemplateOptions();

      // create mocks
      CreateNewKeyPairUnlessUserSpecifiedOtherwise strategy = setupStrategy();
      LoginCredentials keyPairCredentials = LoginCredentials.builder().privateKey(KeyPairHandlerTest.keyPair.getPrivateKey()).build();

      // setup expectations
      expect(strategy.credentialStore.containsKey("group#group")).andReturn(true);
      expect(strategy.credentialStore.get("group#group")).andReturn(keyPairCredentials);
View Full Code Here


      String systemGeneratedFingerprint = "systemGeneratedKeyPairfinger";
      TerremarkVCloudTemplateOptions options = new TerremarkVCloudTemplateOptions();

      // create mocks
      CreateNewKeyPairUnlessUserSpecifiedOtherwise strategy = setupStrategy();
      LoginCredentials keyPairCredentials = LoginCredentials.builder().privateKey(KeyPairHandlerTest.keyPair.getPrivateKey()).build();
      KeyPair keyPair = createMock(KeyPair.class);

      // setup expectations
      expect(strategy.credentialStore.containsKey("group#group")).andReturn(false);
      expect(strategy.createUniqueKeyPair.apply(new OrgAndName(org, "group"))).andReturn(keyPair);
View Full Code Here

      checkNotNull(name, "name should have %s encoded into it", group);
      checkNotNull(template, "template was null");
      checkNotNull(template.getOptions(), "template options was null");

      NodeAndInitialCredentials<N> from = client.createNodeWithGroupEncodedIntoName(group, name, template);
      LoginCredentials fromNode = from.getCredentials();
      LoginCredentials creds = prioritizeCredentialsFromTemplate.apply(template, fromNode);
      String credsKey = "node#" + from.getNodeId();
      if (creds != null) {
         credentialStore.put(credsKey, creds);
      } else {
         logger.trace("node(%s) creation did not return login credentials", from.getNodeId());
View Full Code Here

         // make sure that we don't request multiple keys simultaneously
         synchronized (credentialStore) {
            // if there is already a keypair for the group specified, use it
            if (credentialStore.containsKey("group#" + group)) {
               LoginCredentials creds = LoginCredentials.fromCredentials(credentialStore.get("group#" + group));
               checkState(creds.getOptionalPrivateKey().isPresent(),
                        "incorrect state: should have private key for: %s", creds);
               options.sshKeyFingerprint(SshKeys.fingerprintPrivateKey(creds.getPrivateKey()));
            } else {
               // otherwise create a new keypair and key it under the group
               KeyPair keyPair = createUniqueKeyPair.apply(new OrgAndName(org, group));
               credentialStore.put("group#" + group, LoginCredentials.builder().user(identity).privateKey(
                        keyPair.getPrivateKey()).build());
View Full Code Here

   @Override
   public NodeMetadata createNodeWithGroupEncodedIntoName(String group, String name, Template template) {
      InstantiateVAppTemplateOptions options = getOptions.apply(template);
      NodeAndInitialCredentials<VApp> from = computeClient.startAndReturnCredentials(URI.create(template.getLocation().getId()), URI.create(template
               .getImage().getId()), name, options, template.getOptions().getInboundPorts());
      LoginCredentials fromNode = from.getCredentials();
      if (credentialStore.containsKey("group#" + group)) {
         fromNode = fromNode == null ? LoginCredentials.fromCredentials(credentialStore.get("group#" + group))
                  : fromNode.toBuilder().privateKey(credentialStore.get("group#" + group).credential).build();
      }
      LoginCredentials creds = prioritizeCredentialsFromTemplate.apply(template, fromNode);
      if (creds != null)
         credentialStore.put("node#" + from.getNodeId(), creds);
      return vAppToNodeMetadata.apply(from.getNode());
   }
View Full Code Here

    protected void runScriptOnNode(Exchange exchange) throws CamelException {
        String script = exchange.getIn().getBody(String.class);
        String nodeId = getNodeId(exchange);
        String user = getUser(exchange);

        LoginCredentials credentials = null;

        if (user != null) {
            credentials = LoginCredentials.builder().user(user).build();
        }
        ExecResponse execResponse = null;
View Full Code Here

      // We have to actively wait until the droplet has been provisioned until
      // we can build the entire Droplet object we want to return
      nodeRunningPredicate.apply(dropletCreation.getEventId());
      Droplet droplet = api.getDropletApi().get(dropletCreation.getId());

      LoginCredentials defaultCredentials = LoginCredentials.builder().user("root")
            .privateKey(defaultKeys.get("private")).build();

      return new NodeAndInitialCredentials<Droplet>(droplet, String.valueOf(droplet.getId()), defaultCredentials);
   }
View Full Code Here

   protected SshClient getConnection() {
      if (_connection == null) {
         Credentials currentCreds = checkNotNull(creds.get(), "credential supplier returned null");

         LoginCredentials credentials = new LoginCredentials.Builder().user(currentCreds.identity)
               .password(currentCreds.credential).build();

         _connection = getSshClientFactory().create(HostAndPort.fromParts(hostname, 22), credentials);

         _connection.connect();
View Full Code Here

   @Override
   public SshClient apply(final IMachine vm) {
      String sshPort = "22";
      String guestIdentity = vm.getExtraData(GUEST_OS_USER);
      String guestCredential = vm.getExtraData(GUEST_OS_PASSWORD);
      LoginCredentials loginCredentials = LoginCredentials.builder().user(guestIdentity).password(guestCredential)
            .authenticateSudo(true).build();

      String clientIpAddress = null;

      long nicSlot = 0;
View Full Code Here

      reconfigureNetworkInterfaces(masterMachine, guestOsUser, guestOsPassword, cloneSpec.getNetworkSpec(), clone);

      postConfigurations(clone, guestOsUser, guestOsPassword);

      LoginCredentials credentials = LoginCredentials.builder()
                                                     .user(guestOsUser)
                                                     .password(guestOsPassword)
                                                     .authenticateSudo(true)
                                                     .build();
      return new NodeAndInitialCredentials<IMachine>(clone, cloneName, credentials);
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.