Class: Fog::AWS::EC2::SecurityGroups

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

Instance Method Summary collapse

Methods inherited from Collection

#_dump, _load, aliases, attribute, attributes, #attributes, #connection, #connection=, #create, #inspect, #load, #merge_attributes, model, #model, #new, #reload, #table, #to_json

Constructor Details

#initialize(attributes) ⇒ SecurityGroups

Returns a new instance of SecurityGroups.



26
27
28
29
# File 'lib/fog/aws/models/ec2/security_groups.rb', line 26

def initialize(attributes)
  @group_name ||= []
  super
end

Instance Method Details

#all(group_name = @group_name) ⇒ Object



31
32
33
34
35
# File 'lib/fog/aws/models/ec2/security_groups.rb', line 31

def all(group_name = @group_name)
  @group_name = group_name
  data = connection.describe_security_groups(group_name).body
  load(data['securityGroupInfo'])
end

#get(group_name) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/fog/aws/models/ec2/security_groups.rb', line 37

def get(group_name)
  if group_name
    all(group_name).first
  end
rescue Excon::Errors::BadRequest
  nil
end