Class: Fog::Compute::QingCloud::SecurityGroupRules

Inherits:
Fog::Collection
  • Object
show all
Defined in:
lib/fog/qingcloud/models/compute/security_group_rules.rb

Instance Method Summary collapse

Instance Method Details

#all(filters = self.filters) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/fog/qingcloud/models/compute/security_group_rules.rb', line 13

def all(filters = self.filters)
  group_id = filters['group-id']
  rule_id  = filters['rule-id']
  direction = filters['direction']
  direction = [:ingress, :egress].index(direction)
  data = service.describe_security_group_rules(group_id, rule_id, direction).body
  load(data['security_group_rule_set'])
end

#get(security_group_rule_id) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/fog/qingcloud/models/compute/security_group_rules.rb', line 22

def get(security_group_rule_id)
  if security_group_rule_id
    all('rule-id' => security_group_rule_id).first
  end
rescue Fog::QingCloud::Errors::NotFound
  nil
end