Examples of DescribeKeyPairsRequest


Examples of com.amazonaws.services.ec2.model.DescribeKeyPairsRequest

     */
    try {
      /*
       * Get current key pair in Amazon
       */
      DescribeKeyPairsRequest describeKeyPairsRequest = new DescribeKeyPairsRequest();
      ec2.describeKeyPairs(describeKeyPairsRequest.withKeyNames(KEY_PAIR_NAME));

      /*
       * If key exists and new key is created, delete old key and replace
       * with new one. Else, do nothing
       */
 
View Full Code Here

Examples of com.amazonaws.services.ec2.model.DescribeKeyPairsRequest

        }

        /* Generate key pair in Amazon if necessary */
        try {
            /* Get current key pair in Amazon */
            DescribeKeyPairsRequest describeKeyPairsRequest = new DescribeKeyPairsRequest();
            ec2.describeKeyPairs(describeKeyPairsRequest.withKeyNames(keyPairName));

            /* If key exists and new key is created, delete old key and replace
             * with new one. Else, do nothing */
            if (newKey) {
                DeleteKeyPairRequest deleteKeyPairRequest = new DeleteKeyPairRequest(keyPairName);
View Full Code Here

Examples of com.amazonaws.services.ec2.model.DescribeKeyPairsRequest

        }

        /* Generate key pair in Amazon if necessary */
        try {
            /* Get current key pair in Amazon */
            DescribeKeyPairsRequest describeKeyPairsRequest = new DescribeKeyPairsRequest();
            ec2.describeKeyPairs(describeKeyPairsRequest.withKeyNames(keyPairName));

            /* If key exists and new key is created, delete old key and replace
             * with new one. Else, do nothing */
            if (newKey) {
                DeleteKeyPairRequest deleteKeyPairRequest = new DeleteKeyPairRequest(keyPairName);
View Full Code Here

Examples of com.amazonaws.services.ec2.model.DescribeKeyPairsRequest

        boolean filenameSet = (null != filename);
        boolean keyExists = false;
        if (nameSet)
        {
            log.info("Checking if key pair \"" + name + "\" exists");
            keyExists = !(ec2Client.describeKeyPairs(new DescribeKeyPairsRequest().
                    withFilters(new Filter().withName("key-name").withValues(name))).getKeyPairs().isEmpty());
        }

        if (keyExists && !filenameSet)
        {
View Full Code Here

Examples of com.amazonaws.services.ec2.model.DescribeKeyPairsRequest

        /* the second call should just do nothing */
        activity.execute(execution);
    }

    public void assertKeyNotFound(String keyName) {
        final DescribeKeyPairsRequest request = new DescribeKeyPairsRequest().withKeyNames(keyName);
        try {
            DescribeKeyPairsResult result = client.describeKeyPairs(request);
            fail("Found key " + result.getKeyPairs().get(0));

        } catch (AmazonServiceException e) {
View Full Code Here

Examples of com.amazonaws.services.ec2.model.DescribeKeyPairsRequest

        activity.execute(execution);
        assertKeyPairWasImportedAsExpected();
    }

    private void assertKeyPairWasImportedAsExpected() {
        final DescribeKeyPairsRequest request = new DescribeKeyPairsRequest().withKeyNames(KEYPAIR_NAME);
        DescribeKeyPairsResult result = client.describeKeyPairs(request);

        assertThat(result.getKeyPairs()).hasSize(1);
        assertThat(result.getKeyPairs().get(0).getKeyFingerprint()).isEqualTo(TEST_KEY_FINGERPRINT);
    }
View Full Code Here

Examples of com.amazonaws.services.ec2.model.DescribeKeyPairsRequest

        /* the second call should just do nothing */
        activity.execute(execution);
    }

    public void assertKeyNotFound(String keyName) {
        final DescribeKeyPairsRequest request = new DescribeKeyPairsRequest().withKeyNames(keyName);
        try {
            DescribeKeyPairsResult result = client.describeKeyPairs(request);
            fail("Found key " + result.getKeyPairs().get(0));

        } catch (AmazonServiceException e) {
View Full Code Here

Examples of com.amazonaws.services.ec2.model.DescribeKeyPairsRequest

        activity.execute(execution);
        assertKeyPairWasImportedAsExpected();
    }

    private void assertKeyPairWasImportedAsExpected() {
        final DescribeKeyPairsRequest request = new DescribeKeyPairsRequest().withKeyNames(KEYPAIR_NAME);
        DescribeKeyPairsResult result = client.describeKeyPairs(request);

        assertThat(result.getKeyPairs()).hasSize(1);
        assertThat(result.getKeyPairs().get(0).getKeyFingerprint()).isEqualTo(TEST_KEY_FINGERPRINT);
    }
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.