Method: Fog::Compute::AWS::KeyPair#save

Defined in:
lib/fog/aws/models/compute/key_pair.rb

#saveObject



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/fog/aws/models/compute/key_pair.rb', line 23

def save
  requires :name

  data = if public_key
    connection.import_key_pair(name, public_key).body
  else
    connection.create_key_pair(name).body
  end
  new_attributes = data.reject {|key,value| !['keyFingerprint', 'keyMaterial', 'keyName'].include?(key)}
  merge_attributes(new_attributes)
  true

end