Class: Fog::AWS::EC2::KeyPairs

Inherits:
Collection show all
Defined in:
lib/fog/aws/models/ec2/key_pairs.rb

Instance Method Summary collapse

Methods inherited from Collection

#initialize, #inspect, #update_attributes

Constructor Details

This class inherits a constructor from Fog::Collection

Instance Method Details

#all(key_names = []) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/fog/aws/models/ec2/key_pairs.rb', line 11

def all(key_names = [])
  data = connection.describe_key_pairs(key_names).body
  key_pairs = []
  data['keySet'].each do |key|
    key_pairs << Fog::AWS::EC2::KeyPair.new({
      :connection => connection
    }.merge!(key))
  end
  key_pairs
end

#create(attributes = {}) ⇒ Object



22
23
24
25
26
# File 'lib/fog/aws/models/ec2/key_pairs.rb', line 22

def create(attributes = {})
  bucket = new(attributes)
  bucket.save
  bucket
end

#new(attributes = {}) ⇒ Object



28
29
30
# File 'lib/fog/aws/models/ec2/key_pairs.rb', line 28

def new(attributes = {})
  Fog::AWS::EC2::KeyPair.new(attributes.merge!(:connection => connection))
end