Class: Fog::Compute::Cloudstack::SecurityGroupRules
- Inherits:
-
Fog::Collection
- Object
- Array
- Fog::Collection
- Fog::Compute::Cloudstack::SecurityGroupRules
- Defined in:
- lib/fog/cloudstack/models/compute/security_group_rules.rb
Instance Attribute Summary
Attributes inherited from Fog::Collection
Instance Method Summary collapse
- #all(options = {}) ⇒ Object
- #create(attributes) ⇒ Object
- #get(rule_id) ⇒ Object
- #security_group ⇒ Object
Methods inherited from Fog::Collection
#clear, #destroy, #initialize, #inspect, #load, model, #model, #new, #reload, #table, #to_json
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Collection
Instance Method Details
#all(options = {}) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/fog/cloudstack/models/compute/security_group_rules.rb', line 23 def all(={}) merge_attributes() security_group = self.security_group rules = security_group.ingress_rules.map{|r| r.merge("direction" => "ingress", "security_group_id" => security_group_id)} rules += security_group.egress_rules.map{|r| r.merge("direction" => "egress", "security_group_id" => security_group_id)} load(rules) end |
#create(attributes) ⇒ Object
18 19 20 21 |
# File 'lib/fog/cloudstack/models/compute/security_group_rules.rb', line 18 def create(attributes) model = self.new(attributes.merge(:security_group_id => self.security_group_id)) model.save end |
#get(rule_id) ⇒ Object
31 32 33 |
# File 'lib/fog/cloudstack/models/compute/security_group_rules.rb', line 31 def get(rule_id) all.find{|r| r.id == rule_id} end |
#security_group ⇒ Object
14 15 16 |
# File 'lib/fog/cloudstack/models/compute/security_group_rules.rb', line 14 def security_group connection.security_groups.get(self.security_group_id) end |