Class: Fog::Compute::Cloudstack::SecurityGroup
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Cloudstack::SecurityGroup
show all
- Defined in:
- lib/fog/cloudstack/models/compute/security_group.rb
Instance Attribute Summary
Attributes inherited from Model
#collection, #connection
Instance Method Summary
collapse
Methods inherited from Model
#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Model
Instance Method Details
#destroy ⇒ Object
16
17
18
19
20
|
# File 'lib/fog/cloudstack/models/compute/security_group.rb', line 16
def destroy
requires :id
connection.delete_security_group('id' => self.id)
true
end
|
#egress_rules ⇒ Object
22
23
24
|
# File 'lib/fog/cloudstack/models/compute/security_group.rb', line 22
def egress_rules
attributes[:egress_rules] || []
end
|
#ingress_rules ⇒ Object
26
27
28
|
# File 'lib/fog/cloudstack/models/compute/security_group.rb', line 26
def ingress_rules
attributes[:ingress_rules] || []
end
|
#rules ⇒ Object
44
45
46
|
# File 'lib/fog/cloudstack/models/compute/security_group.rb', line 44
def rules
connection.security_group_rules.all("security_group_id" => self.id)
end
|
#save ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/fog/cloudstack/models/compute/security_group.rb', line 30
def save
requires :name
options = {
'name' => self.name,
'account' => self.account,
'description' => self.description,
'projectid' => self.project_id,
'domainid' => self.domain_id,
}
data = connection.create_security_group(options)
merge_attributes(data['createsecuritygroupresponse']['securitygroup'])
end
|