Class: Aws::EC2::KeyPairInfo
- Inherits:
-
Object
- Object
- Aws::EC2::KeyPairInfo
- Extended by:
- Deprecations
- Defined in:
- lib/aws-sdk-ec2/key_pair_info.rb
Defined Under Namespace
Classes: Collection
Read-Only Attributes collapse
-
#key_fingerprint ⇒ String
If you used CreateKeyPair to create the key pair, this is the SHA-1 digest of the DER encoded private key.
- #name ⇒ String (also: #key_name)
Actions collapse
- #delete(options = {}) ⇒ EmptyStructure
- #identifiers ⇒ Object deprecated private Deprecated.
Instance Method Summary collapse
- #client ⇒ Client
-
#data ⇒ Types::KeyPairInfo
Returns the data for this KeyPairInfo.
-
#data_loaded? ⇒ Boolean
Returns ‘true` if this resource is loaded.
-
#initialize(*args) ⇒ KeyPairInfo
constructor
A new instance of KeyPairInfo.
-
#load ⇒ self
(also: #reload)
Loads, or reloads #data for the current KeyPairInfo.
Constructor Details
#initialize(name, options = {}) ⇒ KeyPairInfo #initialize(options = {}) ⇒ KeyPairInfo
Returns a new instance of KeyPairInfo.
19 20 21 22 23 24 |
# File 'lib/aws-sdk-ec2/key_pair_info.rb', line 19 def initialize(*args) = Hash === args.last ? args.pop.dup : {} @name = extract_name(args, ) @data = .delete(:data) @client = .delete(:client) || Client.new() end |
Instance Method Details
#data ⇒ Types::KeyPairInfo
Returns the data for this Aws::EC2::KeyPairInfo. Calls Client#describe_key_pairs if #data_loaded? is ‘false`.
66 67 68 69 |
# File 'lib/aws-sdk-ec2/key_pair_info.rb', line 66 def data load unless @data @data end |
#data_loaded? ⇒ Boolean
74 75 76 |
# File 'lib/aws-sdk-ec2/key_pair_info.rb', line 74 def data_loaded? !!@data end |
#delete(options = {}) ⇒ EmptyStructure
92 93 94 95 96 |
# File 'lib/aws-sdk-ec2/key_pair_info.rb', line 92 def delete( = {}) = .merge(key_name: @name) resp = @client.delete_key_pair() resp.data end |
#identifiers ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
100 101 102 |
# File 'lib/aws-sdk-ec2/key_pair_info.rb', line 100 def identifiers { name: @name } end |
#key_fingerprint ⇒ String
If you used CreateKeyPair to create the key pair, this is the SHA-1 digest of the DER encoded private key. If you used ImportKeyPair to provide AWS the public key, this is the MD5 public key fingerprint as specified in section 4 of RFC4716.
39 40 41 |
# File 'lib/aws-sdk-ec2/key_pair_info.rb', line 39 def key_fingerprint data.key_fingerprint end |
#load ⇒ self Also known as: reload
Loads, or reloads #data for the current Aws::EC2::KeyPairInfo. Returns ‘self` making it possible to chain methods.
key_pair_info.reload.data
56 57 58 59 60 |
# File 'lib/aws-sdk-ec2/key_pair_info.rb', line 56 def load resp = @client.describe_key_pairs(key_names: [@name]) @data = resp.key_pairs[0] self end |
#name ⇒ String Also known as: key_name
29 30 31 |
# File 'lib/aws-sdk-ec2/key_pair_info.rb', line 29 def name @name end |