Class: Fog::AWS::EC2::SecurityGroups
Instance Method Summary
collapse
Methods inherited from Collection
#_dump, _load, aliases, attribute, attributes, #attributes, #connection, #connection=, #create, #inspect, #merge_attributes, model, #model, #new, #reload
Constructor Details
15
16
17
18
|
# File 'lib/fog/aws/models/ec2/security_groups.rb', line 15
def initialize(attributes)
@group_name ||= []
super
end
|
Instance Method Details
#all(group_name = @group_name) ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/fog/aws/models/ec2/security_groups.rb', line 20
def all(group_name = @group_name)
@group_name = group_name
if @loaded
clear
end
@loaded = true
data = connection.describe_security_groups(group_name).body
data['securityGroupInfo'].each do |security_group|
self << new(security_group)
end
self
end
|
#get(group_name) ⇒ Object
33
34
35
36
37
38
39
|
# File 'lib/fog/aws/models/ec2/security_groups.rb', line 33
def get(group_name)
if group_name
all(group_name).first
end
rescue Excon::Errors::BadRequest
nil
end
|