Examples of KeyPair


Examples of org.jclouds.openstack.nova.v2_0.domain.KeyPair

      options.diskConfig(templateOptions.getDiskConfig());

      Optional<String> privateKey = Optional.absent();
      if (templateOptions.getKeyPairName() != null) {
         options.keyPairName(templateOptions.getKeyPairName());       
         KeyPair keyPair = keyPairCache.getIfPresent(ZoneAndName.fromZoneAndName(template.getLocation().getId(), templateOptions.getKeyPairName()));
         if (keyPair != null && keyPair.getPrivateKey() != null) {
            privateKey = Optional.of(keyPair.getPrivateKey());
            credentialsBuilder.privateKey(privateKey.get());
         }
      }

      String zoneId = template.getLocation().getId();
View Full Code Here

Examples of org.jclouds.trmk.vcloud_0_8.domain.KeyPair

public class KeyPairByNameHandlerTest extends BaseHandlerTest {

   public void testGood() throws UnknownHostException {
      InputStream is = getClass().getResourceAsStream("/keysList.xml");

      KeyPair result = factory.create(
            addOrgAndNameToHandler(injector.getInstance(KeyPairByNameHandler.class), "org", "default")).parse(is);
      assertEquals(result,
            new KeyPair(URI.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/extensions/key/9"),
                  "default", true, null, "4e:af:8a:9f:e9:d2:72:d7:4b:a0:da:98:72:98:4d:7d"));

   }
View Full Code Here

Examples of org.nimbustools.api.services.security.KeyPair

    public CreateKeyPairResponseType createKeyPair(CreateKeyPairType createKeyPairRequestMsg)
            throws RemoteException {

        final String keyName = createKeyPairRequestMsg.getKeyName();

        final KeyPair keyPair;
        try {
            keyPair = keyManager.generateKey(keyName, containerInterface.getCaller());

        } catch (AuthorizationException e) {
            logger.error("Error generating keypair",e);
            throw new RemoteException("You do not have authorization to generate a keypair");
        } catch (OperationDisabledException e) {
            logger.error("Error generating keypair",e);
            throw new RemoteException("Key generation is not supported");
        } catch (KeyExistsException e) {
            logger.error("Error generating keypair",e);
            throw new RemoteException("A keypair named '"+keyName+"' already exists");
        }

        return new CreateKeyPairResponseType(
                keyPair.getFingerprint(),
                keyPair.getPrivateKey(),
                keyName, ""); // TODO do something real with requestId
    }
View Full Code Here

Examples of org.openstack.model.compute.KeyPair

        create.setName(serverName);

        if (request.sshPublicKey != null) {
          if (cloudBehaviours.supportsPublicKeys()) {
            OpenstackCloudHelpers cloudHelpers = new OpenstackCloudHelpers();
            KeyPair keyPair = cloudHelpers.ensurePublicKeyUploaded(computeClient, request.sshPublicKeyName,
                request.sshPublicKey);
            create.setKeyName(keyPair.getName());
          } else if (cloudBehaviours.supportsFileInjection()) {
            String fileContents = SshKeys.serialize(request.sshPublicKey);
            create.addUploadFile("/root/.ssh/authorized_keys", Utf8.getBytes(fileContents));
          } else {
            throw new OpsException("No supported SSH key mechanism on cloud");
View Full Code Here

Examples of org.openstack.model.compute.KeyPair

    return null;
  }

  public KeyPair ensurePublicKeyUploaded(OpenstackComputeClient compute, String name, PublicKey sshPublicKey)
      throws OpsException {
    KeyPair keyPair = findPublicKey(compute, sshPublicKey);

    if (keyPair == null) {
      if (name == null) {
        name = UUID.randomUUID().toString();
      }

      String publicKey = SshKeys.serialize(sshPublicKey);
      KeyPair create = new KeyPair();
      create.setName(name);
      create.setPublicKey(publicKey);

      log.info("Creating SSH key: " + create.getName());
      compute.root().keyPairs().create(create);
    }

    keyPair = findPublicKey(compute, sshPublicKey);
    if (keyPair == null) {
View Full Code Here

Examples of org.wso2.carbon.ec2client.data.KeyPair

        List<KeyPair> keyPairs = new ArrayList<KeyPair>();
        DescribeKeyPairsResponseItemType[] items =
                response.getDescribeKeyPairsResponse().getKeySet().getItem();
        for (DescribeKeyPairsResponseItemType item : items) {
            KeyPair keyPair = new KeyPair(item.getKeyName(), item.getKeyFingerprint());
            keyPairs.add(keyPair);
        }
        return keyPairs;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.