Class: Fog::AWS::Compute::SecurityGroups

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/aws/models/compute/security_groups.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) ⇒ SecurityGroups

Returns a new instance of SecurityGroups.



14
15
16
17
# File 'lib/fog/aws/models/compute/security_groups.rb', line 14

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

Instance Method Details

#all(filters = @filters) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/fog/aws/models/compute/security_groups.rb', line 19

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

#get(group_name) ⇒ Object



29
30
31
32
33
# File 'lib/fog/aws/models/compute/security_groups.rb', line 29

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