Class: Fog::AWS::EC2::KeyPair

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/aws/models/ec2/key_pair.rb

Instance Attribute Summary

Attributes inherited from Model

#connection

Instance Method Summary collapse

Methods inherited from Model

#collection, #initialize, #inspect, #reload, #to_json, #wait_for

Methods included from Fog::Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Fog::Attributes::InstanceMethods

#_dump, #attributes, #identity, #identity=, #merge_attributes, #new_record?, #requires

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#destroyObject



14
15
16
17
18
19
# File 'lib/fog/aws/models/ec2/key_pair.rb', line 14

def destroy
  requires :name

  connection.delete_key_pair(@name)
  true
end

#saveObject



21
22
23
24
25
26
27
28
# File 'lib/fog/aws/models/ec2/key_pair.rb', line 21

def save
  requires :name

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