use of com.amazonaws.services.ec2.model.KeyPairInfo in project aws-doc-sdk-examples by awsdocs.
the class DescribeKeyPairs method main.
public static void main(String[] args) {
final AmazonEC2 ec2 = AmazonEC2ClientBuilder.defaultClient();
DescribeKeyPairsResult response = ec2.describeKeyPairs();
for (KeyPairInfo key_pair : response.getKeyPairs()) {
System.out.printf("Found key pair with name %s " + "and fingerprint %s", key_pair.getKeyName(), key_pair.getKeyFingerprint());
}
}
use of com.amazonaws.services.ec2.model.KeyPairInfo in project GNS by MobilityFirst.
the class AWSEC2 method describeKeyPairs.
/**
* Describe Key Pairs
*
* @param ec2
*/
public static void describeKeyPairs(AmazonEC2 ec2) {
StringBuilder output = new StringBuilder();
String prefix = currentTab + "Key Pairs: ";
DescribeKeyPairsResult dkr = ec2.describeKeyPairs();
for (KeyPairInfo keyPairInfo : dkr.getKeyPairs()) {
output.append(prefix);
prefix = ", ";
output.append(keyPairInfo.getKeyName());
}
System.out.println(output);
}
Aggregations