
com.amazonaws.services.ec2.model.ImportKeyPairRequest Maven / Gradle / Ivy
/*
* Copyright 2010-2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazonaws.services.ec2.model;
import com.amazonaws.AmazonWebServiceRequest;
/**
* Container for the parameters to the {@link com.amazonaws.services.ec2.AmazonEC2#importKeyPair(ImportKeyPairRequest) ImportKeyPair operation}.
*
* Imports the public key from an RSA key pair created with a
* third-party tool. This operation differs from CreateKeyPair as the
* private key is never transferred between the caller and AWS servers.
*
*
* RSA key pairs are easily created on Microsoft Windows and Linux OS
* systems using the ssh-keygen
command line tool provided
* with the standard OpenSSH installation. Standard library support for
* RSA key pair creation is also available for Java, Ruby, Python, and
* many other programming languages.
*
*
* The following formats are supported:
*
*
*
* - OpenSSH public key format,
* - Base64 encoded DER format.
* - SSH public key file format as specified in RFC4716 .
*
*
*
* @see com.amazonaws.services.ec2.AmazonEC2#importKeyPair(ImportKeyPairRequest)
*/
public class ImportKeyPairRequest extends AmazonWebServiceRequest {
/**
* The unique name for the key pair.
*/
private String keyName;
/**
* The public key portion of the key pair being imported.
*/
private String publicKeyMaterial;
/**
* Default constructor for a new ImportKeyPairRequest object. Callers should use the
* setter or fluent setter (with...) methods to initialize this object after creating it.
*/
public ImportKeyPairRequest() {}
/**
* Constructs a new ImportKeyPairRequest object.
* Callers should use the setter or fluent setter (with...) methods to
* initialize any additional object members.
*
* @param keyName The unique name for the key pair.
* @param publicKeyMaterial The public key portion of the key pair being
* imported.
*/
public ImportKeyPairRequest(String keyName, String publicKeyMaterial) {
this.keyName = keyName;
this.publicKeyMaterial = publicKeyMaterial;
}
/**
* The unique name for the key pair.
*
* @return The unique name for the key pair.
*/
public String getKeyName() {
return keyName;
}
/**
* The unique name for the key pair.
*
* @param keyName The unique name for the key pair.
*/
public void setKeyName(String keyName) {
this.keyName = keyName;
}
/**
* The unique name for the key pair.
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param keyName The unique name for the key pair.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public ImportKeyPairRequest withKeyName(String keyName) {
this.keyName = keyName;
return this;
}
/**
* The public key portion of the key pair being imported.
*
* @return The public key portion of the key pair being imported.
*/
public String getPublicKeyMaterial() {
return publicKeyMaterial;
}
/**
* The public key portion of the key pair being imported.
*
* @param publicKeyMaterial The public key portion of the key pair being imported.
*/
public void setPublicKeyMaterial(String publicKeyMaterial) {
this.publicKeyMaterial = publicKeyMaterial;
}
/**
* The public key portion of the key pair being imported.
*
* Returns a reference to this object so that method calls can be chained together.
*
* @param publicKeyMaterial The public key portion of the key pair being imported.
*
* @return A reference to this updated object so that method calls can be chained
* together.
*/
public ImportKeyPairRequest withPublicKeyMaterial(String publicKeyMaterial) {
this.publicKeyMaterial = publicKeyMaterial;
return this;
}
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
sb.append("KeyName: " + keyName + ", ");
sb.append("PublicKeyMaterial: " + publicKeyMaterial + ", ");
sb.append("}");
return sb.toString();
}
}