Class: Fog::AWS::Compute::KeyPairs

Inherits:
Collection
  • Object
show all
Defined in:
lib/bbcloud/vendor/fog-0.3.23/lib/fog/aws/models/compute/key_pairs.rb

Instance Attribute Summary

Attributes inherited from Collection

#connection

Instance Method Summary collapse

Methods inherited from Collection

#clear, #create, #inspect, #load, model, #model, #new, #reload, #table, #to_json

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

#initialize(attributes) ⇒ KeyPairs



15
16
17
18
# File 'lib/bbcloud/vendor/fog-0.3.23/lib/fog/aws/models/compute/key_pairs.rb', line 15

def initialize(attributes)
  self.filters ||= {}
  super
end

Instance Method Details

#all(filters = filters) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/bbcloud/vendor/fog-0.3.23/lib/fog/aws/models/compute/key_pairs.rb', line 20

def all(filters = filters)
  unless filters.is_a?(Hash)
    Formatador.display_line("[yellow][WARN] all with #{filters.class} param is deprecated, use all('key-name' => []) instead[/] [light_black](#{caller.first})[/]")
    filters = {'key-name' => [*filters]}
  end
  self.filters = filters
  data = connection.describe_key_pairs(filters).body
  load(data['keySet'])
end

#get(key_name) ⇒ Object



30
31
32
33
34
# File 'lib/bbcloud/vendor/fog-0.3.23/lib/fog/aws/models/compute/key_pairs.rb', line 30

def get(key_name)
  if key_name
    self.class.new(:connection => connection).all('key-name' => key_name).first
  end
end