Class: Fog::OpenStack::Compute::SecurityGroup
- Inherits:
-
Model
- Object
- Model
- Model
- Fog::OpenStack::Compute::SecurityGroup
show all
- Defined in:
- lib/fog/openstack/compute/models/security_group.rb
Instance Attribute Summary
Attributes inherited from Model
#project
Instance Method Summary
collapse
Methods inherited from Model
#create, #initialize, #update
Instance Method Details
#create_security_group_rule(min, max, ip_protocol = "tcp", cidr = "0.0.0.0/0", group_id = nil) ⇒ Object
43
44
45
46
47
|
# File 'lib/fog/openstack/compute/models/security_group.rb', line 43
def create_security_group_rule(min, max, ip_protocol = "tcp", cidr = "0.0.0.0/0", group_id = nil)
Fog::Logger.deprecation('#create_security_group_rule is deprecated. Use the Fog::OpenStack::Compute::SecurityGroupRules collection to create new rules.')
requires :id
service.create_security_group_rule(id, ip_protocol, min, max, cidr, group_id)
end
|
#delete_security_group_rule(rule_id) ⇒ Object
49
50
51
52
53
|
# File 'lib/fog/openstack/compute/models/security_group.rb', line 49
def delete_security_group_rule(rule_id)
Fog::Logger.deprecation('#create_security_group_rule is deprecated. Use the Fog::OpenStack::Compute::SecurityGroupRule objects to destroy rules.')
service.delete_security_group_rule(rule_id)
true
end
|
#destroy ⇒ Object
37
38
39
40
41
|
# File 'lib/fog/openstack/compute/models/security_group.rb', line 37
def destroy
requires :id
service.delete_security_group(id)
true
end
|
#rules ⇒ Object
18
19
20
21
|
# File 'lib/fog/openstack/compute/models/security_group.rb', line 18
def rules
Fog::Logger.deprecation('#rules is deprecated. Use #security_group_rules instead')
attributes[:security_group_rules]
end
|
#rules=(new_rules) ⇒ Object
no one should be calling this because it doesn’t do anything useful but we deprecated the rules attribute and need to maintain the API
25
26
27
28
|
# File 'lib/fog/openstack/compute/models/security_group.rb', line 25
def rules=(new_rules)
Fog::Logger.deprecation('#rules= is deprecated. Use the Fog::OpenStack::Compute::SecurityGroupRules collection to create new rules.')
attributes[:security_group_rules] = new_rules
end
|
#save ⇒ Object
30
31
32
33
34
35
|
# File 'lib/fog/openstack/compute/models/security_group.rb', line 30
def save
requires :name, :description
data = service.create_security_group(name, description)
merge_attributes(data.body['security_group'])
true
end
|
#security_group_rules ⇒ Object
14
15
16
|
# File 'lib/fog/openstack/compute/models/security_group.rb', line 14
def security_group_rules
Fog::OpenStack::Compute::SecurityGroupRules.new(:service => service).load(attributes[:security_group_rules])
end
|