Class: Fog::Compute::Cloudstack::SecurityGroupRule
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Cloudstack::SecurityGroupRule
show all
- Defined in:
- lib/fog/cloudstack/models/compute/security_group_rule.rb
Instance Attribute Summary
Attributes inherited from Model
#collection, #connection
Instance Method Summary
collapse
Methods inherited from Model
#initialize, #inspect, #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
15
16
17
18
19
20
|
# File 'lib/fog/cloudstack/models/compute/security_group_rule.rb', line 15
def destroy
data = connection.send("revoke_security_group_#{self.direction}", "id" => self.id)
job = connection.jobs.new(data["revokesecuritygroup#{self.direction}"])
job.wait_for { ready? }
job.successful?
end
|
#port_range ⇒ Object
22
23
24
|
# File 'lib/fog/cloudstack/models/compute/security_group_rule.rb', line 22
def port_range
(self.start_port..self.end_port)
end
|
#reload ⇒ Object
41
42
43
44
45
|
# File 'lib/fog/cloudstack/models/compute/security_group_rule.rb', line 41
def reload
requires :id, :security_group_id, :cidr
merge_attributes(security_group.rules.get(self.id))
end
|
#save ⇒ Object
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/fog/cloudstack/models/compute/security_group_rule.rb', line 26
def save
requires :security_group_id, :cidr, :direction
data = connection.send("authorize_security_group_#{self.direction}".to_sym, params)
job = connection.jobs.new(data["authorizesecuritygroup#{self.direction}response"])
job.wait_for { ready? }
merge_attributes(job.result.send("#{self.direction}_rules").last)
self
end
|
#security_group ⇒ Object
37
38
39
|
# File 'lib/fog/cloudstack/models/compute/security_group_rule.rb', line 37
def security_group
connection.security_groups.get(self.security_group_id)
end
|