Class: Fog::Compute::Aliyun::SecurityGroups

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

Instance Method Summary collapse

Instance Method Details

#all(options = {}) ⇒ Object



12
13
14
15
16
# File 'lib/fog/aliyun/models/compute/security_groups.rb', line 12

def all(options = {})
  data = Fog::JSON.decode(service.list_security_groups(options).body)['SecurityGroups']['SecurityGroup']
  load(data)
  # ['Images']['Image']
end

#get(security_group_id) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/fog/aliyun/models/compute/security_groups.rb', line 18

def get(security_group_id)
  if security_group_id
    data = self.class.new(service: service).all
    result = nil
    data.each do |i|
      if i.id == security_group_id
        result = i
        break
      end
    end
    result
  end
end