Java 类com.amazonaws.services.ec2.model.ImportKeyPairResult 实例源码

项目:cerberus-lifecycle-cli    文件:Ec2ServiceTest.java   
@Test
public void testImportKey() {

    String keyName = "key-name";
    String publicKeyMaterial = "public-key-material";
    String keyNameResult = "key-name-result";

    when(ec2Client.importKeyPair(new ImportKeyPairRequest(keyName, publicKeyMaterial)))
            .thenReturn(new ImportKeyPairResult().withKeyName(keyNameResult));

    // invoke method under test
    String result = ec2Service.importKey(keyName, publicKeyMaterial);

    assertEquals(keyNameResult, result);
}
项目:aws-sdk-java-resources    文件:EC2Impl.java   
@Override
public KeyPair importKeyPair(ImportKeyPairRequest request,
        ResultCapture<ImportKeyPairResult> extractor) {

    ActionResult result = service.performAction("ImportKeyPair", request,
            extractor);

    if (result == null) return null;
    return new KeyPairImpl(result.getResource());
}
项目:aws-sdk-java-resources    文件:EC2Impl.java   
@Override
public KeyPair importKeyPair(String publicKeyMaterial, String keyName,
        ResultCapture<ImportKeyPairResult> extractor) {

    ImportKeyPairRequest request = new ImportKeyPairRequest()
        .withPublicKeyMaterial(publicKeyMaterial)
        .withKeyName(keyName);
    return importKeyPair(request, extractor);
}
项目:elasticsearch_my    文件:AmazonEC2Mock.java   
@Override
public ImportKeyPairResult importKeyPair(ImportKeyPairRequest importKeyPairRequest) throws AmazonServiceException, AmazonClientException {
    throw new UnsupportedOperationException("Not supported in mock");
}
项目:aws-sdk-java-resources    文件:EC2Impl.java   
@Override
public KeyPair importKeyPair(String publicKeyMaterial, String keyName) {
    return importKeyPair(publicKeyMaterial, keyName,
            (ResultCapture<ImportKeyPairResult>)null);
}
项目:incubator-provisionr    文件:EnsureKeyPairExists.java   
private void importPoolPublicKeyPair(AmazonEC2 client, String keyName, String publicKey) {
    ImportKeyPairResult result = client.importKeyPair(new ImportKeyPairRequest()
        .withKeyName(keyName).withPublicKeyMaterial(publicKey));
    LOG.info("<< Created remote key with fingerprint {}", result.getKeyFingerprint());
}
项目:cerberus-lifecycle-cli    文件:Ec2Service.java   
/**
 * Import a key pair to AWS EC2.
 *
 * @param keyName Friendly name for the key
 * @param publicKeyMaterial Public key
 * @return Key name
 */
public String importKey(final String keyName, final String publicKeyMaterial) {
    final ImportKeyPairRequest request = new ImportKeyPairRequest(keyName, publicKeyMaterial);
    final ImportKeyPairResult result = ec2Client.importKeyPair(request);
    return result.getKeyName();
}
项目:aws-sdk-java-resources    文件:EC2.java   
/**
 * Performs the <code>ImportKeyPair</code> action and use a ResultCapture to
 * retrieve the low-level client response.
 *
 * <p>
 *
 * @return The <code>KeyPair</code> resource object associated with the
 *         result of this action.
 * @see ImportKeyPairRequest
 */
com.amazonaws.resources.ec2.KeyPair importKeyPair(ImportKeyPairRequest
        request, ResultCapture<ImportKeyPairResult> extractor);
项目:aws-sdk-java-resources    文件:EC2.java   
/**
 * The convenient method form for the <code>ImportKeyPair</code> action.
 *
 * @see #importKeyPair(ImportKeyPairRequest, ResultCapture)
 */
com.amazonaws.resources.ec2.KeyPair importKeyPair(String publicKeyMaterial,
        String keyName, ResultCapture<ImportKeyPairResult> extractor);