/* * Copyright 2018-2023 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 java.io.Serializable; import javax.annotation.Generated; /** *
* Describes a key pair. *
* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class KeyPairInfo implements Serializable, Cloneable { /** ** The ID of the key pair. *
*/ private String keyPairId; /** ** If you used CreateKeyPair to create the key pair: *
** For RSA key pairs, the key fingerprint is the SHA-1 digest of the DER encoded private key. *
** For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for * OpenSSH, starting with OpenSSH 6.8. *
** If you used ImportKeyPair to provide Amazon Web Services the public key: *
** For RSA key pairs, the key fingerprint is the MD5 public key fingerprint as specified in section 4 of RFC4716. *
** For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for * OpenSSH, starting with OpenSSH 6.8. *
** The name of the key pair. *
*/ private String keyName; /** ** The type of key pair. *
*/ private String keyType; /** ** Any tags applied to the key pair. *
*/ private com.amazonaws.internal.SdkInternalList* The public key material. *
*/ private String publicKey; /** ** If you used Amazon EC2 to create the key pair, this is the date and time when the key was created, in ISO 8601 date-time format, in the UTC time * zone. *
** If you imported an existing key pair to Amazon EC2, this is the date and time the key was imported, in ISO 8601 date-time format, in the UTC time * zone. *
*/ private java.util.Date createTime; /** ** The ID of the key pair. *
* * @param keyPairId * The ID of the key pair. */ public void setKeyPairId(String keyPairId) { this.keyPairId = keyPairId; } /** ** The ID of the key pair. *
* * @return The ID of the key pair. */ public String getKeyPairId() { return this.keyPairId; } /** ** The ID of the key pair. *
* * @param keyPairId * The ID of the key pair. * @return Returns a reference to this object so that method calls can be chained together. */ public KeyPairInfo withKeyPairId(String keyPairId) { setKeyPairId(keyPairId); return this; } /** ** If you used CreateKeyPair to create the key pair: *
** For RSA key pairs, the key fingerprint is the SHA-1 digest of the DER encoded private key. *
** For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for * OpenSSH, starting with OpenSSH 6.8. *
** If you used ImportKeyPair to provide Amazon Web Services the public key: *
** For RSA key pairs, the key fingerprint is the MD5 public key fingerprint as specified in section 4 of RFC4716. *
** For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for * OpenSSH, starting with OpenSSH 6.8. *
** For RSA key pairs, the key fingerprint is the SHA-1 digest of the DER encoded private key. *
** For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for * OpenSSH, starting with OpenSSH 6.8. *
** If you used ImportKeyPair to provide Amazon Web Services the public key: *
** For RSA key pairs, the key fingerprint is the MD5 public key fingerprint as specified in section 4 of * RFC4716. *
** For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for * OpenSSH, starting with OpenSSH 6.8. *
** If you used CreateKeyPair to create the key pair: *
** For RSA key pairs, the key fingerprint is the SHA-1 digest of the DER encoded private key. *
** For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for * OpenSSH, starting with OpenSSH 6.8. *
** If you used ImportKeyPair to provide Amazon Web Services the public key: *
** For RSA key pairs, the key fingerprint is the MD5 public key fingerprint as specified in section 4 of RFC4716. *
** For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for * OpenSSH, starting with OpenSSH 6.8. *
** For RSA key pairs, the key fingerprint is the SHA-1 digest of the DER encoded private key. *
** For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for * OpenSSH, starting with OpenSSH 6.8. *
** If you used ImportKeyPair to provide Amazon Web Services the public key: *
** For RSA key pairs, the key fingerprint is the MD5 public key fingerprint as specified in section 4 of * RFC4716. *
** For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for * OpenSSH, starting with OpenSSH 6.8. *
** If you used CreateKeyPair to create the key pair: *
** For RSA key pairs, the key fingerprint is the SHA-1 digest of the DER encoded private key. *
** For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for * OpenSSH, starting with OpenSSH 6.8. *
** If you used ImportKeyPair to provide Amazon Web Services the public key: *
** For RSA key pairs, the key fingerprint is the MD5 public key fingerprint as specified in section 4 of RFC4716. *
** For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for * OpenSSH, starting with OpenSSH 6.8. *
** For RSA key pairs, the key fingerprint is the SHA-1 digest of the DER encoded private key. *
** For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for * OpenSSH, starting with OpenSSH 6.8. *
** If you used ImportKeyPair to provide Amazon Web Services the public key: *
** For RSA key pairs, the key fingerprint is the MD5 public key fingerprint as specified in section 4 of * RFC4716. *
** For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for * OpenSSH, starting with OpenSSH 6.8. *
** The name of the key pair. *
* * @param keyName * The name of the key pair. */ public void setKeyName(String keyName) { this.keyName = keyName; } /** ** The name of the key pair. *
* * @return The name of the key pair. */ public String getKeyName() { return this.keyName; } /** ** The name of the key pair. *
* * @param keyName * The name of the key pair. * @return Returns a reference to this object so that method calls can be chained together. */ public KeyPairInfo withKeyName(String keyName) { setKeyName(keyName); return this; } /** ** The type of key pair. *
* * @param keyType * The type of key pair. * @see KeyType */ public void setKeyType(String keyType) { this.keyType = keyType; } /** ** The type of key pair. *
* * @return The type of key pair. * @see KeyType */ public String getKeyType() { return this.keyType; } /** ** The type of key pair. *
* * @param keyType * The type of key pair. * @return Returns a reference to this object so that method calls can be chained together. * @see KeyType */ public KeyPairInfo withKeyType(String keyType) { setKeyType(keyType); return this; } /** ** The type of key pair. *
* * @param keyType * The type of key pair. * @return Returns a reference to this object so that method calls can be chained together. * @see KeyType */ public KeyPairInfo withKeyType(KeyType keyType) { this.keyType = keyType.toString(); return this; } /** ** Any tags applied to the key pair. *
* * @return Any tags applied to the key pair. */ public java.util.List* Any tags applied to the key pair. *
* * @param tags * Any tags applied to the key pair. */ public void setTags(java.util.Collection* Any tags applied to the key pair. *
** NOTE: This method appends the values to the existing list (if any). Use * {@link #setTags(java.util.Collection)} or {@link #withTags(java.util.Collection)} if you want to override the * existing values. *
* * @param tags * Any tags applied to the key pair. * @return Returns a reference to this object so that method calls can be chained together. */ public KeyPairInfo withTags(Tag... tags) { if (this.tags == null) { setTags(new com.amazonaws.internal.SdkInternalList* Any tags applied to the key pair. *
* * @param tags * Any tags applied to the key pair. * @return Returns a reference to this object so that method calls can be chained together. */ public KeyPairInfo withTags(java.util.Collection* The public key material. *
* * @param publicKey * The public key material. */ public void setPublicKey(String publicKey) { this.publicKey = publicKey; } /** ** The public key material. *
* * @return The public key material. */ public String getPublicKey() { return this.publicKey; } /** ** The public key material. *
* * @param publicKey * The public key material. * @return Returns a reference to this object so that method calls can be chained together. */ public KeyPairInfo withPublicKey(String publicKey) { setPublicKey(publicKey); return this; } /** ** If you used Amazon EC2 to create the key pair, this is the date and time when the key was created, in ISO 8601 date-time format, in the UTC time * zone. *
** If you imported an existing key pair to Amazon EC2, this is the date and time the key was imported, in ISO 8601 date-time format, in the UTC time * zone. *
* * @param createTime * If you used Amazon EC2 to create the key pair, this is the date and time when the key was created, in ISO 8601 date-time format, in the UTC * time zone. ** If you imported an existing key pair to Amazon EC2, this is the date and time the key was imported, in ISO 8601 date-time format, in the UTC * time zone. */ public void setCreateTime(java.util.Date createTime) { this.createTime = createTime; } /** *
* If you used Amazon EC2 to create the key pair, this is the date and time when the key was created, in ISO 8601 date-time format, in the UTC time * zone. *
** If you imported an existing key pair to Amazon EC2, this is the date and time the key was imported, in ISO 8601 date-time format, in the UTC time * zone. *
* * @return If you used Amazon EC2 to create the key pair, this is the date and time when the key was created, in ISO 8601 date-time format, in the UTC * time zone. ** If you imported an existing key pair to Amazon EC2, this is the date and time the key was imported, in ISO 8601 date-time format, in the UTC * time zone. */ public java.util.Date getCreateTime() { return this.createTime; } /** *
* If you used Amazon EC2 to create the key pair, this is the date and time when the key was created, in ISO 8601 date-time format, in the UTC time * zone. *
** If you imported an existing key pair to Amazon EC2, this is the date and time the key was imported, in ISO 8601 date-time format, in the UTC time * zone. *
* * @param createTime * If you used Amazon EC2 to create the key pair, this is the date and time when the key was created, in ISO 8601 date-time format, in the UTC * time zone. ** If you imported an existing key pair to Amazon EC2, this is the date and time the key was imported, in ISO 8601 date-time format, in the UTC * time zone. * @return Returns a reference to this object so that method calls can be chained together. */ public KeyPairInfo withCreateTime(java.util.Date createTime) { setCreateTime(createTime); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getKeyPairId() != null) sb.append("KeyPairId: ").append(getKeyPairId()).append(","); if (getKeyFingerprint() != null) sb.append("KeyFingerprint: ").append(getKeyFingerprint()).append(","); if (getKeyName() != null) sb.append("KeyName: ").append(getKeyName()).append(","); if (getKeyType() != null) sb.append("KeyType: ").append(getKeyType()).append(","); if (getTags() != null) sb.append("Tags: ").append(getTags()).append(","); if (getPublicKey() != null) sb.append("PublicKey: ").append(getPublicKey()).append(","); if (getCreateTime() != null) sb.append("CreateTime: ").append(getCreateTime()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof KeyPairInfo == false) return false; KeyPairInfo other = (KeyPairInfo) obj; if (other.getKeyPairId() == null ^ this.getKeyPairId() == null) return false; if (other.getKeyPairId() != null && other.getKeyPairId().equals(this.getKeyPairId()) == false) return false; if (other.getKeyFingerprint() == null ^ this.getKeyFingerprint() == null) return false; if (other.getKeyFingerprint() != null && other.getKeyFingerprint().equals(this.getKeyFingerprint()) == false) return false; if (other.getKeyName() == null ^ this.getKeyName() == null) return false; if (other.getKeyName() != null && other.getKeyName().equals(this.getKeyName()) == false) return false; if (other.getKeyType() == null ^ this.getKeyType() == null) return false; if (other.getKeyType() != null && other.getKeyType().equals(this.getKeyType()) == false) return false; if (other.getTags() == null ^ this.getTags() == null) return false; if (other.getTags() != null && other.getTags().equals(this.getTags()) == false) return false; if (other.getPublicKey() == null ^ this.getPublicKey() == null) return false; if (other.getPublicKey() != null && other.getPublicKey().equals(this.getPublicKey()) == false) return false; if (other.getCreateTime() == null ^ this.getCreateTime() == null) return false; if (other.getCreateTime() != null && other.getCreateTime().equals(this.getCreateTime()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getKeyPairId() == null) ? 0 : getKeyPairId().hashCode()); hashCode = prime * hashCode + ((getKeyFingerprint() == null) ? 0 : getKeyFingerprint().hashCode()); hashCode = prime * hashCode + ((getKeyName() == null) ? 0 : getKeyName().hashCode()); hashCode = prime * hashCode + ((getKeyType() == null) ? 0 : getKeyType().hashCode()); hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); hashCode = prime * hashCode + ((getPublicKey() == null) ? 0 : getPublicKey().hashCode()); hashCode = prime * hashCode + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); return hashCode; } @Override public KeyPairInfo clone() { try { return (KeyPairInfo) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } }