Class: Fog::AWS::EC2::SecurityGroups
Instance Method Summary
collapse
Methods inherited from Collection
aliases, attribute, attributes, #attributes, #inspect, #merge_attributes
Constructor Details
Returns a new instance of SecurityGroups.
13
14
15
16
|
# File 'lib/fog/aws/models/ec2/security_groups.rb', line 13
def initialize(attributes)
@group_name ||= []
super
end
|
Instance Method Details
#all(group_name = []) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/fog/aws/models/ec2/security_groups.rb', line 18
def all(group_name = [])
data = connection.describe_security_groups(group_name).body
security_groups = Fog::AWS::EC2::SecurityGroups.new({
:connection => connection,
:group_name => group_name
}.merge!(attributes))
data['securityGroupInfo'].each do |security_group|
security_groups << Fog::AWS::EC2::SecurityGroup.new({
:connection => connection,
:security_groups => self
}.merge!(security_group))
end
security_groups
end
|
#create(attributes = {}) ⇒ Object
33
34
35
36
37
|
# File 'lib/fog/aws/models/ec2/security_groups.rb', line 33
def create(attributes = {})
security_group = new(attributes)
security_group.save
security_group
end
|
#get(group_name) ⇒ Object
39
40
41
42
43
|
# File 'lib/fog/aws/models/ec2/security_groups.rb', line 39
def get(group_name)
all(group_name).first
rescue Fog::Errors::BadRequest
nil
end
|
#new(attributes = {}) ⇒ Object
45
46
47
48
49
50
51
52
|
# File 'lib/fog/aws/models/ec2/security_groups.rb', line 45
def new(attributes = {})
Fog::AWS::EC2::SecurityGroup.new(
attributes.merge!(
:connection => connection,
:security_groups => self
)
)
end
|
#reload ⇒ Object
54
55
56
|
# File 'lib/fog/aws/models/ec2/security_groups.rb', line 54
def reload
all(group_name)
end
|